2012-07-12 40 views
0

上午,我试图做一个钩子DLL,以便里面未定义参考Mysnprintf使用<code>CodeBlocks</code>

DllMain

#include "main.h" 
#include "Asm.h" 
#include <stdio.h> 
using namespace std; 
    static HINSTANCE WINAPI Mysnprintf(char* str, int len, const char* format, ...); 

    static void InitDll(){ 
     Originalsnprintf = (snprintfFn)GetProcAddress(GetModuleHandleA("msvcr90.dll"), "_snprintf"); 
     Asm code; 
     code.JMP((int)Mysnprintf); // where JMP = Asm& JMP(int address){...} 
    } 

我不知道什么是错的,因为如果我做了同样的用Microsoft Visual C++它将与工作没有错误!

回答

0

链接器告诉你函数是undefined,它是正确的。您尚未为您的功能编写定义。你只不过就宣称为吧。

放一些花括号后的功能,并告诉你的编译器,你想要的功能什么:

static HINSTANCE WINAPI Mysnprintf(char* str, int len, const char* format, ...) 
{ 
    ... 
}