View previous topic :: View next topic |
Author |
Message |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sat Jan 09, 2016 6:02 pm Post subject: Lea into label, Cant be compiled WHY! -- SOLVED THX GUYS |
|
|
So im trying to get items id, so i can replace junk with something else.
why does it not allow me to compile lea [label],ecx?
Code: | [ENABLE]
aobscan(_ic,89 48 18 C7 46 18 00 00 00 00) // should be unique
alloc(newmem,$1000,3AF25C4F)
globalalloc(itemid,32)
label(code)
label(return)
newmem:
code:
mov [rax+18],ecx
push ecx
lea ecx,[rax+10+20]
lea [itemid],ecx <----------- this line cant be compiled.
pop ecx
mov [rsi+18],00000000
jmp return
_ic:
jmp code
nop
nop
nop
nop
nop
return:
registersymbol(_ic)
[DISABLE]
_ic:
db 89 48 18 C7 46 18 00 00 00 00
unregistersymbol(itemid)
unregistersymbol(_ic)
dealloc(itemid)
dealloc(newmem)
|
Last edited by NanoByte on Sun Jan 10, 2016 8:58 am; edited 1 time in total |
|
Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Sat Jan 09, 2016 6:13 pm Post subject: |
|
|
Do you want to assign the address currently stored in ecx to your variable "itemid"?
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Jan 09, 2016 6:20 pm Post subject: |
|
|
Code: | push rcx
lea rcx,[rax+10+20]
mov qword ptr [itemid],rcx
pop rcx |
|
|
Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun Jan 10, 2016 6:35 am Post subject: Replay |
|
|
Yeah i want the address currently stored in [rax+10] and assign the address to itemid so i can see what, id for certains items are so i dont have dissect datastructure for every item.
Code: | push rcx
lea rcx,[rax+10+20]
mov qword ptr [itemid],rcx <--- this is compileable but gives out wrong data - what does it do? been so long since i last played with cheat engine :D
pop rcx |
|
|
Back to top |
|
 |
mgostIH Expert Cheater
Reputation: 3
Joined: 01 Jan 2016 Posts: 159
|
Posted: Sun Jan 10, 2016 6:40 am Post subject: |
|
|
If you want the address of ecx into the label "itemID", you'll have to rever the lea as the following:
Which is the exact same as:
_________________
|
|
Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Sun Jan 10, 2016 6:53 am Post subject: |
|
|
Right. With mov [itemid],rcx (as Zanzer suggested) you'd have a level 1 pointer ...
|
|
Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun Jan 10, 2016 7:21 am Post subject: Screenshot |
|
|
Cant compile
Code: | Lea itemid,[ecx]
or
mov [itemid],rcx <---- THIS WORKS WOOHOO, but mov used to move value not address why does it work?
|
but if i mov it, it will only give me value of the ecx and not the address?
a label has to be inside > [here] i think
How would you guys approch this?
Description: |
|
Filesize: |
78.22 KB |
Viewed: |
9999 Time(s) |

|
Last edited by NanoByte on Sun Jan 10, 2016 7:58 am; edited 1 time in total |
|
Back to top |
|
 |
mgostIH Expert Cheater
Reputation: 3
Joined: 01 Jan 2016 Posts: 159
|
Posted: Sun Jan 10, 2016 7:44 am Post subject: |
|
|
If the address is stored in [rax+10] (basing on your screenshot, 0x4B8A1C78), then use:
_________________
|
|
Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun Jan 10, 2016 8:00 am Post subject: |
|
|
it works !!!!
but can u explain why it works??
because mov, moves value of the rax not the address, i dont get it
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Jan 10, 2016 8:04 am Post subject: |
|
|
Cheat Engine addresses can be turned into pointers.
It looks like the code you want is simply:
Code: | code:
mov [rax+18],ecx
mov qword ptr [itemid],rax
mov [rsi+18],00000000
jmp return |
Now manually create an address
Check "pointer" and assign the bottom value as "itemid"
Above that, assign the offset value of 10
Click the Add Offset button and give that a value of 20
|
|
Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun Jan 10, 2016 8:17 am Post subject: |
|
|
It Works guys thx alot
would be great if someone explained why the mov instead of lea works would be great
|
|
Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Sun Jan 10, 2016 8:24 am Post subject: |
|
|
I think your problem is the interpretation of "value".
for example moves the VALUE of esi into ecx. In this case the value may be a value like 1 or 1576.234 but an address also is a value in the original sence.
So the code
also moves a VALUE, although you as a human being interpret the value as a pointer, which of course resembles an address, but for the memory instruction, it makes no difference ...
I hope you understand my thought
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Jan 10, 2016 8:27 am Post subject: |
|
|
If we go off of your screenshot, RAX currently contains the value "8FB4B140"
So you want to move that value into the value of "itemid"
Now the CE address you defined starts with a base of "itemid" and the value 8FB4B140 is retrieved
The first offset is 10, so it will add hex 10 to 8FB4B140, giving 8FB4B150
It then takes the value at that address, which is 4B8A1C78 in your screenshot
Now it adds the next offset of hex 20 to 4B8A1C78, giving 4B8A1C98, which is the address containing your item id value
So lets go over the differences between MOV and LEA.
Above, the VALUE at [rax+10] is loaded into RCX (4B8A1C78).
Above, the ADDRESS at [rax+10] is loaded into RCX (8FB4B150).
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun Jan 10, 2016 8:37 am Post subject: |
|
|
mov rcx,[rax+10] is the same as (pseudocode)
RCX:=readQword(RAX+0x10)
lea rcx,[rax+10] is the same as
RCX:=RAX+0x10
LEA - Load Effective Address
_________________
|
|
Back to top |
|
 |
NanoByte Expert Cheater
Reputation: 1
Joined: 13 Sep 2013 Posts: 222
|
Posted: Sun Jan 10, 2016 8:56 am Post subject: |
|
|
Thanks alot guys, i understand it now
|
|
Back to top |
|
 |
|