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 


How to compare & assign multi level pointer?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
ColonelRVH
Advanced Cheater
Reputation: 1

Joined: 22 Jan 2015
Posts: 59
Location: VN

PostPosted: Sun Mar 12, 2017 8:58 am    Post subject: How to compare & assign multi level pointer? Reply with quote

Say, there's a pointer that has

Offset1: 04
Offset2: 11A
Register for the base address is eax.


Now i want to compare that pointer in asm. How do I do that?

Code:
cmp dword [eax+04+11A],#whatever
//doesn't work

push ebx
mov ebx,[eax+04]
cmp dword [ebx+11A],#whatever
je whatevercode
pop ebx
//also doesn't work // Updated: it worked.


Any suggestion?

Also is there anyway to assign that pointer to address list? I know the method BaseAddress+offset but the Pointer itself (no +offset).

----

Update 01: My bad, the second one actually works. Now the question is how to assign that pointer to address list without offset?

Code:

push ebx
push ecx
  mov ecx,[eax+04]
  mov ebx,[ecx+11A]
  mov [checker3],ebx
pop ecx
pop ebx


checker3 failed. This one is for learning purpose only.

_________________
Open for Simple Table request, depends on my interest.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Mar 12, 2017 9:55 am    Post subject: Reply with quote

How did checker3 fail? Did you get a compilation error? Did it have the wrong value?
Code:
push ecx
  mov ecx,[eax+04]
  mov [checker3],ecx
pop ecx
Back to top
View user's profile Send private message
ColonelRVH
Advanced Cheater
Reputation: 1

Joined: 22 Jan 2015
Posts: 59
Location: VN

PostPosted: Sun Mar 12, 2017 10:04 am    Post subject: Reply with quote


check3 got the right value (checker3)
while pointer checker3 with offset0 just weird.

maybe i should ask how to assign to get BOTH the address and value instead? Is it possible?

_________________
Open for Simple Table request, depends on my interest.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Mar 12, 2017 10:09 am    Post subject: Reply with quote

Use my code then add an offset of 11A to your table entry? Or add to my code:
Code:
add [checker3],11A
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Mar 12, 2017 10:17 am    Post subject: Reply with quote

Not sure what you are trying to do here, but if you are wanting to store a value in checker3, then you should not set it up as a pointer in your table. If you are wanting to put an address in checker3, then set it up as a pointer, but use load effective address for storing.
Back to top
View user's profile Send private message
ColonelRVH
Advanced Cheater
Reputation: 1

Joined: 22 Jan 2015
Posts: 59
Location: VN

PostPosted: Sun Mar 12, 2017 10:26 am    Post subject: Reply with quote

@++METHOS it's as Zanzer solution. (:

Zanzer wrote:
Use my code then add an offset of 11A to your table entry? Or add to my code:
Code:
add [checker3],11A


Oh this one is right, Thanks.

But why is that different than:
Code:
mov ecx,[eax+04]
mov [checker3],ecx


Please explain.

_________________
Open for Simple Table request, depends on my interest.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Mar 12, 2017 10:38 am    Post subject: Reply with quote

Okay. I had to reread this thread. I was totally confused. I should get some more sleep, probably. Do not mind me. Very Happy
Back to top
View user's profile Send private message
ColonelRVH
Advanced Cheater
Reputation: 1

Joined: 22 Jan 2015
Posts: 59
Location: VN

PostPosted: Sun Mar 12, 2017 10:40 am    Post subject: Reply with quote

++METHOS wrote:
Okay. I had to reread this thread. I was totally confused. I should get some more sleep, probably. Do not mind me. Very Happy


Have a nice dream, thanks for the help. Very Happy

