2 * Win32 process handles
4 * Copyright 1998 Alexandre Julliard
11 #include "wine/server.h"
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(win32
);
17 /*********************************************************************
18 * CloseW32Handle (KERNEL.474)
19 * CloseHandle (KERNEL32.@)
21 BOOL WINAPI
CloseHandle( HANDLE handle
)
25 /* stdio handles need special treatment */
26 if ((handle
== STD_INPUT_HANDLE
) ||
27 (handle
== STD_OUTPUT_HANDLE
) ||
28 (handle
== STD_ERROR_HANDLE
))
29 handle
= GetStdHandle( handle
);
31 status
= NtClose( handle
);
32 if (status
) SetLastError( RtlNtStatusToDosError(status
) );
37 /*********************************************************************
38 * GetHandleInformation (KERNEL32.@)
40 BOOL WINAPI
GetHandleInformation( HANDLE handle
, LPDWORD flags
)
43 SERVER_START_REQ( set_handle_info
)
49 ret
= !wine_server_call_err( req
);
50 if (ret
&& flags
) *flags
= reply
->old_flags
;
57 /*********************************************************************
58 * SetHandleInformation (KERNEL32.@)
60 BOOL WINAPI
SetHandleInformation( HANDLE handle
, DWORD mask
, DWORD flags
)
63 SERVER_START_REQ( set_handle_info
)
69 ret
= !wine_server_call_err( req
);
76 /*********************************************************************
77 * DuplicateHandle (KERNEL32.@)
79 BOOL WINAPI
DuplicateHandle( HANDLE source_process
, HANDLE source
,
80 HANDLE dest_process
, HANDLE
*dest
,
81 DWORD access
, BOOL inherit
, DWORD options
)
84 SERVER_START_REQ( dup_handle
)
86 req
->src_process
= source_process
;
87 req
->src_handle
= source
;
88 req
->dst_process
= dest_process
;
90 req
->inherit
= inherit
;
91 req
->options
= options
;
93 ret
= !wine_server_call_err( req
);
96 if (dest
) *dest
= reply
->handle
;
97 if (reply
->fd
!= -1) close( reply
->fd
);
105 /***********************************************************************
106 * ConvertToGlobalHandle (KERNEL.476)
107 * ConvertToGlobalHandle (KERNEL32.@)
109 HANDLE WINAPI
ConvertToGlobalHandle(HANDLE hSrc
)
111 HANDLE ret
= INVALID_HANDLE_VALUE
;
112 DuplicateHandle( GetCurrentProcess(), hSrc
, GetCurrentProcess(), &ret
, 0, FALSE
,
113 DUP_HANDLE_MAKE_GLOBAL
| DUP_HANDLE_SAME_ACCESS
| DUP_HANDLE_CLOSE_SOURCE
);
117 /***********************************************************************
118 * SetHandleContext (KERNEL32.@)
120 BOOL WINAPI
SetHandleContext(HANDLE hnd
,DWORD context
) {
121 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
);
122 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
126 /***********************************************************************
127 * GetHandleContext (KERNEL32.@)
129 DWORD WINAPI
GetHandleContext(HANDLE hnd
) {
130 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
);
131 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
135 /***********************************************************************
136 * CreateSocketHandle (KERNEL32.@)
138 HANDLE WINAPI
CreateSocketHandle(void) {
139 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");
140 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
141 return INVALID_HANDLE_VALUE
;