Ignore window caption from PROPSHEETHEADER in wizards. Update window
[wine.git] / scheduler / handle.c
bloba5bc9e5e015d18833da35f1298d786155b96db35
1 /*
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
21 #include "config.h"
23 #include <assert.h>
24 #include <stdarg.h>
25 #include <stdio.h>
26 #ifdef HAVE_IO_H
27 # include <io.h>
28 #endif
29 #ifdef HAVE_UNISTD_H
30 # include <unistd.h>
31 #endif
32 #include "windef.h"
33 #include "winbase.h"
34 #include "wine/server.h"
35 #include "winerror.h"
36 #include "wine/debug.h"
37 #include "../kernel/kernel_private.h" /* FIXME: to be changed when moving file to dlls/kernel */
39 WINE_DEFAULT_DEBUG_CHANNEL(win32);
41 /*********************************************************************
42 * CloseW32Handle (KERNEL.474)
43 * CloseHandle (KERNEL32.@)
45 BOOL WINAPI CloseHandle( HANDLE handle )
47 NTSTATUS status;
49 /* stdio handles need special treatment */
50 if ((handle == (HANDLE)STD_INPUT_HANDLE) ||
51 (handle == (HANDLE)STD_OUTPUT_HANDLE) ||
52 (handle == (HANDLE)STD_ERROR_HANDLE))
53 handle = GetStdHandle( (DWORD)handle );
55 if (is_console_handle(handle))
56 return CloseConsoleHandle(handle);
58 status = NtClose( handle );
59 if (status) SetLastError( RtlNtStatusToDosError(status) );
60 return !status;
64 /*********************************************************************
65 * GetHandleInformation (KERNEL32.@)
67 BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
69 BOOL ret;
70 SERVER_START_REQ( set_handle_info )
72 req->handle = handle;
73 req->flags = 0;
74 req->mask = 0;
75 req->fd = -1;
76 ret = !wine_server_call_err( req );
77 if (ret && flags) *flags = reply->old_flags;
79 SERVER_END_REQ;
80 return ret;
84 /*********************************************************************
85 * SetHandleInformation (KERNEL32.@)
87 BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
89 BOOL ret;
90 SERVER_START_REQ( set_handle_info )
92 req->handle = handle;
93 req->flags = flags;
94 req->mask = mask;
95 req->fd = -1;
96 ret = !wine_server_call_err( req );
98 SERVER_END_REQ;
99 return ret;
103 /*********************************************************************
104 * DuplicateHandle (KERNEL32.@)
106 BOOL WINAPI DuplicateHandle( HANDLE source_process, HANDLE source,
107 HANDLE dest_process, HANDLE *dest,
108 DWORD access, BOOL inherit, DWORD options )
110 NTSTATUS status;
112 if (is_console_handle(source))
114 /* FIXME: this test is not sufficient, we need to test process ids, not handles */
115 if (source_process != dest_process ||
116 source_process != GetCurrentProcess())
118 SetLastError(ERROR_INVALID_PARAMETER);
119 return FALSE;
121 *dest = DuplicateConsoleHandle( source, access, inherit, options );
122 return (*dest != INVALID_HANDLE_VALUE);
124 status = NtDuplicateObject( source_process, source, dest_process, dest,
125 access, inherit ? OBJ_INHERIT : 0, options );
126 if (status) SetLastError( RtlNtStatusToDosError(status) );
127 return !status;
131 /***********************************************************************
132 * ConvertToGlobalHandle (KERNEL.476)
133 * ConvertToGlobalHandle (KERNEL32.@)
135 HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
137 HANDLE ret = INVALID_HANDLE_VALUE;
138 DuplicateHandle( GetCurrentProcess(), hSrc, GetCurrentProcess(), &ret, 0, FALSE,
139 DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS | DUP_HANDLE_CLOSE_SOURCE );
140 return ret;
143 /***********************************************************************
144 * SetHandleContext (KERNEL32.@)
146 BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) {
147 FIXME("(%p,%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);
148 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
149 return FALSE;
152 /***********************************************************************
153 * GetHandleContext (KERNEL32.@)
155 DWORD WINAPI GetHandleContext(HANDLE hnd) {
156 FIXME("(%p), 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);
157 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
158 return 0;
161 /***********************************************************************
162 * CreateSocketHandle (KERNEL32.@)
164 HANDLE WINAPI CreateSocketHandle(void) {
165 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");
166 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
167 return INVALID_HANDLE_VALUE;