0

我正在使用CodeBlocks并试图在里面制作一个钩子dll

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++事情,它将不会出错!!!

4

1 回答 1

0

链接器告诉你函数是undefined,这是正确的。您还没有为您的函数编写定义。你只是宣布了它。

在函数后面加上一些花括号,并告诉编译器您希望该函数做什么

static HINSTANCE WINAPI Mysnprintf(char* str, int len, const char* format, ...)
{
  ...
}
于 2012-07-12T00:43:22.973 回答