HANDLE OpenProcess(
DWORD dwDesiredAccess,
BOOL bInheritHandle,
DWORD dwProcessId
);
dwDesiredAccess
[in] PROCESS_ALL_ACCESS
PROCESS_CREATE_THREAD
PROCESS_QUERY_INFORMATION
bInheritHandle
[in] TRUE
, each handle in the process is inherited by the new process. Otherwise, the handles are not inherited.
dwProcessId
[in] NULL
. To get extended error information, call GetLastError
.To compile an application that uses this function, the _WIN32_WINNT macro must be set to 0x0400 or later. For more information, see Using the Windows Headers.
The calling process must have the appropriate privileges for the target process. For example, to open a process with PROCESS_VM_READ
access, the calling process must have SeDebugPrivilege
enabled.
You can obtain the process identifier of the current process by calling the GetCurrentProcessId
function.
To obtain a handle to the current process, you can use the special value (HANDLE)-1
or GetCurrentProcess()
.
Windows 2000 Professional.
Windows 2000 Server.
Declared in processthreadsapi.h
, include windows.h
.
Use Kernel32.lib
.
Kernel32.dll
.