wined3d: Avoid the deprecated syntax for SM3 varyings on core profile.
[wine/multimedia.git] / dlls / user32 / misc.c
blobd2b4b738326ea4f38a9b1bc0ae42a1eed89ac8d1
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 <stdarg.h>
25 #include "windef.h"
26 #include "wine/windef16.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "winnls.h"
31 #include "winternl.h"
32 #include "controls.h"
33 #include "user_private.h"
35 #include "wine/unicode.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(win);
40 #define IMM_INIT_MAGIC 0x19650412
41 static HWND (WINAPI *imm_get_ui_window)(HKL);
43 /* MSIME messages */
44 static UINT WM_MSIME_SERVICE;
45 static UINT WM_MSIME_RECONVERTOPTIONS;
46 static UINT WM_MSIME_MOUSE;
47 static UINT WM_MSIME_RECONVERTREQUEST;
48 static UINT WM_MSIME_RECONVERT;
49 static UINT WM_MSIME_QUERYPOSITION;
50 static UINT WM_MSIME_DOCUMENTFEED;
52 /* USER signal proc flags and codes */
53 /* See UserSignalProc for comments */
54 #define USIG_FLAGS_WIN32 0x0001
55 #define USIG_FLAGS_GUI 0x0002
56 #define USIG_FLAGS_FEEDBACK 0x0004
57 #define USIG_FLAGS_FAULT 0x0008
59 #define USIG_DLL_UNLOAD_WIN16 0x0001
60 #define USIG_DLL_UNLOAD_WIN32 0x0002
61 #define USIG_FAULT_DIALOG_PUSH 0x0003
62 #define USIG_FAULT_DIALOG_POP 0x0004
63 #define USIG_DLL_UNLOAD_ORPHANS 0x0005
64 #define USIG_THREAD_INIT 0x0010
65 #define USIG_THREAD_EXIT 0x0020
66 #define USIG_PROCESS_CREATE 0x0100
67 #define USIG_PROCESS_INIT 0x0200
68 #define USIG_PROCESS_EXIT 0x0300
69 #define USIG_PROCESS_DESTROY 0x0400
70 #define USIG_PROCESS_RUNNING 0x0500
71 #define USIG_PROCESS_LOADED 0x0600
73 /***********************************************************************
74 * SignalProc32 (USER.391)
75 * UserSignalProc (USER32.@)
77 * The exact meaning of the USER signals is undocumented, but this
78 * should cover the basic idea:
80 * USIG_DLL_UNLOAD_WIN16
81 * This is sent when a 16-bit module is unloaded.
83 * USIG_DLL_UNLOAD_WIN32
84 * This is sent when a 32-bit module is unloaded.
86 * USIG_DLL_UNLOAD_ORPHANS
87 * This is sent after the last Win3.1 module is unloaded,
88 * to allow removal of orphaned menus.
90 * USIG_FAULT_DIALOG_PUSH
91 * USIG_FAULT_DIALOG_POP
92 * These are called to allow USER to prepare for displaying a
93 * fault dialog, even though the fault might have happened while
94 * inside a USER critical section.
96 * USIG_THREAD_INIT
97 * This is called from the context of a new thread, as soon as it
98 * has started to run.
100 * USIG_THREAD_EXIT
101 * This is called, still in its context, just before a thread is
102 * about to terminate.
104 * USIG_PROCESS_CREATE
105 * This is called, in the parent process context, after a new process
106 * has been created.
108 * USIG_PROCESS_INIT
109 * This is called in the new process context, just after the main thread
110 * has started execution (after the main thread's USIG_THREAD_INIT has
111 * been sent).
113 * USIG_PROCESS_LOADED
114 * This is called after the executable file has been loaded into the
115 * new process context.
117 * USIG_PROCESS_RUNNING
118 * This is called immediately before the main entry point is called.
120 * USIG_PROCESS_EXIT
121 * This is called in the context of a process that is about to
122 * terminate (but before the last thread's USIG_THREAD_EXIT has
123 * been sent).
125 * USIG_PROCESS_DESTROY
126 * This is called after a process has terminated.
129 * The meaning of the dwFlags bits is as follows:
131 * USIG_FLAGS_WIN32
132 * Current process is 32-bit.
134 * USIG_FLAGS_GUI
135 * Current process is a (Win32) GUI process.
137 * USIG_FLAGS_FEEDBACK
138 * Current process needs 'feedback' (determined from the STARTUPINFO
139 * flags STARTF_FORCEONFEEDBACK / STARTF_FORCEOFFFEEDBACK).
141 * USIG_FLAGS_FAULT
142 * The signal is being sent due to a fault.
144 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
145 DWORD dwFlags, HMODULE16 hModule )
147 FIXME("(%04x, %08x, %04x, %04x)\n",
148 uCode, dwThreadOrProcessID, dwFlags, hModule );
149 /* FIXME: Should chain to GdiSignalProc now. */
150 return 0;
154 /**********************************************************************
155 * SetLastErrorEx [USER32.@]
157 * Sets the last-error code.
159 * RETURNS
160 * None.
162 void WINAPI SetLastErrorEx(
163 DWORD error, /* [in] Per-thread error code */
164 DWORD type) /* [in] Error type */
166 TRACE("(0x%08x, 0x%08x)\n", error,type);
167 switch(type) {
168 case 0:
169 break;
170 case SLE_ERROR:
171 case SLE_MINORERROR:
172 case SLE_WARNING:
173 /* Fall through for now */
174 default:
175 FIXME("(error=%08x, type=%08x): Unhandled type\n", error,type);
176 break;
178 SetLastError( error );
181 /******************************************************************************
182 * GetAltTabInfoA [USER32.@]
184 BOOL WINAPI GetAltTabInfoA(HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
186 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
187 return FALSE;
190 /******************************************************************************
191 * GetAltTabInfoW [USER32.@]
193 BOOL WINAPI GetAltTabInfoW(HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
195 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
196 return FALSE;
199 /******************************************************************************
200 * SetDebugErrorLevel [USER32.@]
201 * Sets the minimum error level for generating debugging events
203 * PARAMS
204 * dwLevel [I] Debugging error level
206 * RETURNS
207 * Nothing.
209 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
211 FIXME("(%d): stub\n", dwLevel);
215 /***********************************************************************
216 * SetWindowStationUser (USER32.@)
218 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2)
220 FIXME("(0x%08x,0x%08x),stub!\n",x1,x2);
221 return 1;
224 /***********************************************************************
225 * RegisterLogonProcess (USER32.@)
227 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x)
229 FIXME("(%p,%d),stub!\n",hprocess,x);
230 return 1;
233 /***********************************************************************
234 * SetLogonNotifyWindow (USER32.@)
236 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
238 FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
239 return 1;
242 static const WCHAR primary_device_name[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
243 static const WCHAR primary_device_string[] = {'X','1','1',' ','W','i','n','d','o','w','i','n','g',' ',
244 'S','y','s','t','e','m',0};
245 static const WCHAR primary_device_deviceid[] = {'P','C','I','\\','V','E','N','_','0','0','0','0','&',
246 'D','E','V','_','0','0','0','0',0};
248 /***********************************************************************
249 * EnumDisplayDevicesA (USER32.@)
251 BOOL WINAPI EnumDisplayDevicesA( LPCSTR lpDevice, DWORD i, LPDISPLAY_DEVICEA lpDispDev,
252 DWORD dwFlags )
254 UNICODE_STRING deviceW;
255 DISPLAY_DEVICEW ddW;
256 BOOL ret;
258 if(lpDevice)
259 RtlCreateUnicodeStringFromAsciiz(&deviceW, lpDevice);
260 else
261 deviceW.Buffer = NULL;
263 ddW.cb = sizeof(ddW);
264 ret = EnumDisplayDevicesW(deviceW.Buffer, i, &ddW, dwFlags);
265 RtlFreeUnicodeString(&deviceW);
267 if(!ret) return ret;
269 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceName, -1, lpDispDev->DeviceName, sizeof(lpDispDev->DeviceName), NULL, NULL);
270 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceString, -1, lpDispDev->DeviceString, sizeof(lpDispDev->DeviceString), NULL, NULL);
271 lpDispDev->StateFlags = ddW.StateFlags;
273 if(lpDispDev->cb >= offsetof(DISPLAY_DEVICEA, DeviceID) + sizeof(lpDispDev->DeviceID))
274 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceID, -1, lpDispDev->DeviceID, sizeof(lpDispDev->DeviceID), NULL, NULL);
275 if(lpDispDev->cb >= offsetof(DISPLAY_DEVICEA, DeviceKey) + sizeof(lpDispDev->DeviceKey))
276 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceKey, -1, lpDispDev->DeviceKey, sizeof(lpDispDev->DeviceKey), NULL, NULL);
278 return TRUE;
281 /***********************************************************************
282 * EnumDisplayDevicesW (USER32.@)
284 BOOL WINAPI EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD i, LPDISPLAY_DEVICEW lpDisplayDevice,
285 DWORD dwFlags )
287 FIXME("(%s,%d,%p,0x%08x), stub!\n",debugstr_w(lpDevice),i,lpDisplayDevice,dwFlags);
289 if (i)
290 return FALSE;
292 memcpy(lpDisplayDevice->DeviceName, primary_device_name, sizeof(primary_device_name));
293 memcpy(lpDisplayDevice->DeviceString, primary_device_string, sizeof(primary_device_string));
295 lpDisplayDevice->StateFlags =
296 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
297 DISPLAY_DEVICE_PRIMARY_DEVICE |
298 DISPLAY_DEVICE_VGA_COMPATIBLE;
300 if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(lpDisplayDevice->DeviceID))
301 memcpy(lpDisplayDevice->DeviceID, primary_device_deviceid, sizeof(primary_device_deviceid));
302 if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceKey) + sizeof(lpDisplayDevice->DeviceKey))
303 lpDisplayDevice->DeviceKey[0] = 0;
305 return TRUE;
308 struct monitor_enum_info
310 RECT rect;
311 UINT max_area;
312 UINT min_distance;
313 HMONITOR primary;
314 HMONITOR nearest;
315 HMONITOR ret;
318 /* helper callback for MonitorFromRect */
319 static BOOL CALLBACK monitor_enum( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
321 struct monitor_enum_info *info = (struct monitor_enum_info *)lp;
322 RECT intersect;
324 if (IntersectRect( &intersect, rect, &info->rect ))
326 /* check for larger intersecting area */
327 UINT area = (intersect.right - intersect.left) * (intersect.bottom - intersect.top);
328 if (area > info->max_area)
330 info->max_area = area;
331 info->ret = monitor;
334 else if (!info->max_area) /* if not intersecting, check for min distance */
336 UINT distance;
337 UINT x, y;
339 if (info->rect.right <= rect->left) x = rect->left - info->rect.right;
340 else if (rect->right <= info->rect.left) x = info->rect.left - rect->right;
341 else x = 0;
342 if (info->rect.bottom <= rect->top) y = rect->top - info->rect.bottom;
343 else if (rect->bottom <= info->rect.top) y = info->rect.top - rect->bottom;
344 else y = 0;
345 distance = x * x + y * y;
346 if (distance < info->min_distance)
348 info->min_distance = distance;
349 info->nearest = monitor;
352 if (!info->primary)
354 MONITORINFO mon_info;
355 mon_info.cbSize = sizeof(mon_info);
356 GetMonitorInfoW( monitor, &mon_info );
357 if (mon_info.dwFlags & MONITORINFOF_PRIMARY) info->primary = monitor;
359 return TRUE;
362 /***********************************************************************
363 * MonitorFromRect (USER32.@)
365 HMONITOR WINAPI MonitorFromRect( LPRECT rect, DWORD flags )
367 struct monitor_enum_info info;
369 info.rect = *rect;
370 info.max_area = 0;
371 info.min_distance = ~0u;
372 info.primary = 0;
373 info.nearest = 0;
374 info.ret = 0;
376 if (IsRectEmpty(&info.rect))
378 info.rect.right = info.rect.left + 1;
379 info.rect.bottom = info.rect.top + 1;
382 if (!EnumDisplayMonitors( 0, NULL, monitor_enum, (LPARAM)&info )) return 0;
383 if (!info.ret)
385 if (flags & MONITOR_DEFAULTTOPRIMARY) info.ret = info.primary;
386 else if (flags & MONITOR_DEFAULTTONEAREST) info.ret = info.nearest;
389 TRACE( "%s flags %x returning %p\n", wine_dbgstr_rect(rect), flags, info.ret );
390 return info.ret;
393 /***********************************************************************
394 * MonitorFromPoint (USER32.@)
396 HMONITOR WINAPI MonitorFromPoint( POINT pt, DWORD flags )
398 RECT rect;
400 SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 );
401 return MonitorFromRect( &rect, flags );
404 /***********************************************************************
405 * MonitorFromWindow (USER32.@)
407 HMONITOR WINAPI MonitorFromWindow(HWND hWnd, DWORD dwFlags)
409 RECT rect;
410 WINDOWPLACEMENT wp;
412 TRACE("(%p, 0x%08x)\n", hWnd, dwFlags);
414 if (IsIconic(hWnd) && GetWindowPlacement(hWnd, &wp))
415 return MonitorFromRect( &wp.rcNormalPosition, dwFlags );
417 if (GetWindowRect( hWnd, &rect ))
418 return MonitorFromRect( &rect, dwFlags );
420 if (!(dwFlags & (MONITOR_DEFAULTTOPRIMARY|MONITOR_DEFAULTTONEAREST))) return 0;
421 /* retrieve the primary */
422 SetRect( &rect, 0, 0, 1, 1 );
423 return MonitorFromRect( &rect, dwFlags );
426 /***********************************************************************
427 * GetMonitorInfoA (USER32.@)
429 BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
431 MONITORINFOEXW miW;
432 MONITORINFOEXA *miA = (MONITORINFOEXA*)lpMonitorInfo;
433 BOOL ret;
435 if((miA->cbSize != sizeof(MONITORINFOEXA)) && (miA->cbSize != sizeof(MONITORINFO)))
436 return FALSE;
438 miW.cbSize = sizeof(miW);
440 ret = GetMonitorInfoW(hMonitor, (MONITORINFO*)&miW);
441 if(!ret) return ret;
443 miA->rcMonitor = miW.rcMonitor;
444 miA->rcWork = miW.rcWork;
445 miA->dwFlags = miW.dwFlags;
446 if(miA->cbSize == sizeof(MONITORINFOEXA))
447 WideCharToMultiByte(CP_ACP, 0, miW.szDevice, -1, miA->szDevice, sizeof(miA->szDevice), NULL, NULL);
448 return ret;
451 /***********************************************************************
452 * GetMonitorInfoW (USER32.@)
454 BOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
456 BOOL ret;
458 if (lpMonitorInfo->cbSize != sizeof(MONITORINFOEXW) && lpMonitorInfo->cbSize != sizeof(MONITORINFO))
459 return FALSE;
461 ret = USER_Driver->pGetMonitorInfo( hMonitor, lpMonitorInfo );
462 if (ret)
463 TRACE("flags %04x, monitor %s, work %s\n", lpMonitorInfo->dwFlags,
464 wine_dbgstr_rect(&lpMonitorInfo->rcMonitor),
465 wine_dbgstr_rect(&lpMonitorInfo->rcWork));
466 return ret;
469 /***********************************************************************
470 * EnumDisplayMonitors (USER32.@)
472 BOOL WINAPI EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
474 return USER_Driver->pEnumDisplayMonitors( hdc, rect, proc, lp );
477 /***********************************************************************
478 * RegisterSystemThread (USER32.@)
480 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
482 FIXME("(%08x, %08x)\n", flags, reserved);
485 /***********************************************************************
486 * RegisterShellHookWindow [USER32.@]
488 BOOL WINAPI RegisterShellHookWindow ( HWND hWnd )
490 FIXME("(%p): stub\n", hWnd);
491 return FALSE;
495 /***********************************************************************
496 * DeregisterShellHookWindow [USER32.@]
498 HRESULT WINAPI DeregisterShellHookWindow ( DWORD u )
500 FIXME("0x%08x stub\n",u);
501 return 0;
506 /***********************************************************************
507 * RegisterTasklist [USER32.@]
509 DWORD WINAPI RegisterTasklist (DWORD x)
511 FIXME("0x%08x\n",x);
512 return TRUE;
516 /***********************************************************************
517 * RegisterDeviceNotificationA (USER32.@)
519 * See RegisterDeviceNotificationW.
521 HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hnd, LPVOID notifyfilter, DWORD flags)
523 FIXME("(hwnd=%p, filter=%p,flags=0x%08x) returns a fake device notification handle!\n",
524 hnd,notifyfilter,flags );
525 return (HDEVNOTIFY) 0xcafecafe;
528 /***********************************************************************
529 * RegisterDeviceNotificationW (USER32.@)
531 * Registers a window with the system so that it will receive
532 * notifications about a device.
534 * PARAMS
535 * hRecipient [I] Window or service status handle that
536 * will receive notifications.
537 * pNotificationFilter [I] DEV_BROADCAST_HDR followed by some
538 * type-specific data.
539 * dwFlags [I] See notes
541 * RETURNS
543 * A handle to the device notification.
545 * NOTES
547 * The dwFlags parameter can be one of two values:
548 *| DEVICE_NOTIFY_WINDOW_HANDLE - hRecipient is a window handle
549 *| DEVICE_NOTIFY_SERVICE_HANDLE - hRecipient is a service status handle
551 HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecipient, LPVOID pNotificationFilter, DWORD dwFlags)
553 FIXME("(hwnd=%p, filter=%p,flags=0x%08x) returns a fake device notification handle!\n",
554 hRecipient,pNotificationFilter,dwFlags );
555 return (HDEVNOTIFY) 0xcafeaffe;
558 /***********************************************************************
559 * UnregisterDeviceNotification (USER32.@)
562 BOOL WINAPI UnregisterDeviceNotification(HDEVNOTIFY hnd)
564 FIXME("(handle=%p), STUB!\n", hnd);
565 return TRUE;
568 /***********************************************************************
569 * GetAppCompatFlags (USER32.@)
571 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
573 FIXME("(%p) stub\n", hTask);
574 return 0;
577 /***********************************************************************
578 * GetAppCompatFlags2 (USER32.@)
580 DWORD WINAPI GetAppCompatFlags2( HTASK hTask )
582 FIXME("(%p) stub\n", hTask);
583 return 0;
587 /***********************************************************************
588 * AlignRects (USER32.@)
590 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
592 FIXME("(%p, %d, %d, %d): stub\n", rect, b, c, d);
593 if (rect)
594 FIXME("rect: [[%d, %d], [%d, %d]]\n", rect->left, rect->top, rect->right, rect->bottom);
595 /* Calls OffsetRect */
596 return FALSE;
600 /***********************************************************************
601 * LoadLocalFonts (USER32.@)
603 VOID WINAPI LoadLocalFonts(VOID)
605 /* are loaded. */
606 return;
610 /***********************************************************************
611 * User32InitializeImmEntryTable
613 BOOL WINAPI User32InitializeImmEntryTable(DWORD magic)
615 static const WCHAR imm32_dllW[] = {'i','m','m','3','2','.','d','l','l',0};
616 HMODULE imm32 = GetModuleHandleW(imm32_dllW);
618 TRACE("(%x)\n", magic);
620 if (!imm32 || magic != IMM_INIT_MAGIC)
621 return FALSE;
623 if (imm_get_ui_window)
624 return TRUE;
626 WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService");
627 WM_MSIME_RECONVERTOPTIONS = RegisterWindowMessageA("MSIMEReconvertOptions");
628 WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation");
629 WM_MSIME_RECONVERTREQUEST = RegisterWindowMessageA("MSIMEReconvertRequest");
630 WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
631 WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
632 WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
634 /* this part is not compatible with native imm32.dll */
635 imm_get_ui_window = (void*)GetProcAddress(imm32, "__wine_get_ui_window");
636 if (!imm_get_ui_window)
637 FIXME("native imm32.dll not supported\n");
638 return TRUE;
641 /**********************************************************************
642 * WINNLSGetIMEHotkey [USER32.@]
645 UINT WINAPI WINNLSGetIMEHotkey(HWND hwnd)
647 FIXME("hwnd %p: stub!\n", hwnd);
648 return 0; /* unknown */
651 /**********************************************************************
652 * WINNLSEnableIME [USER32.@]
655 BOOL WINAPI WINNLSEnableIME(HWND hwnd, BOOL enable)
657 FIXME("hwnd %p enable %d: stub!\n", hwnd, enable);
658 return TRUE; /* success (?) */
661 /**********************************************************************
662 * WINNLSGetEnableStatus [USER32.@]
665 BOOL WINAPI WINNLSGetEnableStatus(HWND hwnd)
667 FIXME("hwnd %p: stub!\n", hwnd);
668 return TRUE; /* success (?) */
671 /**********************************************************************
672 * SendIMEMessageExA [USER32.@]
675 LRESULT WINAPI SendIMEMessageExA(HWND hwnd, LPARAM lparam)
677 FIXME("(%p,%lx): stub\n", hwnd, lparam);
678 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
679 return 0;
682 /**********************************************************************
683 * SendIMEMessageExW [USER32.@]
686 LRESULT WINAPI SendIMEMessageExW(HWND hwnd, LPARAM lparam)
688 FIXME("(%p,%lx): stub\n", hwnd, lparam);
689 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
690 return 0;
693 /**********************************************************************
694 * DisableProcessWindowsGhosting [USER32.@]
697 VOID WINAPI DisableProcessWindowsGhosting(VOID)
699 FIXME(": stub\n");
700 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
701 return;
704 /**********************************************************************
705 * UserHandleGrantAccess [USER32.@]
708 BOOL WINAPI UserHandleGrantAccess(HANDLE handle, HANDLE job, BOOL grant)
710 FIXME("(%p,%p,%d): stub\n", handle, job, grant);
711 return TRUE;
714 /**********************************************************************
715 * RegisterPowerSettingNotification [USER32.@]
717 HPOWERNOTIFY WINAPI RegisterPowerSettingNotification(HANDLE recipient, const GUID *guid, DWORD flags)
719 FIXME("(%p,%s,%x): stub\n", recipient, debugstr_guid(guid), flags);
720 return (HPOWERNOTIFY)0xdeadbeef;
723 /**********************************************************************
724 * UnregisterPowerSettingNotification [USER32.@]
726 BOOL WINAPI UnregisterPowerSettingNotification(HPOWERNOTIFY handle)
728 FIXME("(%p): stub\n", handle);
729 return TRUE;
732 /**********************************************************************
733 * SetGestureConfig [USER32.@]
735 BOOL WINAPI SetGestureConfig( HWND hwnd, DWORD reserved, UINT id, PGESTURECONFIG config, UINT size )
737 FIXME("(%p %08x %u %p %u): stub\n", hwnd, reserved, id, config, size);
738 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
739 return FALSE;
742 /**********************************************************************
743 * IsTouchWindow [USER32.@]
745 BOOL WINAPI IsTouchWindow( HWND hwnd, PULONG flags )
747 FIXME("(%p %p): stub\n", hwnd, flags);
748 return FALSE;
751 /**********************************************************************
752 * IsWindowRedirectedForPrint [USER32.@]
754 BOOL WINAPI IsWindowRedirectedForPrint( HWND hwnd )
756 FIXME("(%p): stub\n", hwnd);
757 return FALSE;
761 static const WCHAR imeW[] = {'I','M','E',0};
762 const struct builtin_class_descr IME_builtin_class =
764 imeW, /* name */
765 0, /* style */
766 WINPROC_IME, /* proc */
767 2*sizeof(LONG_PTR), /* extra */
768 IDC_ARROW, /* cursor */
769 0 /* brush */
772 static BOOL is_ime_ui_msg( UINT msg )
774 switch(msg) {
775 case WM_IME_STARTCOMPOSITION:
776 case WM_IME_ENDCOMPOSITION:
777 case WM_IME_COMPOSITION:
778 case WM_IME_SETCONTEXT:
779 case WM_IME_NOTIFY:
780 case WM_IME_CONTROL:
781 case WM_IME_COMPOSITIONFULL:
782 case WM_IME_SELECT:
783 case WM_IME_CHAR:
784 case WM_IME_REQUEST:
785 case WM_IME_KEYDOWN:
786 case WM_IME_KEYUP:
787 return TRUE;
788 default:
789 if ((msg == WM_MSIME_RECONVERTOPTIONS) ||
790 (msg == WM_MSIME_SERVICE) ||
791 (msg == WM_MSIME_MOUSE) ||
792 (msg == WM_MSIME_RECONVERTREQUEST) ||
793 (msg == WM_MSIME_RECONVERT) ||
794 (msg == WM_MSIME_QUERYPOSITION) ||
795 (msg == WM_MSIME_DOCUMENTFEED))
796 return TRUE;
798 return FALSE;
802 LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
804 HWND uiwnd;
806 if (msg==WM_CREATE || msg==WM_NCCREATE)
807 return TRUE;
809 if (imm_get_ui_window && is_ime_ui_msg(msg))
811 if ((uiwnd = imm_get_ui_window(GetKeyboardLayout(0))))
812 return SendMessageA(uiwnd, msg, wParam, lParam);
813 return FALSE;
816 return DefWindowProcA(hwnd, msg, wParam, lParam);
819 LRESULT WINAPI ImeWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
821 HWND uiwnd;
823 if (msg==WM_CREATE || msg==WM_NCCREATE)
824 return TRUE;
826 if (imm_get_ui_window && is_ime_ui_msg(msg))
828 if ((uiwnd = imm_get_ui_window(GetKeyboardLayout(0))))
829 return SendMessageW(uiwnd, msg, wParam, lParam);
830 return FALSE;
833 return DefWindowProcW(hwnd, msg, wParam, lParam);