2 * Win32 process handles
4 * Copyright 1998 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "wine/server.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(win32
);
31 /*********************************************************************
32 * CloseW32Handle (KERNEL.474)
33 * CloseHandle (KERNEL32.@)
35 BOOL WINAPI
CloseHandle( HANDLE handle
)
39 /* stdio handles need special treatment */
40 if ((handle
== STD_INPUT_HANDLE
) ||
41 (handle
== STD_OUTPUT_HANDLE
) ||
42 (handle
== STD_ERROR_HANDLE
))
43 handle
= GetStdHandle( handle
);
45 status
= NtClose( handle
);
46 if (status
) SetLastError( RtlNtStatusToDosError(status
) );
51 /*********************************************************************
52 * GetHandleInformation (KERNEL32.@)
54 BOOL WINAPI
GetHandleInformation( HANDLE handle
, LPDWORD flags
)
57 SERVER_START_REQ( set_handle_info
)
63 ret
= !wine_server_call_err( req
);
64 if (ret
&& flags
) *flags
= reply
->old_flags
;
71 /*********************************************************************
72 * SetHandleInformation (KERNEL32.@)
74 BOOL WINAPI
SetHandleInformation( HANDLE handle
, DWORD mask
, DWORD flags
)
77 SERVER_START_REQ( set_handle_info
)
83 ret
= !wine_server_call_err( req
);
90 /*********************************************************************
91 * DuplicateHandle (KERNEL32.@)
93 BOOL WINAPI
DuplicateHandle( HANDLE source_process
, HANDLE source
,
94 HANDLE dest_process
, HANDLE
*dest
,
95 DWORD access
, BOOL inherit
, DWORD options
)
98 SERVER_START_REQ( dup_handle
)
100 req
->src_process
= source_process
;
101 req
->src_handle
= source
;
102 req
->dst_process
= dest_process
;
103 req
->access
= access
;
104 req
->inherit
= inherit
;
105 req
->options
= options
;
107 ret
= !wine_server_call_err( req
);
110 if (dest
) *dest
= reply
->handle
;
111 if (reply
->fd
!= -1) close( reply
->fd
);
119 /***********************************************************************
120 * ConvertToGlobalHandle (KERNEL.476)
121 * ConvertToGlobalHandle (KERNEL32.@)
123 HANDLE WINAPI
ConvertToGlobalHandle(HANDLE hSrc
)
125 HANDLE ret
= INVALID_HANDLE_VALUE
;
126 DuplicateHandle( GetCurrentProcess(), hSrc
, GetCurrentProcess(), &ret
, 0, FALSE
,
127 DUP_HANDLE_MAKE_GLOBAL
| DUP_HANDLE_SAME_ACCESS
| DUP_HANDLE_CLOSE_SOURCE
);
131 /***********************************************************************
132 * SetHandleContext (KERNEL32.@)
134 BOOL WINAPI
SetHandleContext(HANDLE hnd
,DWORD context
) {
135 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
);
136 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
140 /***********************************************************************
141 * GetHandleContext (KERNEL32.@)
143 DWORD WINAPI
GetHandleContext(HANDLE hnd
) {
144 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
);
145 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
149 /***********************************************************************
150 * CreateSocketHandle (KERNEL32.@)
152 HANDLE WINAPI
CreateSocketHandle(void) {
153 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");
154 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
155 return INVALID_HANDLE_VALUE
;