Do not output text in OutputDebugStrAW when not being debugged
[wine] / scheduler / handle.c
1 /*
2  * Win32 process handles
3  *
4  * Copyright 1998 Alexandre Julliard
5  */
6
7 #include <assert.h>
8 #include <stdio.h>
9 #include "winbase.h"
10 #include "server.h"
11 #include "winerror.h"
12 #include "debugtools.h"
13
14 DEFAULT_DEBUG_CHANNEL(win32)
15
16 /*********************************************************************
17  *           CloseHandle   (KERNEL32.23)
18  */
19 BOOL WINAPI CloseHandle( HANDLE handle )
20 {
21     struct close_handle_request *req = get_req_buffer();
22     req->handle = handle;
23     return !server_call( REQ_CLOSE_HANDLE );
24 }
25
26
27 /*********************************************************************
28  *           GetHandleInformation   (KERNEL32.336)
29  */
30 BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
31 {
32     struct get_handle_info_request *req = get_req_buffer();
33     req->handle = handle;
34     if (server_call( REQ_GET_HANDLE_INFO )) return FALSE;
35     if (flags) *flags = req->flags;
36     return TRUE;
37 }
38
39
40 /*********************************************************************
41  *           SetHandleInformation   (KERNEL32.653)
42  */
43 BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
44 {
45     struct set_handle_info_request *req = get_req_buffer();
46     req->handle = handle;
47     req->flags  = flags;
48     req->mask   = mask;
49     return !server_call( REQ_SET_HANDLE_INFO );
50 }
51
52
53 /*********************************************************************
54  *           DuplicateHandle   (KERNEL32.192)
55  */
56 BOOL WINAPI DuplicateHandle( HANDLE source_process, HANDLE source,
57                                HANDLE dest_process, HANDLE *dest,
58                                DWORD access, BOOL inherit, DWORD options )
59 {
60     struct dup_handle_request *req = get_req_buffer();
61
62     req->src_process = source_process;
63     req->src_handle  = source;
64     req->dst_process = dest_process;
65     req->access      = access;
66     req->inherit     = inherit;
67     req->options     = options;
68
69     if (server_call( REQ_DUP_HANDLE )) return FALSE;
70     if (dest) *dest = req->handle;
71     return TRUE;
72 }
73
74
75 /***********************************************************************
76  *           ConvertToGlobalHandle              (KERNEL32)
77  */
78 HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
79 {
80     struct dup_handle_request *req = get_req_buffer();
81
82     req->src_process = GetCurrentProcess();
83     req->src_handle  = hSrc;
84     req->dst_process = -1;
85     req->access      = 0;
86     req->inherit     = FALSE;
87     req->options     = DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS;
88
89     server_call( REQ_DUP_HANDLE );
90     return req->handle;
91 }
92
93 /***********************************************************************
94  *           SetHandleContext                   (KERNEL32)
95  */
96 BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) {
97     FIXME("(%d,%ld), stub. The external WSOCK32 will not work with WINE, do not use it.\n",hnd,context);
98     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
99     return FALSE;
100 }
101
102 /***********************************************************************
103  *           GetHandleContext                   (KERNEL32)
104  */
105 DWORD WINAPI GetHandleContext(HANDLE hnd) {
106     FIXME("(%d), stub. The external WSOCK32 will not work with WINE, do not use it.\n",hnd);
107     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
108     return 0;
109 }
110
111 /***********************************************************************
112  *           CreateSocketHandle                 (KERNEL32)
113  */
114 HANDLE WINAPI CreateSocketHandle(void) {
115     FIXME("(), stub. The external WSOCK32 will not work with WINE, do not use it.\n");
116     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
117     return INVALID_HANDLE_VALUE;
118 }