Skip to content

Commit 4b39b1f

Browse files
committed
Minor changes
1 parent e5315d0 commit 4b39b1f

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

Detours.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff 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)) {

0 commit comments

Comments
 (0)