Implement Hash function on composite moniker.
[wine/multimedia.git] / dlls / user / misc.c
blobdbdfb83dd9a447a3b2e9710a94bc38f4b78c5e61
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 "winnls.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(win);
34 /* callback to allow EnumDesktopsA to use EnumDesktopsW */
35 typedef struct {
36 DESKTOPENUMPROCA lpEnumFunc;
37 LPARAM lParam;
38 } ENUMDESKTOPS_LPARAM;
40 /* EnumDesktopsA passes this callback function to EnumDesktopsW.
41 * It simply converts the string to ASCII and calls the callback
42 * function provided by the original caller
44 static BOOL CALLBACK EnumDesktopProcWtoA(LPWSTR lpszDesktop, LPARAM lParam)
46 LPSTR buffer;
47 INT len;
48 BOOL ret;
49 ENUMDESKTOPS_LPARAM *data = (ENUMDESKTOPS_LPARAM *)lParam;
51 len = WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, NULL, 0, NULL, NULL);
52 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len))) return FALSE;
53 WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, buffer, len, NULL, NULL);
55 ret = data->lpEnumFunc(buffer, data->lParam);
57 HeapFree(GetProcessHeap(), 0, buffer);
58 return ret;
61 /**********************************************************************
62 * SetLastErrorEx [USER32.@]
64 * Sets the last-error code.
66 * RETURNS
67 * None.
69 void WINAPI SetLastErrorEx(
70 DWORD error, /* [in] Per-thread error code */
71 DWORD type) /* [in] Error type */
73 TRACE("(0x%08lx, 0x%08lx)\n", error,type);
74 switch(type) {
75 case 0:
76 break;
77 case SLE_ERROR:
78 case SLE_MINORERROR:
79 case SLE_WARNING:
80 /* Fall through for now */
81 default:
82 FIXME("(error=%08lx, type=%08lx): Unhandled type\n", error,type);
83 break;
85 SetLastError( error );
88 /******************************************************************************
89 * GetAltTabInfoA [USER32.@]
91 BOOL WINAPI GetAltTabInfoA(HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
93 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
94 return FALSE;
97 /******************************************************************************
98 * GetAltTabInfoW [USER32.@]
100 BOOL WINAPI GetAltTabInfoW(HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
102 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
103 return FALSE;
106 /******************************************************************************
107 * GetProcessWindowStation [USER32.@]
109 * Returns handle of window station
111 * NOTES
112 * Docs say the return value is HWINSTA
114 * RETURNS
115 * Success: Handle to window station associated with calling process
116 * Failure: NULL
118 HWINSTA WINAPI GetProcessWindowStation(void)
120 FIXME("(void): stub\n");
121 return (HWINSTA)1;
125 /******************************************************************************
126 * GetThreadDesktop [USER32.@]
128 * Returns handle to desktop
130 * PARAMS
131 * dwThreadId [I] Thread identifier
133 * RETURNS
134 * Success: Handle to desktop associated with specified thread
135 * Failure: NULL
137 HDESK WINAPI GetThreadDesktop( DWORD dwThreadId )
139 FIXME("(%lx): stub\n",dwThreadId);
140 return (HDESK)1;
144 /******************************************************************************
145 * SetDebugErrorLevel [USER32.@]
146 * Sets the minimum error level for generating debugging events
148 * PARAMS
149 * dwLevel [I] Debugging error level
151 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
153 FIXME("(%ld): stub\n", dwLevel);
157 /******************************************************************************
158 * GetProcessDefaultLayout [USER32.@]
160 * Gets the default layout for parentless windows.
161 * Right now, just returns 0 (left-to-right).
163 * RETURNS
164 * Success: Nonzero
165 * Failure: Zero
167 * BUGS
168 * No RTL
170 BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
172 if ( !pdwDefaultLayout ) {
173 SetLastError( ERROR_INVALID_PARAMETER );
174 return FALSE;
176 FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
177 *pdwDefaultLayout = 0;
178 return TRUE;
182 /******************************************************************************
183 * SetProcessDefaultLayout [USER32.@]
185 * Sets the default layout for parentless windows.
186 * Right now, only accepts 0 (left-to-right).
188 * RETURNS
189 * Success: Nonzero
190 * Failure: Zero
192 * BUGS
193 * No RTL
195 BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
197 if ( dwDefaultLayout == 0 )
198 return TRUE;
199 FIXME( "( %08lx ): No BiDi\n", dwDefaultLayout );
200 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
201 return FALSE;
205 /***********************************************************************
206 * CreateDesktopA (USER32.@)
208 HDESK WINAPI CreateDesktopA( LPSTR lpszDesktop,LPSTR lpszDevice,LPDEVMODEA pDevmode,
209 DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa )
211 FIXME("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n", lpszDesktop,lpszDevice,pDevmode,
212 dwFlags,dwDesiredAccess,lpsa );
213 return (HDESK)0xcafedead;
216 /***********************************************************************
217 * CreateDesktopW (USER32.@)
219 HDESK WINAPI CreateDesktopW( LPWSTR lpszDesktop,LPWSTR lpszDevice,LPDEVMODEW pDevmode,
220 DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa)
222 FIXME("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n",
223 debugstr_w(lpszDesktop),debugstr_w(lpszDevice),pDevmode,
224 dwFlags,dwDesiredAccess,lpsa );
225 return (HDESK)0xcafedead;
228 /******************************************************************************
229 * OpenDesktopA [USER32.@]
231 * Not supported on Win9x - returns NULL and calls SetLastError.
233 HDESK WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
234 BOOL fInherit, DWORD dwDesiredAccess )
236 FIXME("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
237 fInherit,dwDesiredAccess);
239 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
240 return 0;
243 /******************************************************************************
244 * OpenInputDesktop [USER32.@]
246 * Not supported on Win9x - returns NULL and calls SetLastError.
248 HDESK WINAPI OpenInputDesktop( DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess )
250 FIXME("(%lx,%i,%lx): stub\n",dwFlags, fInherit,dwDesiredAccess);
251 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
252 return 0;
255 /***********************************************************************
256 * CloseDesktop (USER32.@)
258 BOOL WINAPI CloseDesktop(HDESK hDesk)
260 FIXME("(%p)\n", hDesk);
261 return TRUE;
264 /******************************************************************************
265 * EnumDesktopsA [USER32.@]
267 BOOL WINAPI EnumDesktopsA( HWINSTA hwinsta, DESKTOPENUMPROCA lpEnumFunc,
268 LPARAM lParam )
270 ENUMDESKTOPS_LPARAM caller_data;
272 caller_data.lpEnumFunc = lpEnumFunc;
273 caller_data.lParam = lParam;
275 return EnumDesktopsW(hwinsta, EnumDesktopProcWtoA, (LPARAM) &caller_data);
278 /******************************************************************************
279 * EnumDesktopsW [USER32.@]
281 BOOL WINAPI EnumDesktopsW( HWINSTA hwinsta, DESKTOPENUMPROCW lpEnumFunc,
282 LPARAM lParam )
284 FIXME("%p,%p,%lx): stub\n",hwinsta,lpEnumFunc,lParam);
285 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
286 return FALSE;
289 /***********************************************************************
290 * EnumDesktopWindows (USER32.@)
292 BOOL WINAPI EnumDesktopWindows( HDESK hDesktop, WNDENUMPROC lpfn, LPARAM lParam )
294 FIXME("(%p, %p, 0x%08lx), stub!\n", hDesktop, lpfn, lParam );
295 return TRUE;
298 /***********************************************************************
299 * CreateWindowStationW (USER32.@)
301 HWINSTA WINAPI CreateWindowStationW( LPWSTR winstation,DWORD res1,DWORD desiredaccess,
302 LPSECURITY_ATTRIBUTES lpsa )
304 FIXME("(%s,0x%08lx,0x%08lx,%p),stub!\n",debugstr_w(winstation), res1,desiredaccess,lpsa );
305 return (HWINSTA)0xdeadcafe;
308 /***********************************************************************
309 * CloseWindowStation (USER32.@)
311 BOOL WINAPI CloseWindowStation(HWINSTA hWinSta)
313 FIXME("(%p)\n", hWinSta);
314 return TRUE;
317 /***********************************************************************
318 * SetWindowStationUser (USER32.@)
320 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2)
322 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
323 return 1;
326 /***********************************************************************
327 * SetProcessWindowStation (USER32.@)
329 BOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta)
331 FIXME("(%p),stub!\n",hWinSta);
332 return TRUE;
335 /******************************************************************************
336 * EnumWindowStationsA [USER32.@]
338 BOOL WINAPI EnumWindowStationsA( WINSTAENUMPROCA lpEnumFunc, LPARAM lParam)
340 FIXME("%p,%lx): stub\n",lpEnumFunc,lParam);
341 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
342 return FALSE;
345 /******************************************************************************
346 * EnumWindowStationsW [USER32.@]
348 BOOL WINAPI EnumWindowStationsW( WINSTAENUMPROCW lpEnumFunc, LPARAM lParam)
350 FIXME("%p,%lx): stub\n",lpEnumFunc,lParam);
351 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
352 return FALSE;
355 /***********************************************************************
356 * GetUserObjectInformationA (USER32.@)
358 BOOL WINAPI GetUserObjectInformationA( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
360 FIXME("(%p %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
361 return TRUE;
364 /***********************************************************************
365 * GetUserObjectInformationW (USER32.@)
367 BOOL WINAPI GetUserObjectInformationW( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
369 FIXME("(%p %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
370 return TRUE;
373 /******************************************************************************
374 * SetUserObjectInformationA (USER32.@)
376 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, INT nIndex,
377 LPVOID pvInfo, DWORD nLength )
379 FIXME("(%p,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
380 return TRUE;
383 /***********************************************************************
384 * GetUserObjectSecurity (USER32.@)
386 BOOL WINAPI GetUserObjectSecurity(HANDLE hObj, PSECURITY_INFORMATION pSIRequested,
387 PSECURITY_DESCRIPTOR pSID, DWORD nLength, LPDWORD lpnLengthNeeded)
389 FIXME("(%p %p %p len=%ld %p),stub!\n", hObj, pSIRequested, pSID, nLength, lpnLengthNeeded);
390 return TRUE;
393 /***********************************************************************
394 * SetUserObjectSecurity (USER32.@)
396 BOOL WINAPI SetUserObjectSecurity( HANDLE hObj, PSECURITY_INFORMATION pSIRequested,
397 PSECURITY_DESCRIPTOR pSID )
399 FIXME("(%p,%p,%p),stub!\n",hObj,pSIRequested,pSID);
400 return TRUE;
403 /******************************************************************************
404 * SetThreadDesktop (USER32.@)
406 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
408 FIXME("(%p): stub\n",hDesktop);
409 return TRUE;
412 /***********************************************************************
413 * RegisterLogonProcess (USER32.@)
415 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x)
417 FIXME("(%p,%d),stub!\n",hprocess,x);
418 return 1;
421 /***********************************************************************
422 * SetLogonNotifyWindow (USER32.@)
424 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
426 FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
427 return 1;
430 /***********************************************************************
431 * RegisterSystemThread (USER32.@)
433 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
435 FIXME("(%08lx, %08lx)\n", flags, reserved);
438 /***********************************************************************
439 * RegisterShellHookWindow [USER32.@]
441 BOOL WINAPI RegisterShellHookWindow ( HWND hWnd )
443 FIXME("(%p): stub\n", hWnd);
444 return 0;
448 /***********************************************************************
449 * DeregisterShellHookWindow [USER32.@]
451 HRESULT WINAPI DeregisterShellHookWindow ( DWORD u )
453 FIXME("0x%08lx stub\n",u);
454 return 0;
459 /***********************************************************************
460 * RegisterTasklist [USER32.@]
462 DWORD WINAPI RegisterTasklist (DWORD x)
464 FIXME("0x%08lx\n",x);
465 return TRUE;
469 /***********************************************************************
470 * RegisterDeviceNotificationA (USER32.@)
472 * See RegisterDeviceNotificationW.
474 HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hnd, LPVOID notifyfilter, DWORD flags)
476 FIXME("(hwnd=%p, filter=%p,flags=0x%08lx), STUB!\n", hnd,notifyfilter,flags );
477 return 0;
480 /***********************************************************************
481 * RegisterDeviceNotificationW (USER32.@)
483 * Registers a window with the system so that it will receive
484 * notifications about a device.
486 * PARAMS
487 * hRecepient [I] Window or service status handle that
488 * will receive notifications.
489 * pNotificationFilter [I] DEV_BROADCAST_HDR followed by some
490 * type-specific data.
491 * dwFlags [I] See notes
493 * RETURNS
495 * A handle to the device notification.
497 * NOTES
499 * The dwFlags parameter can be one of two values:
500 *| DEVICE_NOTIFY_WINDOW_HANDLE - hRecepient is a window handle
501 *| DEVICE_NOTIFY_SERVICE_HANDLE - hRecepient is a service status handle
503 HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecepient, LPVOID pNotificationFilter, DWORD dwFlags)
505 FIXME("(hwnd=%p, filter=%p,flags=0x%08lx), STUB!\n", hRecepient,pNotificationFilter,dwFlags );
506 return 0;
509 /***********************************************************************
510 * GetAppCompatFlags (USER32.@)
512 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
514 FIXME("stub\n");
515 return 0;
519 /***********************************************************************
520 * AlignRects (USER32.@)
522 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
524 FIXME("(%p, %ld, %ld, %ld): stub\n", rect, b, c, d);
525 if (rect)
526 FIXME("rect: [[%ld, %ld], [%ld, %ld]]\n", rect->left, rect->top, rect->right, rect->bottom);
527 /* Calls OffsetRect */
528 return FALSE;
532 /***********************************************************************
533 * LoadLocalFonts (USER32.@)
535 VOID WINAPI LoadLocalFonts(VOID)
537 /* are loaded. */
538 return;
542 /***********************************************************************
543 * USER_489 (USER.489)
545 LONG WINAPI stub_USER_489(void) { FIXME("stub\n"); return 0; }
547 /***********************************************************************
548 * USER_490 (USER.490)
550 LONG WINAPI stub_USER_490(void) { FIXME("stub\n"); return 0; }
552 /***********************************************************************
553 * USER_492 (USER.492)
555 LONG WINAPI stub_USER_492(void) { FIXME("stub\n"); return 0; }
557 /***********************************************************************
558 * USER_496 (USER.496)
560 LONG WINAPI stub_USER_496(void) { FIXME("stub\n"); return 0; }
562 /***********************************************************************
563 * User32InitializeImmEntryTable
565 BOOL WINAPI User32InitializeImmEntryTable(LPVOID ptr)
567 FIXME("(%p): stub\n", ptr);
568 return TRUE;
571 /**********************************************************************
572 * WINNLSGetIMEHotkey [USER32.@]
575 UINT WINAPI WINNLSGetIMEHotkey(HWND hUnknown1)
577 FIXME("hUnknown1 %p: stub!\n", hUnknown1);
578 return 0; /* unknown */
581 /**********************************************************************
582 * WINNLSEnableIME [USER32.@]
585 BOOL WINAPI WINNLSEnableIME(HWND hUnknown1, BOOL bUnknown2)
587 FIXME("hUnknown1 %p bUnknown2 %d: stub!\n", hUnknown1, bUnknown2);
588 return TRUE; /* success (?) */
591 /**********************************************************************
592 * WINNLSGetEnableStatus [USER32.@]
595 BOOL WINAPI WINNLSGetEnableStatus(HWND hUnknown1)
597 FIXME("hUnknown1 %p: stub!\n", hUnknown1);
598 return TRUE; /* success (?) */
601 /**********************************************************************
602 * SendIMEMessageExA [USER32.@]
605 LRESULT WINAPI SendIMEMessageExA(HWND p1, LPARAM p2)
607 FIXME("(%p,%lx): stub\n", p1, p2);
608 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
609 return 0;
612 /**********************************************************************
613 * SendIMEMessageExW [USER32.@]
616 LRESULT WINAPI SendIMEMessageExW(HWND p1, LPARAM p2)
618 FIXME("(%p,%lx): stub\n", p1, p2);
619 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
620 return 0;