File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7362,15 +7362,16 @@ namespace Detours {
73627362 auto& eflags = *reinterpret_cast<REGISTER_FLAGS*>(&pCTX->EFlags);
73637363
73647364 if (Exception.ExceptionCode == EXCEPTION_SINGLE_STEP) {
7365- for (auto it = g_MemoryHookRecords.begin(); it != g_MemoryHookRecords.end();) {
7365+ for (auto it = g_MemoryHookRecords.begin(); it != g_MemoryHookRecords.end(); ++it ) {
73667366 const auto& pRecord = *it;
73677367 if (!pRecord) {
7368- ++it;
73697368 continue;
73707369 }
73717370
73727371 auto pit = pRecord->m_PendingRestoreThreads.find(unCurrentTID);
73737372 if (pit != pRecord->m_PendingRestoreThreads.end()) {
7373+ eflags.m_unTF = 0;
7374+
73747375 if (!pRecord->m_bPendingDeletion) {
73757376 for (const auto& pPage : pRecord->m_Pages) {
73767377 if (!pPage || !pPage->ChangeProtection(PAGE_NOACCESS)) {
@@ -7380,18 +7381,16 @@ namespace Detours {
73807381 }
73817382
73827383 pRecord->m_PendingRestoreThreads.erase(pit);
7383- }
73847384
7385- if (pRecord->m_bPendingDeletion) {
7386- it = g_MemoryHookRecords.erase(it);
7387- } else {
7388- ++it;
7385+ if (pRecord->m_bPendingDeletion && pRecord->m_PendingRestoreThreads.empty()) {
7386+ g_MemoryHookRecords.erase(it);
7387+ }
7388+
7389+ return true;
73897390 }
73907391 }
73917392
7392- eflags.m_unTF = 0;
7393-
7394- return true;
7393+ return false;
73957394 }
73967395
73977396 if ((Exception.ExceptionCode != EXCEPTION_ACCESS_VIOLATION) || (Exception.NumberParameters != 2)) {
You can’t perform that action at this time.
0 commit comments