MCPcopy Create free account
hub / github.com/beefytech/Beef / Perftools_LoadLibraryExW

Method Perftools_LoadLibraryExW

BeefRT/gperftools/src/windows/patch_functions.cc:987–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985static std::map<HMODULE, int>* g_load_map = NULL;
986
987HMODULE WINAPI WindowsInfo::Perftools_LoadLibraryExW(LPCWSTR lpFileName,
988 HANDLE hFile,
989 DWORD dwFlags) {
990 HMODULE rv;
991 // Check to see if the modules is already loaded, flag 0 gets a
992 // reference if it was loaded. If it was loaded no need to call
993 // PatchAllModules, just increase the reference count to match
994 // what GetModuleHandleExW does internally inside windows.
995 if (::GetModuleHandleExW(0, lpFileName, &rv)) {
996 return rv;
997 } else {
998 // Not already loaded, so load it.
999 rv = ((HMODULE (WINAPI *)(LPCWSTR, HANDLE, DWORD))
1000 function_info_[kLoadLibraryExW].origstub_fn)(
1001 lpFileName, hFile, dwFlags);
1002 // This will patch any newly loaded libraries, if patching needs
1003 // to be done.
1004 PatchAllModules();
1005
1006 return rv;
1007 }
1008}
1009
1010BOOL WINAPI WindowsInfo::Perftools_FreeLibrary(HMODULE hLibModule) {
1011 BOOL rv = ((BOOL (WINAPI *)(HMODULE))

Callers

nothing calls this directly

Calls 1

PatchAllModulesFunction · 0.70

Tested by

no test coverage detected