mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Include flag changes when protecting rwcseg
This commit is contained in:
parent
fa1d50b62c
commit
6bcd33ea54
1 changed files with 16 additions and 0 deletions
|
@ -200,6 +200,22 @@ void PatchIAT()
|
||||||
{
|
{
|
||||||
DWORD dwProtect;
|
DWORD dwProtect;
|
||||||
VirtualProtect((LPVOID)((ptrdiff_t)hInstance + pSection->VirtualAddress), pSection->Misc.VirtualSize, PAGE_EXECUTE_READ, &dwProtect);
|
VirtualProtect((LPVOID)((ptrdiff_t)hInstance + pSection->VirtualAddress), pSection->Misc.VirtualSize, PAGE_EXECUTE_READ, &dwProtect);
|
||||||
|
|
||||||
|
if ( (pSection->Characteristics & IMAGE_SCN_CNT_CODE) == 0 )
|
||||||
|
{
|
||||||
|
pSection->Characteristics |= IMAGE_SCN_CNT_CODE;
|
||||||
|
ntHeader->OptionalHeader.SizeOfCode += pSection->Misc.VirtualSize;
|
||||||
|
}
|
||||||
|
if ( (pSection->Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) != 0 )
|
||||||
|
{
|
||||||
|
pSection->Characteristics &= ~(IMAGE_SCN_CNT_INITIALIZED_DATA);
|
||||||
|
ntHeader->OptionalHeader.SizeOfInitializedData -= pSection->Misc.VirtualSize;
|
||||||
|
}
|
||||||
|
if ( (pSection->Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 )
|
||||||
|
{
|
||||||
|
pSection->Characteristics &= ~(IMAGE_SCN_CNT_UNINITIALIZED_DATA);
|
||||||
|
ntHeader->OptionalHeader.SizeOfUninitializedData -= pSection->Misc.VirtualSize;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue