MCPcopy Create free account
hub / github.com/SafeBreach-Labs/PoolParty / w_DuplicateHandle

Function w_DuplicateHandle

PoolParty/WinApi.cpp:16–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16std::shared_ptr<HANDLE> w_DuplicateHandle(
17 HANDLE hSourceProcessHandle,
18 HANDLE hSourceHandle,
19 HANDLE hTargetProcessHandle,
20 DWORD dwDesiredAccess,
21 BOOL bInheritHandle,
22 DWORD dwOptions)
23{
24 HANDLE hTargetHandle;
25 RAISE_IF_FALSE(
26 "DuplicateHandle",
27 DuplicateHandle(
28 hSourceProcessHandle,
29 hSourceHandle,
30 hTargetProcessHandle,
31 &hTargetHandle,
32 dwDesiredAccess,
33 bInheritHandle,
34 dwOptions)
35 );
36
37 return std::shared_ptr<HANDLE>(new HANDLE(hTargetHandle), [](HANDLE* p_handle) {CloseHandle(*p_handle); });
38}
39
40std::shared_ptr<HANDLE> w_CreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitalState, LPWSTR lpName)
41{

Callers 1

HijackProcessHandleFunction · 0.85

Calls 1

RAISE_IF_FALSEFunction · 0.85

Tested by

no test coverage detected