File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class VirtualUnprotector
3737 m_nLength = nLength;
3838 m_pTarget = pTarget;
3939
40- assert ( VirtualProtect (pTarget, nLength, PAGE_EXECUTE_READWRITE , &m_nOldProtect) );
40+ bool bIsUnprotected = VirtualProtect (pTarget, nLength, PAGE_EXECUTE_READWRITE , &m_nOldProtect);
4141#else
4242 long pageSize = sysconf (_SC_PAGESIZE);
4343
@@ -54,18 +54,22 @@ class VirtualUnprotector
5454 m_nLength = nAligned;
5555 m_pTarget = pPageStart;
5656
57- assert ( !mprotect (pPageStart, nAligned, PROT_READ | PROT_WRITE ) );
57+ bool bIsUnprotected = !mprotect (pPageStart, nAligned, PROT_READ | PROT_WRITE );
5858#endif
59+
60+ assert (bIsUnprotected);
5961 }
6062
6163 ~VirtualUnprotector ()
6264 {
6365#if _WIN32
6466 DWORD origProtect;
65- assert ( VirtualProtect (m_pTarget, m_nLength, m_nOldProtect, &origProtect) );
67+ bool bIsUnprotected = VirtualProtect (m_pTarget, m_nLength, m_nOldProtect, &origProtect);
6668#else
67- assert ( !mprotect (m_pTarget, m_nLength, m_nOldProtect) );
69+ bool bIsUnprotected = !mprotect (m_pTarget, m_nLength, m_nOldProtect);
6870#endif
71+
72+ assert (bIsUnprotected);
6973 }
7074
7175private:
You can’t perform that action at this time.
0 commit comments