@@ -12,7 +12,7 @@ namespace Iat_hook
12
12
{
13
13
if (!hModule)
14
14
hModule = GetModuleHandle (nullptr );
15
-
15
+
16
16
const DWORD_PTR instance = reinterpret_cast <DWORD_PTR>(hModule);
17
17
const PIMAGE_NT_HEADERS ntHeader = reinterpret_cast <PIMAGE_NT_HEADERS>(instance + reinterpret_cast <PIMAGE_DOS_HEADER>(instance)->e_lfanew );
18
18
PIMAGE_IMPORT_DESCRIPTOR pImports = reinterpret_cast <PIMAGE_IMPORT_DESCRIPTOR>(instance + ntHeader->OptionalHeader .DataDirectory [IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress );
@@ -53,7 +53,7 @@ namespace Iat_hook
53
53
__except ((GetExceptionCode () == EXCEPTION_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
54
54
{
55
55
}
56
-
56
+
57
57
__try
58
58
{
59
59
for (IMAGE_IMPORT_DESCRIPTOR* iid = pImports; iid->Name != 0 ; iid++) {
@@ -74,7 +74,7 @@ namespace Iat_hook
74
74
{
75
75
char * mod_func_name = (char *)(mod_func_ptr_ord + (size_t )hModule + 2 );
76
76
const intptr_t nmod_func_name = (intptr_t )mod_func_name;
77
- if (nmod_func_name >= 0 && !lstrcmpA (function, mod_func_name))
77
+ if (nmod_func_name >= 0 && !lstrcmpA (function, mod_func_name)) {
78
78
return func_idx + (void **)(iid->FirstThunk + (size_t )hModule);
79
79
}
80
80
}
@@ -84,11 +84,11 @@ namespace Iat_hook
84
84
__except ((GetExceptionCode () == EXCEPTION_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
85
85
{
86
86
}
87
-
87
+
88
88
return 0 ;
89
89
}
90
90
91
- uintptr_t detour_iat_ptr (const char * function, void * newfunction, HMODULE hModule = NULL , const char * chModule = NULL , const DWORD ordinal = 0 )
91
+ uintptr_t detour_iat_ptr (const char * function, void * newfunction, HMODULE hModule = NULL , const char * chModule = NULL , const DWORD ordinal = 0 )
92
92
{
93
93
void ** func_ptr = find_iat_func (function, hModule, chModule, ordinal);
94
94
if (!func_ptr || *func_ptr == newfunction || *func_ptr == NULL )
0 commit comments