-1

我一直在尝试使用GetProcAddresskernel32.dll 中的几个函数。它工作得很好,除了“OutputDebugString”函数。

我的代码:

typedef void(WINAPI *LPGETNUMBER)(LPCTSTR);

int main() {
    const LPGETNUMBER pAddr = (LPGETNUMBER)GetProcAddress(GetModuleHandle((LPCSTR)("kernel32.dll")), "OutputDebugString");
    if (NULL == pAddr) {
        int32_t nLastErrorCode = GetLastError();
    }
}
4

2 回答 2

4

没有这样的功能。导出被命名为OutputDebugStringAOutputDebugStringW

https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362

于 2018-11-20T13:32:33.657 回答
3

OutputDebugString是一个宏扩展为OutputDebugStringAOutputDebugStringW取决于您是使用 ANSI 还是 Unicode 构建。因此,您需要选择其中之一(最好,但不一定,取决于您的构建模式)。

于 2018-11-20T13:32:40.790 回答