Get rid of the registry lookups, rely entirely on the kernel devices
[wine.git] / dlls / user / misc.c
blob9c36273335c6fd94c82d78fc614792351fd8c585
1 /*
2 * Misc USER functions
4 * Copyright 1995 Thomas Sandford
5 * Copyright 1997 Marcus Meissner
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "winerror.h"
29 #include "winnls.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(win);
35 /* callback to allow EnumDesktopsA to use EnumDesktopsW */
36 typedef struct {
37 DESKTOPENUMPROCA lpEnumFunc;
38 LPARAM lParam;
39 } ENUMDESKTOPS_LPARAM;
41 /* EnumDesktopsA passes this callback function to EnumDesktopsW.
42 * It simply converts the string to ASCII and calls the callback
43 * function provided by the original caller
45 static BOOL CALLBACK EnumDesktopProcWtoA(LPWSTR lpszDesktop, LPARAM lParam)
47 LPSTR buffer;
48 INT len;
49 BOOL ret;
50 ENUMDESKTOPS_LPARAM *data = (ENUMDESKTOPS_LPARAM *)lParam;
52 len = WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, NULL, 0, NULL, NULL);
53 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len))) return FALSE;
54 WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, buffer, len, NULL, NULL);
56 ret = data->lpEnumFunc(buffer, data->lParam);
58 HeapFree(GetProcessHeap(), 0, buffer);
59 return ret;
62 /**********************************************************************
63 * SetLastErrorEx [USER32.@] Sets the last-error code.
65 * RETURNS
66 * None.
68 void WINAPI SetLastErrorEx(
69 DWORD error, /* [in] Per-thread error code */
70 DWORD type) /* [in] Error type */
72 TRACE("(0x%08lx, 0x%08lx)\n", error,type);
73 switch(type) {
74 case 0:
75 break;
76 case SLE_ERROR:
77 case SLE_MINORERROR:
78 case SLE_WARNING:
79 /* Fall through for now */
80 default:
81 FIXME("(error=%08lx, type=%08lx): Unhandled type\n", error,type);
82 break;
84 SetLastError( error );
88 /******************************************************************************
89 * GetProcessWindowStation [USER32.@] Returns handle of window station
91 * NOTES
92 * Docs say the return value is HWINSTA
94 * RETURNS
95 * Success: Handle to window station associated with calling process
96 * Failure: NULL
98 HWINSTA WINAPI GetProcessWindowStation(void)
100 FIXME("(void): stub\n");
101 return (HWINSTA)1;
105 /******************************************************************************
106 * GetThreadDesktop [USER32.@] Returns handle to desktop
108 * NOTES
109 * Docs say the return value is HDESK
111 * PARAMS
112 * dwThreadId [I] Thread identifier
114 * RETURNS
115 * Success: Handle to desktop associated with specified thread
116 * Failure: NULL
118 DWORD WINAPI GetThreadDesktop( DWORD dwThreadId )
120 FIXME("(%lx): stub\n",dwThreadId);
121 return 1;
125 /******************************************************************************
126 * SetDebugErrorLevel [USER32.@]
127 * Sets the minimum error level for generating debugging events
129 * PARAMS
130 * dwLevel [I] Debugging error level
132 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
134 FIXME("(%ld): stub\n", dwLevel);
138 /******************************************************************************
139 * GetProcessDefaultLayout [USER32.@]
141 * Gets the default layout for parentless windows.
142 * Right now, just returns 0 (left-to-right).
144 * RETURNS
145 * Success: Nonzero
146 * Failure: Zero
148 * BUGS
149 * No RTL
151 BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
153 if ( !pdwDefaultLayout ) {
154 SetLastError( ERROR_INVALID_PARAMETER );
155 return FALSE;
157 FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
158 *pdwDefaultLayout = 0;
159 return TRUE;
163 /******************************************************************************
164 * SetProcessDefaultLayout [USER32.@]
166 * Sets the default layout for parentless windows.
167 * Right now, only accepts 0 (left-to-right).
169 * RETURNS
170 * Success: Nonzero
171 * Failure: Zero
173 * BUGS
174 * No RTL
176 BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
178 if ( dwDefaultLayout == 0 )
179 return TRUE;
180 FIXME( "( %08lx ): No BiDi\n", dwDefaultLayout );
181 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
182 return FALSE;
186 /******************************************************************************
187 * OpenDesktopA [USER32.@]
189 * NOTES
190 * Return type should be HDESK
192 * Not supported on Win9x - returns NULL and calls SetLastError.
194 HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
195 BOOL fInherit, DWORD dwDesiredAccess )
197 FIXME("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
198 fInherit,dwDesiredAccess);
200 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
201 return 0;
204 /******************************************************************************
205 * EnumDesktopsA [USER32.@]
207 BOOL WINAPI EnumDesktopsA( HWINSTA hwinsta, DESKTOPENUMPROCA lpEnumFunc,
208 LPARAM lParam )
210 ENUMDESKTOPS_LPARAM caller_data;
212 caller_data.lpEnumFunc = lpEnumFunc;
213 caller_data.lParam = lParam;
215 return EnumDesktopsW(hwinsta, EnumDesktopProcWtoA, (LPARAM) &caller_data);
218 /******************************************************************************
219 * EnumDesktopsW [USER32.@]
221 BOOL WINAPI EnumDesktopsW( HWINSTA hwinsta, DESKTOPENUMPROCW lpEnumFunc,
222 LPARAM lParam )
224 FIXME("%p,%p,%lx): stub\n",hwinsta,lpEnumFunc,lParam);
225 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
226 return FALSE;
229 /******************************************************************************
230 * SetUserObjectInformationA (USER32.@)
232 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, INT nIndex,
233 LPVOID pvInfo, DWORD nLength )
235 FIXME("(%p,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
236 return TRUE;
239 /******************************************************************************
240 * SetThreadDesktop (USER32.@)
242 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
244 FIXME("(%p): stub\n",hDesktop);
245 return TRUE;
249 /***********************************************************************
250 * RegisterShellHookWindow [USER32.@]
252 BOOL WINAPI RegisterShellHookWindow ( HWND hWnd )
254 FIXME("(%p): stub\n", hWnd);
255 return 0;
259 /***********************************************************************
260 * DeregisterShellHookWindow [USER32.@]
262 HRESULT WINAPI DeregisterShellHookWindow ( DWORD u )
264 FIXME("0x%08lx stub\n",u);
265 return 0;
270 /***********************************************************************
271 * RegisterTasklist [USER32.@]
273 DWORD WINAPI RegisterTasklist (DWORD x)
275 FIXME("0x%08lx\n",x);
276 return TRUE;
280 /***********************************************************************
281 * GetAppCompatFlags (USER32.@)
283 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
285 FIXME("stub\n");
286 return 0;
290 /***********************************************************************
291 * AlignRects (USER32.@)
293 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
295 FIXME("(%p, %ld, %ld, %ld): stub\n", rect, b, c, d);
296 if (rect)
297 FIXME("rect: [[%ld, %ld], [%ld, %ld]]\n", rect->left, rect->top, rect->right, rect->bottom);
298 /* Calls OffsetRect */
299 return FALSE;
303 /***********************************************************************
304 * USER_489 (USER.489)
306 LONG WINAPI stub_USER_489(void) { FIXME("stub\n"); return 0; }
308 /***********************************************************************
309 * USER_490 (USER.490)
311 LONG WINAPI stub_USER_490(void) { FIXME("stub\n"); return 0; }
313 /***********************************************************************
314 * USER_492 (USER.492)
316 LONG WINAPI stub_USER_492(void) { FIXME("stub\n"); return 0; }
318 /***********************************************************************
319 * USER_496 (USER.496)
321 LONG WINAPI stub_USER_496(void) { FIXME("stub\n"); return 0; }