| View previous topic :: View next topic |
| Author |
Message |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Fri Jul 11, 2008 5:04 pm Post subject: [Help] Array Pointers |
|
|
I am trying to make an array that looks like this:
a = addy
v = addy's value
[x][1][2]
[1][a][v]
[2][a][v]
[3][a][v]
[4][a][v]
[5][a][v]
So I tryed to compile it, no errors. I ran it, blah.exe has stoped working... I tryed making an array that was a pointer, and just putting pointers into it, same. Whenever I try to do something with an array and a pointer the program stops working.
I am using VC++ 2008, whats wrong?
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Fri Jul 11, 2008 5:43 pm Post subject: |
|
|
| Code: | typedef struct LOL {
DWORD addr;
DWORD value;
} LOL;
LOL array[10]; |
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Fri Jul 11, 2008 5:49 pm Post subject: |
|
|
| Well I know what I am doing, but it is using a pointer which is giving me errors.... I dont know whats going on. Could you show me how you would put the value of an address into an array?
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Fri Jul 11, 2008 6:12 pm Post subject: |
|
|
| Code: | typedef struct LOL {
DWORD addr;
DWORD value;
} LOL;
LOL array[3];
int i;
array[0].addr = 0xBAADF00D;
array[1].addr = 0xDEADBEEF;
array[2].addr = 0x1337C0DE;
for( i = 0; i<3; i++ ) array[i].value = *((DWORD*)(array[i].addr)); |
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Fri Jul 11, 2008 6:45 pm Post subject: |
|
|
Crashed instantly.... I am going to keep trying different things... One idea I had was to use ASM and its mov function to put the address stored by a variable into another. How would I do this with the __asm function.
normally it would be like: mov var,[addy]
any ideas?
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Fri Jul 11, 2008 7:55 pm Post subject: |
|
|
Did you used this exact same code:
| Code: | array[0].addr = 0xBAADF00D;
array[1].addr = 0xDEADBEEF;
array[2].addr = 0x1337C0DE; |
?
No wonder you crashed...
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Fri Jul 11, 2008 8:01 pm Post subject: |
|
|
| Yes, I did. But I have also been trying other things. I think by not using any pointers it would have no errors... So how could I do this in ASM (put the value a variable stores into another variable)
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Fri Jul 11, 2008 8:04 pm Post subject: |
|
|
These addresses aren't even valid. (unless you allocated memory there)
Try changing the addresses to valid addresses?
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Fri Jul 11, 2008 8:26 pm Post subject: |
|
|
That could be it... I will check. (I am using addresses 0x00400000 - 0x0040000F).
Wait. I checked with CE the addys are from 40000-FFFFFFFF.... There is memory at 0x00400000.
But how would I put the value of an address stored in a variable into another variable in ASM? ty.
EDIT:
Problem fixed! I am going to show off my program now! Ty for both of your help, I have thanked you in my program.
| Description: |
| My program. It searched for memory in your proccess. Soon to be improved. |
|
| Filesize: |
54.81 KB |
| Viewed: |
4507 Time(s) |

|
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Jul 12, 2008 7:28 am Post subject: |
|
|
lol...
You probably shouldn't be screwing around down there at the base address; that's where the PE header is, and if you go far enough, you could truly fuck some stuff up (not permanently). In the PE header are where your imports are stored, as well as your exports and what not. If you rewrite some of it, then... well, who knows what would happen. Most likely an instant crash would result.
_________________
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Sat Jul 12, 2008 8:26 am Post subject: |
|
|
| Ah... Thank you for inrming me, that could be bad. It is clear I am making a C++ cheat engine, just a very very very simple one. But how would I search for the memory region of a process? If I did 00000000-FFFFFFFF that would be 4 gigs.... Not the best way to do it.
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Jul 12, 2008 8:51 am Post subject: |
|
|
| Chaosis13 wrote: | | Ah... Thank you for inrming me, that could be bad. It is clear I am making a C++ cheat engine, just a very very very simple one. But how would I search for the memory region of a process? If I did 00000000-FFFFFFFF that would be 4 gigs.... Not the best way to do it. |
I wrote a memory scanner in C#, and it was relatively fast; here's the simplified algorithm:
| Code: |
1) Dump memory regions of process
2) Loop through regions, and add the ones that aren't labeled PAGE_NOACESS to a list
3) Loop through the list of regions:
a) Init a byte[] of size [region].Size
b) ReadProcessMemory from the proc to the byte[]
c) loop through the bytes and compare them to a parameter (value)
a) if it matches, add that to a list
4) return the list
|
_________________
|
|
| Back to top |
|
 |
sphere90 Grandmaster Cheater
Reputation: 0
Joined: 24 Jun 2006 Posts: 912
|
Posted: Sat Jul 12, 2008 8:51 am Post subject: |
|
|
| Chaosis13 wrote: | | Ah... Thank you for inrming me, that could be bad. It is clear I am making a C++ cheat engine, just a very very very simple one. But how would I search for the memory region of a process? If I did 00000000-FFFFFFFF that would be 4 gigs.... Not the best way to do it. |
Search from 0x400000 to (0x400000 + process image size)
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Jul 12, 2008 8:58 am Post subject: |
|
|
| sphere90 wrote: | | Chaosis13 wrote: | | Ah... Thank you for inrming me, that could be bad. It is clear I am making a C++ cheat engine, just a very very very simple one. But how would I search for the memory region of a process? If I did 00000000-FFFFFFFF that would be 4 gigs.... Not the best way to do it. |
Search from 0x400000 to (0x400000 + process image size) |
That's probably only going to give you a module; there's also most likely going to be empty space in between.
_________________
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Sat Jul 12, 2008 9:56 am Post subject: |
|
|
I have been searching through CE source, but havent found out anything good yet... Maybe I could do it just like CE.
Also I dont care about the ram usage, aslong as it doesn't get too big... I have 4 gigs, and most modern computers have atleast 2. So using 100mb of ram woundnt be horrible...
|
|
| Back to top |
|
 |
|