1 #include <stdio.h> 2 #include <windows.h> 3 4 int main() 5 { 6 PBYTE Base; 7 PVOID Ret; 8 9 Base = VirtualAlloc(NULL, 10 1048576, 11 MEM_RESERVE, 12 PAGE_READWRITE); 13 if (Base == NULL) 14 { 15 printf("VirtualAlloc failed 1\n"); 16 } 17 18 Ret = VirtualAlloc(Base + 4096, 19 4096, 20 MEM_COMMIT, 21 PAGE_READWRITE); 22 if (Ret == NULL) 23 { 24 printf("VirtualAlloc failed 2\n"); 25 } 26 27 Ret = VirtualAlloc(Base + 12288, 28 4096, 29 MEM_COMMIT, 30 PAGE_READWRITE); 31 if (Ret == NULL) 32 { 33 printf("VirtualAlloc failed 3\n"); 34 } 35 36 Ret = VirtualAlloc(Base + 20480, 37 4096, 38 MEM_COMMIT, 39 PAGE_READWRITE); 40 if (Ret == NULL) 41 { 42 printf("VirtualAlloc failed 4\n"); 43 } 44 45 Ret = VirtualAlloc(Base + 4096, 46 28672, 47 MEM_RESERVE, 48 PAGE_READWRITE); 49 if (Ret == NULL) 50 { 51 printf("VirtualAlloc failed 5\n"); 52 } 53 return 0; 54 } 55 56