MCPcopy Create free account
hub / github.com/qilingframework/qiling / _GetModuleHandle

Function _GetModuleHandle

qiling/os/windows/dlls/kernel32/libloaderapi.py:15–32  ·  view source on GitHub ↗
(ql: Qiling, address: int, params)

Source from the content-addressed store, hash-verified

13from qiling.os.windows.utils import has_lib_ext
14
15def _GetModuleHandle(ql: Qiling, address: int, params):
16 lpModuleName = params["lpModuleName"]
17
18 if lpModuleName == 0:
19 ret = ql.loader.pe_image_address
20 else:
21 if not has_lib_ext(lpModuleName):
22 lpModuleName = f'{lpModuleName}.dll'
23
24 image = ql.loader.get_image_by_name(lpModuleName, casefold=True)
25
26 if image:
27 ret = image.base
28 else:
29 ql.log.debug(f'Library "{lpModuleName}" not imported')
30 ret = 0
31
32 return ret
33
34# HMODULE GetModuleHandleA(
35# LPCSTR lpModuleName

Callers 3

hook_GetModuleHandleAFunction · 0.85
hook_GetModuleHandleWFunction · 0.85
hook_GetModuleHandleExWFunction · 0.85

Calls 2

has_lib_extFunction · 0.90
get_image_by_nameMethod · 0.80

Tested by

no test coverage detected