bool pal::get_own_module_path(string_t* recv) { HMODULE hmod; if (!GetModuleHandleFromAddress(&get_own_module_path, &hmod)) return false; return GetModuleFileNameWrapper(hmod, recv); }
bool pal::get_current_module(dll_t *mod) { HMODULE hmod = nullptr; if (!GetModuleHandleFromAddress(&get_current_module, &hmod)) return false; *mod = (pal::dll_t)hmod; return true; }
// Gets the handle to the currently executing module. static HMODULE GetCurrentModuleHandle() { // pass a pointer to the current function return GetModuleHandleFromAddress(GetCurrentModuleHandle); }
static bool IsAddressInCurrentModule(void *address) { return GetCurrentModuleHandle() == GetModuleHandleFromAddress(address); }