Add dumping of window styles at the window creation time.
[wine/hacks.git] / scheduler / handle.c
blobea42da5e238a832a9b06de9f6c27ca27589ac4a2
1 /*
2 * Win32 process handles
4 * Copyright 1998 Alexandre Julliard
5 */
7 #include <assert.h>
8 #include <stdio.h>
9 #include <unistd.h>
10 #include "winbase.h"
11 #include "wine/server.h"
12 #include "winerror.h"
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(win32);
17 /*********************************************************************
18 * CloseW32Handle (KERNEL.474)
19 * CloseHandle (KERNEL32.@)
21 BOOL WINAPI CloseHandle( HANDLE handle )
23 NTSTATUS status;
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) );
33 return !status;
37 /*********************************************************************
38 * GetHandleInformation (KERNEL32.@)
40 BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
42 BOOL ret;
43 SERVER_START_REQ( set_handle_info )
45 req->handle = handle;
46 req->flags = 0;
47 req->mask = 0;
48 req->fd = -1;
49 ret = !SERVER_CALL_ERR();
50 if (ret && flags) *flags = req->old_flags;
52 SERVER_END_REQ;
53 return ret;
57 /*********************************************************************
58 * SetHandleInformation (KERNEL32.@)
60 BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
62 BOOL ret;
63 SERVER_START_REQ( set_handle_info )
65 req->handle = handle;
66 req->flags = flags;
67 req->mask = mask;
68 req->fd = -1;
69 ret = !SERVER_CALL_ERR();
71 SERVER_END_REQ;
72 return ret;
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 )
83 BOOL ret;
84 SERVER_START_REQ( dup_handle )
86 req->src_process = source_process;
87 req->src_handle = source;
88 req->dst_process = dest_process;
89 req->access = access;
90 req->inherit = inherit;
91 req->options = options;
93 ret = !SERVER_CALL_ERR();
94 if (ret)
96 if (dest) *dest = req->handle;
97 if (req->fd != -1) close( req->fd );
100 SERVER_END_REQ;
101 return ret;
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 );
114 return ret;
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);
123 return FALSE;
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);
132 return 0;
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;