OpenProcess returns access denied RRS feed

  • Question

  • I've been trying to read from a memory address using the flag of PROCESS_ALL_ACCESS in the OpenProcess function without success.

    I have been able to successfully do this with a program called perma-edit that grants the process privileges, without it OpenProcess returns access denied.
    Friday, February 29, 2008 1:07 AM

All replies

  • Instead of PROCESS_ALL_ACCESS, try flags you actually require, e.g.: PROCESS_VM_READ or PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE. Or use the MAXIMUM_ALLOWED value instead.


    Friday, February 29, 2008 8:00 AM
  • Already tried that, the handle always returns null (access denied). GetLastError() returns 5.

    Is there some other way to get a process handle?
    Friday, February 29, 2008 11:36 AM
  • Hi,


    The error code indicates that you don’t have the specified access right to the process object.


    To open a handle to another local process and obtain full access rights, you must enable the SeDebugPrivilege privilege.


    For detail information, you can refer to


    Hope this helps!


    Wednesday, March 5, 2008 7:47 AM
  • Do I still need to set the SeDebugPrivilege even if I just need to read stuff from the pid? Eg process name and command line it was launched with.
    Thursday, May 6, 2010 2:33 PM
  • need to unable priveledges , check out Access Control Functions in msdn, add 1 more parameter in openprocess API is PROCESS_QUERY_LIMITED_INFORMATION




    Friday, June 11, 2010 1:59 PM