Again, Please explain @Zanzer. (:

_________________
Open for Simple Table request, depends on my interest.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Mar 12, 2017 11:29 am    Post subject: Reply with quote

Code:
  mov ecx,[eax+04]  // ECX now equals the base *address* you want
  mov ebx,[ecx+11A] // ECX + 11A is the final *address* you want
                    // but this instruction sets EBX to the *value* at that address

Saving ECX into checker3 and then adding 11A as an offset in your table (instead of 0, like you had) will get you to the address you want.
Or, in my second code, you could simply add 11A to the value you just stored there (ECX).
That too will take you to the address you want.
Back to top
View user's profile Send private message
ColonelRVH
Advanced Cheater
Reputation: 1

Joined: 22 Jan 2015
Posts: 59
Location: VN

PostPosted: Sun Mar 12, 2017 11:42 am    Post subject: Reply with quote

Zanzer wrote:
Code:
  mov ecx,[eax+04]  // ECX now equals the base *address* you want
  mov ebx,[ecx+11A] // ECX + 11A is the final *address* you want
                    // but this instruction sets EBX to the *value* at that address

Saving ECX into checker3 and then adding 11A as an offset in your table (instead of 0, like you had) will get you to the address you want.
Or, in my second code, you could simply add 11A to the value you just stored there (ECX).
That too will take you to the address you want.


It's still a bit vague to me. Like i said I know that I can simply

Code:
mov [checker3],eax

Then on the Table list just add 2 offsets +04 and +11A I will get that one.

But I want checker3 to instantly give me the address and value without those 2 offsets on the Table (This one is more of learning purpose, well, for me as I have a limited knowledge of asm)

Still don't really get why sometimes it's a value and sometimes an address or pointer.

_________________
Open for Simple Table request, depends on my interest.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Mar 12, 2017 12:36 pm    Post subject: Reply with quote

I do not know if this would work or not:

Code:
//stuff
label(checker3)

registersymbol(checker3)

newmem:
push edi
lea edi,[eax+04]+11A
mov [checker3],edi
pop edi

//originalcode

checker3:
dd 0

//stuff


If not, then maybe...


Code:
//stuff
label(checker3)

registersymbol(checker3)

newmem:
push edi
lea edi,[eax+04]
lea edi,[edi+11A]
mov [checker3],edi
pop edi

//originalcode

checker3:
dd 0

//stuff
Back to top
View user's profile Send private message
gameplayer
Advanced Cheater
Reputation: 2

Joined: 26 Jun 2011
Posts: 97
Location: Vietnam

PostPosted: Mon Mar 13, 2017 8:20 pm    Post subject: Reply with quote

@ColonelRVH
Since you say the final value is sometimes a pointer address. Are you sure that the final value (with offset 11A) is a dword value?
BTW, you can not set both address and it's value directly without a different base address in CE's memory by using simple code injection method.
Back to top
View user's profile Send private message
ColonelRVH
Advanced Cheater
Reputation: 1

Joined: 22 Jan 2015
Posts: 59
Location: VN

PostPosted: Tue Mar 14, 2017 7:58 am    Post subject: Reply with quote

++METHOS wrote:
I do not know if this would work or not:

Code:
//stuff
label(checker3)

registersymbol(checker3)

newmem:
push edi
lea edi,[eax+04]+11A
mov [checker3],edi
pop edi

//originalcode

checker3:
dd 0

//stuff


If not, then maybe...


Code:
//stuff
label(checker3)

registersymbol(checker3)

newmem:
push edi
lea edi,[eax+04]
lea edi,[edi+11A]
mov [checker3],edi
pop edi

//originalcode

checker3:
dd 0

//stuff


both of them didn't work, zanzer did it perfectly, just dunno why though. Very Happy

_________________
Open for Simple Table request, depends on my interest.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Mar 14, 2017 8:02 am    Post subject: Reply with quote

Hard to say without knowing what you are really trying to do and without seeing what you are actually doing. Glad you got it sorted, though. Very Happy

But, yeah, The Zanzer is just that good. Mr. Green
Back to top
View user's profile Send private message
ColonelRVH
Advanced Cheater
Reputation: 1

Joined: 22 Jan 2015
Posts: 59
Location: VN

PostPosted: Tue Mar 14, 2017 9:02 am    Post subject: Reply with quote

I did mention in post #3 though

Quote:


Basically I want to see checker 3 acts like the Result one. BUT Without adding any further offset to it on the address list.

_________________
Open for Simple Table request, depends on my interest.
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 Discussions 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