diff --git a/GUI/host/host.cc b/GUI/host/host.cc index a1e2a08..6584687 100644 --- a/GUI/host/host.cc +++ b/GUI/host/host.cc @@ -168,7 +168,7 @@ namespace Host HMODULE textHooker = LoadLibraryExW(ITH_DLL, nullptr, DONT_RESOLVE_DLL_REFERENCES); wchar_t textHookerPath[MAX_PATH]; - unsigned int textHookerPathSize = GetModuleFileNameW(textHooker, textHookerPath, MAX_PATH) * 2 + 2; + DWORD textHookerPathSize = GetModuleFileNameW(textHooker, textHookerPath, MAX_PATH) * 2 + 2; FreeLibrary(textHooker); if (HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId)) @@ -215,13 +215,13 @@ namespace Host WriteFile(processRecordsByIds[pid].hostPipe, &info, sizeof(info), DUMMY, nullptr); } - void RemoveHook(DWORD pid, unsigned __int64 addr) + void RemoveHook(DWORD pid, uint64_t addr) { auto info = RemoveHookCmd(addr); WriteFile(processRecordsByIds[pid].hostPipe, &info, sizeof(info), DUMMY, nullptr); } - HookParam GetHookParam(DWORD pid, unsigned __int64 addr) + HookParam GetHookParam(DWORD pid, uint64_t addr) { LOCK(hostMutex); HookParam ret = {}; @@ -238,7 +238,7 @@ namespace Host HookParam GetHookParam(ThreadParam tp) { return GetHookParam(tp.pid, tp.hook); } - std::wstring GetHookName(DWORD pid, unsigned __int64 addr) + std::wstring GetHookName(DWORD pid, uint64_t addr) { if (pid == 0) return L"Console"; LOCK(hostMutex); diff --git a/GUI/host/host.h b/GUI/host/host.h index 6c5e9f8..e70ffc1 100644 --- a/GUI/host/host.h +++ b/GUI/host/host.h @@ -19,11 +19,11 @@ namespace Host void DetachProcess(DWORD pid); void InsertHook(DWORD pid, HookParam hp, std::string name = ""); - void RemoveHook(DWORD pid, unsigned __int64 addr); + void RemoveHook(DWORD pid, uint64_t addr); - HookParam GetHookParam(DWORD pid, unsigned __int64 addr); + HookParam GetHookParam(DWORD pid, uint64_t addr); HookParam GetHookParam(ThreadParam tp); - std::wstring GetHookName(DWORD pid, unsigned __int64 addr); + std::wstring GetHookName(DWORD pid, uint64_t addr); TextThread* GetThread(ThreadParam tp); void AddConsoleOutput(std::wstring text); diff --git a/include/common.h b/include/common.h index 1600942..4db1fa3 100644 --- a/include/common.h +++ b/include/common.h @@ -8,3 +8,4 @@ #include #include #include +#include diff --git a/include/types.h b/include/types.h index 8098dbf..dee707c 100644 --- a/include/types.h +++ b/include/types.h @@ -11,7 +11,7 @@ struct HookParam typedef bool(*filter_fun_t)(LPVOID str, DWORD *len, HookParam *hp, BYTE index); // jichi 10/24/2014: Add filter function. Return true if skip the text typedef bool(*hook_fun_t)(DWORD esp, HookParam *hp); // jichi 10/24/2014: Add generic hook function, return false if stop execution. - unsigned __int64 address; // absolute or relative address + uint64_t address; // absolute or relative address int offset, // offset of the data in the memory index, // deref_offset1 split, // offset of the split character @@ -31,12 +31,12 @@ struct HookParam struct ThreadParam // From hook, used internally by host as well { DWORD pid; // jichi: 5/11/2014: The process ID - unsigned __int64 hook; // Artikash 6/6/2018: The insertion address of the hook - unsigned __int64 retn; // jichi 5/11/2014: The return address of the hook - unsigned __int64 spl; // jichi 5/11/2014: the processed split value of the hook paramete + uint64_t hook; // Artikash 6/6/2018: The insertion address of the hook + uint64_t retn; // jichi 5/11/2014: The return address of the hook + uint64_t spl; // jichi 5/11/2014: the processed split value of the hook paramete }; // Artikash 5/31/2018: required for unordered_map to work with struct key -template <> struct std::hash { size_t operator()(const ThreadParam& tp) const { return std::hash<__int64>()((tp.pid + tp.hook) ^ (tp.retn + tp.spl)); } }; +template <> struct std::hash { size_t operator()(const ThreadParam& tp) const { return std::hash()((tp.pid + tp.hook) ^ (tp.retn + tp.spl)); } }; static bool operator==(const ThreadParam& one, const ThreadParam& two) { return one.pid == two.pid && one.hook == two.hook && one.retn == two.retn && one.spl == two.spl; } struct InsertHookCmd // From host @@ -49,9 +49,9 @@ struct InsertHookCmd // From host struct RemoveHookCmd // From host { - RemoveHookCmd(unsigned __int64 address) : address(address) {}; + RemoveHookCmd(uint64_t address) : address(address) {}; int command = HOST_COMMAND_REMOVE_HOOK; - unsigned __int64 address; + uint64_t address; }; struct ConsoleOutputNotif // From hook @@ -63,9 +63,9 @@ struct ConsoleOutputNotif // From hook struct HookRemovedNotif // From hook { - HookRemovedNotif(unsigned __int64 address) : address(address) {}; + HookRemovedNotif(uint64_t address) : address(address) {}; int command = HOST_NOTIFICATION_RMVHOOK; - unsigned __int64 address; + uint64_t address; }; #define LOCK(mutex) std::lock_guard lock(mutex) diff --git a/vnrhook/main.cc b/vnrhook/main.cc index 852f8ca..dd204e7 100644 --- a/vnrhook/main.cc +++ b/vnrhook/main.cc @@ -80,7 +80,7 @@ void NewHook(const HookParam &hp, LPCSTR lpname, DWORD flag) else ConsoleOutput("NextHooker: too many hooks: can't insert"); } -void RemoveHook(unsigned __int64 addr) +void RemoveHook(uint64_t addr) { for (int i = 0; i < MAX_HOOK; i++) if (abs((long long)(::hookman[i].hp.address - addr)) < 9) diff --git a/vnrhook/main.h b/vnrhook/main.h index 5d41f19..ea2063f 100644 --- a/vnrhook/main.h +++ b/vnrhook/main.h @@ -9,7 +9,7 @@ #include "pipe.h" void NewHook(const HookParam &hp, LPCSTR name, DWORD flag = HOOK_ENGINE); -void RemoveHook(unsigned __int64 addr); +void RemoveHook(uint64_t addr); void SwitchTrigger(DWORD on); // EOF diff --git a/vnrhook/pipe.cc b/vnrhook/pipe.cc index f9a9336..1321420 100644 --- a/vnrhook/pipe.cc +++ b/vnrhook/pipe.cc @@ -90,7 +90,7 @@ void ConsoleOutput(LPCSTR text) WriteFile(::hookPipe, &info, strlen(text) + sizeof(info), DUMMY, nullptr); } -void NotifyHookRemove(unsigned __int64 addr) +void NotifyHookRemove(uint64_t addr) { auto info = HookRemovedNotif(addr); WriteFile(::hookPipe, &info, sizeof(info), DUMMY, nullptr); diff --git a/vnrhook/pipe.h b/vnrhook/pipe.h index b57658b..a4493ee 100644 --- a/vnrhook/pipe.h +++ b/vnrhook/pipe.h @@ -4,5 +4,5 @@ #include "types.h" void CreatePipe(); -void NotifyHookRemove(unsigned __int64 addr); +void NotifyHookRemove(uint64_t addr); void ConsoleOutput(LPCSTR text); // jichi 12/25/2013: Used to return length of sent text