I have been trying to use GetProcAddress
with several functions from kernel32.dll. It worked fine, except with "OutputDebugString" function.
My code:
typedef void(WINAPI *LPGETNUMBER)(LPCTSTR);
int main() {
const LPGETNUMBER pAddr = (LPGETNUMBER)GetProcAddress(GetModuleHandle((LPCSTR)("kernel32.dll")), "OutputDebugString");
if (NULL == pAddr) {
int32_t nLastErrorCode = GetLastError();
}
}
There is no such function. The exports are named OutputDebugStringA
and OutputDebugStringW
.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362