Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的功能中,我使用
__asm { mov ecx,dword ptr [0x28F1431] mov ecx,ds:[0x28F14131] }
这应该产生以下字节:(0x8B0D)mov ecx, dword ptr []。但是第一条指令产生0xB9( mov ecx,0x28F14131) 和第二条指令0x3E:8B0D
0x8B0D
mov ecx, dword ptr []
0xB9
mov ecx,0x28F14131
0x3E
所以我的问题是,我应该使用什么指令在 C++ 中获得所需的结果__asm?
__asm
如果您 100% 知道内联程序集的字节序列应该是什么,那么您始终可以显式使用这些字节。确切的语法使我无法理解,但是如果您使用的是 GCC,则可以尝试....
__asm { .byte 0x## .byte 0x## ... }
只有当您 100% 确定地知道整个指令的字节序列是什么时,这种方法才有效。如果你要这样做,一定要适当地评论。
(对于它的价值,我过去不得不使用这种方法来解决编译器错误,无论如何它都会为其中一条指令使用错误的字节序列。)