How to registersymbol?

Post here (make sure thread doesn't exist first) any type of tutorials: text, images, videos or oriented discussions on specific games. No online-related discussions/posts OR warez!
Paul44
RCE Fanatics
RCE Fanatics
Posts: 887
Joined: Thu Jul 27, 2017 9:02 am
Reputation: 566

Re: How to registersymbol?

Post by Paul44 »

^:

alloc(infPoints,8)
...
mov [seePoints],rsi

cmp [infPoints],1
jne code

push r15
mov r15,SetPoints
mov r15d,dword ptr [r15]
mov [rsi+18],r15d
pop r15
...

if the game gives you them mem_issues, you'll have to stick to the same principle everywhere (like in every script in that table):
> basically your cpu tries to mov/cmp a register with a value away past +2GB... and fails (offset too big, etc)
(in worst case scenario, CE will "screw up" the injection altogether ~ i've seen this already plenty of times; iow you'll crash !)
> by moving your label's mem_address to a registry, it "just" compares 2 reg_values on the stack... sort of
(there are some topics @CEF discussing/explaining this ~ mem_mgmt is not my thing)

*******************

alloc(infPoints,4) <= int 4bytes
...
push r15
mov r15,seePoints
mov [r15],rsi

mov r15,infPoints
cmp [r15],1
jne code

mov r15,SetPoints
mov r15d,dword ptr [r15]
mov [rsi+18],r15d

code:
pop r15 <= just make sure r15 is properly pop-ed
movsxd rdx,dword ptr [rsi+18]
test rdx,rdx
mov rcx,rax
jmp return

*******************
=> your original code might work today, but not tomorrow. it all depends on how windows allocate/offer memory to CE, i guess...

ps: video - yep, that guy is really good; any of his videos are worth to watch... (~ Chris Fayte)

jgoemat
Table Makers
Table Makers
Posts: 73
Joined: Fri Jul 21, 2017 6:47 pm
Reputation: 77

Re: How to registersymbol?

Post by jgoemat »

Couple of things I'd mention, I'd be interested in what other people think...

When I add data and register a symbol, I like to do 'align 10' to make sure it is aligned. I think this has minor performance but alignment of some sort is required by some SSE instructions. Personally I just hate seeing the address end in something like a 7 in my table.

Code: Select all

align 10
SetPoints:
  dd #100
Second, be cautious of the register sizes. It looks like the code in your final works because you use 'r15d' as a 32-bit register, but if you did 'mov r15, dword ptr [SetPoints], the 'dword ptr' is meaningless and it ends up loading 64 bits into r15:

Code: Select all

  mov r15, dword ptr [SetPoints]
  // r15 is now DEAD2222BEEF1111
  ret

align 10
SetPoints:
  dd BEEF1111
  dd DEAD2222
Not realizing that has caused me grief in the past and it can be hard to realize what's happening. If you just do 'mov r15d, dword ptr [SetPoints]' that sets the lower 32 bits, but the upper 32 bits may be anything. If you want to do that, do 'xor r15,r15' first to zero the top 32 bits.

Post Reply

Who is online

Users browsing this forum: No registered users