DMA in VB
Posted: 2002-06-01
By: ArchiveBot
Viewed: 85
Filed Under:
No attachments for this post
DMA, create DMA emulation In vb.
Original Author: Randy Ready AKA Qages
Code
DMA. Dynamic Memory Allocation.
vb is non-dma, this means that the memory address for a varable will be the same when the user reopens your program (will change if you add lots of new code).
this is bad because h4x0rs can steal or modify your program.
to make a emulation of DMA in vb, just redim a Array varable by random numbers and use whats in the middle. its simple.
ill give a example below
25682 ' this is a random number, really doesnt have any importance,
redim stack((25682 - 6) To (25682 + 8)) ' the RAMDOM numbers 6,8 are the impornant
[memory address] [place in our array]
00000000 1 (-6)
00000002 2 (-5)
00000004 3 (-4)
00000008 4 (-3)
0000000A 5 (-2)
0000000C 6 (-1)
0000000E 7 (+0) '- Our middle numbers, this is what we want to use
00000010 8 (+1)
00000012 9 (+2)
00000014 10 (+3)
00000018 11 (+4)
0000001A 12 (+5)
0000001C 13 (+6)
0000001E 14 (+7)
00000020 15 (+8)
ok the user closed the programan reloads it now creats new random numbers.
ReDim stack((55431 - 2) To (55431 + 10)) ' the RANDOM numbers 2,10 are the impornant
[memory address][place in our array]
00000000 1 (-2)
00000002 2 (-1)
00000004 3 (+0) '- Our middle numbers, this is what we want to use
00000008 4 (+1)
0000000A 5 (+2)
0000000C 6 (+3)
0000000E 7 (+4)
00000010 8 (+5)
00000012 9 (+6)
00000014 10 (+7)
00000018 11 (+8)
0000001A 12 (+9)
0000001C 13 (+10)
ok the first time the user opend the program the memory address for the middle (+0) is 0000000E, the next time its 00000004,
there its diffrent memory address! DMA
Heres the Complete code to use:
'globals
dim stack() as single ' we need tomake this a array! important
dim STACKNUM as long
' thecode
dim STACKNUMfrom as byte
dim STACKNUMto as byte
STartR:
Randomize
STACKNUM = Int(((999999) * Rnd) + 3000) ' + 3000 - TO make sure were not 0 or some low number
STACKNUMfrom = Int(((99) * Rnd)) ' increase 99 for more randomness, decrese for less memory useage
STACKNUMto = Int(((99) * Rnd)) ' increase 99 for more randomness, decrese for less memory useage
ReDim stack((STACKNUM - STACKNUMfrom) To (STACKNUM + STACKNUMto)) As Single
'you canuse more that just the middle number(STACKNUM), to use more use STACKNUM + whatever and STACKNUM - Whatever,
and use the code below tomake sure you have enuf spacein the array
If STACKNUMto < 2 Then ' STACKNUMto this is for our + STACKNUM, the number 2 is howmuch we want to use. can be used for
- STACKNUM too.
GoTo STartR
End If
to use this just use:
stack(STACKNUM) or
stack(STACKNUM + 1)
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.