2 * Win32 process handles
4 * Copyright 1998 Alexandre Julliard
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(win32
);
17 /*********************************************************************
18 * CloseHandle (KERNEL.11)
19 * CloseHandle (WIN32S16.11)
20 * CloseHandle (KERNEL32.@)
22 BOOL WINAPI
CloseHandle( HANDLE handle
)
26 /* stdio handles need special treatment */
27 if ((handle
== STD_INPUT_HANDLE
) ||
28 (handle
== STD_OUTPUT_HANDLE
) ||
29 (handle
== STD_ERROR_HANDLE
))
30 handle
= GetStdHandle( handle
);
32 status
= NtClose( handle
);
33 if (status
) SetLastError( RtlNtStatusToDosError(status
) );
38 /*********************************************************************
39 * GetHandleInformation (KERNEL32.336)
41 BOOL WINAPI
GetHandleInformation( HANDLE handle
, LPDWORD flags
)
46 struct set_handle_info_request
*req
= server_alloc_req( sizeof(*req
), 0 );
51 ret
= !server_call( REQ_SET_HANDLE_INFO
);
52 if (ret
&& flags
) *flags
= req
->old_flags
;
59 /*********************************************************************
60 * SetHandleInformation (KERNEL32.653)
62 BOOL WINAPI
SetHandleInformation( HANDLE handle
, DWORD mask
, DWORD flags
)
67 struct set_handle_info_request
*req
= server_alloc_req( sizeof(*req
), 0 );
72 ret
= !server_call( REQ_SET_HANDLE_INFO
);
79 /*********************************************************************
80 * DuplicateHandle (KERNEL32.192)
82 BOOL WINAPI
DuplicateHandle( HANDLE source_process
, HANDLE source
,
83 HANDLE dest_process
, HANDLE
*dest
,
84 DWORD access
, BOOL inherit
, DWORD options
)
89 struct dup_handle_request
*req
= server_alloc_req( sizeof(*req
), 0 );
91 req
->src_process
= source_process
;
92 req
->src_handle
= source
;
93 req
->dst_process
= dest_process
;
95 req
->inherit
= inherit
;
96 req
->options
= options
;
98 ret
= !server_call( REQ_DUP_HANDLE
);
101 if (dest
) *dest
= req
->handle
;
102 if (req
->fd
!= -1) close( req
->fd
);
110 /***********************************************************************
111 * ConvertToGlobalHandle (KERNEL.476)
112 * ConvertToGlobalHandle (KERNEL32.@)
114 HANDLE WINAPI
ConvertToGlobalHandle(HANDLE hSrc
)
116 HANDLE ret
= INVALID_HANDLE_VALUE
;
117 DuplicateHandle( GetCurrentProcess(), hSrc
, GetCurrentProcess(), &ret
, 0, FALSE
,
118 DUP_HANDLE_MAKE_GLOBAL
| DUP_HANDLE_SAME_ACCESS
| DUP_HANDLE_CLOSE_SOURCE
);
122 /***********************************************************************
123 * SetHandleContext (KERNEL32.@)
125 BOOL WINAPI
SetHandleContext(HANDLE hnd
,DWORD context
) {
126 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
);
127 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
131 /***********************************************************************
132 * GetHandleContext (KERNEL32.@)
134 DWORD WINAPI
GetHandleContext(HANDLE hnd
) {
135 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
);
136 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
140 /***********************************************************************
141 * CreateSocketHandle (KERNEL32.@)
143 HANDLE WINAPI
CreateSocketHandle(void) {
144 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");
145 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
146 return INVALID_HANDLE_VALUE
;