From 5ea77e23a5a81384cfb1e2391a509c28af19a88c Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 19 Jul 2018 21:44:03 -0400 Subject: [PATCH] bugfix --- CMakeLists.txt | 2 +- vnr/texthook/hookman.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c397e9e..3e045ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ add_compile_options( /MP /GS- $<$:/MT> - $<$:/MTd> + #$<$:/MTd> ) add_definitions( diff --git a/vnr/texthook/hookman.cc b/vnr/texthook/hookman.cc index 91ed2f8..afa8fcd 100644 --- a/vnr/texthook/hookman.cc +++ b/vnr/texthook/hookman.cc @@ -101,12 +101,13 @@ void HookManager::RemoveProcessContext(DWORD pid) void HookManager::RegisterProcess(DWORD pid, HANDLE hostPipe) { HM_LOCK; - ProcessRecord record = processRecordsByIds[pid]; + ProcessRecord record; record.hostPipe = hostPipe; record.hookman_section = OpenFileMappingW(FILE_MAP_READ, FALSE, (ITH_SECTION_ + std::to_wstring(pid)).c_str()); record.hookman_map = MapViewOfFile(record.hookman_section, FILE_MAP_READ, 0, 0, HOOK_SECTION_SIZE / 2); // jichi 1/16/2015: Changed to half to hook section size record.process_handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); record.hookman_mutex = OpenMutexW(MUTEX_ALL_ACCESS, FALSE, (ITH_HOOKMAN_MUTEX_ + std::to_wstring(pid)).c_str()); + processRecordsByIds[pid] = record; if (attach) attach(pid); }