MCPcopy Create free account
hub / github.com/LibreVR/Revive / HookLoadLibraryW

Function HookLoadLibraryW

LibOVRProxy/main.cpp:10–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "OVR_Version.h"
9
10static HMODULE(WINAPI* TrueLoadLibraryW)(LPCWSTR lpFileName) = LoadLibraryW;
11static HMODULE(WINAPI* TrueLoadLibraryExW)(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) = LoadLibraryExW;
12
13WCHAR revModuleName[MAX_PATH];
14WCHAR ovrModuleName[MAX_PATH];
15
16HMODULE WINAPI HookLoadLibraryW(LPCWSTR lpFileName)
17{
18 LPCWSTR name = PathFindFileNameW(lpFileName);
19 LPCWSTR ext = PathFindExtensionW(name);
20 size_t length = ext - name;
21
22 // Load our own library again so the ref count is incremented.
23 if (wcsncmp(name, ovrModuleName, length) == 0)
24 return TrueLoadLibraryW(revModuleName);
25
26 return TrueLoadLibraryW(lpFileName);
27}
28
29HMODULE WINAPI HookLoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
30{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected