please dont rip this site Prev Next

OpenProcess info  Overview  Group

The OpenProcess function returns a handle of an existing process object.

HANDLE OpenProcess(

    DWORD dwDesiredAccess,

// access flag

    BOOL bInheritHandle,

// handle inheritance flag

    DWORD dwProcessId 

// process identifier



Specifies the access to the process object. For operating systems that support security checking, this access is checked against any security descriptor for the target process. Any combination of the following access flags can be specified in addition to the STANDARD_RIGHTS_REQUIRED access flags:




Specifies all possible access flags for the process object.


Used internally.


Enables using the process handle in the CreateRemoteThread function to create a thread in the process.


Enables using the process handle as either the source or target process in the DuplicateHandle function to duplicate a handle.


Enables using the process handle in the GetExitCodeProcess and GetPriorityClass functions to read information from the process object.


Enables using the process handle in the SetPriorityClass function to set the priority class of the process.


Enables using the process handle in the TerminateProcess function to terminate the process.


Enables using the process handle in the VirtualProtectEx and WriteProcessMemory functions to modify the virtual memory of the process.


Enables using the process handle in the ReadProcessMemory function to read from the virtual memory of the process.


Enables using the process handle in the WriteProcessMemory function to write to the virtual memory of the process.


Windows NT only: Enables using the process handle in any of the wait functions to wait for the process to terminate.

Specifies whether the returned handle can be inherited by a new process created by the current process. If TRUE, the handle is inheritable.
Specifies the process identifier of the process to open.

Return Values

If the function succeeds, the return value is an open handle of the specified process.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.


The handle returned by the OpenProcess function can be used in any function that requires a handle to a process, such as the wait functions, provided the appropriate access rights were requested.

When you are finished with the handle, be sure to close it using the CloseHandle function.

See Also

CloseHandle, CreateProcess, CreateRemoteThread, DuplicateHandle, GetCurrentProcess, GetCurrentProcessId, GetExitCodeProcess, GetPriorityClass, ReadProcessMemory, SetPriorityClass, TerminateProcess, VirtualProtectEx, WriteProcessMemory 

file: /Techref/os/win/api/win32/func/src/f66_6.htm, 6KB, , updated: 2000/4/7 12:19, local time: 2024/7/20 00:19,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> OpenProcess</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!