| 67 | } |
| 68 | |
| 69 | FARPROC 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 | |
| 90 | usize kPageSize = 0; |
| 91 |
nothing calls this directly
no outgoing calls
no test coverage detected