如何在x64 Visual C ++中执行裸函数和内联汇编程序 [英] How to do a naked function and inline assembler in x64 Visual C++
本文介绍了如何在x64 Visual C ++中执行裸函数和内联汇编程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用裸函数和内联汇编器代理方法调用.
I am proxying a method call in using a naked function and inline assembler.
__declspec(naked) void ProxyFunction()
{
static const unsigned int addressofRealFunction = 0x0041b200;
__asm
{
jmp [addressofRealFunction];
}
}
如何将其翻译为x64?在Visual Studio中,x64没有内联汇编程序或裸函数.
How can I translate this to x64? In visual studio there is no inline assembler or naked functions for x64.
Naked删除了程序集的序言和结尾.我需要这样做,以确保堆栈框架在调用中保持相等.
Naked removes the assembly prologue and epilogue. I need this to make sure the stack frame stays equivalent for the call.
你会怎么做?
推荐答案
尝试直接编译:
void ProxyFunction()
{
RealFunction();
}
查看编译器是否对其进行了优化以使其完全消失.可能会.
See if the compiler optimizes it down to bare jump. It might.
这篇关于如何在x64 Visual C ++中执行裸函数和内联汇编程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文