Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Help] Array Pointers
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Fri Jul 11, 2008 5:04 pm    Post subject: [Help] Array Pointers Reply with quote

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
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Fri Jul 11, 2008 5:43 pm    Post subject: Reply with quote

Code:
typedef struct LOL {
    DWORD addr;
    DWORD value;
} LOL;

LOL array[10];
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Fri Jul 11, 2008 5:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Fri Jul 11, 2008 6:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Fri Jul 11, 2008 6:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Jul 11, 2008 7:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Fri Jul 11, 2008 8:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Jul 11, 2008 8:04 pm    Post subject: Reply with quote

These addresses aren't even valid. (unless you allocated memory there)
Try changing the addresses to valid addresses?
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Fri Jul 11, 2008 8:26 pm    Post subject: Reply with quote

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.



C++ program.jpg
 Description:
My program. It searched for memory in your proccess. Soon to be improved.
 Filesize:  54.81 KB
 Viewed:  4507 Time(s)

C++ program.jpg


Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Jul 12, 2008 7:28 am    Post subject: Reply with quote

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.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Sat Jul 12, 2008 8:26 am    Post subject: Reply with quote

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
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Jul 12, 2008 8:51 am    Post subject: Reply with quote

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

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
sphere90
Grandmaster Cheater
Reputation: 0

Joined: 24 Jun 2006
Posts: 912

PostPosted: Sat Jul 12, 2008 8:51 am    Post subject: Reply with quote

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
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Jul 12, 2008 8:58 am    Post subject: Reply with quote

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.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Sat Jul 12, 2008 9:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites