Don't open device if already open.
[wine] / dlls / user / misc.c
1 /*
2  * Misc USER functions
3  *
4  * Copyright 1995 Thomas Sandford
5  * Copyright 1997 Marcus Meissner
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #include <stdarg.h>
23
24 #include "windef.h"
25 #include "wine/windef16.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "winnls.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(win);
34
35 /* USER signal proc flags and codes */
36 /* See UserSignalProc for comments */
37 #define USIG_FLAGS_WIN32          0x0001
38 #define USIG_FLAGS_GUI            0x0002
39 #define USIG_FLAGS_FEEDBACK       0x0004
40 #define USIG_FLAGS_FAULT          0x0008
41
42 #define USIG_DLL_UNLOAD_WIN16     0x0001
43 #define USIG_DLL_UNLOAD_WIN32     0x0002
44 #define USIG_FAULT_DIALOG_PUSH    0x0003
45 #define USIG_FAULT_DIALOG_POP     0x0004
46 #define USIG_DLL_UNLOAD_ORPHANS   0x0005
47 #define USIG_THREAD_INIT          0x0010
48 #define USIG_THREAD_EXIT          0x0020
49 #define USIG_PROCESS_CREATE       0x0100
50 #define USIG_PROCESS_INIT         0x0200
51 #define USIG_PROCESS_EXIT         0x0300
52 #define USIG_PROCESS_DESTROY      0x0400
53 #define USIG_PROCESS_RUNNING      0x0500
54 #define USIG_PROCESS_LOADED       0x0600
55
56
57 /***********************************************************************
58  *              SignalProc32 (USER.391)
59  *              UserSignalProc (USER32.@)
60  *
61  * The exact meaning of the USER signals is undocumented, but this
62  * should cover the basic idea:
63  *
64  * USIG_DLL_UNLOAD_WIN16
65  *     This is sent when a 16-bit module is unloaded.
66  *
67  * USIG_DLL_UNLOAD_WIN32
68  *     This is sent when a 32-bit module is unloaded.
69  *
70  * USIG_DLL_UNLOAD_ORPHANS
71  *     This is sent after the last Win3.1 module is unloaded,
72  *     to allow removal of orphaned menus.
73  *
74  * USIG_FAULT_DIALOG_PUSH
75  * USIG_FAULT_DIALOG_POP
76  *     These are called to allow USER to prepare for displaying a
77  *     fault dialog, even though the fault might have happened while
78  *     inside a USER critical section.
79  *
80  * USIG_THREAD_INIT
81  *     This is called from the context of a new thread, as soon as it
82  *     has started to run.
83  *
84  * USIG_THREAD_EXIT
85  *     This is called, still in its context, just before a thread is
86  *     about to terminate.
87  *
88  * USIG_PROCESS_CREATE
89  *     This is called, in the parent process context, after a new process
90  *     has been created.
91  *
92  * USIG_PROCESS_INIT
93  *     This is called in the new process context, just after the main thread
94  *     has started execution (after the main thread's USIG_THREAD_INIT has
95  *     been sent).
96  *
97  * USIG_PROCESS_LOADED
98  *     This is called after the executable file has been loaded into the
99  *     new process context.
100  *
101  * USIG_PROCESS_RUNNING
102  *     This is called immediately before the main entry point is called.
103  *
104  * USIG_PROCESS_EXIT
105  *     This is called in the context of a process that is about to
106  *     terminate (but before the last thread's USIG_THREAD_EXIT has
107  *     been sent).
108  *
109  * USIG_PROCESS_DESTROY
110  *     This is called after a process has terminated.
111  *
112  *
113  * The meaning of the dwFlags bits is as follows:
114  *
115  * USIG_FLAGS_WIN32
116  *     Current process is 32-bit.
117  *
118  * USIG_FLAGS_GUI
119  *     Current process is a (Win32) GUI process.
120  *
121  * USIG_FLAGS_FEEDBACK
122  *     Current process needs 'feedback' (determined from the STARTUPINFO
123  *     flags STARTF_FORCEONFEEDBACK / STARTF_FORCEOFFFEEDBACK).
124  *
125  * USIG_FLAGS_FAULT
126  *     The signal is being sent due to a fault.
127  */
128 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
129                             DWORD dwFlags, HMODULE16 hModule )
130 {
131     FIXME("(%04x, %08lx, %04lx, %04x)\n",
132           uCode, dwThreadOrProcessID, dwFlags, hModule );
133     /* FIXME: Should chain to GdiSignalProc now. */
134     return 0;
135 }
136
137
138 /* callback to allow EnumDesktopsA to use EnumDesktopsW */
139 typedef struct {
140     DESKTOPENUMPROCA lpEnumFunc;
141     LPARAM lParam;
142 } ENUMDESKTOPS_LPARAM;
143
144 /* EnumDesktopsA passes this callback function to EnumDesktopsW.
145  * It simply converts the string to ASCII and calls the callback
146  * function provided by the original caller
147  */
148 static BOOL CALLBACK EnumDesktopProcWtoA(LPWSTR lpszDesktop, LPARAM lParam)
149 {
150     LPSTR buffer;
151     INT   len;
152     BOOL  ret;
153     ENUMDESKTOPS_LPARAM *data = (ENUMDESKTOPS_LPARAM *)lParam;
154
155     len = WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, NULL, 0, NULL, NULL);
156     if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len))) return FALSE;
157     WideCharToMultiByte(CP_ACP, 0, lpszDesktop, -1, buffer, len, NULL, NULL);
158
159     ret = data->lpEnumFunc(buffer, data->lParam);
160
161     HeapFree(GetProcessHeap(), 0, buffer);
162     return ret;
163 }
164
165 /**********************************************************************
166  * SetLastErrorEx [USER32.@]
167  *
168  * Sets the last-error code.
169  *
170  * RETURNS
171  *    None.
172  */
173 void WINAPI SetLastErrorEx(
174     DWORD error, /* [in] Per-thread error code */
175     DWORD type)  /* [in] Error type */
176 {
177     TRACE("(0x%08lx, 0x%08lx)\n", error,type);
178     switch(type) {
179         case 0:
180             break;
181         case SLE_ERROR:
182         case SLE_MINORERROR:
183         case SLE_WARNING:
184             /* Fall through for now */
185         default:
186             FIXME("(error=%08lx, type=%08lx): Unhandled type\n", error,type);
187             break;
188     }
189     SetLastError( error );
190 }
191
192 /******************************************************************************
193  * GetAltTabInfoA [USER32.@]
194  */
195 BOOL WINAPI GetAltTabInfoA(HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
196 {
197     FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
198     return FALSE;
199 }
200
201 /******************************************************************************
202  * GetAltTabInfoW [USER32.@]
203  */
204 BOOL WINAPI GetAltTabInfoW(HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
205 {
206     FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
207     return FALSE;
208 }
209
210 /******************************************************************************
211  * GetProcessWindowStation [USER32.@]
212  *
213  * Returns handle of window station
214  *
215  * NOTES
216  *    Docs say the return value is HWINSTA
217  *
218  * RETURNS
219  *    Success: Handle to window station associated with calling process
220  *    Failure: NULL
221  */
222 HWINSTA WINAPI GetProcessWindowStation(void)
223 {
224     FIXME("(void): stub\n");
225     return (HWINSTA)1;
226 }
227
228
229 /******************************************************************************
230  * GetThreadDesktop [USER32.@]
231  *
232  * Returns handle to desktop
233  *
234  * PARAMS
235  *    dwThreadId [I] Thread identifier
236  *
237  * RETURNS
238  *    Success: Handle to desktop associated with specified thread
239  *    Failure: NULL
240  */
241 HDESK WINAPI GetThreadDesktop( DWORD dwThreadId )
242 {
243     FIXME("(%lx): stub\n",dwThreadId);
244     return (HDESK)1;
245 }
246
247
248 /******************************************************************************
249  * SetDebugErrorLevel [USER32.@]
250  * Sets the minimum error level for generating debugging events
251  *
252  * PARAMS
253  *    dwLevel [I] Debugging error level
254  */
255 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
256 {
257     FIXME("(%ld): stub\n", dwLevel);
258 }
259
260
261 /******************************************************************************
262  *                    GetProcessDefaultLayout [USER32.@]
263  *
264  * Gets the default layout for parentless windows.
265  * Right now, just returns 0 (left-to-right).
266  *
267  * RETURNS
268  *    Success: Nonzero
269  *    Failure: Zero
270  *
271  * BUGS
272  *    No RTL
273  */
274 BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
275 {
276     if ( !pdwDefaultLayout ) {
277         SetLastError( ERROR_INVALID_PARAMETER );
278         return FALSE;
279      }
280     FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
281     *pdwDefaultLayout = 0;
282     return TRUE;
283 }
284
285
286 /******************************************************************************
287  *                    SetProcessDefaultLayout [USER32.@]
288  *
289  * Sets the default layout for parentless windows.
290  * Right now, only accepts 0 (left-to-right).
291  *
292  * RETURNS
293  *    Success: Nonzero
294  *    Failure: Zero
295  *
296  * BUGS
297  *    No RTL
298  */
299 BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
300 {
301     if ( dwDefaultLayout == 0 )
302         return TRUE;
303     FIXME( "( %08lx ): No BiDi\n", dwDefaultLayout );
304     SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
305     return FALSE;
306 }
307
308
309 /***********************************************************************
310  *              CreateDesktopA (USER32.@)
311  */
312 HDESK WINAPI CreateDesktopA( LPSTR lpszDesktop,LPSTR lpszDevice,LPDEVMODEA pDevmode,
313                              DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa )
314 {
315     FIXME("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n", lpszDesktop,lpszDevice,pDevmode,
316           dwFlags,dwDesiredAccess,lpsa );
317     return (HDESK)0xcafedead;
318 }
319
320 /***********************************************************************
321  *              CreateDesktopW (USER32.@)
322  */
323 HDESK WINAPI CreateDesktopW( LPWSTR lpszDesktop,LPWSTR lpszDevice,LPDEVMODEW pDevmode,
324                              DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa)
325 {
326     FIXME("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n",
327           debugstr_w(lpszDesktop),debugstr_w(lpszDevice),pDevmode,
328           dwFlags,dwDesiredAccess,lpsa );
329     return (HDESK)0xcafedead;
330 }
331
332 /******************************************************************************
333  * OpenDesktopA [USER32.@]
334  *
335  *    Not supported on Win9x - returns NULL and calls SetLastError.
336  */
337 HDESK WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
338                                 BOOL fInherit, DWORD dwDesiredAccess )
339 {
340     FIXME("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
341           fInherit,dwDesiredAccess);
342
343     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
344     return 0;
345 }
346
347 /******************************************************************************
348  * OpenInputDesktop [USER32.@]
349  *
350  *    Not supported on Win9x - returns NULL and calls SetLastError.
351  */
352 HDESK WINAPI OpenInputDesktop( DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess )
353 {
354     FIXME("(%lx,%i,%lx): stub\n",dwFlags, fInherit,dwDesiredAccess);
355     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
356     return 0;
357 }
358
359 /***********************************************************************
360  *              CloseDesktop (USER32.@)
361  */
362 BOOL WINAPI CloseDesktop(HDESK hDesk)
363 {
364     FIXME("(%p)\n", hDesk);
365     return TRUE;
366 }
367
368 /******************************************************************************
369  *              EnumDesktopsA [USER32.@]
370  */
371 BOOL WINAPI EnumDesktopsA( HWINSTA hwinsta, DESKTOPENUMPROCA lpEnumFunc,
372                     LPARAM lParam )
373 {
374     ENUMDESKTOPS_LPARAM caller_data;
375
376     caller_data.lpEnumFunc = lpEnumFunc;
377     caller_data.lParam     = lParam;
378     
379     return EnumDesktopsW(hwinsta, EnumDesktopProcWtoA, (LPARAM) &caller_data);
380 }
381
382 /******************************************************************************
383  *              EnumDesktopsW [USER32.@]
384  */
385 BOOL WINAPI EnumDesktopsW( HWINSTA hwinsta, DESKTOPENUMPROCW lpEnumFunc,
386                     LPARAM lParam )
387 {
388     FIXME("%p,%p,%lx): stub\n",hwinsta,lpEnumFunc,lParam);
389     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
390     return FALSE;
391 }
392
393 /***********************************************************************
394  *              EnumDesktopWindows (USER32.@)
395  */
396 BOOL WINAPI EnumDesktopWindows( HDESK hDesktop, WNDENUMPROC lpfn, LPARAM lParam )
397 {
398   FIXME("(%p, %p, 0x%08lx), stub!\n", hDesktop, lpfn, lParam );
399   return TRUE;
400 }
401
402 /***********************************************************************
403  *              CreateWindowStationW (USER32.@)
404  */
405 HWINSTA WINAPI CreateWindowStationW( LPWSTR winstation,DWORD res1,DWORD desiredaccess,
406                                      LPSECURITY_ATTRIBUTES lpsa )
407 {
408     FIXME("(%s,0x%08lx,0x%08lx,%p),stub!\n",debugstr_w(winstation), res1,desiredaccess,lpsa );
409     return (HWINSTA)0xdeadcafe;
410 }
411
412 /***********************************************************************
413  *              CloseWindowStation (USER32.@)
414  */
415 BOOL WINAPI CloseWindowStation(HWINSTA hWinSta)
416 {
417     FIXME("(%p)\n", hWinSta);
418     return TRUE;
419 }
420
421 /***********************************************************************
422  *              SetWindowStationUser (USER32.@)
423  */
424 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2)
425 {
426     FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
427     return 1;
428 }
429
430 /***********************************************************************
431  *              SetProcessWindowStation (USER32.@)
432  */
433 BOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta)
434 {
435     FIXME("(%p),stub!\n",hWinSta);
436     return TRUE;
437 }
438
439 /******************************************************************************
440  *              EnumWindowStationsA [USER32.@]
441  */
442 BOOL WINAPI EnumWindowStationsA( WINSTAENUMPROCA lpEnumFunc, LPARAM lParam)
443 {
444     FIXME("%p,%lx): stub\n",lpEnumFunc,lParam);
445     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
446     return FALSE;
447 }
448
449 /******************************************************************************
450  *              EnumWindowStationsW [USER32.@]
451  */
452 BOOL WINAPI EnumWindowStationsW( WINSTAENUMPROCW lpEnumFunc, LPARAM lParam)
453 {
454     FIXME("%p,%lx): stub\n",lpEnumFunc,lParam);
455     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
456     return FALSE;
457 }
458
459 /***********************************************************************
460  *              GetUserObjectInformationA (USER32.@)
461  */
462 BOOL WINAPI GetUserObjectInformationA( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
463 {
464     FIXME("(%p %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
465     return TRUE;
466 }
467
468 /***********************************************************************
469  *              GetUserObjectInformationW (USER32.@)
470  */
471 BOOL WINAPI GetUserObjectInformationW( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
472 {
473     FIXME("(%p %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
474     return TRUE;
475 }
476
477 /******************************************************************************
478  *              SetUserObjectInformationA   (USER32.@)
479  */
480 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, INT nIndex,
481                                        LPVOID pvInfo, DWORD nLength )
482 {
483     FIXME("(%p,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
484     return TRUE;
485 }
486
487 /***********************************************************************
488  *              GetUserObjectSecurity (USER32.@)
489  */
490 BOOL WINAPI GetUserObjectSecurity(HANDLE hObj, PSECURITY_INFORMATION pSIRequested,
491                                   PSECURITY_DESCRIPTOR pSID, DWORD nLength, LPDWORD lpnLengthNeeded)
492 {
493     FIXME("(%p %p %p len=%ld %p),stub!\n",  hObj, pSIRequested, pSID, nLength, lpnLengthNeeded);
494     return TRUE;
495 }
496
497 /***********************************************************************
498  *              SetUserObjectSecurity (USER32.@)
499  */
500 BOOL WINAPI SetUserObjectSecurity( HANDLE hObj, PSECURITY_INFORMATION pSIRequested,
501                                    PSECURITY_DESCRIPTOR pSID )
502 {
503     FIXME("(%p,%p,%p),stub!\n",hObj,pSIRequested,pSID);
504     return TRUE;
505 }
506
507 /******************************************************************************
508  *              SetThreadDesktop   (USER32.@)
509  */
510 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
511 {
512     FIXME("(%p): stub\n",hDesktop);
513     return TRUE;
514 }
515
516 /***********************************************************************
517  *              RegisterLogonProcess (USER32.@)
518  */
519 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x)
520 {
521     FIXME("(%p,%d),stub!\n",hprocess,x);
522     return 1;
523 }
524
525 /***********************************************************************
526  *              SetLogonNotifyWindow (USER32.@)
527  */
528 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
529 {
530     FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
531     return 1;
532 }
533
534 /***********************************************************************
535  *              EnumDisplayDevicesA (USER32.@)
536  */
537 BOOL WINAPI EnumDisplayDevicesA( LPVOID unused, DWORD i, LPDISPLAY_DEVICEA lpDisplayDevice,
538                                  DWORD dwFlags )
539 {
540     if (i)
541         return FALSE;
542     FIXME("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
543     strcpy(lpDisplayDevice->DeviceName,"X11");
544     strcpy(lpDisplayDevice->DeviceString,"X 11 Windowing System");
545     lpDisplayDevice->StateFlags =
546         DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
547         DISPLAY_DEVICE_PRIMARY_DEVICE |
548         DISPLAY_DEVICE_VGA_COMPATIBLE;
549     return TRUE;
550 }
551
552 /***********************************************************************
553  *              EnumDisplayDevicesW (USER32.@)
554  */
555 BOOL WINAPI EnumDisplayDevicesW( LPVOID unused, DWORD i, LPDISPLAY_DEVICEW lpDisplayDevice,
556                                  DWORD dwFlags )
557 {
558     if (i)
559         return FALSE;
560     FIXME("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
561     MultiByteToWideChar( CP_ACP, 0, "X11", -1, lpDisplayDevice->DeviceName,
562                          sizeof(lpDisplayDevice->DeviceName)/sizeof(WCHAR) );
563     MultiByteToWideChar( CP_ACP, 0, "X11 Windowing System", -1, lpDisplayDevice->DeviceString,
564                          sizeof(lpDisplayDevice->DeviceString)/sizeof(WCHAR) );
565     lpDisplayDevice->StateFlags =
566         DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
567         DISPLAY_DEVICE_PRIMARY_DEVICE |
568         DISPLAY_DEVICE_VGA_COMPATIBLE;
569     return TRUE;
570 }
571
572 /***********************************************************************
573  *              RegisterSystemThread (USER32.@)
574  */
575 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
576 {
577     FIXME("(%08lx, %08lx)\n", flags, reserved);
578 }
579
580 /***********************************************************************
581  *           RegisterShellHookWindow                    [USER32.@]
582  */
583 BOOL WINAPI RegisterShellHookWindow ( HWND hWnd )
584 {
585     FIXME("(%p): stub\n", hWnd);
586     return 0;
587 }
588
589
590 /***********************************************************************
591  *           DeregisterShellHookWindow                  [USER32.@]
592  */
593 HRESULT WINAPI DeregisterShellHookWindow ( DWORD u )
594 {
595     FIXME("0x%08lx stub\n",u);
596     return 0;
597
598 }
599
600
601 /***********************************************************************
602  *           RegisterTasklist                           [USER32.@]
603  */
604 DWORD WINAPI RegisterTasklist (DWORD x)
605 {
606     FIXME("0x%08lx\n",x);
607     return TRUE;
608 }
609
610
611 /***********************************************************************
612  *              RegisterDeviceNotificationA (USER32.@)
613  *
614  * See RegisterDeviceNotificationW.
615  */
616 HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hnd, LPVOID notifyfilter, DWORD flags)
617 {
618     FIXME("(hwnd=%p, filter=%p,flags=0x%08lx), STUB!\n", hnd,notifyfilter,flags );
619     return 0;
620 }
621
622 /***********************************************************************
623  *              RegisterDeviceNotificationW (USER32.@)
624  *
625  * Registers a window with the system so that it will receive
626  * notifications about a device.
627  *
628  * PARAMS
629  *     hRecepient           [I] Window or service status handle that
630  *                              will receive notifications.
631  *     pNotificationFilter  [I] DEV_BROADCAST_HDR followed by some
632  *                              type-specific data.
633  *     dwFlags              [I] See notes
634  *
635  * RETURNS
636  *
637  * A handle to the device notification.
638  *
639  * NOTES
640  *
641  * The dwFlags parameter can be one of two values:
642  *| DEVICE_NOTIFY_WINDOW_HANDLE  - hRecepient is a window handle
643  *| DEVICE_NOTIFY_SERVICE_HANDLE - hRecepient is a service status handle
644  */
645 HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecepient, LPVOID pNotificationFilter, DWORD dwFlags)
646 {
647     FIXME("(hwnd=%p, filter=%p,flags=0x%08lx), STUB!\n", hRecepient,pNotificationFilter,dwFlags );
648     return 0;
649 }
650
651 /***********************************************************************
652  *           GetAppCompatFlags   (USER32.@)
653  */
654 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
655 {
656     FIXME("stub\n");
657     return 0;
658 }
659
660
661 /***********************************************************************
662  *           AlignRects   (USER32.@)
663  */
664 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
665 {
666     FIXME("(%p, %ld, %ld, %ld): stub\n", rect, b, c, d);
667     if (rect)
668         FIXME("rect: [[%ld, %ld], [%ld, %ld]]\n", rect->left, rect->top, rect->right, rect->bottom);
669     /* Calls OffsetRect */
670     return FALSE;
671 }
672
673
674 /***********************************************************************
675  *              LoadLocalFonts (USER32.@)
676  */
677 VOID WINAPI LoadLocalFonts(VOID)
678 {
679     /* are loaded. */
680     return;
681 }
682
683
684 /***********************************************************************
685  *              USER_489 (USER.489)
686  */
687 LONG WINAPI stub_USER_489(void) { FIXME("stub\n"); return 0; }
688
689 /***********************************************************************
690  *              USER_490 (USER.490)
691  */
692 LONG WINAPI stub_USER_490(void) { FIXME("stub\n"); return 0; }
693
694 /***********************************************************************
695  *              USER_492 (USER.492)
696  */
697 LONG WINAPI stub_USER_492(void) { FIXME("stub\n"); return 0; }
698
699 /***********************************************************************
700  *              USER_496 (USER.496)
701  */
702 LONG WINAPI stub_USER_496(void) { FIXME("stub\n"); return 0; }
703
704 /***********************************************************************
705  *              User32InitializeImmEntryTable
706  */
707 BOOL WINAPI User32InitializeImmEntryTable(LPVOID ptr)
708 {
709   FIXME("(%p): stub\n", ptr);
710   return TRUE;
711 }
712
713 /**********************************************************************
714  * WINNLSGetIMEHotkey [USER32.@]
715  *
716  */
717 UINT WINAPI WINNLSGetIMEHotkey(HWND hUnknown1)
718 {
719     FIXME("hUnknown1 %p: stub!\n", hUnknown1);
720     return 0; /* unknown */
721 }
722
723 /**********************************************************************
724  * WINNLSEnableIME [USER32.@]
725  *
726  */
727 BOOL WINAPI WINNLSEnableIME(HWND hUnknown1, BOOL bUnknown2)
728 {
729     FIXME("hUnknown1 %p bUnknown2 %d: stub!\n", hUnknown1, bUnknown2);
730     return TRUE; /* success (?) */
731 }
732
733 /**********************************************************************
734  * WINNLSGetEnableStatus [USER32.@]
735  *
736  */
737 BOOL WINAPI WINNLSGetEnableStatus(HWND hUnknown1)
738 {
739     FIXME("hUnknown1 %p: stub!\n", hUnknown1);
740     return TRUE; /* success (?) */
741 }
742
743 /**********************************************************************
744  * SendIMEMessageExA [USER32.@]
745  *
746  */
747 LRESULT WINAPI SendIMEMessageExA(HWND p1, LPARAM p2)
748 {
749   FIXME("(%p,%lx): stub\n", p1, p2);
750   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
751   return 0;
752 }
753
754 /**********************************************************************
755  * SendIMEMessageExW [USER32.@]
756  *
757  */
758 LRESULT WINAPI SendIMEMessageExW(HWND p1, LPARAM p2)
759 {
760   FIXME("(%p,%lx): stub\n", p1, p2);
761   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
762   return 0;
763 }