Define and use endian conversion macros for big-endian machines.
[wine.git] / dlls / user / misc.c
blob9363c58622cc29d48a62252346c6192d4f6efe85
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 "winuser.h"
27 #include "winnls.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(win);
33 /* callback to allow EnumDesktopsA to use EnumDesktopsW */
34 typedef struct {
35 DESKTOPENUMPROCA lpEnumFunc;
36 LPARAM lParam;
37 } ENUMDESKTOPS_LPARAM;
39 /* EnumDesktopsA passes this callback function to EnumDesktopsW.
40 * It simply converts the string to ASCII and calls the callback
41 * function provided by the original caller
43 static BOOL CALLBACK EnumDesktopProcWtoA(LPWSTR lpszDesktop, LPARAM lParam)
45 LPSTR buffer;
46 INT len;
47 BOOL ret;
48 ENUMDESKTOPS_LPARAM *data = (ENUMDESKTOPS_LPARAM *)lParam;
50 len = WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, NULL, 0, NULL, NULL);
51 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len))) return FALSE;
52 WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, buffer, len, NULL, NULL);
54 ret = data->lpEnumFunc(buffer, data->lParam);
56 HeapFree(GetProcessHeap(), 0, buffer);
57 return ret;
60 /**********************************************************************
61 * SetLastErrorEx [USER32.@]
63 * 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 );
87 /******************************************************************************
88 * GetAltTabInfoA [USER32.@]
90 BOOL WINAPI GetAltTabInfoA(HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
92 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
93 return FALSE;
96 /******************************************************************************
97 * GetAltTabInfoW [USER32.@]
99 BOOL WINAPI GetAltTabInfoW(HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
101 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
102 return FALSE;
105 /******************************************************************************
106 * GetProcessWindowStation [USER32.@]
108 * Returns handle of window station
110 * NOTES
111 * Docs say the return value is HWINSTA
113 * RETURNS
114 * Success: Handle to window station associated with calling process
115 * Failure: NULL
117 HWINSTA WINAPI GetProcessWindowStation(void)
119 FIXME("(void): stub\n");
120 return (HWINSTA)1;
124 /******************************************************************************
125 * GetThreadDesktop [USER32.@]
127 * Returns handle to desktop
129 * PARAMS
130 * dwThreadId [I] Thread identifier
132 * RETURNS
133 * Success: Handle to desktop associated with specified thread
134 * Failure: NULL
136 HDESK WINAPI GetThreadDesktop( DWORD dwThreadId )
138 FIXME("(%lx): stub\n",dwThreadId);
139 return (HDESK)1;
143 /******************************************************************************
144 * SetDebugErrorLevel [USER32.@]
145 * Sets the minimum error level for generating debugging events
147 * PARAMS
148 * dwLevel [I] Debugging error level
150 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
152 FIXME("(%ld): stub\n", dwLevel);
156 /******************************************************************************
157 * GetProcessDefaultLayout [USER32.@]
159 * Gets the default layout for parentless windows.
160 * Right now, just returns 0 (left-to-right).
162 * RETURNS
163 * Success: Nonzero
164 * Failure: Zero
166 * BUGS
167 * No RTL
169 BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
171 if ( !pdwDefaultLayout ) {
172 SetLastError( ERROR_INVALID_PARAMETER );
173 return FALSE;
175 FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
176 *pdwDefaultLayout = 0;
177 return TRUE;
181 /******************************************************************************
182 * SetProcessDefaultLayout [USER32.@]
184 * Sets the default layout for parentless windows.
185 * Right now, only accepts 0 (left-to-right).
187 * RETURNS
188 * Success: Nonzero
189 * Failure: Zero
191 * BUGS
192 * No RTL
194 BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
196 if ( dwDefaultLayout == 0 )
197 return TRUE;
198 FIXME( "( %08lx ): No BiDi\n", dwDefaultLayout );
199 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
200 return FALSE;
204 /******************************************************************************
205 * OpenDesktopA [USER32.@]
207 * Not supported on Win9x - returns NULL and calls SetLastError.
209 HDESK WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
210 BOOL fInherit, DWORD dwDesiredAccess )
212 FIXME("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
213 fInherit,dwDesiredAccess);
215 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
216 return 0;
219 /******************************************************************************
220 * OpenInputDesktop [USER32.@]
222 * Not supported on Win9x - returns NULL and calls SetLastError.
224 HDESK WINAPI OpenInputDesktop( DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess )
226 FIXME("(%lx,%i,%lx): stub\n",dwFlags, fInherit,dwDesiredAccess);
227 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
228 return 0;
231 /******************************************************************************
232 * EnumDesktopsA [USER32.@]
234 BOOL WINAPI EnumDesktopsA( HWINSTA hwinsta, DESKTOPENUMPROCA lpEnumFunc,
235 LPARAM lParam )
237 ENUMDESKTOPS_LPARAM caller_data;
239 caller_data.lpEnumFunc = lpEnumFunc;
240 caller_data.lParam = lParam;
242 return EnumDesktopsW(hwinsta, EnumDesktopProcWtoA, (LPARAM) &caller_data);
245 /******************************************************************************
246 * EnumDesktopsW [USER32.@]
248 BOOL WINAPI EnumDesktopsW( HWINSTA hwinsta, DESKTOPENUMPROCW lpEnumFunc,
249 LPARAM lParam )
251 FIXME("%p,%p,%lx): stub\n",hwinsta,lpEnumFunc,lParam);
252 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
253 return FALSE;
256 /******************************************************************************
257 * EnumWindowStationsA [USER32.@]
259 BOOL WINAPI EnumWindowStationsA( WINSTAENUMPROCA lpEnumFunc, LPARAM lParam)
261 FIXME("%p,%lx): stub\n",lpEnumFunc,lParam);
262 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
263 return FALSE;
266 /******************************************************************************
267 * EnumWindowStationsW [USER32.@]
269 BOOL WINAPI EnumWindowStationsW( WINSTAENUMPROCW lpEnumFunc, LPARAM lParam)
271 FIXME("%p,%lx): stub\n",lpEnumFunc,lParam);
272 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
273 return FALSE;
276 /******************************************************************************
277 * SetUserObjectInformationA (USER32.@)
279 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, INT nIndex,
280 LPVOID pvInfo, DWORD nLength )
282 FIXME("(%p,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
283 return TRUE;
286 /******************************************************************************
287 * SetThreadDesktop (USER32.@)
289 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
291 FIXME("(%p): stub\n",hDesktop);
292 return TRUE;
296 /***********************************************************************
297 * RegisterShellHookWindow [USER32.@]
299 BOOL WINAPI RegisterShellHookWindow ( HWND hWnd )
301 FIXME("(%p): stub\n", hWnd);
302 return 0;
306 /***********************************************************************
307 * DeregisterShellHookWindow [USER32.@]
309 HRESULT WINAPI DeregisterShellHookWindow ( DWORD u )
311 FIXME("0x%08lx stub\n",u);
312 return 0;
317 /***********************************************************************
318 * RegisterTasklist [USER32.@]
320 DWORD WINAPI RegisterTasklist (DWORD x)
322 FIXME("0x%08lx\n",x);
323 return TRUE;
327 /***********************************************************************
328 * GetAppCompatFlags (USER32.@)
330 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
332 FIXME("stub\n");
333 return 0;
337 /***********************************************************************
338 * AlignRects (USER32.@)
340 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
342 FIXME("(%p, %ld, %ld, %ld): stub\n", rect, b, c, d);
343 if (rect)
344 FIXME("rect: [[%ld, %ld], [%ld, %ld]]\n", rect->left, rect->top, rect->right, rect->bottom);
345 /* Calls OffsetRect */
346 return FALSE;
350 /***********************************************************************
351 * USER_489 (USER.489)
353 LONG WINAPI stub_USER_489(void) { FIXME("stub\n"); return 0; }
355 /***********************************************************************
356 * USER_490 (USER.490)
358 LONG WINAPI stub_USER_490(void) { FIXME("stub\n"); return 0; }
360 /***********************************************************************
361 * USER_492 (USER.492)
363 LONG WINAPI stub_USER_492(void) { FIXME("stub\n"); return 0; }
365 /***********************************************************************
366 * USER_496 (USER.496)
368 LONG WINAPI stub_USER_496(void) { FIXME("stub\n"); return 0; }
370 /***********************************************************************
371 * User32InitializeImmEntryTable
373 BOOL WINAPI User32InitializeImmEntryTable(LPVOID ptr)
375 FIXME("(%p): stub\n", ptr);
376 return TRUE;
379 /**********************************************************************
380 * WINNLSGetIMEHotkey [USER32.@]
383 UINT WINAPI WINNLSGetIMEHotkey(HWND hUnknown1)
385 FIXME("hUnknown1 %p: stub!\n", hUnknown1);
386 return 0; /* unknown */
389 /**********************************************************************
390 * WINNLSEnableIME [USER32.@]
393 BOOL WINAPI WINNLSEnableIME(HWND hUnknown1, BOOL bUnknown2)
395 FIXME("hUnknown1 %p bUnknown2 %d: stub!\n", hUnknown1, bUnknown2);
396 return TRUE; /* success (?) */
399 /**********************************************************************
400 * WINNLSGetEnableStatus [USER32.@]
403 BOOL WINAPI WINNLSGetEnableStatus(HWND hUnknown1)
405 FIXME("hUnknown1 %p: stub!\n", hUnknown1);
406 return TRUE; /* success (?) */
409 /**********************************************************************
410 * SendIMEMessageExA [USER32.@]
413 LRESULT WINAPI SendIMEMessageExA(HWND p1, LPARAM p2)
415 FIXME("(%p,%lx): stub\n", p1, p2);
416 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
417 return 0;
420 /**********************************************************************
421 * SendIMEMessageExW [USER32.@]
424 LRESULT WINAPI SendIMEMessageExW(HWND p1, LPARAM p2)
426 FIXME("(%p,%lx): stub\n", p1, p2);
427 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
428 return 0;