| 274 | } |
| 275 | |
| 276 | void HookLoadLibrary() |
| 277 | { |
| 278 | HMODULE hModuleKernel = GetModuleHandle("KernelBase.dll"); |
| 279 | if (hModuleKernel == nullptr) |
| 280 | hModuleKernel = GetModuleHandle("kernel32.dll"); |
| 281 | if (hModuleKernel != nullptr) |
| 282 | { |
| 283 | // LoadLibraryExW is called by the other LoadLibrary functions, so we |
| 284 | // only need to hook it. |
| 285 | |
| 286 | // TODO hook!!! |
| 287 | LoadLibraryExW_dll = (LoadLibraryExW_t)GetProcAddress(hModuleKernel, "LoadLibraryExW"); |
| 288 | |
| 289 | // destroy these functions. |
| 290 | const auto hHook = new HOOK_TRACE_INFO(); |
| 291 | ULONG ACLEntries[1] = {0}; |
| 292 | HOOK_STATUS status = LhInstallHook( |
| 293 | (void*)LoadLibraryExW_dll, |
| 294 | (void*)LoadLibraryExW_intercept, |
| 295 | (PVOID)nullptr, |
| 296 | hHook); |
| 297 | assert(status == 0); |
| 298 | status = LhSetExclusiveACL(ACLEntries, 0, hHook); |
| 299 | assert(status == 0); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | void redirect(int port) |
| 304 | { |
no test coverage detected