Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ulonglong AllocAtHighestUserAddressBuffer()
- {
- #define HighestUserAddress 0x7FFFFFFF0000
- #define HighestUserAddressBuffer 0x7FFFFFFEF000
- #define PageSize 0x1000
- ulonglong Base = 0x7FFFFFFEF000;
- ulonglong RegionSize = 0x1000;
- int retV = ZwAllocateVirtualMemory(GetCurrentProcess(),&Base,0,&RegionSize,MEM_RESERVE,PAGE_READWRITE);
- printf("ZwAllocateVirtualMemory, ret: %X, Base: %I64X Size: %I64X\r\n",retV,Base,RegionSize);
- if(retV >= 0)
- {
- retV = ZwAllocateVirtualMemory(GetCurrentProcess(),&Base,0,&RegionSize,MEM_COMMIT,PAGE_READWRITE);
- printf("ZwAllocateVirtualMemory, ret: %X, Base: %I64X Size: %I64X\r\n",retV,Base,RegionSize);
- *(uchar*)(HighestUserAddressBuffer+0xFFF) = 0;
- return Base;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement