 <p>thanks to to the answer here</p> <p><a href="http://www.rohitab.com/discuss/topic/39969-hook-function-without-knowing-signature/" rel="nofollow">http://www.rohitab.com/discuss/topic/39969-hook-function-without-knowing-signature/</a></p> <blockquote> <p>I guess, you almost there with your code... you just need to make your trampoline function not >damaging the stack... firstly the function should be declared naked (without default prologue, in >studio I believe it would be something like __declspec(naked) or something)... secondly you need to >think about do you need to do something after the call to original function... if not, I think it is >better just to simply make a jmp instead of call (using inline assembler or something)... </p> </blockquote> <p>Here is my code. used vs2012 on windows 7 64bit but 32bit compile. simple win32 console app . hope it helps anyone else</p> <pre><code>#include "stdafx.h" void originalFunction(int x,int y,int z) { printf("running originalFunction with x=%d\n",x); } __declspec(naked) void trampolineFunction() { __asm jmp [originalFunction] } int _tmain(int argc, _TCHAR* argv[]) { ((void (*)(...))trampolineFunction)(7,8,9); getchar(); return 0; } </code></pre>