Assorted memleak fixes. Found on Michael Stefaniuc smatch list.
[wine.git] / windows / user.c
blobf758530b66237ac8f7993e184a33c3522fb6db03
1 /*
2 * Misc. USER functions
4 * Copyright 1993 Robert J. Amstadt
5 * 1996 Alex Korobka
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>
23 #include <stdlib.h>
24 #include <string.h>
25 #include "wine/winbase16.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "wine/winuser16.h"
31 #include "winreg.h"
32 #include "winternl.h"
33 #include "tlhelp32.h"
34 #include "user_private.h"
35 #include "win.h"
36 #include "controls.h"
37 #include "cursoricon.h"
38 #include "message.h"
39 #include "local.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(user);
44 static SYSLEVEL USER_SysLevel;
45 static CRITICAL_SECTION_DEBUG critsect_debug =
47 0, 0, &USER_SysLevel.crst,
48 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
49 0, 0, { 0, (DWORD)(__FILE__ ": USER_SysLevel") }
51 static SYSLEVEL USER_SysLevel = { { &critsect_debug, -1, 0, 0, 0, 0 }, 2 };
53 /* USER signal proc flags and codes */
54 /* See UserSignalProc for comments */
55 #define USIG_FLAGS_WIN32 0x0001
56 #define USIG_FLAGS_GUI 0x0002
57 #define USIG_FLAGS_FEEDBACK 0x0004
58 #define USIG_FLAGS_FAULT 0x0008
60 #define USIG_DLL_UNLOAD_WIN16 0x0001
61 #define USIG_DLL_UNLOAD_WIN32 0x0002
62 #define USIG_FAULT_DIALOG_PUSH 0x0003
63 #define USIG_FAULT_DIALOG_POP 0x0004
64 #define USIG_DLL_UNLOAD_ORPHANS 0x0005
65 #define USIG_THREAD_INIT 0x0010
66 #define USIG_THREAD_EXIT 0x0020
67 #define USIG_PROCESS_CREATE 0x0100
68 #define USIG_PROCESS_INIT 0x0200
69 #define USIG_PROCESS_EXIT 0x0300
70 #define USIG_PROCESS_DESTROY 0x0400
71 #define USIG_PROCESS_RUNNING 0x0500
72 #define USIG_PROCESS_LOADED 0x0600
74 /* UserSeeUserDo parameters */
75 #define USUD_LOCALALLOC 0x0001
76 #define USUD_LOCALFREE 0x0002
77 #define USUD_LOCALCOMPACT 0x0003
78 #define USUD_LOCALHEAP 0x0004
79 #define USUD_FIRSTCLASS 0x0005
81 /***********************************************************************
82 * GetFreeSystemResources (USER.284)
84 WORD WINAPI GetFreeSystemResources16( WORD resType )
86 HINSTANCE16 gdi_inst;
87 WORD gdi_heap;
88 int userPercent, gdiPercent;
90 if ((gdi_inst = LoadLibrary16( "GDI" )) < 32) return 0;
91 gdi_heap = gdi_inst | 7;
93 switch(resType)
95 case GFSR_USERRESOURCES:
96 userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
97 LOCAL_HeapSize( USER_HeapSel );
98 gdiPercent = 100;
99 break;
101 case GFSR_GDIRESOURCES:
102 gdiPercent = (int)LOCAL_CountFree( gdi_inst ) * 100 /
103 LOCAL_HeapSize( gdi_inst );
104 userPercent = 100;
105 break;
107 case GFSR_SYSTEMRESOURCES:
108 userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
109 LOCAL_HeapSize( USER_HeapSel );
110 gdiPercent = (int)LOCAL_CountFree( gdi_inst ) * 100 /
111 LOCAL_HeapSize( gdi_inst );
112 break;
114 default:
115 userPercent = gdiPercent = 0;
116 break;
118 FreeLibrary16( gdi_inst );
119 TRACE("<- userPercent %d, gdiPercent %d\n", userPercent, gdiPercent);
120 return (WORD)min( userPercent, gdiPercent );
124 /***********************************************************************
125 * USER_Lock
127 void USER_Lock(void)
129 _EnterSysLevel( &USER_SysLevel );
133 /***********************************************************************
134 * USER_Unlock
136 void USER_Unlock(void)
138 _LeaveSysLevel( &USER_SysLevel );
142 /***********************************************************************
143 * USER_CheckNotLock
145 * Make sure that we don't hold the user lock.
147 void USER_CheckNotLock(void)
149 _CheckNotSysLevel( &USER_SysLevel );
153 /***********************************************************************
154 * WIN_SuspendWndsLock
156 * Suspend the lock on WND structures.
157 * Returns the number of locks suspended
158 * FIXME: should be removed
160 int WIN_SuspendWndsLock( void )
162 int isuspendedLocks = _ConfirmSysLevel( &USER_SysLevel );
163 int count = isuspendedLocks;
165 while ( count-- > 0 )
166 _LeaveSysLevel( &USER_SysLevel );
168 return isuspendedLocks;
171 /***********************************************************************
172 * WIN_RestoreWndsLock
174 * Restore the suspended locks on WND structures
175 * FIXME: should be removed
177 void WIN_RestoreWndsLock( int ipreviousLocks )
179 while ( ipreviousLocks-- > 0 )
180 _EnterSysLevel( &USER_SysLevel );
183 /***********************************************************************
184 * SignalProc32 (USER.391)
185 * UserSignalProc (USER32.@)
187 * The exact meaning of the USER signals is undocumented, but this
188 * should cover the basic idea:
190 * USIG_DLL_UNLOAD_WIN16
191 * This is sent when a 16-bit module is unloaded.
193 * USIG_DLL_UNLOAD_WIN32
194 * This is sent when a 32-bit module is unloaded.
196 * USIG_DLL_UNLOAD_ORPHANS
197 * This is sent after the last Win3.1 module is unloaded,
198 * to allow removal of orphaned menus.
200 * USIG_FAULT_DIALOG_PUSH
201 * USIG_FAULT_DIALOG_POP
202 * These are called to allow USER to prepare for displaying a
203 * fault dialog, even though the fault might have happened while
204 * inside a USER critical section.
206 * USIG_THREAD_INIT
207 * This is called from the context of a new thread, as soon as it
208 * has started to run.
210 * USIG_THREAD_EXIT
211 * This is called, still in its context, just before a thread is
212 * about to terminate.
214 * USIG_PROCESS_CREATE
215 * This is called, in the parent process context, after a new process
216 * has been created.
218 * USIG_PROCESS_INIT
219 * This is called in the new process context, just after the main thread
220 * has started execution (after the main thread's USIG_THREAD_INIT has
221 * been sent).
223 * USIG_PROCESS_LOADED
224 * This is called after the executable file has been loaded into the
225 * new process context.
227 * USIG_PROCESS_RUNNING
228 * This is called immediately before the main entry point is called.
230 * USIG_PROCESS_EXIT
231 * This is called in the context of a process that is about to
232 * terminate (but before the last thread's USIG_THREAD_EXIT has
233 * been sent).
235 * USIG_PROCESS_DESTROY
236 * This is called after a process has terminated.
239 * The meaning of the dwFlags bits is as follows:
241 * USIG_FLAGS_WIN32
242 * Current process is 32-bit.
244 * USIG_FLAGS_GUI
245 * Current process is a (Win32) GUI process.
247 * USIG_FLAGS_FEEDBACK
248 * Current process needs 'feedback' (determined from the STARTUPINFO
249 * flags STARTF_FORCEONFEEDBACK / STARTF_FORCEOFFFEEDBACK).
251 * USIG_FLAGS_FAULT
252 * The signal is being sent due to a fault.
254 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
255 DWORD dwFlags, HMODULE16 hModule )
257 FIXME("(%04x, %08lx, %04lx, %04x)\n",
258 uCode, dwThreadOrProcessID, dwFlags, hModule );
259 /* FIXME: Should chain to GdiSignalProc now. */
260 return 0;
263 /***********************************************************************
264 * USER_GetProcessHandleList(Internal)
266 static HANDLE *USER_GetProcessHandleList(void)
268 DWORD count, i, n;
269 HANDLE *list;
270 PROCESSENTRY32 pe;
271 HANDLE hSnapshot;
272 BOOL r;
274 hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
275 if (!hSnapshot)
277 ERR("cannot create snapshot\n");
278 return FALSE;
281 /* count the number of processes plus one */
282 for (count=0; ;count++)
284 pe.dwSize = sizeof pe;
285 if (count)
286 r = Process32Next( hSnapshot, &pe );
287 else
288 r = Process32First( hSnapshot, &pe );
289 if (!r)
290 break;
293 /* allocate memory make a list of the process handles */
294 list = HeapAlloc( GetProcessHeap(), 0, (count+1)*sizeof(HANDLE) );
295 n=0;
296 for (i=0; i<count; i++)
298 pe.dwSize = sizeof pe;
299 if (i)
300 r = Process32Next( hSnapshot, &pe );
301 else
302 r = Process32First( hSnapshot, &pe );
303 if (!r)
304 break;
306 /* don't kill ourselves */
307 if (GetCurrentProcessId() == pe.th32ProcessID )
308 continue;
310 /* open the process so we don't can track it */
311 list[n] = OpenProcess( PROCESS_QUERY_INFORMATION|
312 PROCESS_TERMINATE,
313 FALSE, pe.th32ProcessID );
315 /* check it didn't terminate already */
316 if( list[n] )
317 n++;
319 list[n]=0;
320 CloseHandle( hSnapshot );
322 if (!r)
323 ERR("Error enumerating processes\n");
325 TRACE("return %lu processes\n", n);
327 return list;
330 /***********************************************************************
331 * USER_KillProcesses (Internal)
333 static DWORD USER_KillProcesses(void)
335 DWORD n, r, i;
336 HANDLE *handles;
337 const DWORD dwShutdownTimeout = 10000;
339 TRACE("terminating other processes\n");
341 /* kill it and add it to our list of object to wait on */
342 handles = USER_GetProcessHandleList();
343 for (n=0; handles && handles[n]; n++)
344 TerminateProcess( handles[n], 0 );
346 /* wait for processes to exit */
347 for (i=0; i<n; i+=MAXIMUM_WAIT_OBJECTS)
349 int n_objs = ((n-i)>MAXIMUM_WAIT_OBJECTS) ? MAXIMUM_WAIT_OBJECTS : (n-i);
350 r = WaitForMultipleObjects( n_objs, &handles[i], TRUE, dwShutdownTimeout );
351 if (r==WAIT_TIMEOUT)
352 ERR("wait failed!\n");
355 /* close the handles */
356 for (i=0; i<n; i++)
357 CloseHandle( handles[i] );
359 HeapFree( GetProcessHeap(), 0, handles );
361 return n;
364 /***********************************************************************
365 * USER_DoShutdown (Internal)
367 static void USER_DoShutdown(void)
369 DWORD i, n;
370 const DWORD nRetries = 10;
372 for (i=0; i<nRetries; i++)
374 n = USER_KillProcesses();
375 TRACE("Killed %ld processes, attempt %ld\n", n, i);
376 if(!n)
377 break;
381 /***********************************************************************
382 * USER_StartRebootProcess (Internal)
384 static BOOL USER_StartRebootProcess(void)
386 WCHAR winebootW[] = { 'w','i','n','e','b','o','o','t',0 };
387 PROCESS_INFORMATION pi;
388 STARTUPINFOW si;
389 BOOL r;
391 memset( &si, 0, sizeof si );
392 si.cb = sizeof si;
394 r = CreateProcessW( NULL, winebootW, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
395 if (r)
397 CloseHandle( pi.hProcess );
398 CloseHandle( pi.hThread );
400 else
401 MESSAGE("wine: Failed to start wineboot\n");
403 return r;
406 /***********************************************************************
407 * ExitWindowsEx (USER32.@)
409 BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reserved )
411 int i;
412 BOOL result = FALSE;
413 HWND *list, *phwnd;
415 /* We have to build a list of all windows first, as in EnumWindows */
416 TRACE("(%x,%lx)\n", flags, reserved);
418 list = WIN_ListChildren( GetDesktopWindow() );
419 if (list)
421 /* Send a WM_QUERYENDSESSION message to every window */
423 for (i = 0; list[i]; i++)
425 /* Make sure that the window still exists */
426 if (!IsWindow( list[i] )) continue;
427 if (!SendMessageW( list[i], WM_QUERYENDSESSION, 0, 0 )) break;
429 result = !list[i];
431 /* Now notify all windows that got a WM_QUERYENDSESSION of the result */
433 for (phwnd = list; i > 0; i--, phwnd++)
435 if (!IsWindow( *phwnd )) continue;
436 SendMessageW( *phwnd, WM_ENDSESSION, result, 0 );
438 HeapFree( GetProcessHeap(), 0, list );
440 if ( !(result || (flags & EWX_FORCE) ))
441 return FALSE;
444 /* USER_DoShutdown will kill all processes except the current process */
445 USER_DoShutdown();
447 if (flags & EWX_REBOOT)
448 USER_StartRebootProcess();
450 if (result) ExitProcess(0);
451 return TRUE;
454 /***********************************************************************
455 * ChangeDisplaySettingsA (USER32.@)
457 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
459 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
462 /***********************************************************************
463 * ChangeDisplaySettingsW (USER32.@)
465 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
467 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
470 /***********************************************************************
471 * ChangeDisplaySettingsExA (USER32.@)
473 LONG WINAPI ChangeDisplaySettingsExA(
474 LPCSTR devname, LPDEVMODEA devmode, HWND hwnd, DWORD flags,
475 LPVOID lparam
477 DEVMODEW devmodeW;
478 LONG ret;
479 UNICODE_STRING nameW;
481 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
482 else nameW.Buffer = NULL;
484 if (devmode)
486 devmodeW.dmBitsPerPel = devmode->dmBitsPerPel;
487 devmodeW.dmPelsHeight = devmode->dmPelsHeight;
488 devmodeW.dmPelsWidth = devmode->dmPelsWidth;
489 devmodeW.dmDisplayFlags = devmode->dmDisplayFlags;
490 devmodeW.dmDisplayFrequency = devmode->dmDisplayFrequency;
491 devmodeW.dmFields = devmode->dmFields;
492 ret = ChangeDisplaySettingsExW(nameW.Buffer, &devmodeW, hwnd, flags, lparam);
494 else
496 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
499 if (devname) RtlFreeUnicodeString(&nameW);
500 return ret;
503 /***********************************************************************
504 * ChangeDisplaySettingsExW (USER32.@)
506 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
507 DWORD flags, LPVOID lparam )
509 /* Pass the request on to the driver */
510 if (!USER_Driver.pChangeDisplaySettingsExW) return DISP_CHANGE_FAILED;
511 return USER_Driver.pChangeDisplaySettingsExW( devname, devmode, hwnd, flags, lparam );
514 /***********************************************************************
515 * EnumDisplaySettingsW (USER32.@)
517 * RETURNS
518 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
519 * FALSE if we do not have the nth setting
521 BOOL WINAPI EnumDisplaySettingsW(
522 LPCWSTR name, /* [in] huh? */
523 DWORD n, /* [in] nth entry in display settings list*/
524 LPDEVMODEW devmode /* [out] devmode for that setting */
526 return EnumDisplaySettingsExW(name, n, devmode, 0);
529 /***********************************************************************
530 * EnumDisplaySettingsA (USER32.@)
532 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
534 return EnumDisplaySettingsExA(name, n, devmode, 0);
537 /***********************************************************************
538 * EnumDisplaySettingsExA (USER32.@)
540 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
541 LPDEVMODEA lpDevMode, DWORD dwFlags)
543 DEVMODEW devmodeW;
544 BOOL ret;
545 UNICODE_STRING nameW;
547 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
548 else nameW.Buffer = NULL;
550 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
551 if (ret)
553 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
554 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
555 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
556 lpDevMode->dmDisplayFlags = devmodeW.dmDisplayFlags;
557 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
558 lpDevMode->dmFields = devmodeW.dmFields;
560 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
561 return ret;
564 /***********************************************************************
565 * EnumDisplaySettingsExW (USER32.@)
567 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
568 LPDEVMODEW lpDevMode, DWORD dwFlags)
570 /* Pass the request on to the driver */
571 if (!USER_Driver.pEnumDisplaySettingsExW) return FALSE;
572 return USER_Driver.pEnumDisplaySettingsExW(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
575 /***********************************************************************
576 * EnumDisplayDevicesA (USER32.@)
578 BOOL WINAPI EnumDisplayDevicesA(
579 LPVOID unused,DWORD i,LPDISPLAY_DEVICEA lpDisplayDevice,DWORD dwFlags
581 if (i)
582 return FALSE;
583 FIXME("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
584 strcpy(lpDisplayDevice->DeviceName,"X11");
585 strcpy(lpDisplayDevice->DeviceString,"X 11 Windowing System");
586 lpDisplayDevice->StateFlags =
587 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
588 DISPLAY_DEVICE_PRIMARY_DEVICE |
589 DISPLAY_DEVICE_VGA_COMPATIBLE;
590 return TRUE;
593 /***********************************************************************
594 * EnumDisplayDevicesW (USER32.@)
596 BOOL WINAPI EnumDisplayDevicesW(
597 LPVOID unused,DWORD i,LPDISPLAY_DEVICEW lpDisplayDevice,DWORD dwFlags
599 if (i)
600 return FALSE;
601 FIXME("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
602 MultiByteToWideChar( CP_ACP, 0, "X11", -1, lpDisplayDevice->DeviceName,
603 sizeof(lpDisplayDevice->DeviceName)/sizeof(WCHAR) );
604 MultiByteToWideChar( CP_ACP, 0, "X11 Windowing System", -1, lpDisplayDevice->DeviceString,
605 sizeof(lpDisplayDevice->DeviceString)/sizeof(WCHAR) );
606 lpDisplayDevice->StateFlags =
607 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
608 DISPLAY_DEVICE_PRIMARY_DEVICE |
609 DISPLAY_DEVICE_VGA_COMPATIBLE;
610 return TRUE;
613 /***********************************************************************
614 * UserSeeUserDo (USER.216)
616 DWORD WINAPI UserSeeUserDo16(WORD wReqType, WORD wParam1, WORD wParam2, WORD wParam3)
618 switch (wReqType)
620 case USUD_LOCALALLOC:
621 return LOCAL_Alloc(USER_HeapSel, wParam1, wParam3);
622 case USUD_LOCALFREE:
623 return LOCAL_Free(USER_HeapSel, wParam1);
624 case USUD_LOCALCOMPACT:
625 return LOCAL_Compact(USER_HeapSel, wParam3, 0);
626 case USUD_LOCALHEAP:
627 return USER_HeapSel;
628 case USUD_FIRSTCLASS:
629 FIXME("return a pointer to the first window class.\n");
630 return (DWORD)-1;
631 default:
632 WARN("wReqType %04x (unknown)\n", wReqType);
633 return (DWORD)-1;
637 /***********************************************************************
638 * RegisterLogonProcess (USER32.@)
640 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x) {
641 FIXME("(%p,%d),stub!\n",hprocess,x);
642 return 1;
645 /***********************************************************************
646 * CreateWindowStationW (USER32.@)
648 HWINSTA WINAPI CreateWindowStationW(
649 LPWSTR winstation,DWORD res1,DWORD desiredaccess,
650 LPSECURITY_ATTRIBUTES lpsa
652 FIXME("(%s,0x%08lx,0x%08lx,%p),stub!\n",debugstr_w(winstation),
653 res1,desiredaccess,lpsa
655 return (HWINSTA)0xdeadcafe;
658 /***********************************************************************
659 * SetProcessWindowStation (USER32.@)
661 BOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta) {
662 FIXME("(%p),stub!\n",hWinSta);
663 return TRUE;
666 /***********************************************************************
667 * SetUserObjectSecurity (USER32.@)
669 BOOL WINAPI SetUserObjectSecurity(
670 HANDLE hObj,
671 PSECURITY_INFORMATION pSIRequested,
672 PSECURITY_DESCRIPTOR pSID
674 FIXME("(%p,%p,%p),stub!\n",hObj,pSIRequested,pSID);
675 return TRUE;
678 /***********************************************************************
679 * CreateDesktopA (USER32.@)
681 HDESK WINAPI CreateDesktopA(
682 LPSTR lpszDesktop,LPSTR lpszDevice,LPDEVMODEA pDevmode,
683 DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa
685 FIXME("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n",
686 lpszDesktop,lpszDevice,pDevmode,
687 dwFlags,dwDesiredAccess,lpsa
689 return (HDESK)0xcafedead;
692 /***********************************************************************
693 * CreateDesktopW (USER32.@)
695 HDESK WINAPI CreateDesktopW(
696 LPWSTR lpszDesktop,LPWSTR lpszDevice,LPDEVMODEW pDevmode,
697 DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa
699 FIXME("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n",
700 debugstr_w(lpszDesktop),debugstr_w(lpszDevice),pDevmode,
701 dwFlags,dwDesiredAccess,lpsa
703 return (HDESK)0xcafedead;
706 /***********************************************************************
707 * EnumDesktopWindows (USER32.@)
709 BOOL WINAPI EnumDesktopWindows( HDESK hDesktop, WNDENUMPROC lpfn, LPARAM lParam ) {
710 FIXME("(%p, %p, 0x%08lx), stub!\n", hDesktop, lpfn, lParam );
711 return TRUE;
715 /***********************************************************************
716 * CloseWindowStation (USER32.@)
718 BOOL WINAPI CloseWindowStation(HWINSTA hWinSta)
720 FIXME("(%p)\n", hWinSta);
721 return TRUE;
724 /***********************************************************************
725 * CloseDesktop (USER32.@)
727 BOOL WINAPI CloseDesktop(HDESK hDesk)
729 FIXME("(%p)\n", hDesk);
730 return TRUE;
733 /***********************************************************************
734 * SetWindowStationUser (USER32.@)
736 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2) {
737 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
738 return 1;
741 /***********************************************************************
742 * SetLogonNotifyWindow (USER32.@)
744 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd) {
745 FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
746 return 1;
749 /***********************************************************************
750 * LoadLocalFonts (USER32.@)
752 VOID WINAPI LoadLocalFonts(VOID) {
753 /* are loaded. */
754 return;
756 /***********************************************************************
757 * GetUserObjectInformationA (USER32.@)
759 BOOL WINAPI GetUserObjectInformationA( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
760 { FIXME("(%p %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
761 return TRUE;
763 /***********************************************************************
764 * GetUserObjectInformationW (USER32.@)
766 BOOL WINAPI GetUserObjectInformationW( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
767 { FIXME("(%p %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
768 return TRUE;
770 /***********************************************************************
771 * GetUserObjectSecurity (USER32.@)
773 BOOL WINAPI GetUserObjectSecurity(HANDLE hObj, PSECURITY_INFORMATION pSIRequested,
774 PSECURITY_DESCRIPTOR pSID, DWORD nLength, LPDWORD lpnLengthNeeded)
775 { FIXME("(%p %p %p len=%ld %p),stub!\n", hObj, pSIRequested, pSID, nLength, lpnLengthNeeded);
776 return TRUE;
779 /***********************************************************************
780 * SetSystemCursor (USER32.@)
782 BOOL WINAPI SetSystemCursor(HCURSOR hcur, DWORD id)
783 { FIXME("(%p,%08lx),stub!\n", hcur, id);
784 return TRUE;
787 /***********************************************************************
788 * RegisterSystemThread (USER32.@)
790 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
792 FIXME("(%08lx, %08lx)\n", flags, reserved);
795 /***********************************************************************
796 * RegisterDeviceNotificationA (USER32.@)
798 * See RegisterDeviceNotificationW.
800 HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hnd, LPVOID notifyfilter, DWORD flags)
802 FIXME("(hwnd=%p, filter=%p,flags=0x%08lx), STUB!\n", hnd,notifyfilter,flags );
803 return 0;
806 /***********************************************************************
807 * RegisterDeviceNotificationW (USER32.@)
809 * Registers a window with the system so that it will receive
810 * notifications about a device.
812 * PARAMS
813 * hRecepient [I] Window or service status handle that
814 * will receive notifications.
815 * pNotificationFilter [I] DEV_BROADCAST_HDR followed by some
816 * type-specific data.
817 * dwFlags [I] See notes
819 * RETURNS
821 * A handle to the device notification.
823 * NOTES
825 * The dwFlags parameter can be one of two values:
826 *| DEVICE_NOTIFY_WINDOW_HANDLE - hRecepient is a window handle
827 *| DEVICE_NOTIFY_SERVICE_HANDLE - hRecepient is a service status handle
829 HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecepient, LPVOID pNotificationFilter, DWORD dwFlags)
831 FIXME("(hwnd=%p, filter=%p,flags=0x%08lx), STUB!\n", hRecepient,pNotificationFilter,dwFlags );
832 return 0;