Page 1 of 1

assembly - how to convert this string into something that can be cmp'ed.

Posted: Sat Dec 01, 2018 6:26 am
by manaphoenix
Ok ... so i'm trying to make an aob injection copy for the game; I have already done it once with the 1 of the 2 main characters. The second however has a name longer than 16 bits, hence this code won't compile. I have looked for hours and can't figure it out, how do you convert 'FemaleHero' into something that can be compared?

The extra push and such just because someone might wonder why I'm doing it is that the name is stored through a pointer (IE. address points to an address that then points to the value)

Code: Select all

[ENABLE]

aobscanmodule(Characters,EoCApp.exe,41 8B 87 24 01 00 00 41) // should be unique
alloc(newmem,$1000,"EoCApp.exe"+D5797D)

label(code)
label(return)
label(hero_base)
registersymbol(hero_base)

newmem:
push ebx
mov ebx,[r15+28]
mov [hero_base],ebx
cmp [ebx+0],'FemaleHero'
pop ebx
jne code
mov [hero_base],r15

code:
  mov eax,[r15+00000124]
  jmp return

hero_base:
dd 0

Characters:
  jmp newmem
  nop
  nop
return:
registersymbol(Characters)

[DISABLE]

Characters:
  db 41 8B 87 24 01 00 00

unregistersymbol(Characters)
unregistersymbol(hero_base)
dealloc(newmem)

Re: assembly - how to convert this string into something that can be cmp'ed.

Posted: Sat Dec 01, 2018 4:18 pm
by JohnFK
Assuming FemaleHero is not unicode you have many options:

Code: Select all

//note, each char = 1 byte

mov rsi,'FemaleHe' //just an example, take care about using a free register yourself, string can be 8 chars long only.
cmp [rbx],rsi

//or

cmp dword ptr [ebx],'Fema' // can only be 4 bytes. Thus you need to split compare
jne code
cmp dword ptr [ebx+4],'leHe'

Re: assembly - how to convert this string into something that can be cmp'ed.

Posted: Sat Dec 01, 2018 8:26 pm
by Chucky
Convert [Link]
Swap bytes.
Use XMM reg.
[Link]
[Link]

Re: assembly - how to convert this string into something that can be cmp'ed.

Posted: Mon Dec 03, 2018 12:39 am
by manaphoenix
Thanks for the replies! I needed to update the game so I may not even need this info now; but helpful for the future never the less.

Re: assembly - how to convert this string into something that can be cmp'ed.

Posted: Fri Dec 21, 2018 2:19 pm
by SunBeam
You can easily use Lua to read-up strings; Lua and ASM can also be inter-connected. Yes, in your ASM cave :P Head to CEF for a demo ;) Adjust things properly, then you can write your stuff in Lua and have the ASM wrapper in your script execute it ;) See my Assassin's Creed: Origins table. The item swapper scripts.