Fixed a few behaviors of the combobox that were broken.
[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;
22     
23     req.handle = handle;
24     CLIENT_SendRequest( REQ_CLOSE_HANDLE, -1, 1, &req, sizeof(req) );
25     return !CLIENT_WaitReply( NULL, NULL, 0 );
26 }
27
28
29 /*********************************************************************
30  *           GetHandleInformation   (KERNEL32.336)
31  */
32 BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
33 {
34     struct get_handle_info_request req;
35     struct get_handle_info_reply reply;
36
37     req.handle = handle;
38     CLIENT_SendRequest( REQ_GET_HANDLE_INFO, -1, 1, &req, sizeof(req) );
39     if (CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL )) return FALSE;
40     if (flags) *flags = reply.flags;
41     return TRUE;
42 }
43
44
45 /*********************************************************************
46  *           SetHandleInformation   (KERNEL32.653)
47  */
48 BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
49 {
50     struct set_handle_info_request req;
51
52     req.handle = handle;
53     req.flags  = flags;
54     req.mask   = mask;
55     CLIENT_SendRequest( REQ_SET_HANDLE_INFO, -1, 1, &req, sizeof(req) );
56     return !CLIENT_WaitReply( NULL, NULL, 0 );
57 }
58
59
60 /*********************************************************************
61  *           DuplicateHandle   (KERNEL32.192)
62  */
63 BOOL WINAPI DuplicateHandle( HANDLE source_process, HANDLE source,
64                                HANDLE dest_process, HANDLE *dest,
65                                DWORD access, BOOL inherit, DWORD options )
66 {
67     struct dup_handle_request req;
68     struct dup_handle_reply reply;
69
70     req.src_process = source_process;
71     req.src_handle  = source;
72     req.dst_process = dest_process;
73     req.access      = access;
74     req.inherit     = inherit;
75     req.options     = options;
76
77     CLIENT_SendRequest( REQ_DUP_HANDLE, -1, 1, &req, sizeof(req) );
78     if (CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL )) return FALSE;
79     if (dest) *dest = reply.handle;
80     return TRUE;
81 }
82
83
84 /***********************************************************************
85  *           ConvertToGlobalHandle              (KERNEL32)
86  */
87 HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
88 {
89     struct dup_handle_request req;
90     struct dup_handle_reply reply;
91
92     req.src_process = GetCurrentProcess();
93     req.src_handle  = hSrc;
94     req.dst_process = -1;
95     req.access      = 0;
96     req.inherit     = FALSE;
97     req.options     = DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS;
98
99     CLIENT_SendRequest( REQ_DUP_HANDLE, -1, 1, &req, sizeof(req) );
100     CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
101     return reply.handle;
102 }
103
104 /***********************************************************************
105  *           SetHandleContext                   (KERNEL32)
106  */
107 BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) {
108     FIXME("(%d,%ld), stub. The external WSOCK32 will not work with WINE, do not use it.\n",hnd,context);
109     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
110     return FALSE;
111 }
112
113 /***********************************************************************
114  *           GetHandleContext                   (KERNEL32)
115  */
116 DWORD WINAPI GetHandleContext(HANDLE hnd) {
117     FIXME("(%d), stub. The external WSOCK32 will not work with WINE, do not use it.\n",hnd);
118     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
119     return 0;
120 }
121
122 /***********************************************************************
123  *           CreateSocketHandle                 (KERNEL32)
124  */
125 HANDLE WINAPI CreateSocketHandle(void) {
126     FIXME("(), stub. The external WSOCK32 will not work with WINE, do not use it.\n");
127     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
128     return INVALID_HANDLE_VALUE;
129 }