2 * Win32 process handles
4 * Copyright 1998 Alexandre Julliard
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(win32
);
16 /*********************************************************************
17 * CloseHandle (KERNEL32.23)
19 BOOL WINAPI
CloseHandle( HANDLE handle
)
23 /* stdio handles need special treatment */
24 if ((handle
== STD_INPUT_HANDLE
) ||
25 (handle
== STD_OUTPUT_HANDLE
) ||
26 (handle
== STD_ERROR_HANDLE
))
27 handle
= GetStdHandle( handle
);
29 status
= NtClose( handle
);
30 if (status
) SetLastError( RtlNtStatusToDosError(status
) );
35 /*********************************************************************
36 * GetHandleInformation (KERNEL32.336)
38 BOOL WINAPI
GetHandleInformation( HANDLE handle
, LPDWORD flags
)
43 struct get_handle_info_request
*req
= server_alloc_req( sizeof(*req
), 0 );
45 ret
= !server_call( REQ_GET_HANDLE_INFO
);
46 if (ret
&& flags
) *flags
= req
->flags
;
53 /*********************************************************************
54 * SetHandleInformation (KERNEL32.653)
56 BOOL WINAPI
SetHandleInformation( HANDLE handle
, DWORD mask
, DWORD flags
)
61 struct set_handle_info_request
*req
= server_alloc_req( sizeof(*req
), 0 );
65 ret
= !server_call( REQ_SET_HANDLE_INFO
);
72 /*********************************************************************
73 * DuplicateHandle (KERNEL32.192)
75 BOOL WINAPI
DuplicateHandle( HANDLE source_process
, HANDLE source
,
76 HANDLE dest_process
, HANDLE
*dest
,
77 DWORD access
, BOOL inherit
, DWORD options
)
82 struct dup_handle_request
*req
= server_alloc_req( sizeof(*req
), 0 );
84 req
->src_process
= source_process
;
85 req
->src_handle
= source
;
86 req
->dst_process
= dest_process
;
88 req
->inherit
= inherit
;
89 req
->options
= options
;
91 ret
= !server_call( REQ_DUP_HANDLE
);
92 if (ret
&& dest
) *dest
= req
->handle
;
99 /***********************************************************************
100 * ConvertToGlobalHandle (KERNEL32)
102 HANDLE WINAPI
ConvertToGlobalHandle(HANDLE hSrc
)
105 DuplicateHandle( GetCurrentProcess(), hSrc
, (HANDLE
)-1, &ret
, 0, FALSE
,
106 DUP_HANDLE_MAKE_GLOBAL
| DUP_HANDLE_SAME_ACCESS
| DUP_HANDLE_CLOSE_SOURCE
);
110 /***********************************************************************
111 * SetHandleContext (KERNEL32)
113 BOOL WINAPI
SetHandleContext(HANDLE hnd
,DWORD context
) {
114 FIXME("(%d,%ld), stub. In case this got called by WSOCK32/WS2_32: the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd
,context
);
115 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
119 /***********************************************************************
120 * GetHandleContext (KERNEL32)
122 DWORD WINAPI
GetHandleContext(HANDLE hnd
) {
123 FIXME("(%d), stub. In case this got called by WSOCK32/WS2_32: the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd
);
124 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
128 /***********************************************************************
129 * CreateSocketHandle (KERNEL32)
131 HANDLE WINAPI
CreateSocketHandle(void) {
132 FIXME("(), stub. In case this got called by WSOCK32/WS2_32: the external WINSOCK DLLs won't work with WINE, don't use them.\n");
133 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
134 return INVALID_HANDLE_VALUE
;