2016. 1. 11. 17:24
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Opens an existing local process object.


Syntex

C++


HANDLE WINAPI OpenProcess(

_In_ DWORD     dwDesiredAccess,

_In_ BOOL       bInheritHandle,

_In_ DWORD     dwProcessId

);




Parameters 


dwDesiredAccess[in]

The access to the process object. This access right is checked against the security descriptor for the process. This parameter can be one or more of the process access rights/


bInheritHandle[in]

If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.


dwProceddId[in]

The identifier of the local process to be opened 


If the specified process is the System Process(0x00000000), the function fails and the last error code is ERROR_INVALID_PARAMETER. If the specified process is the Idle process or one of the CSRSS processes, this function fails and the last error code is ERROR_ACCESS_DENIED because their access restrictions prevent user-level code from opening them.


If you are using GetCurrentProcessId as an argument to this function, consider using GetCurrentProcess instead of OpenProcess, for improved performance.




Return value

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

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



Remarks

To open a handle to another local process and obtain full access rights, you must enable the SeBebugPrivilege privilege. For more information, see Changing Privileges in a Token


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.





Header     WinBase.h (include Windows.h)

    Processthreadsapi.h on WIndows 8 and Windows Server2012


Library     Kernel32.lib

DLL       Kernel32.dll




See also 

AssignProcessToJobObject

CloseHandle

CreateProcess

CreateRemoteThread

DuplicateHandle

GetCurrentProcess

GetCurrentProcessId

GetExitCodePRocess

GetModuleFileNameEx

GetPriorityClass

Process and Thread Functions

Processes

ReadProcessMemory

SetPriorityClass

SetProcessWorkingSetSize

TerminateProcess

VirtualProtectEx

WriteProcessMemory

'C / C++' 카테고리의 다른 글

VirtualAllocEx()  (0) 2016.01.15
GetProcAddress()  (0) 2016.01.14
CreateRemoteThread()  (0) 2016.01.11
SetWindowsHookEx()  (0) 2016.01.11
pragma data_seg >> dll 내부에 공유섹션 만들기  (0) 2016.01.11
Posted by af334