I use VirtualAllocEx on a remote process to reserve some space like this:
VirtualAllocEX (RemoteProcessHandle, nil, SizeInBytes, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
Then I “fill”/write the allocated addressspace with WriteProcessMemory
Then I properly use
VirtualFreeEx (RemoteProcessHandle, Address, 0, MEM_RELEASE);
to release the allocated space.
Is it possible to check on the Address of VirtualAllocEx after VirtualFreeEx has been called to check if VirtualFreeEx was successful?
As soon as you return the address to the system, any future reference of that address is invalid. Once you have made the successful call to
VirtualFreeEx, you must not refer toAddressagain. Once you have returned the address to the system, the system owns it. The only way for that address to become valid in the future, is through another call toVirtualAllocEx.