-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LDE/Detour Bug #1
Comments
Hi @TrevorSundberg, thanks for posting this issue! The original site that library was from (http://www.beaengine.org/) seems down so it's hard to see if it was updated. I posted an issue in their repo to see if anyone replies, but otherwise let's go with your solution. If you have time I'd appreciate you making a pull request with that fix, and also leaving a note above the conditional explaining the issue. Thanks again! |
I'll be honest, I don't use git; I use hg/mercurial so I'm not familiar with git pull requests... but I'll try! |
Ah ok no worries then I can do it On Tuesday, 1 December 2015, TrevorSundberg [email protected]
|
LDE incorrectly reads 0x48 as a single byte assembly instruction (x64)
0x48 as far as I understand is supposed to indicate qword and is part of a longer instruction.
In the following example notice that:
mov rax,qword ptr [rsp+68h]
Incorrectly becomes the 32 bit version:
mov eax,dword ptr [rsp+68h]
The detour actually copied 5 bytes, however visual studio's disassembler is fine thinking that 48 is OK at the beginning of an absolute jump (48 FF 25). Apparently actually running this code is fine too. The 5 bytes came from 1 for the first 0x48, 3 for the (83 EC 38) sub instruction, and another 1 for the next 0x48.
I'm not sure if this is because the LDE disassembler you use doesn't properly detect x64, or something else. A proposed fix (may not be the best) is manual detection of 0x48 in GetDetourLenAuto:
This leads to the following correct assembly:
Hope this fix makes it in or you find out what's wrong with LDE. Either way, I love the library and I'm just glad I was able to understand what was happening!
The text was updated successfully, but these errors were encountered: