2012-07-12 38 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, ...) 
{ 
    ... 
}