mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
fix ddraw unprotecting
This commit is contained in:
parent
64168d3301
commit
a17495fdbc
@ -200,21 +200,23 @@ 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 )
|
DWORD Characteristics = pSection->Characteristics;
|
||||||
|
if ( (Characteristics & IMAGE_SCN_CNT_CODE) == 0 )
|
||||||
{
|
{
|
||||||
pSection->Characteristics |= IMAGE_SCN_CNT_CODE;
|
Characteristics |= IMAGE_SCN_CNT_CODE;
|
||||||
ntHeader->OptionalHeader.SizeOfCode += pSection->Misc.VirtualSize;
|
Memory::VP::Patch( &ntHeader->OptionalHeader.SizeOfCode, ntHeader->OptionalHeader.SizeOfCode + pSection->Misc.VirtualSize );
|
||||||
}
|
}
|
||||||
if ( (pSection->Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) != 0 )
|
if ( (Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) != 0 )
|
||||||
{
|
{
|
||||||
pSection->Characteristics &= ~(IMAGE_SCN_CNT_INITIALIZED_DATA);
|
Characteristics &= ~(IMAGE_SCN_CNT_INITIALIZED_DATA);
|
||||||
ntHeader->OptionalHeader.SizeOfInitializedData -= pSection->Misc.VirtualSize;
|
Memory::VP::Patch( &ntHeader->OptionalHeader.SizeOfInitializedData, ntHeader->OptionalHeader.SizeOfInitializedData - pSection->Misc.VirtualSize );
|
||||||
}
|
}
|
||||||
if ( (pSection->Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 )
|
if ( (Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 )
|
||||||
{
|
{
|
||||||
pSection->Characteristics &= ~(IMAGE_SCN_CNT_UNINITIALIZED_DATA);
|
Characteristics &= ~(IMAGE_SCN_CNT_UNINITIALIZED_DATA);
|
||||||
ntHeader->OptionalHeader.SizeOfUninitializedData -= pSection->Misc.VirtualSize;
|
Memory::VP::Patch( &ntHeader->OptionalHeader.SizeOfUninitializedData, ntHeader->OptionalHeader.SizeOfUninitializedData - pSection->Misc.VirtualSize );
|
||||||
}
|
}
|
||||||
|
Memory::VP::Patch( &pSection->Characteristics, Characteristics );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user