2 * Win32 process handles
4 * Copyright 1998 Alexandre Julliard
13 /*********************************************************************
14 * CloseHandle (KERNEL32.23)
16 BOOL WINAPI
CloseHandle( HANDLE handle
)
18 struct close_handle_request req
= { handle
};
19 CLIENT_SendRequest( REQ_CLOSE_HANDLE
, -1, 1, &req
, sizeof(req
) );
20 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
24 /*********************************************************************
25 * GetHandleInformation (KERNEL32.336)
27 BOOL WINAPI
GetHandleInformation( HANDLE handle
, LPDWORD flags
)
29 struct get_handle_info_request req
;
30 struct get_handle_info_reply reply
;
33 CLIENT_SendRequest( REQ_GET_HANDLE_INFO
, -1, 1, &req
, sizeof(req
) );
34 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return FALSE
;
35 if (flags
) *flags
= reply
.flags
;
40 /*********************************************************************
41 * SetHandleInformation (KERNEL32.653)
43 BOOL WINAPI
SetHandleInformation( HANDLE handle
, DWORD mask
, DWORD flags
)
45 struct set_handle_info_request req
;
50 CLIENT_SendRequest( REQ_SET_HANDLE_INFO
, -1, 1, &req
, sizeof(req
) );
51 return !CLIENT_WaitReply( NULL
, NULL
, 0 );
55 /*********************************************************************
56 * DuplicateHandle (KERNEL32.192)
58 BOOL WINAPI
DuplicateHandle( HANDLE source_process
, HANDLE source
,
59 HANDLE dest_process
, HANDLE
*dest
,
60 DWORD access
, BOOL inherit
, DWORD options
)
62 struct dup_handle_request req
;
63 struct dup_handle_reply reply
;
65 req
.src_process
= source_process
;
66 req
.src_handle
= source
;
67 req
.dst_process
= dest_process
;
69 req
.inherit
= inherit
;
70 req
.options
= options
;
72 CLIENT_SendRequest( REQ_DUP_HANDLE
, -1, 1, &req
, sizeof(req
) );
73 if (CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
)) return FALSE
;
74 if (dest
) *dest
= reply
.handle
;
79 /***********************************************************************
80 * ConvertToGlobalHandle (KERNEL32)
82 HANDLE WINAPI
ConvertToGlobalHandle(HANDLE hSrc
)
84 struct dup_handle_request req
;
85 struct dup_handle_reply reply
;
87 req
.src_process
= GetCurrentProcess();
88 req
.src_handle
= hSrc
;
92 req
.options
= DUP_HANDLE_MAKE_GLOBAL
| DUP_HANDLE_SAME_ACCESS
;
94 CLIENT_SendRequest( REQ_DUP_HANDLE
, -1, 1, &req
, sizeof(req
) );
95 CLIENT_WaitSimpleReply( &reply
, sizeof(reply
), NULL
);