Fixed signal stack handling on Linux when sigaltstack is available.
[wine/multimedia.git] / scheduler / handle.c
blob8b05df4d37797d75848cccb03a1e030fa167dc91
1 /*
2 * Win32 process handles
4 * Copyright 1998 Alexandre Julliard
5 */
7 #include <assert.h>
8 #include <stdio.h>
9 #include "winbase.h"
10 #include "server.h"
11 #include "winerror.h"
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(win32)
16 /*********************************************************************
17 * CloseHandle (KERNEL32.23)
19 BOOL WINAPI CloseHandle( HANDLE handle )
21 struct close_handle_request *req = get_req_buffer();
22 /* stdio handles need special treatment */
23 if ((handle == STD_INPUT_HANDLE) ||
24 (handle == STD_OUTPUT_HANDLE) ||
25 (handle == STD_ERROR_HANDLE))
26 handle = GetStdHandle( handle );
27 req->handle = handle;
28 return !server_call( REQ_CLOSE_HANDLE );
32 /*********************************************************************
33 * GetHandleInformation (KERNEL32.336)
35 BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
37 struct get_handle_info_request *req = get_req_buffer();
38 req->handle = handle;
39 if (server_call( REQ_GET_HANDLE_INFO )) return FALSE;
40 if (flags) *flags = req->flags;
41 return TRUE;
45 /*********************************************************************
46 * SetHandleInformation (KERNEL32.653)
48 BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
50 struct set_handle_info_request *req = get_req_buffer();
51 req->handle = handle;
52 req->flags = flags;
53 req->mask = mask;
54 return !server_call( REQ_SET_HANDLE_INFO );
58 /*********************************************************************
59 * DuplicateHandle (KERNEL32.192)
61 BOOL WINAPI DuplicateHandle( HANDLE source_process, HANDLE source,
62 HANDLE dest_process, HANDLE *dest,
63 DWORD access, BOOL inherit, DWORD options )
65 struct dup_handle_request *req = get_req_buffer();
67 req->src_process = source_process;
68 req->src_handle = source;
69 req->dst_process = dest_process;
70 req->access = access;
71 req->inherit = inherit;
72 req->options = options;
74 if (server_call( REQ_DUP_HANDLE )) return FALSE;
75 if (dest) *dest = req->handle;
76 return TRUE;
80 /***********************************************************************
81 * ConvertToGlobalHandle (KERNEL32)
83 HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
85 struct dup_handle_request *req = get_req_buffer();
87 req->src_process = GetCurrentProcess();
88 req->src_handle = hSrc;
89 req->dst_process = -1;
90 req->access = 0;
91 req->inherit = FALSE;
92 req->options = DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS;
94 server_call( REQ_DUP_HANDLE );
95 return req->handle;
98 /***********************************************************************
99 * SetHandleContext (KERNEL32)
101 BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) {
102 FIXME("(%d,%ld), stub. The external WSOCK32 will not work with WINE, do not use it.\n",hnd,context);
103 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
104 return FALSE;
107 /***********************************************************************
108 * GetHandleContext (KERNEL32)
110 DWORD WINAPI GetHandleContext(HANDLE hnd) {
111 FIXME("(%d), stub. The external WSOCK32 will not work with WINE, do not use it.\n",hnd);
112 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
113 return 0;
116 /***********************************************************************
117 * CreateSocketHandle (KERNEL32)
119 HANDLE WINAPI CreateSocketHandle(void) {
120 FIXME("(), stub. The external WSOCK32 will not work with WINE, do not use it.\n");
121 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
122 return INVALID_HANDLE_VALUE;