user32: Do not block sending/posting WM_NOTIFY messages.
[wine.git] / dlls / user32 / misc.c
blob4faea6be3cd8fdbb050d146167df1c089514431d
1 /*
2 * Misc USER functions
4 * Copyright 1995 Thomas Sandford
5 * Copyright 1997 Marcus Meissner
6 * Copyright 1998 Turchanov Sergey
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "config.h"
25 #include <stdarg.h>
27 #include "windef.h"
28 #include "wine/windef16.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "winnls.h"
33 #include "winternl.h"
34 #include "controls.h"
35 #include "user_private.h"
37 #include "wine/unicode.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(win);
42 #define IMM_INIT_MAGIC 0x19650412
43 static HWND (WINAPI *imm_get_ui_window)(HKL);
45 /* MSIME messages */
46 static UINT WM_MSIME_SERVICE;
47 static UINT WM_MSIME_RECONVERTOPTIONS;
48 static UINT WM_MSIME_MOUSE;
49 static UINT WM_MSIME_RECONVERTREQUEST;
50 static UINT WM_MSIME_RECONVERT;
51 static UINT WM_MSIME_QUERYPOSITION;
52 static UINT WM_MSIME_DOCUMENTFEED;
54 /* USER signal proc flags and codes */
55 /* See UserSignalProc for comments */
56 #define USIG_FLAGS_WIN32 0x0001
57 #define USIG_FLAGS_GUI 0x0002
58 #define USIG_FLAGS_FEEDBACK 0x0004
59 #define USIG_FLAGS_FAULT 0x0008
61 #define USIG_DLL_UNLOAD_WIN16 0x0001
62 #define USIG_DLL_UNLOAD_WIN32 0x0002
63 #define USIG_FAULT_DIALOG_PUSH 0x0003
64 #define USIG_FAULT_DIALOG_POP 0x0004
65 #define USIG_DLL_UNLOAD_ORPHANS 0x0005
66 #define USIG_THREAD_INIT 0x0010
67 #define USIG_THREAD_EXIT 0x0020
68 #define USIG_PROCESS_CREATE 0x0100
69 #define USIG_PROCESS_INIT 0x0200
70 #define USIG_PROCESS_EXIT 0x0300
71 #define USIG_PROCESS_DESTROY 0x0400
72 #define USIG_PROCESS_RUNNING 0x0500
73 #define USIG_PROCESS_LOADED 0x0600
75 /***********************************************************************
76 * SignalProc32 (USER.391)
77 * UserSignalProc (USER32.@)
79 * The exact meaning of the USER signals is undocumented, but this
80 * should cover the basic idea:
82 * USIG_DLL_UNLOAD_WIN16
83 * This is sent when a 16-bit module is unloaded.
85 * USIG_DLL_UNLOAD_WIN32
86 * This is sent when a 32-bit module is unloaded.
88 * USIG_DLL_UNLOAD_ORPHANS
89 * This is sent after the last Win3.1 module is unloaded,
90 * to allow removal of orphaned menus.
92 * USIG_FAULT_DIALOG_PUSH
93 * USIG_FAULT_DIALOG_POP
94 * These are called to allow USER to prepare for displaying a
95 * fault dialog, even though the fault might have happened while
96 * inside a USER critical section.
98 * USIG_THREAD_INIT
99 * This is called from the context of a new thread, as soon as it
100 * has started to run.
102 * USIG_THREAD_EXIT
103 * This is called, still in its context, just before a thread is
104 * about to terminate.
106 * USIG_PROCESS_CREATE
107 * This is called, in the parent process context, after a new process
108 * has been created.
110 * USIG_PROCESS_INIT
111 * This is called in the new process context, just after the main thread
112 * has started execution (after the main thread's USIG_THREAD_INIT has
113 * been sent).
115 * USIG_PROCESS_LOADED
116 * This is called after the executable file has been loaded into the
117 * new process context.
119 * USIG_PROCESS_RUNNING
120 * This is called immediately before the main entry point is called.
122 * USIG_PROCESS_EXIT
123 * This is called in the context of a process that is about to
124 * terminate (but before the last thread's USIG_THREAD_EXIT has
125 * been sent).
127 * USIG_PROCESS_DESTROY
128 * This is called after a process has terminated.
131 * The meaning of the dwFlags bits is as follows:
133 * USIG_FLAGS_WIN32
134 * Current process is 32-bit.
136 * USIG_FLAGS_GUI
137 * Current process is a (Win32) GUI process.
139 * USIG_FLAGS_FEEDBACK
140 * Current process needs 'feedback' (determined from the STARTUPINFO
141 * flags STARTF_FORCEONFEEDBACK / STARTF_FORCEOFFFEEDBACK).
143 * USIG_FLAGS_FAULT
144 * The signal is being sent due to a fault.
146 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
147 DWORD dwFlags, HMODULE16 hModule )
149 FIXME("(%04x, %08x, %04x, %04x)\n",
150 uCode, dwThreadOrProcessID, dwFlags, hModule );
151 /* FIXME: Should chain to GdiSignalProc now. */
152 return 0;
156 /**********************************************************************
157 * SetLastErrorEx [USER32.@]
159 * Sets the last-error code.
161 * RETURNS
162 * None.
164 void WINAPI SetLastErrorEx(
165 DWORD error, /* [in] Per-thread error code */
166 DWORD type) /* [in] Error type */
168 TRACE("(0x%08x, 0x%08x)\n", error,type);
169 switch(type) {
170 case 0:
171 break;
172 case SLE_ERROR:
173 case SLE_MINORERROR:
174 case SLE_WARNING:
175 /* Fall through for now */
176 default:
177 FIXME("(error=%08x, type=%08x): Unhandled type\n", error,type);
178 break;
180 SetLastError( error );
183 /******************************************************************************
184 * GetAltTabInfoA [USER32.@]
186 BOOL WINAPI GetAltTabInfoA(HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
188 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
189 return FALSE;
192 /******************************************************************************
193 * GetAltTabInfoW [USER32.@]
195 BOOL WINAPI GetAltTabInfoW(HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
197 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
198 return FALSE;
201 /******************************************************************************
202 * SetDebugErrorLevel [USER32.@]
203 * Sets the minimum error level for generating debugging events
205 * PARAMS
206 * dwLevel [I] Debugging error level
208 * RETURNS
209 * Nothing.
211 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
213 FIXME("(%d): stub\n", dwLevel);
217 /***********************************************************************
218 * SetWindowStationUser (USER32.@)
220 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2)
222 FIXME("(0x%08x,0x%08x),stub!\n",x1,x2);
223 return 1;
226 /***********************************************************************
227 * RegisterLogonProcess (USER32.@)
229 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x)
231 FIXME("(%p,%d),stub!\n",hprocess,x);
232 return 1;
235 /***********************************************************************
236 * SetLogonNotifyWindow (USER32.@)
238 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
240 FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
241 return 1;
244 static const WCHAR primary_device_name[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
245 static const WCHAR primary_device_string[] = {'X','1','1',' ','W','i','n','d','o','w','i','n','g',' ',
246 'S','y','s','t','e','m',0};
247 static const WCHAR primary_device_deviceid[] = {'P','C','I','\\','V','E','N','_','0','0','0','0','&',
248 'D','E','V','_','0','0','0','0',0};
250 /***********************************************************************
251 * EnumDisplayDevicesA (USER32.@)
253 BOOL WINAPI EnumDisplayDevicesA( LPCSTR lpDevice, DWORD i, LPDISPLAY_DEVICEA lpDispDev,
254 DWORD dwFlags )
256 UNICODE_STRING deviceW;
257 DISPLAY_DEVICEW ddW;
258 BOOL ret;
260 if(lpDevice)
261 RtlCreateUnicodeStringFromAsciiz(&deviceW, lpDevice);
262 else
263 deviceW.Buffer = NULL;
265 ddW.cb = sizeof(ddW);
266 ret = EnumDisplayDevicesW(deviceW.Buffer, i, &ddW, dwFlags);
267 RtlFreeUnicodeString(&deviceW);
269 if(!ret) return ret;
271 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceName, -1, lpDispDev->DeviceName, sizeof(lpDispDev->DeviceName), NULL, NULL);
272 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceString, -1, lpDispDev->DeviceString, sizeof(lpDispDev->DeviceString), NULL, NULL);
273 lpDispDev->StateFlags = ddW.StateFlags;
275 if(lpDispDev->cb >= offsetof(DISPLAY_DEVICEA, DeviceID) + sizeof(lpDispDev->DeviceID))
276 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceID, -1, lpDispDev->DeviceID, sizeof(lpDispDev->DeviceID), NULL, NULL);
277 if(lpDispDev->cb >= offsetof(DISPLAY_DEVICEA, DeviceKey) + sizeof(lpDispDev->DeviceKey))
278 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceKey, -1, lpDispDev->DeviceKey, sizeof(lpDispDev->DeviceKey), NULL, NULL);
280 return TRUE;
283 /***********************************************************************
284 * EnumDisplayDevicesW (USER32.@)
286 BOOL WINAPI EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD i, LPDISPLAY_DEVICEW lpDisplayDevice,
287 DWORD dwFlags )
289 FIXME("(%s,%d,%p,0x%08x), stub!\n",debugstr_w(lpDevice),i,lpDisplayDevice,dwFlags);
291 if (i)
292 return FALSE;
294 memcpy(lpDisplayDevice->DeviceName, primary_device_name, sizeof(primary_device_name));
295 memcpy(lpDisplayDevice->DeviceString, primary_device_string, sizeof(primary_device_string));
297 lpDisplayDevice->StateFlags =
298 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
299 DISPLAY_DEVICE_PRIMARY_DEVICE |
300 DISPLAY_DEVICE_VGA_COMPATIBLE;
302 if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(lpDisplayDevice->DeviceID))
303 memcpy(lpDisplayDevice->DeviceID, primary_device_deviceid, sizeof(primary_device_deviceid));
304 if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceKey) + sizeof(lpDisplayDevice->DeviceKey))
305 lpDisplayDevice->DeviceKey[0] = 0;
307 return TRUE;
310 struct monitor_enum_info
312 RECT rect;
313 UINT max_area;
314 UINT min_distance;
315 HMONITOR primary;
316 HMONITOR nearest;
317 HMONITOR ret;
320 /* helper callback for MonitorFromRect */
321 static BOOL CALLBACK monitor_enum( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
323 struct monitor_enum_info *info = (struct monitor_enum_info *)lp;
324 RECT intersect;
326 if (IntersectRect( &intersect, rect, &info->rect ))
328 /* check for larger intersecting area */
329 UINT area = (intersect.right - intersect.left) * (intersect.bottom - intersect.top);
330 if (area > info->max_area)
332 info->max_area = area;
333 info->ret = monitor;
336 else if (!info->max_area) /* if not intersecting, check for min distance */
338 UINT distance;
339 UINT x, y;
341 if (info->rect.right <= rect->left) x = rect->left - info->rect.right;
342 else if (rect->right <= info->rect.left) x = info->rect.left - rect->right;
343 else x = 0;
344 if (info->rect.bottom <= rect->top) y = rect->top - info->rect.bottom;
345 else if (rect->bottom <= info->rect.top) y = info->rect.top - rect->bottom;
346 else y = 0;
347 distance = x * x + y * y;
348 if (distance < info->min_distance)
350 info->min_distance = distance;
351 info->nearest = monitor;
354 if (!info->primary)
356 MONITORINFO mon_info;
357 mon_info.cbSize = sizeof(mon_info);
358 GetMonitorInfoW( monitor, &mon_info );
359 if (mon_info.dwFlags & MONITORINFOF_PRIMARY) info->primary = monitor;
361 return TRUE;
364 /***********************************************************************
365 * MonitorFromRect (USER32.@)
367 HMONITOR WINAPI MonitorFromRect( LPRECT rect, DWORD flags )
369 struct monitor_enum_info info;
371 info.rect = *rect;
372 info.max_area = 0;
373 info.min_distance = ~0u;
374 info.primary = 0;
375 info.nearest = 0;
376 info.ret = 0;
378 if (IsRectEmpty(&info.rect))
380 info.rect.right = info.rect.left + 1;
381 info.rect.bottom = info.rect.top + 1;
384 if (!EnumDisplayMonitors( 0, NULL, monitor_enum, (LPARAM)&info )) return 0;
385 if (!info.ret)
387 if (flags & MONITOR_DEFAULTTOPRIMARY) info.ret = info.primary;
388 else if (flags & MONITOR_DEFAULTTONEAREST) info.ret = info.nearest;
391 TRACE( "%s flags %x returning %p\n", wine_dbgstr_rect(rect), flags, info.ret );
392 return info.ret;
395 /***********************************************************************
396 * MonitorFromPoint (USER32.@)
398 HMONITOR WINAPI MonitorFromPoint( POINT pt, DWORD flags )
400 RECT rect;
402 SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 );
403 return MonitorFromRect( &rect, flags );
406 /***********************************************************************
407 * MonitorFromWindow (USER32.@)
409 HMONITOR WINAPI MonitorFromWindow(HWND hWnd, DWORD dwFlags)
411 RECT rect;
412 WINDOWPLACEMENT wp;
414 TRACE("(%p, 0x%08x)\n", hWnd, dwFlags);
416 if (IsIconic(hWnd) && GetWindowPlacement(hWnd, &wp))
417 return MonitorFromRect( &wp.rcNormalPosition, dwFlags );
419 if (GetWindowRect( hWnd, &rect ))
420 return MonitorFromRect( &rect, dwFlags );
422 if (!(dwFlags & (MONITOR_DEFAULTTOPRIMARY|MONITOR_DEFAULTTONEAREST))) return 0;
423 /* retrieve the primary */
424 SetRect( &rect, 0, 0, 1, 1 );
425 return MonitorFromRect( &rect, dwFlags );
428 /***********************************************************************
429 * GetMonitorInfoA (USER32.@)
431 BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
433 MONITORINFOEXW miW;
434 MONITORINFOEXA *miA = (MONITORINFOEXA*)lpMonitorInfo;
435 BOOL ret;
437 if((miA->cbSize != sizeof(MONITORINFOEXA)) && (miA->cbSize != sizeof(MONITORINFO)))
438 return FALSE;
440 miW.cbSize = sizeof(miW);
442 ret = GetMonitorInfoW(hMonitor, (MONITORINFO*)&miW);
443 if(!ret) return ret;
445 miA->rcMonitor = miW.rcMonitor;
446 miA->rcWork = miW.rcWork;
447 miA->dwFlags = miW.dwFlags;
448 if(miA->cbSize == sizeof(MONITORINFOEXA))
449 WideCharToMultiByte(CP_ACP, 0, miW.szDevice, -1, miA->szDevice, sizeof(miA->szDevice), NULL, NULL);
450 return ret;
453 /***********************************************************************
454 * GetMonitorInfoW (USER32.@)
456 BOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
458 BOOL ret;
460 if (lpMonitorInfo->cbSize != sizeof(MONITORINFOEXW) && lpMonitorInfo->cbSize != sizeof(MONITORINFO))
461 return FALSE;
463 ret = USER_Driver->pGetMonitorInfo( hMonitor, lpMonitorInfo );
464 if (ret)
465 TRACE("flags %04x, monitor %s, work %s\n", lpMonitorInfo->dwFlags,
466 wine_dbgstr_rect(&lpMonitorInfo->rcMonitor),
467 wine_dbgstr_rect(&lpMonitorInfo->rcWork));
468 return ret;
471 #ifdef __i386__
472 /* Some apps pass a non-stdcall callback to EnumDisplayMonitors,
473 * so we need a small assembly wrapper to call it.
474 * MJ's Help Diagnostic expects that %ecx contains the address to the rect.
476 struct enumdisplaymonitors_lparam
478 MONITORENUMPROC proc;
479 LPARAM lparam;
482 extern BOOL CALLBACK enumdisplaymonitors_callback_wrapper(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lparam);
483 __ASM_STDCALL_FUNC( enumdisplaymonitors_callback_wrapper, 16,
484 "pushl %ebp\n\t"
485 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
486 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
487 "movl %esp,%ebp\n\t"
488 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
489 "subl $8,%esp\n\t"
490 "movl 20(%ebp),%eax\n\t" /* struct enumdisplaymonitors_lparam *orig = (struct enumdisplaymonitors_lparam*)lparam */
491 "pushl 4(%eax)\n\t" /* push orig->lparam */
492 "pushl 16(%ebp)\n\t"
493 "pushl 12(%ebp)\n\t"
494 "pushl 8(%ebp)\n\t"
495 "movl 16(%ebp),%ecx\n\t"
496 "call *(%eax)\n\t" /* call orig->proc */
497 "leave\n\t"
498 __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
499 __ASM_CFI(".cfi_same_value %ebp\n\t")
500 "ret $16" )
501 #endif /* __i386__ */
503 /***********************************************************************
504 * EnumDisplayMonitors (USER32.@)
506 BOOL WINAPI EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
508 #ifdef __i386__
509 struct enumdisplaymonitors_lparam orig = { proc, lp };
510 proc = enumdisplaymonitors_callback_wrapper;
511 lp = (LPARAM)&orig;
512 #endif
513 return USER_Driver->pEnumDisplayMonitors( hdc, rect, proc, lp );
517 /***********************************************************************
518 * QueryDisplayConfig (USER32.@)
520 LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numpathelements, DISPLAYCONFIG_PATH_INFO *pathinfo,
521 UINT32 *numinfoelements, DISPLAYCONFIG_MODE_INFO *modeinfo,
522 DISPLAYCONFIG_TOPOLOGY_ID *topologyid)
524 FIXME("(%08x %p %p %p %p %p)\n", flags, numpathelements, pathinfo, numinfoelements, modeinfo, topologyid);
525 return ERROR_CALL_NOT_IMPLEMENTED;
528 /***********************************************************************
529 * RegisterSystemThread (USER32.@)
531 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
533 FIXME("(%08x, %08x)\n", flags, reserved);
536 /***********************************************************************
537 * RegisterShellHookWindow [USER32.@]
539 BOOL WINAPI RegisterShellHookWindow ( HWND hWnd )
541 FIXME("(%p): stub\n", hWnd);
542 return FALSE;
546 /***********************************************************************
547 * DeregisterShellHookWindow [USER32.@]
549 HRESULT WINAPI DeregisterShellHookWindow ( DWORD u )
551 FIXME("0x%08x stub\n",u);
552 return 0;
557 /***********************************************************************
558 * RegisterTasklist [USER32.@]
560 DWORD WINAPI RegisterTasklist (DWORD x)
562 FIXME("0x%08x\n",x);
563 return TRUE;
567 /***********************************************************************
568 * RegisterDeviceNotificationA (USER32.@)
570 * See RegisterDeviceNotificationW.
572 HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hnd, LPVOID notifyfilter, DWORD flags)
574 FIXME("(hwnd=%p, filter=%p,flags=0x%08x) returns a fake device notification handle!\n",
575 hnd,notifyfilter,flags );
576 return (HDEVNOTIFY) 0xcafecafe;
579 /***********************************************************************
580 * RegisterDeviceNotificationW (USER32.@)
582 * Registers a window with the system so that it will receive
583 * notifications about a device.
585 * PARAMS
586 * hRecipient [I] Window or service status handle that
587 * will receive notifications.
588 * pNotificationFilter [I] DEV_BROADCAST_HDR followed by some
589 * type-specific data.
590 * dwFlags [I] See notes
592 * RETURNS
594 * A handle to the device notification.
596 * NOTES
598 * The dwFlags parameter can be one of two values:
599 *| DEVICE_NOTIFY_WINDOW_HANDLE - hRecipient is a window handle
600 *| DEVICE_NOTIFY_SERVICE_HANDLE - hRecipient is a service status handle
602 HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecipient, LPVOID pNotificationFilter, DWORD dwFlags)
604 FIXME("(hwnd=%p, filter=%p,flags=0x%08x) returns a fake device notification handle!\n",
605 hRecipient,pNotificationFilter,dwFlags );
606 return (HDEVNOTIFY) 0xcafeaffe;
609 /***********************************************************************
610 * UnregisterDeviceNotification (USER32.@)
613 BOOL WINAPI UnregisterDeviceNotification(HDEVNOTIFY hnd)
615 FIXME("(handle=%p), STUB!\n", hnd);
616 return TRUE;
619 /***********************************************************************
620 * GetAppCompatFlags (USER32.@)
622 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
624 FIXME("(%p) stub\n", hTask);
625 return 0;
628 /***********************************************************************
629 * GetAppCompatFlags2 (USER32.@)
631 DWORD WINAPI GetAppCompatFlags2( HTASK hTask )
633 FIXME("(%p) stub\n", hTask);
634 return 0;
638 /***********************************************************************
639 * AlignRects (USER32.@)
641 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
643 FIXME("(%p, %d, %d, %d): stub\n", rect, b, c, d);
644 if (rect)
645 FIXME("rect: [[%d, %d], [%d, %d]]\n", rect->left, rect->top, rect->right, rect->bottom);
646 /* Calls OffsetRect */
647 return FALSE;
651 /***********************************************************************
652 * LoadLocalFonts (USER32.@)
654 VOID WINAPI LoadLocalFonts(VOID)
656 /* are loaded. */
657 return;
661 /***********************************************************************
662 * User32InitializeImmEntryTable
664 BOOL WINAPI User32InitializeImmEntryTable(DWORD magic)
666 static const WCHAR imm32_dllW[] = {'i','m','m','3','2','.','d','l','l',0};
667 HMODULE imm32 = GetModuleHandleW(imm32_dllW);
669 TRACE("(%x)\n", magic);
671 if (!imm32 || magic != IMM_INIT_MAGIC)
672 return FALSE;
674 if (imm_get_ui_window)
675 return TRUE;
677 WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService");
678 WM_MSIME_RECONVERTOPTIONS = RegisterWindowMessageA("MSIMEReconvertOptions");
679 WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation");
680 WM_MSIME_RECONVERTREQUEST = RegisterWindowMessageA("MSIMEReconvertRequest");
681 WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
682 WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
683 WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
685 /* this part is not compatible with native imm32.dll */
686 imm_get_ui_window = (void*)GetProcAddress(imm32, "__wine_get_ui_window");
687 if (!imm_get_ui_window)
688 FIXME("native imm32.dll not supported\n");
689 return TRUE;
692 /**********************************************************************
693 * WINNLSGetIMEHotkey [USER32.@]
696 UINT WINAPI WINNLSGetIMEHotkey(HWND hwnd)
698 FIXME("hwnd %p: stub!\n", hwnd);
699 return 0; /* unknown */
702 /**********************************************************************
703 * WINNLSEnableIME [USER32.@]
706 BOOL WINAPI WINNLSEnableIME(HWND hwnd, BOOL enable)
708 FIXME("hwnd %p enable %d: stub!\n", hwnd, enable);
709 return TRUE; /* success (?) */
712 /**********************************************************************
713 * WINNLSGetEnableStatus [USER32.@]
716 BOOL WINAPI WINNLSGetEnableStatus(HWND hwnd)
718 FIXME("hwnd %p: stub!\n", hwnd);
719 return TRUE; /* success (?) */
722 /**********************************************************************
723 * SendIMEMessageExA [USER32.@]
726 LRESULT WINAPI SendIMEMessageExA(HWND hwnd, LPARAM lparam)
728 FIXME("(%p,%lx): stub\n", hwnd, lparam);
729 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
730 return 0;
733 /**********************************************************************
734 * SendIMEMessageExW [USER32.@]
737 LRESULT WINAPI SendIMEMessageExW(HWND hwnd, LPARAM lparam)
739 FIXME("(%p,%lx): stub\n", hwnd, lparam);
740 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
741 return 0;
744 /**********************************************************************
745 * DisableProcessWindowsGhosting [USER32.@]
748 VOID WINAPI DisableProcessWindowsGhosting(VOID)
750 FIXME(": stub\n");
751 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
752 return;
755 /**********************************************************************
756 * UserHandleGrantAccess [USER32.@]
759 BOOL WINAPI UserHandleGrantAccess(HANDLE handle, HANDLE job, BOOL grant)
761 FIXME("(%p,%p,%d): stub\n", handle, job, grant);
762 return TRUE;
765 /**********************************************************************
766 * RegisterPowerSettingNotification [USER32.@]
768 HPOWERNOTIFY WINAPI RegisterPowerSettingNotification(HANDLE recipient, const GUID *guid, DWORD flags)
770 FIXME("(%p,%s,%x): stub\n", recipient, debugstr_guid(guid), flags);
771 return (HPOWERNOTIFY)0xdeadbeef;
774 /**********************************************************************
775 * UnregisterPowerSettingNotification [USER32.@]
777 BOOL WINAPI UnregisterPowerSettingNotification(HPOWERNOTIFY handle)
779 FIXME("(%p): stub\n", handle);
780 return TRUE;
783 /*****************************************************************************
784 * GetGestureConfig (USER32.@)
786 BOOL WINAPI GetGestureConfig( HWND hwnd, DWORD reserved, DWORD flags, UINT *count, GESTURECONFIG *config, UINT size )
788 FIXME("(%p %08x %08x %p %p %u): stub\n", hwnd, reserved, flags, count, config, size);
789 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
790 return FALSE;
793 /**********************************************************************
794 * SetGestureConfig [USER32.@]
796 BOOL WINAPI SetGestureConfig( HWND hwnd, DWORD reserved, UINT id, PGESTURECONFIG config, UINT size )
798 FIXME("(%p %08x %u %p %u): stub\n", hwnd, reserved, id, config, size);
799 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
800 return FALSE;
803 /**********************************************************************
804 * IsTouchWindow [USER32.@]
806 BOOL WINAPI IsTouchWindow( HWND hwnd, PULONG flags )
808 FIXME("(%p %p): stub\n", hwnd, flags);
809 return FALSE;
812 /**********************************************************************
813 * IsWindowRedirectedForPrint [USER32.@]
815 BOOL WINAPI IsWindowRedirectedForPrint( HWND hwnd )
817 FIXME("(%p): stub\n", hwnd);
818 return FALSE;
821 /**********************************************************************
822 * GetDisplayConfigBufferSizes [USER32.@]
824 LONG WINAPI GetDisplayConfigBufferSizes(UINT32 flags, UINT32 *num_path_info, UINT32 *num_mode_info)
826 FIXME("(0x%x %p %p): stub\n", flags, num_path_info, num_mode_info);
828 if (!num_path_info || !num_mode_info)
829 return ERROR_INVALID_PARAMETER;
831 *num_path_info = 0;
832 *num_mode_info = 0;
833 return ERROR_NOT_SUPPORTED;
836 static const WCHAR imeW[] = {'I','M','E',0};
837 const struct builtin_class_descr IME_builtin_class =
839 imeW, /* name */
840 0, /* style */
841 WINPROC_IME, /* proc */
842 2*sizeof(LONG_PTR), /* extra */
843 IDC_ARROW, /* cursor */
844 0 /* brush */
847 static BOOL is_ime_ui_msg( UINT msg )
849 switch(msg) {
850 case WM_IME_STARTCOMPOSITION:
851 case WM_IME_ENDCOMPOSITION:
852 case WM_IME_COMPOSITION:
853 case WM_IME_SETCONTEXT:
854 case WM_IME_NOTIFY:
855 case WM_IME_CONTROL:
856 case WM_IME_COMPOSITIONFULL:
857 case WM_IME_SELECT:
858 case WM_IME_CHAR:
859 case WM_IME_REQUEST:
860 case WM_IME_KEYDOWN:
861 case WM_IME_KEYUP:
862 return TRUE;
863 default:
864 if ((msg == WM_MSIME_RECONVERTOPTIONS) ||
865 (msg == WM_MSIME_SERVICE) ||
866 (msg == WM_MSIME_MOUSE) ||
867 (msg == WM_MSIME_RECONVERTREQUEST) ||
868 (msg == WM_MSIME_RECONVERT) ||
869 (msg == WM_MSIME_QUERYPOSITION) ||
870 (msg == WM_MSIME_DOCUMENTFEED))
871 return TRUE;
873 return FALSE;
877 LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
879 HWND uiwnd;
881 if (msg==WM_CREATE || msg==WM_NCCREATE)
882 return TRUE;
884 if (imm_get_ui_window && is_ime_ui_msg(msg))
886 if ((uiwnd = imm_get_ui_window(GetKeyboardLayout(0))))
887 return SendMessageA(uiwnd, msg, wParam, lParam);
888 return FALSE;
891 return DefWindowProcA(hwnd, msg, wParam, lParam);
894 LRESULT WINAPI ImeWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
896 HWND uiwnd;
898 if (msg==WM_CREATE || msg==WM_NCCREATE)
899 return TRUE;
901 if (imm_get_ui_window && is_ime_ui_msg(msg))
903 if ((uiwnd = imm_get_ui_window(GetKeyboardLayout(0))))
904 return SendMessageW(uiwnd, msg, wParam, lParam);
905 return FALSE;
908 return DefWindowProcW(hwnd, msg, wParam, lParam);