[C++]WriteProcessMemory: Problems opening the process - WTF -

01/06/2014 20:51 Hybrid~#16
Thanks for bothering in lookin' at this. I'll try it later.
01/06/2014 23:25 MrSm!th#17
Quote:
Originally Posted by Omdihar View Post
You don't need to request PROCESS_ALL_ACCESS access.
Requesting PROCESS_VM_WRITE should work.
That wouldn't make a difference for WriteProcessMemory.
01/07/2014 01:05 Omdi#18
Quote:
Originally Posted by MrSm!th View Post
That wouldn't make a difference for WriteProcessMemory.
That's the point :D
The problem is in OpenProcess and not in WriteProcessMemory.

You can find a solution in the msdn specification:
Quote:
The size of thePROCESS_ALL_ACCESS*flag increased on Windows Server*2008 and Windows*Vista. If an application compiled for Windows Server*2008 and Windows*Vista is run on Windows Server*2003 or Windows*XP, the*PROCESS_ALL_ACCESS*flag is too large and the function specifying this flag fails with*ERROR_ACCESS_DENIED. To avoid this problem, specify the minimum set of access rights required for the operation. If*PROCESS_ALL_ACCESS*must be used, set _WIN32_WINNT to the minimum operating system targeted by your application*
You just try to avoid using PROCESS_ALL_ACCESS.
Use the flag you currently need, in your case write access should be enough.
01/07/2014 15:19 MrSm!th#19
Quote:
Originally Posted by Omdihar View Post
That's the point :D
The problem is in OpenProcess and not in WriteProcessMemory.

You can find a solution in the msdn specification:


You just try to avoid using PROCESS_ALL_ACCESS.
Use the flag you currently need, in your case write access should be enough.
Then OpenProcess should fail and not WriteProcessMemory.