HANDLE OpenProcess(fdwAccess, fInherit, IDProcess) | |||||
DWORD fdwAccess; | /* desired access flag | */ | |||
BOOL fInherit; | /* will child process inherit? | */ | |||
DWORD IDProcess; | /* identifies the process | */ |
The OpenProcess function returns a handle for an existing process.
fdwAccess
Specifies the desired access to the process object. For NT/Win32, this access is checked against any security descriptor for the target process. The following access flags can be specified in addition to the STANDARD_RIGHTS_REQUIRED access flags:
Value | Meaning |
PROCESS_DUP_HANDLE | ||
Required to duplicate an object handle into or out of a process. | ||
PROCESS_QUERY_INFORMATION | ||
Required to read certain information from the process object. | ||
PROCESS_VM_READ | ||
Required to read the memory of another process. | ||
PROCESS_VM_WRITE | ||
Required to write the memory of another process. | ||
SYNCHRONIZE | ||
Synchronization (wait) access. | ||
PROCESS_ALL_ACCESS | ||
Specifies all of the possible access flags for a process object. |
fInherit
Specifies whether the returned handle will be inherited by a new process created by the current process. A value of TRUE indicates that the new process will inherit the handle.
IDProcess
Specifies the process ID of the process to open.
The return value is an open handle to the specified process if the function is successful. Otherwise it is NULL.
If this function is successful, the handle is granted access to the process object only to the extent requested by the fdwAccess parameter.
The handle returned by the OpenProcess function may be used by the calling process with any function that requires a handle to a process.
Opening a process creates a handle to the specified process. Associated with the process handle is a set of access rights that may be performed using the process handle. The caller specifies the desired access to the process using the fdwAccess parameter.
ExitProcess, GetCurrentProcess, GetCurrentProcessId, GetExitCodeProcess, TerminateProcess