Authors: Gavriel State <gavriels@corel.com>, Ulrich Czekalla <ulrichc@corel.com>
[wine] / windows / user.c
1 /*
2  * Misc. USER functions
3  *
4  * Copyright 1993 Robert J. Amstadt
5  *           1996 Alex Korobka 
6  */
7
8 #include <stdlib.h>
9 #include "wine/winbase16.h"
10 #include "windef.h"
11 #include "wingdi.h"
12 #include "winuser.h"
13 #include "heap.h"
14 #include "user.h"
15 #include "gdi.h"
16 #include "task.h"
17 #include "queue.h"
18 #include "class.h"
19 #include "win.h"
20 #include "clipboard.h"
21 #include "menu.h"
22 #include "cursoricon.h"
23 #include "hook.h"
24 #include "toolhelp.h"
25 #include "message.h"
26 #include "module.h"
27 #include "monitor.h"
28 #include "miscemu.h"
29 #include "shell.h"
30 #include "callback.h"
31 #include "local.h"
32 #include "process.h"
33 #include "debugtools.h"
34
35 DECLARE_DEBUG_CHANNEL(hook)
36 DECLARE_DEBUG_CHANNEL(local)
37 DECLARE_DEBUG_CHANNEL(system)
38 DECLARE_DEBUG_CHANNEL(win)
39 DECLARE_DEBUG_CHANNEL(win32)
40
41 /***********************************************************************
42  *           GetFreeSystemResources   (USER.284)
43  */
44 WORD WINAPI GetFreeSystemResources16( WORD resType )
45 {
46     int userPercent, gdiPercent;
47
48     switch(resType)
49     {
50     case GFSR_USERRESOURCES:
51         userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
52                                LOCAL_HeapSize( USER_HeapSel );
53         gdiPercent  = 100;
54         break;
55
56     case GFSR_GDIRESOURCES:
57         gdiPercent  = (int)LOCAL_CountFree( GDI_HeapSel ) * 100 /
58                                LOCAL_HeapSize( GDI_HeapSel );
59         userPercent = 100;
60         break;
61
62     case GFSR_SYSTEMRESOURCES:
63         userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
64                                LOCAL_HeapSize( USER_HeapSel );
65         gdiPercent  = (int)LOCAL_CountFree( GDI_HeapSel ) * 100 /
66                                LOCAL_HeapSize( GDI_HeapSel );
67         break;
68
69     default:
70         return 0;
71     }
72     return (WORD)min( userPercent, gdiPercent );
73 }
74
75
76 /***********************************************************************
77  *           SystemHeapInfo   (TOOLHELP.71)
78  */
79 BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo )
80 {
81     pHeapInfo->wUserFreePercent = GetFreeSystemResources16( GFSR_USERRESOURCES );
82     pHeapInfo->wGDIFreePercent  = GetFreeSystemResources16( GFSR_GDIRESOURCES );
83     pHeapInfo->hUserSegment = USER_HeapSel;
84     pHeapInfo->hGDISegment  = GDI_HeapSel;
85     return TRUE;
86 }
87
88
89 /***********************************************************************
90  *           TimerCount   (TOOLHELP.80)
91  */
92 BOOL16 WINAPI TimerCount16( TIMERINFO *pTimerInfo )
93 {
94     /* FIXME
95      * In standard mode, dwmsSinceStart = dwmsThisVM 
96      *
97      * I tested this, under Windows in enhanced mode, and
98      * if you never switch VM (ie start/stop DOS) these
99      * values should be the same as well. 
100      *
101      * Also, Wine should adjust for the hardware timer
102      * to reduce the amount of error to ~1ms. 
103      * I can't be bothered, can you?
104      */
105     pTimerInfo->dwmsSinceStart = pTimerInfo->dwmsThisVM = GetTickCount();
106     return TRUE;
107 }
108
109 /**********************************************************************
110  *           InitApp   (USER.5)
111  */
112 INT16 WINAPI InitApp16( HINSTANCE16 hInstance )
113 {
114     /* Hack: restore the divide-by-zero handler */
115     /* FIXME: should set a USER-specific handler that displays a msg box */
116     INT_SetPMHandler( 0, INT_GetPMHandler( 0xff ) );
117
118     /* Create task message queue */
119     if ( !GetFastQueue16() ) return 0;
120
121     return 1;
122 }
123
124 /**********************************************************************
125  *           USER_ModuleUnload
126  */
127 static void USER_ModuleUnload( HMODULE16 hModule )
128 {
129     HOOK_FreeModuleHooks( hModule );
130     CLASS_FreeModuleClasses( hModule );
131     CURSORICON_FreeModuleIcons( hModule );
132 }
133
134 /**********************************************************************
135  *           USER_QueueCleanup
136  */
137 static void USER_QueueCleanup( HQUEUE16 hQueue )
138 {
139     if ( hQueue )
140     {
141         WND* desktop = WIN_GetDesktop();
142
143         /* Patch desktop window */
144         if ( desktop->hmemTaskQ == hQueue )
145         {
146             HTASK16 nextTask = TASK_GetNextTask( GetCurrentTask() );
147             desktop->hmemTaskQ = GetTaskQueue16( nextTask );
148         }
149
150         /* Patch resident popup menu window */
151         MENU_PatchResidentPopup( hQueue, NULL );
152
153         TIMER_RemoveQueueTimers( hQueue );
154
155         HOOK_FreeQueueHooks( hQueue );
156
157         QUEUE_SetExitingQueue( hQueue );
158         WIN_ResetQueueWindows( desktop, hQueue, (HQUEUE16)0);
159         QUEUE_SetExitingQueue( 0 );
160
161         /* Free the message queue */
162         QUEUE_DeleteMsgQueue( hQueue );
163
164         WIN_ReleaseDesktop();
165     }
166 }
167
168 /**********************************************************************
169  *           USER_AppExit
170  */
171 static void USER_AppExit( HINSTANCE16 hInstance )
172 {
173     /* FIXME: maybe destroy menus (Windows only complains about them
174      * but does nothing);
175      */
176
177     /* ModuleUnload() in "Internals" */
178
179     hInstance = GetExePtr( hInstance );
180     if( GetModuleUsage16( hInstance ) <= 1 ) 
181         USER_ModuleUnload( hInstance );
182 }
183
184
185 /***********************************************************************
186  *           USER_SignalProc (USER.314)
187  */
188 void WINAPI USER_SignalProc( HANDLE16 hTaskOrModule, UINT16 uCode,
189                              UINT16 uExitFn, HINSTANCE16 hInstance,
190                              HQUEUE16 hQueue )
191 {
192     FIXME_(win)("Win 3.1 USER signal %04x\n", uCode );
193 }
194
195 /***********************************************************************
196  *           FinalUserInit (USER.400)
197  */
198 void WINAPI FinalUserInit16( void )
199 {
200     /* FIXME: Should chain to FinalGdiInit now. */
201 }
202
203 /***********************************************************************
204  *           UserSignalProc     (USER.610) (USER32.559)
205  *
206  * For comments about the meaning of uCode and dwFlags 
207  * see PROCESS_CallUserSignalProc.
208  *
209  */
210 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
211                             DWORD dwFlags, HMODULE16 hModule )
212 {
213     static HANDLE win16_idle_event;
214     HINSTANCE16 hInst;
215     PDB * pdb;
216
217     /* FIXME: Proper reaction to most signals still missing. */
218
219     switch ( uCode )
220     {
221     case USIG_DLL_UNLOAD_WIN16:
222     case USIG_DLL_UNLOAD_WIN32:
223         USER_ModuleUnload( hModule );
224         break;
225
226     case USIG_DLL_UNLOAD_ORPHANS:
227         break;
228
229     case USIG_FAULT_DIALOG_PUSH:
230     case USIG_FAULT_DIALOG_POP:
231         break;
232
233     case USIG_THREAD_INIT:
234         break;
235
236     case USIG_THREAD_EXIT:
237         USER_QueueCleanup( GetThreadQueue16( dwThreadOrProcessID ) );
238         SetThreadQueue16( dwThreadOrProcessID, 0 );
239         break;
240
241     case USIG_PROCESS_CREATE:
242       pdb = PROCESS_Current();
243
244       /* Create the idle event for the process. We have just one idle_event for all
245          win16 processes, while each win32 process has its own */
246
247       if ( pdb->flags & PDB32_WIN16_PROC )
248       {
249           if (!win16_idle_event)
250           {
251               win16_idle_event = CreateEventA ( NULL, TRUE, FALSE, NULL );
252               win16_idle_event = ConvertToGlobalHandle ( win16_idle_event );
253           }
254           pdb->idle_event = win16_idle_event;
255       }
256       else { /* win32 process */
257         pdb->idle_event = CreateEventA ( NULL, TRUE, FALSE, NULL );
258         pdb->idle_event = ConvertToGlobalHandle ( pdb->idle_event );
259         TRACE_(win)("created win32 idle event: %x\n", pdb->idle_event );
260       }
261       break;
262
263     case USIG_PROCESS_INIT:
264     case USIG_PROCESS_LOADED:
265       break;
266     case USIG_PROCESS_RUNNING:
267         SetEvent ( PROCESS_Current()->idle_event );
268         break;
269
270     case USIG_PROCESS_EXIT:
271         break;
272
273     case USIG_PROCESS_DESTROY:      
274       hInst = GetProcessDword( dwThreadOrProcessID, GPD_HINSTANCE16 );
275       USER_AppExit( hInst );
276
277       pdb = PROCESS_Current();
278       if ( ! (pdb->flags & PDB32_WIN16_PROC) ) {
279         TRACE_(win)("destroying win32 idle event: %x\n", pdb->idle_event );
280         CloseHandle ( pdb->idle_event );        
281       }
282       break;
283
284     default:
285         FIXME_(win)("(%04x, %08lx, %04lx, %04x)\n",
286                     uCode, dwThreadOrProcessID, dwFlags, hModule );
287         break;
288     }
289
290     /* FIXME: Should chain to GdiSignalProc now. */
291
292     return 0;
293 }
294
295 /***********************************************************************
296  *           USER_DllEntryPoint  (USER.374)
297  */
298 BOOL WINAPI USER_DllEntryPoint( DWORD dwReason, HINSTANCE hInstDLL, WORD ds,
299                                 WORD wHeapSize, DWORD dwReserved1, WORD wReserved2 )
300 {
301     switch ( dwReason )
302     {
303     case DLL_PROCESS_ATTACH:
304         /* 
305          * We need to load the 32-bit library so as to be able
306          * to access the system resources stored there!
307          */
308         if ( !LoadLibraryA("USER32.DLL") )
309         {
310             ERR_(win)( "Could not load USER32.DLL\n" );
311             return FALSE;
312         }
313     }
314
315     return TRUE;
316 }
317
318
319 /***********************************************************************
320  *           ExitWindows16   (USER.7)
321  */
322 BOOL16 WINAPI ExitWindows16( DWORD dwReturnCode, UINT16 wReserved )
323 {
324     return ExitWindowsEx( EWX_LOGOFF, 0xffffffff );
325 }
326
327
328 /***********************************************************************
329  *           ExitWindowsExec16   (USER.246)
330  */
331 BOOL16 WINAPI ExitWindowsExec16( LPCSTR lpszExe, LPCSTR lpszParams )
332 {
333     TRACE_(system)("Should run the following in DOS-mode: \"%s %s\"\n",
334         lpszExe, lpszParams);
335     return ExitWindowsEx( EWX_LOGOFF, 0xffffffff );
336 }
337
338
339 /***********************************************************************
340  *           ExitWindowsEx   (USER32.196)
341  */
342 BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reserved )
343 {
344     int i;
345     BOOL result;
346     WND **list, **ppWnd;
347         
348     /* We have to build a list of all windows first, as in EnumWindows */
349
350     if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
351     {
352         WIN_ReleaseDesktop();
353         return FALSE;
354     }
355
356     /* Send a WM_QUERYENDSESSION message to every window */
357
358     for (ppWnd = list, i = 0; *ppWnd; ppWnd++, i++)
359     {
360         /* Make sure that the window still exists */
361         if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
362         if (!SendMessage16( (*ppWnd)->hwndSelf, WM_QUERYENDSESSION, 0, 0 ))
363             break;
364     }
365     result = !(*ppWnd);
366
367     /* Now notify all windows that got a WM_QUERYENDSESSION of the result */
368
369     for (ppWnd = list; i > 0; i--, ppWnd++)
370     {
371         if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
372         SendMessage16( (*ppWnd)->hwndSelf, WM_ENDSESSION, result, 0 );
373     }
374     WIN_ReleaseWinArray(list);
375
376     if (result) ExitKernel16();
377     WIN_ReleaseDesktop();
378     return FALSE;
379 }
380
381 static void _dump_CDS_flags(DWORD flags) {
382 #define X(x) if (flags & CDS_##x) MESSAGE(""#x ",");
383         X(UPDATEREGISTRY);X(TEST);X(FULLSCREEN);X(GLOBAL);
384         X(SET_PRIMARY);X(RESET);X(SETRECT);X(NORESET);
385 #undef X
386 }
387
388 /***********************************************************************
389  *           ChangeDisplaySettingsA    (USER32.589)
390  */
391 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
392 {
393   FIXME_(system)("(%p,0x%08lx), stub\n",devmode,flags);
394   MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n");
395   if (devmode==NULL)
396     FIXME_(system)("   devmode=NULL (return to default mode)\n");
397   else if ( (devmode->dmBitsPerPel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor)) 
398             || (devmode->dmPelsHeight != MONITOR_GetHeight(&MONITOR_PrimaryMonitor))
399             || (devmode->dmPelsWidth != MONITOR_GetWidth(&MONITOR_PrimaryMonitor)) )
400
401   {
402
403     if (devmode->dmFields & DM_BITSPERPEL)
404       FIXME_(system)("   bpp=%ld\n",devmode->dmBitsPerPel);
405     if (devmode->dmFields & DM_PELSWIDTH)
406       FIXME_(system)("   width=%ld\n",devmode->dmPelsWidth);
407     if (devmode->dmFields & DM_PELSHEIGHT)
408       FIXME_(system)("   height=%ld\n",devmode->dmPelsHeight);
409     FIXME_(system)(" (Putting X in this mode beforehand might help)\n"); 
410     /* we don't, but the program ... does not need to know */
411     return DISP_CHANGE_SUCCESSFUL; 
412   }
413   return DISP_CHANGE_SUCCESSFUL;
414 }
415
416 /***********************************************************************
417  *           ChangeDisplaySettingsExA    (USER32.604)
418  */
419 LONG WINAPI ChangeDisplaySettingsExA( 
420         LPCSTR devname, LPDEVMODEA devmode, HWND hwnd, DWORD flags,
421         LPARAM lparam
422 ) {
423   FIXME_(system)("(%s,%p,0x%04x,0x%08lx,0x%08lx), stub\n",devname,devmode,hwnd,flags,lparam);
424   MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n");
425   if (devmode==NULL)
426     FIXME_(system)("   devmode=NULL (return to default mode)\n");
427   else if ( (devmode->dmBitsPerPel != MONITOR_GetDepth(&MONITOR_PrimaryMonitor)) 
428             || (devmode->dmPelsHeight != MONITOR_GetHeight(&MONITOR_PrimaryMonitor))
429             || (devmode->dmPelsWidth != MONITOR_GetWidth(&MONITOR_PrimaryMonitor)) )
430
431   {
432
433     if (devmode->dmFields & DM_BITSPERPEL)
434       FIXME_(system)("   bpp=%ld\n",devmode->dmBitsPerPel);
435     if (devmode->dmFields & DM_PELSWIDTH)
436       FIXME_(system)("   width=%ld\n",devmode->dmPelsWidth);
437     if (devmode->dmFields & DM_PELSHEIGHT)
438       FIXME_(system)("   height=%ld\n",devmode->dmPelsHeight);
439     FIXME_(system)(" (Putting X in this mode beforehand might help)\n"); 
440     /* we don't, but the program ... does not need to know */
441     return DISP_CHANGE_SUCCESSFUL; 
442   }
443   return DISP_CHANGE_SUCCESSFUL;
444 }
445
446 /***********************************************************************
447  *           EnumDisplaySettingsA   (USER32.592)
448  * FIXME: Currently uses static list of modes.
449  *
450  * RETURNS
451  *      TRUE if nth setting exists found (described in the LPDEVMODEA struct)
452  *      FALSE if we do not have the nth setting
453  */
454 BOOL WINAPI EnumDisplaySettingsA(
455         LPCSTR name,            /* [in] huh? */
456         DWORD n,                /* [in] nth entry in display settings list*/
457         LPDEVMODEA devmode      /* [out] devmode for that setting */
458 ) {
459 #define NRMODES 5
460 #define NRDEPTHS 4
461         struct {
462                 int w,h;
463         } modes[NRMODES]={{512,384},{640,400},{640,480},{800,600},{1024,768}};
464         int depths[4] = {8,16,24,32};
465
466         TRACE_(system)("(%s,%ld,%p)\n",name,n,devmode);
467         if (n==0) {
468                 devmode->dmBitsPerPel = MONITOR_GetDepth(&MONITOR_PrimaryMonitor);
469                 devmode->dmPelsHeight = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
470                 devmode->dmPelsWidth  = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
471                 return TRUE;
472         }
473         if ((n-1)<NRMODES*NRDEPTHS) {
474                 devmode->dmBitsPerPel   = depths[(n-1)/NRMODES];
475                 devmode->dmPelsHeight   = modes[(n-1)%NRMODES].h;
476                 devmode->dmPelsWidth    = modes[(n-1)%NRMODES].w;
477                 return TRUE;
478         }
479         return FALSE;
480 }
481
482 /***********************************************************************
483  *           EnumDisplaySettingsW   (USER32.593)
484  */
485 BOOL WINAPI EnumDisplaySettingsW(LPCWSTR name,DWORD n,LPDEVMODEW devmode) {
486         LPSTR nameA = HEAP_strdupWtoA(GetProcessHeap(),0,name);
487         DEVMODEA        devmodeA; 
488         BOOL ret = EnumDisplaySettingsA(nameA,n,&devmodeA); 
489
490         if (ret) {
491                 devmode->dmBitsPerPel   = devmodeA.dmBitsPerPel;
492                 devmode->dmPelsHeight   = devmodeA.dmPelsHeight;
493                 devmode->dmPelsWidth    = devmodeA.dmPelsWidth;
494                 /* FIXME: convert rest too, if they are ever returned */
495         }
496         HeapFree(GetProcessHeap(),0,nameA);
497         return ret;
498 }
499
500 /***********************************************************************
501  *           EnumDisplayDevicesA   (USER32.184)
502  */
503 BOOL WINAPI EnumDisplayDevicesA(
504         LPVOID unused,DWORD i,LPDISPLAY_DEVICEA lpDisplayDevice,DWORD dwFlags
505 ) {
506         if (i)
507                 return FALSE;
508         FIXME_(system)("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
509         strcpy(lpDisplayDevice->DeviceName,"X11");
510         strcpy(lpDisplayDevice->DeviceString,"X 11 Windowing System");
511         lpDisplayDevice->StateFlags =
512                         DISPLAY_DEVICE_ATTACHED_TO_DESKTOP      |
513                         DISPLAY_DEVICE_PRIMARY_DEVICE           |
514                         DISPLAY_DEVICE_VGA_COMPATIBLE;
515         return TRUE;
516 }
517
518 /***********************************************************************
519  *           EnumDisplayDevicesW   (USER32.185)
520  */
521 BOOL WINAPI EnumDisplayDevicesW(
522         LPVOID unused,DWORD i,LPDISPLAY_DEVICEW lpDisplayDevice,DWORD dwFlags
523 ) {
524         if (i)
525                 return FALSE;
526         FIXME_(system)("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
527         lstrcpyAtoW(lpDisplayDevice->DeviceName,"X11");
528         lstrcpyAtoW(lpDisplayDevice->DeviceString,"X 11 Windowing System");
529         lpDisplayDevice->StateFlags =
530                         DISPLAY_DEVICE_ATTACHED_TO_DESKTOP      |
531                         DISPLAY_DEVICE_PRIMARY_DEVICE           |
532                         DISPLAY_DEVICE_VGA_COMPATIBLE;
533         return TRUE;
534 }
535
536 /***********************************************************************
537  *           SetEventHook   (USER.321)
538  *
539  *      Used by Turbo Debugger for Windows
540  */
541 FARPROC16 WINAPI SetEventHook16(FARPROC16 lpfnEventHook)
542 {
543         FIXME_(hook)("(lpfnEventHook=%08x): stub\n", (UINT)lpfnEventHook);
544         return NULL;
545 }
546
547 /***********************************************************************
548  *           UserSeeUserDo   (USER.216)
549  */
550 DWORD WINAPI UserSeeUserDo16(WORD wReqType, WORD wParam1, WORD wParam2, WORD wParam3)
551 {
552     switch (wReqType)
553     {
554     case USUD_LOCALALLOC:
555         return LOCAL_Alloc(USER_HeapSel, wParam1, wParam3);
556     case USUD_LOCALFREE:
557         return LOCAL_Free(USER_HeapSel, wParam1);
558     case USUD_LOCALCOMPACT:
559         return LOCAL_Compact(USER_HeapSel, wParam3, 0);
560     case USUD_LOCALHEAP:
561         return USER_HeapSel;
562     case USUD_FIRSTCLASS:
563         FIXME_(local)("return a pointer to the first window class.\n"); 
564         return (DWORD)-1;
565     default:
566         WARN_(local)("wReqType %04x (unknown)", wReqType);
567         return (DWORD)-1;
568     }
569 }
570
571 /***********************************************************************
572  *         GetSystemDebugState16   (USER.231)
573  */
574 WORD WINAPI GetSystemDebugState16(void)
575 {
576     return 0;  /* FIXME */
577 }
578
579 /***********************************************************************
580  *           RegisterLogonProcess   (USER32.434)
581  */
582 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x) {
583         FIXME_(win32)("(%d,%d),stub!\n",hprocess,x);
584         return 1;
585 }
586
587 /***********************************************************************
588  *           CreateWindowStationW   (USER32.86)
589  */
590 HWINSTA WINAPI CreateWindowStationW(
591         LPWSTR winstation,DWORD res1,DWORD desiredaccess,
592         LPSECURITY_ATTRIBUTES lpsa
593 ) {
594         FIXME_(win32)("(%s,0x%08lx,0x%08lx,%p),stub!\n",debugstr_w(winstation),
595                 res1,desiredaccess,lpsa
596         );
597         return 0xdeadcafe;
598 }
599
600 /***********************************************************************
601  *           SetProcessWindowStation   (USER32.496)
602  */
603 BOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta) {
604         FIXME_(win32)("(%d),stub!\n",hWinSta);
605         return TRUE;
606 }
607
608 /***********************************************************************
609  *           SetUserObjectSecurity   (USER32.514)
610  */
611 BOOL WINAPI SetUserObjectSecurity(
612         HANDLE hObj,
613         /*LPSECURITY_INFORMATION*/LPVOID pSIRequested,
614         PSECURITY_DESCRIPTOR pSID
615 ) {
616         FIXME_(win32)("(0x%08x,%p,%p),stub!\n",hObj,pSIRequested,pSID);
617         return TRUE;
618 }
619
620 /***********************************************************************
621  *           CreateDesktopW   (USER32.69)
622  */
623 HDESK WINAPI CreateDesktopW(
624         LPWSTR lpszDesktop,LPWSTR lpszDevice,LPDEVMODEW pDevmode,
625         DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa
626 ) {
627         FIXME_(win32)("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n",
628                 debugstr_w(lpszDesktop),debugstr_w(lpszDevice),pDevmode,
629                 dwFlags,dwDesiredAccess,lpsa
630         );
631         return 0xcafedead;
632 }
633
634 /***********************************************************************
635  *           CloseWindowStation
636  */
637 BOOL WINAPI CloseWindowStation(HWINSTA hWinSta)
638 {
639     FIXME_(win32)("(0x%08x)\n", hWinSta);
640     return TRUE;
641 }
642
643 /***********************************************************************
644  *           CloseDesktop
645  */
646 BOOL WINAPI CloseDesktop(HDESK hDesk)
647 {
648     FIXME_(win32)("(0x%08x)\n", hDesk);
649     return TRUE;
650 }
651
652 /***********************************************************************
653  *           SetWindowStationUser   (USER32.521)
654  */
655 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2) {
656         FIXME_(win32)("(0x%08lx,0x%08lx),stub!\n",x1,x2);
657         return 1;
658 }
659
660 /***********************************************************************
661  *           SetLogonNotifyWindow   (USER32.486)
662  */
663 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd) {
664         FIXME_(win32)("(0x%x,%04x),stub!\n",hwinsta,hwnd);
665         return 1;
666 }
667
668 /***********************************************************************
669  *           LoadLocalFonts   (USER32.486)
670  */
671 VOID WINAPI LoadLocalFonts(VOID) {
672         /* are loaded. */
673         return;
674 }
675 /***********************************************************************
676  *           GetUserObjectInformationA   (USER32.299)
677  */
678 BOOL WINAPI GetUserObjectInformationA( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
679 {       FIXME_(win32)("(0x%x %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
680         return TRUE;
681 }
682 /***********************************************************************
683  *           GetUserObjectInformationW   (USER32.300)
684  */
685 BOOL WINAPI GetUserObjectInformationW( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
686 {       FIXME_(win32)("(0x%x %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
687         return TRUE;
688 }
689 /***********************************************************************
690  *           GetUserObjectSecurity   (USER32.300)
691  */
692 BOOL WINAPI GetUserObjectSecurity(HANDLE hObj, SECURITY_INFORMATION * pSIRequested,
693         PSECURITY_DESCRIPTOR pSID, DWORD nLength, LPDWORD lpnLengthNeeded)
694 {       FIXME_(win32)("(0x%x %p %p len=%ld %p),stub!\n",  hObj, pSIRequested, pSID, nLength, lpnLengthNeeded);
695         return TRUE;
696 }
697
698 /***********************************************************************
699  *           SetSystemCursor   (USER32.507)
700  */
701 BOOL WINAPI SetSystemCursor(HCURSOR hcur, DWORD id)
702 {       FIXME_(win32)("(%08x,%08lx),stub!\n",  hcur, id);
703         return TRUE;
704 }
705
706 /***********************************************************************
707  *      RegisterSystemThread    (USER32.435)
708  */
709 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
710 {
711         FIXME_(win32)("(%08lx, %08lx)\n", flags, reserved);
712 }