Skip to content

Instantly share code, notes, and snippets.

View oklas's full-sized avatar
🌱
Thanks for sharing with your friends

Serguei Okladnikov oklas

🌱
Thanks for sharing with your friends
View GitHub Profile
@oklas
oklas / duplicate_handle.cpp
Created August 1, 2016 19:57
The windows handle pass to and get from master process
extern DWORD g_masterProcessId;
HANDLE DuplicateHandleToMaster( HANDLE handle )
{
HANDLE master_handle = NULL;
HANDLE master_process = OpenProcess(
PROCESS_DUP_HANDLE, FALSE, g_masterProcessId
);
if( ! master_process ) return NULL;