16,548
社区成员




#include <stdio.h>
#include <windows.h>
void test_func()
{
printf("hello world\n");
}
int main()
{
DWORD dwFuc = (DWORD)test_func;//我想得到的是内存中函数fuc的首地址,但是强制转换后就不对了
_asm{
call dwFuc
}
BYTE* pAddress = (BYTE*)test_func;
printf("0x%x ", *pAddress++);
printf("0x%x ", *pAddress++);
printf("0x%x ", *pAddress++);
printf("0x%x \n", *pAddress++);
return 0;
}
vs2013编译,结果:
debug:
hello world
0xe9 0x3e 0x3 0x0
release:
hello world
0x68 0x0 0x21 0x93
0xe9是跳转指令,这个结果是对的啊。[/quote]
嗯嗯 原来我代码没错 太谢谢你了#include <stdio.h>
#include <windows.h>
void test_func()
{
printf("hello world\n");
}
int main()
{
DWORD dwFuc = (DWORD)test_func;//我想得到的是内存中函数fuc的首地址,但是强制转换后就不对了
_asm{
call dwFuc
}
BYTE* pAddress = (BYTE*)test_func;
printf("0x%x ", *pAddress++);
printf("0x%x ", *pAddress++);
printf("0x%x ", *pAddress++);
printf("0x%x \n", *pAddress++);
return 0;
}
vs2013编译,结果:
debug:
hello world
0xe9 0x3e 0x3 0x0
release:
hello world
0x68 0x0 0x21 0x93
0xe9是跳转指令,这个结果是对的啊。