feature: MyVirtualProtect

This commit is contained in:
Dobin Rutishauser
2024-06-24 16:58:44 +02:00
parent 31be61ee8e
commit b6db721c12
12 changed files with 68 additions and 6 deletions
+9
View File
@@ -0,0 +1,9 @@
BOOL MyVirtualProtect(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD flNewProtect,
PDWORD lpflOldprotect
) {
return VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldprotect);
}
+19
View File
@@ -0,0 +1,19 @@
// How many bytes we VirtualProtect
#define VP_SIZE 16
BOOL MyVirtualProtect(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD flNewProtect,
PDWORD lpflOldprotect
) {
char *dest = (char *)lpAddress;
for(int n=0; n<(dwSize/4096)+1; n++) {
if (VirtualProtect(dest + (n * 4096), VP_SIZE, flNewProtect, lpflOldprotect) == 0) {
return FALSE;
}
}
return TRUE;
}