Skip to content

Commit

Permalink
fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Oct 21, 2022
1 parent aa4e675 commit 9a2f8a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ workspace "d3d9-wrapper"
targetname "d3d9"
targetextension ".dll"
characterset ("MBCS")
flags { "StaticRuntime" }
staticruntime "On"

defines { "rsc_CompanyName=\"ThirteenAG\"" }
defines { "rsc_LegalCopyright=\"MIT License\""}
Expand Down
10 changes: 5 additions & 5 deletions source/iathook.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Iat_hook
{
if (!hModule)
hModule = GetModuleHandle(nullptr);

const DWORD_PTR instance = reinterpret_cast<DWORD_PTR>(hModule);
const PIMAGE_NT_HEADERS ntHeader = reinterpret_cast<PIMAGE_NT_HEADERS>(instance + reinterpret_cast<PIMAGE_DOS_HEADER>(instance)->e_lfanew);
PIMAGE_IMPORT_DESCRIPTOR pImports = reinterpret_cast<PIMAGE_IMPORT_DESCRIPTOR>(instance + ntHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
Expand Down Expand Up @@ -53,7 +53,7 @@ namespace Iat_hook
__except ((GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
}

__try
{
for (IMAGE_IMPORT_DESCRIPTOR* iid = pImports; iid->Name != 0; iid++) {
Expand All @@ -74,7 +74,7 @@ namespace Iat_hook
{
char* mod_func_name = (char*)(mod_func_ptr_ord + (size_t)hModule + 2);
const intptr_t nmod_func_name = (intptr_t)mod_func_name;
if (nmod_func_name >= 0 && !lstrcmpA(function, mod_func_name))
if (nmod_func_name >= 0 && !lstrcmpA(function, mod_func_name)) {
return func_idx + (void**)(iid->FirstThunk + (size_t)hModule);
}
}
Expand All @@ -84,11 +84,11 @@ namespace Iat_hook
__except ((GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
}

return 0;
}

uintptr_t detour_iat_ptr(const char* function, void* newfunction, HMODULE hModule = NULL , const char* chModule = NULL, const DWORD ordinal = 0)
uintptr_t detour_iat_ptr(const char* function, void* newfunction, HMODULE hModule = NULL, const char* chModule = NULL, const DWORD ordinal = 0)
{
void** func_ptr = find_iat_func(function, hModule, chModule, ordinal);
if (!func_ptr || *func_ptr == newfunction || *func_ptr == NULL)
Expand Down

2 comments on commit 9a2f8a2

@anzz1
Copy link
Contributor

@anzz1 anzz1 commented on 9a2f8a2 Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof that was embarassing 😅

@ThirteenAG
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof that was embarassing 😅

eh, it's alright :)

Please sign in to comment.