[英]How to store register values using assembly to C++ variables?
int my_var;
void __declspec(naked) stuff()
{
__asm
{
lea edx, [ecx + edi + 0x0000111]
}
}
How to store the value from the address [ecx + edi + 0x0000111] in the c++ variable "my_var" above.如何将来自地址 [ecx + edi + 0x0000111] 的值存储在上面的 c++ 变量“my_var”中。
From the Microsoft docs :来自微软文档:
An __asm block can refer to any symbols, including variable names, that are in scope where the block appears.
__asm 块可以引用 scope 中出现该块的任何符号,包括变量名。
Therefore you could do this:因此你可以这样做:
int my_var;
void __declspec(naked) stuff()
{
__asm
{
lea edx, [ecx + edi + 0x0000111]
mov my_var, edx
ret
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.