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

Method Perftools_FreeLibrary

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

Source from the content-addressed store, hash-verified

1008}
1009
1010BOOL WINAPI WindowsInfo::Perftools_FreeLibrary(HMODULE hLibModule) {
1011 BOOL rv = ((BOOL (WINAPI *)(HMODULE))
1012 function_info_[kFreeLibrary].origstub_fn)(hLibModule);
1013
1014 // Check to see if the module is still loaded by passing the base
1015 // address and seeing if it comes back with the same address. If it
1016 // is the same address it's still loaded, so the FreeLibrary() call
1017 // was a noop, and there's no need to redo the patching.
1018 HMODULE owner = NULL;
1019 BOOL result = ::GetModuleHandleExW(
1020 (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
1021 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT),
1022 (LPCWSTR)hLibModule,
1023 &owner);
1024 if (result && owner == hLibModule)
1025 return rv;
1026
1027 PatchAllModules(); // this will fix up the list of patched libraries
1028 return rv;
1029}
1030
1031
1032// ---------------------------------------------------------------------

Callers

nothing calls this directly

Calls 1

PatchAllModulesFunction · 0.70

Tested by

no test coverage detected