better hash fn

This commit is contained in:
Akash Mozumdar 2019-01-11 16:15:42 -05:00
parent 0f7fe46980
commit d8429851cb

View File

@ -57,8 +57,7 @@ namespace
size_t HashThreadParam(ThreadParam tp) size_t HashThreadParam(ThreadParam tp)
{ {
std::hash<int64_t> hash; return std::hash<int64_t>()(tp.processId + tp.addr) + std::hash<int64_t>()(tp.ctx + tp.ctx2);
return hash(hash(tp.processId) + hash(tp.addr) + hash(tp.ctx) + hash(tp.ctx2));
} }
ThreadSafe<std::unordered_map<ThreadParam, std::unique_ptr<TextThread>, Functor<HashThreadParam>>, std::recursive_mutex> textThreadsByParams; ThreadSafe<std::unordered_map<ThreadParam, std::unique_ptr<TextThread>, Functor<HashThreadParam>>, std::recursive_mutex> textThreadsByParams;
ThreadSafe<std::unordered_map<DWORD, ProcessRecord>, std::recursive_mutex> processRecordsByIds; ThreadSafe<std::unordered_map<DWORD, ProcessRecord>, std::recursive_mutex> processRecordsByIds;
@ -160,8 +159,7 @@ namespace Host
return false; return false;
} }
static HMODULE vnrhook = LoadLibraryExW(ITH_DLL, nullptr, DONT_RESOLVE_DLL_REFERENCES); static std::wstring location = Util::GetModuleFilename(LoadLibraryExW(ITH_DLL, nullptr, DONT_RESOLVE_DLL_REFERENCES)).value();
static std::wstring location = Util::GetModuleFilename(vnrhook).value();
if (AutoHandle<> process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId)) if (AutoHandle<> process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId))
{ {