MCPcopy Create free account
hub / github.com/cinit/WSAPatch / BadGetProcAddress

Function BadGetProcAddress

WsaPatch.cpp:69–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69FARPROC WINAPI BadGetProcAddress(_In_ HMODULE hModule, _In_ LPCSTR lpProcName) {
70 FARPROC result;
71 if (hModule == hNtdll && lpProcName != nullptr && strcmp(lpProcName, "RtlGetVersion") == 0) {
72 result = reinterpret_cast<FARPROC>(FakeRtlGetVersion);
73 SetLastError(0);
74 } else {
75 result = GetProcAddress(hModule, lpProcName);
76 if (result == nullptr) {
77 ErrnoRestorer errnoRestorer;
78 if (hModule != nullptr) {
79 WCHAR buffer[1024] = {};
80 GetModuleFileNameW(hModule, buffer, _countof(buffer));
81 LOGW(L"-GetProcAddress: hModule=%s(%p), lpProcName=%hs, result=NULL", buffer, hModule, lpProcName);
82 } else {
83 LOGW(L"-GetProcAddress: hModule=NULL, lpProcName=%hs, result=NULL", lpProcName ? lpProcName : "NULL");
84 }
85 }
86 }
87 return result;
88}
89
90usize kPageSize = 0;
91

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected