comctl32/tests: Make test_combo_WS_VSCROLL() static.
[wine.git] / dlls / user32 / misc.c
blob895ccce312a4dbb2531a7878fff42f2fc4e9e746
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);
44 BOOL (WINAPI *imm_register_window)(HWND) = NULL;
45 void (WINAPI *imm_unregister_window)(HWND) = NULL;
47 /* MSIME messages */
48 static UINT WM_MSIME_SERVICE;
49 static UINT WM_MSIME_RECONVERTOPTIONS;
50 static UINT WM_MSIME_MOUSE;
51 static UINT WM_MSIME_RECONVERTREQUEST;
52 static UINT WM_MSIME_RECONVERT;
53 static UINT WM_MSIME_QUERYPOSITION;
54 static UINT WM_MSIME_DOCUMENTFEED;
56 /* USER signal proc flags and codes */
57 /* See UserSignalProc for comments */
58 #define USIG_FLAGS_WIN32 0x0001
59 #define USIG_FLAGS_GUI 0x0002
60 #define USIG_FLAGS_FEEDBACK 0x0004
61 #define USIG_FLAGS_FAULT 0x0008
63 #define USIG_DLL_UNLOAD_WIN16 0x0001
64 #define USIG_DLL_UNLOAD_WIN32 0x0002
65 #define USIG_FAULT_DIALOG_PUSH 0x0003
66 #define USIG_FAULT_DIALOG_POP 0x0004
67 #define USIG_DLL_UNLOAD_ORPHANS 0x0005
68 #define USIG_THREAD_INIT 0x0010
69 #define USIG_THREAD_EXIT 0x0020
70 #define USIG_PROCESS_CREATE 0x0100
71 #define USIG_PROCESS_INIT 0x0200
72 #define USIG_PROCESS_EXIT 0x0300
73 #define USIG_PROCESS_DESTROY 0x0400
74 #define USIG_PROCESS_RUNNING 0x0500
75 #define USIG_PROCESS_LOADED 0x0600
77 /***********************************************************************
78 * SignalProc32 (USER.391)
79 * UserSignalProc (USER32.@)
81 * The exact meaning of the USER signals is undocumented, but this
82 * should cover the basic idea:
84 * USIG_DLL_UNLOAD_WIN16
85 * This is sent when a 16-bit module is unloaded.
87 * USIG_DLL_UNLOAD_WIN32
88 * This is sent when a 32-bit module is unloaded.
90 * USIG_DLL_UNLOAD_ORPHANS
91 * This is sent after the last Win3.1 module is unloaded,
92 * to allow removal of orphaned menus.
94 * USIG_FAULT_DIALOG_PUSH
95 * USIG_FAULT_DIALOG_POP
96 * These are called to allow USER to prepare for displaying a
97 * fault dialog, even though the fault might have happened while
98 * inside a USER critical section.
100 * USIG_THREAD_INIT
101 * This is called from the context of a new thread, as soon as it
102 * has started to run.
104 * USIG_THREAD_EXIT
105 * This is called, still in its context, just before a thread is
106 * about to terminate.
108 * USIG_PROCESS_CREATE
109 * This is called, in the parent process context, after a new process
110 * has been created.
112 * USIG_PROCESS_INIT
113 * This is called in the new process context, just after the main thread
114 * has started execution (after the main thread's USIG_THREAD_INIT has
115 * been sent).
117 * USIG_PROCESS_LOADED
118 * This is called after the executable file has been loaded into the
119 * new process context.
121 * USIG_PROCESS_RUNNING
122 * This is called immediately before the main entry point is called.
124 * USIG_PROCESS_EXIT
125 * This is called in the context of a process that is about to
126 * terminate (but before the last thread's USIG_THREAD_EXIT has
127 * been sent).
129 * USIG_PROCESS_DESTROY
130 * This is called after a process has terminated.
133 * The meaning of the dwFlags bits is as follows:
135 * USIG_FLAGS_WIN32
136 * Current process is 32-bit.
138 * USIG_FLAGS_GUI
139 * Current process is a (Win32) GUI process.
141 * USIG_FLAGS_FEEDBACK
142 * Current process needs 'feedback' (determined from the STARTUPINFO
143 * flags STARTF_FORCEONFEEDBACK / STARTF_FORCEOFFFEEDBACK).
145 * USIG_FLAGS_FAULT
146 * The signal is being sent due to a fault.
148 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
149 DWORD dwFlags, HMODULE16 hModule )
151 FIXME("(%04x, %08x, %04x, %04x)\n",
152 uCode, dwThreadOrProcessID, dwFlags, hModule );
153 /* FIXME: Should chain to GdiSignalProc now. */
154 return 0;
158 /**********************************************************************
159 * SetLastErrorEx [USER32.@]
161 * Sets the last-error code.
163 * RETURNS
164 * None.
166 void WINAPI SetLastErrorEx(
167 DWORD error, /* [in] Per-thread error code */
168 DWORD type) /* [in] Error type */
170 TRACE("(0x%08x, 0x%08x)\n", error,type);
171 switch(type) {
172 case 0:
173 break;
174 case SLE_ERROR:
175 case SLE_MINORERROR:
176 case SLE_WARNING:
177 /* Fall through for now */
178 default:
179 FIXME("(error=%08x, type=%08x): Unhandled type\n", error,type);
180 break;
182 SetLastError( error );
185 /******************************************************************************
186 * GetAltTabInfoA [USER32.@]
188 BOOL WINAPI GetAltTabInfoA(HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
190 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
191 return FALSE;
194 /******************************************************************************
195 * GetAltTabInfoW [USER32.@]
197 BOOL WINAPI GetAltTabInfoW(HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
199 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
200 return FALSE;
203 /******************************************************************************
204 * SetDebugErrorLevel [USER32.@]
205 * Sets the minimum error level for generating debugging events
207 * PARAMS
208 * dwLevel [I] Debugging error level
210 * RETURNS
211 * Nothing.
213 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
215 FIXME("(%d): stub\n", dwLevel);
219 /***********************************************************************
220 * SetWindowStationUser (USER32.@)
222 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2)
224 FIXME("(0x%08x,0x%08x),stub!\n",x1,x2);
225 return 1;
228 /***********************************************************************
229 * RegisterLogonProcess (USER32.@)
231 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x)
233 FIXME("(%p,%d),stub!\n",hprocess,x);
234 return 1;
237 /***********************************************************************
238 * SetLogonNotifyWindow (USER32.@)
240 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
242 FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
243 return 1;
246 static const WCHAR primary_device_name[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
247 static const WCHAR primary_device_string[] = {'X','1','1',' ','W','i','n','d','o','w','i','n','g',' ',
248 'S','y','s','t','e','m',0};
249 static const WCHAR primary_device_deviceid[] = {'P','C','I','\\','V','E','N','_','0','0','0','0','&',
250 'D','E','V','_','0','0','0','0',0};
252 /***********************************************************************
253 * EnumDisplayDevicesA (USER32.@)
255 BOOL WINAPI EnumDisplayDevicesA( LPCSTR lpDevice, DWORD i, LPDISPLAY_DEVICEA lpDispDev,
256 DWORD dwFlags )
258 UNICODE_STRING deviceW;
259 DISPLAY_DEVICEW ddW;
260 BOOL ret;
262 if(lpDevice)
263 RtlCreateUnicodeStringFromAsciiz(&deviceW, lpDevice);
264 else
265 deviceW.Buffer = NULL;
267 ddW.cb = sizeof(ddW);
268 ret = EnumDisplayDevicesW(deviceW.Buffer, i, &ddW, dwFlags);
269 RtlFreeUnicodeString(&deviceW);
271 if(!ret) return ret;
273 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceName, -1, lpDispDev->DeviceName, sizeof(lpDispDev->DeviceName), NULL, NULL);
274 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceString, -1, lpDispDev->DeviceString, sizeof(lpDispDev->DeviceString), NULL, NULL);
275 lpDispDev->StateFlags = ddW.StateFlags;
277 if(lpDispDev->cb >= offsetof(DISPLAY_DEVICEA, DeviceID) + sizeof(lpDispDev->DeviceID))
278 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceID, -1, lpDispDev->DeviceID, sizeof(lpDispDev->DeviceID), NULL, NULL);
279 if(lpDispDev->cb >= offsetof(DISPLAY_DEVICEA, DeviceKey) + sizeof(lpDispDev->DeviceKey))
280 WideCharToMultiByte(CP_ACP, 0, ddW.DeviceKey, -1, lpDispDev->DeviceKey, sizeof(lpDispDev->DeviceKey), NULL, NULL);
282 return TRUE;
285 /***********************************************************************
286 * EnumDisplayDevicesW (USER32.@)
288 BOOL WINAPI EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD i, LPDISPLAY_DEVICEW lpDisplayDevice,
289 DWORD dwFlags )
291 FIXME("(%s,%d,%p,0x%08x), stub!\n",debugstr_w(lpDevice),i,lpDisplayDevice,dwFlags);
293 if (i)
294 return FALSE;
296 memcpy(lpDisplayDevice->DeviceName, primary_device_name, sizeof(primary_device_name));
297 memcpy(lpDisplayDevice->DeviceString, primary_device_string, sizeof(primary_device_string));
299 lpDisplayDevice->StateFlags =
300 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
301 DISPLAY_DEVICE_PRIMARY_DEVICE |
302 DISPLAY_DEVICE_VGA_COMPATIBLE;
304 if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(lpDisplayDevice->DeviceID))
305 memcpy(lpDisplayDevice->DeviceID, primary_device_deviceid, sizeof(primary_device_deviceid));
306 if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceKey) + sizeof(lpDisplayDevice->DeviceKey))
307 lpDisplayDevice->DeviceKey[0] = 0;
309 return TRUE;
312 struct monitor_enum_info
314 RECT rect;
315 UINT max_area;
316 UINT min_distance;
317 HMONITOR primary;
318 HMONITOR nearest;
319 HMONITOR ret;
322 /* helper callback for MonitorFromRect */
323 static BOOL CALLBACK monitor_enum( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
325 struct monitor_enum_info *info = (struct monitor_enum_info *)lp;
326 RECT intersect;
328 if (IntersectRect( &intersect, rect, &info->rect ))
330 /* check for larger intersecting area */
331 UINT area = (intersect.right - intersect.left) * (intersect.bottom - intersect.top);
332 if (area > info->max_area)
334 info->max_area = area;
335 info->ret = monitor;
338 else if (!info->max_area) /* if not intersecting, check for min distance */
340 UINT distance;
341 UINT x, y;
343 if (info->rect.right <= rect->left) x = rect->left - info->rect.right;
344 else if (rect->right <= info->rect.left) x = info->rect.left - rect->right;
345 else x = 0;
346 if (info->rect.bottom <= rect->top) y = rect->top - info->rect.bottom;
347 else if (rect->bottom <= info->rect.top) y = info->rect.top - rect->bottom;
348 else y = 0;
349 distance = x * x + y * y;
350 if (distance < info->min_distance)
352 info->min_distance = distance;
353 info->nearest = monitor;
356 if (!info->primary)
358 MONITORINFO mon_info;
359 mon_info.cbSize = sizeof(mon_info);
360 GetMonitorInfoW( monitor, &mon_info );
361 if (mon_info.dwFlags & MONITORINFOF_PRIMARY) info->primary = monitor;
363 return TRUE;
366 /***********************************************************************
367 * MonitorFromRect (USER32.@)
369 HMONITOR WINAPI MonitorFromRect( LPRECT rect, DWORD flags )
371 struct monitor_enum_info info;
373 info.rect = *rect;
374 info.max_area = 0;
375 info.min_distance = ~0u;
376 info.primary = 0;
377 info.nearest = 0;
378 info.ret = 0;
380 if (IsRectEmpty(&info.rect))
382 info.rect.right = info.rect.left + 1;
383 info.rect.bottom = info.rect.top + 1;
386 if (!EnumDisplayMonitors( 0, NULL, monitor_enum, (LPARAM)&info )) return 0;
387 if (!info.ret)
389 if (flags & MONITOR_DEFAULTTOPRIMARY) info.ret = info.primary;
390 else if (flags & MONITOR_DEFAULTTONEAREST) info.ret = info.nearest;
393 TRACE( "%s flags %x returning %p\n", wine_dbgstr_rect(rect), flags, info.ret );
394 return info.ret;
397 /***********************************************************************
398 * MonitorFromPoint (USER32.@)
400 HMONITOR WINAPI MonitorFromPoint( POINT pt, DWORD flags )
402 RECT rect;
404 SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 );
405 return MonitorFromRect( &rect, flags );
408 /***********************************************************************
409 * MonitorFromWindow (USER32.@)
411 HMONITOR WINAPI MonitorFromWindow(HWND hWnd, DWORD dwFlags)
413 RECT rect;
414 WINDOWPLACEMENT wp;
416 TRACE("(%p, 0x%08x)\n", hWnd, dwFlags);
418 wp.length = sizeof(wp);
419 if (IsIconic(hWnd) && GetWindowPlacement(hWnd, &wp))
420 return MonitorFromRect( &wp.rcNormalPosition, dwFlags );
422 if (GetWindowRect( hWnd, &rect ))
423 return MonitorFromRect( &rect, dwFlags );
425 if (!(dwFlags & (MONITOR_DEFAULTTOPRIMARY|MONITOR_DEFAULTTONEAREST))) return 0;
426 /* retrieve the primary */
427 SetRect( &rect, 0, 0, 1, 1 );
428 return MonitorFromRect( &rect, dwFlags );
431 /***********************************************************************
432 * GetMonitorInfoA (USER32.@)
434 BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
436 MONITORINFOEXW miW;
437 MONITORINFOEXA *miA = (MONITORINFOEXA*)lpMonitorInfo;
438 BOOL ret;
440 if((miA->cbSize != sizeof(MONITORINFOEXA)) && (miA->cbSize != sizeof(MONITORINFO)))
441 return FALSE;
443 miW.cbSize = sizeof(miW);
445 ret = GetMonitorInfoW(hMonitor, (MONITORINFO*)&miW);
446 if(!ret) return ret;
448 miA->rcMonitor = miW.rcMonitor;
449 miA->rcWork = miW.rcWork;
450 miA->dwFlags = miW.dwFlags;
451 if(miA->cbSize == sizeof(MONITORINFOEXA))
452 WideCharToMultiByte(CP_ACP, 0, miW.szDevice, -1, miA->szDevice, sizeof(miA->szDevice), NULL, NULL);
453 return ret;
456 /***********************************************************************
457 * GetMonitorInfoW (USER32.@)
459 BOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
461 BOOL ret;
463 if (lpMonitorInfo->cbSize != sizeof(MONITORINFOEXW) && lpMonitorInfo->cbSize != sizeof(MONITORINFO))
464 return FALSE;
466 ret = USER_Driver->pGetMonitorInfo( hMonitor, lpMonitorInfo );
467 if (ret)
468 TRACE("flags %04x, monitor %s, work %s\n", lpMonitorInfo->dwFlags,
469 wine_dbgstr_rect(&lpMonitorInfo->rcMonitor),
470 wine_dbgstr_rect(&lpMonitorInfo->rcWork));
471 return ret;
474 #ifdef __i386__
475 /* Some apps pass a non-stdcall callback to EnumDisplayMonitors,
476 * so we need a small assembly wrapper to call it.
477 * MJ's Help Diagnostic expects that %ecx contains the address to the rect.
479 struct enumdisplaymonitors_lparam
481 MONITORENUMPROC proc;
482 LPARAM lparam;
485 extern BOOL CALLBACK enumdisplaymonitors_callback_wrapper(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lparam);
486 __ASM_STDCALL_FUNC( enumdisplaymonitors_callback_wrapper, 16,
487 "pushl %ebp\n\t"
488 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
489 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
490 "movl %esp,%ebp\n\t"
491 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
492 "subl $8,%esp\n\t"
493 "movl 20(%ebp),%eax\n\t" /* struct enumdisplaymonitors_lparam *orig = (struct enumdisplaymonitors_lparam*)lparam */
494 "pushl 4(%eax)\n\t" /* push orig->lparam */
495 "pushl 16(%ebp)\n\t"
496 "pushl 12(%ebp)\n\t"
497 "pushl 8(%ebp)\n\t"
498 "movl 16(%ebp),%ecx\n\t"
499 "call *(%eax)\n\t" /* call orig->proc */
500 "leave\n\t"
501 __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
502 __ASM_CFI(".cfi_same_value %ebp\n\t")
503 "ret $16" )
504 #endif /* __i386__ */
506 /***********************************************************************
507 * EnumDisplayMonitors (USER32.@)
509 BOOL WINAPI EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
511 #ifdef __i386__
512 struct enumdisplaymonitors_lparam orig = { proc, lp };
513 proc = enumdisplaymonitors_callback_wrapper;
514 lp = (LPARAM)&orig;
515 #endif
516 return USER_Driver->pEnumDisplayMonitors( hdc, rect, proc, lp );
520 /***********************************************************************
521 * QueryDisplayConfig (USER32.@)
523 LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numpathelements, DISPLAYCONFIG_PATH_INFO *pathinfo,
524 UINT32 *numinfoelements, DISPLAYCONFIG_MODE_INFO *modeinfo,
525 DISPLAYCONFIG_TOPOLOGY_ID *topologyid)
527 FIXME("(%08x %p %p %p %p %p)\n", flags, numpathelements, pathinfo, numinfoelements, modeinfo, topologyid);
528 return ERROR_CALL_NOT_IMPLEMENTED;
531 /***********************************************************************
532 * RegisterSystemThread (USER32.@)
534 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
536 FIXME("(%08x, %08x)\n", flags, reserved);
539 /***********************************************************************
540 * RegisterShellHookWindow [USER32.@]
542 BOOL WINAPI RegisterShellHookWindow(HWND hWnd)
544 FIXME("(%p): stub\n", hWnd);
545 return FALSE;
549 /***********************************************************************
550 * DeregisterShellHookWindow [USER32.@]
552 BOOL WINAPI DeregisterShellHookWindow(HWND hWnd)
554 FIXME("(%p): stub\n", hWnd);
555 return FALSE;
559 /***********************************************************************
560 * RegisterTasklist [USER32.@]
562 DWORD WINAPI RegisterTasklist (DWORD x)
564 FIXME("0x%08x\n",x);
565 return TRUE;
569 /***********************************************************************
570 * RegisterDeviceNotificationA (USER32.@)
572 * See RegisterDeviceNotificationW.
574 HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hnd, LPVOID notifyfilter, DWORD flags)
576 FIXME("(hwnd=%p, filter=%p,flags=0x%08x) returns a fake device notification handle!\n",
577 hnd,notifyfilter,flags );
578 return (HDEVNOTIFY) 0xcafecafe;
581 /***********************************************************************
582 * RegisterDeviceNotificationW (USER32.@)
584 * Registers a window with the system so that it will receive
585 * notifications about a device.
587 * PARAMS
588 * hRecipient [I] Window or service status handle that
589 * will receive notifications.
590 * pNotificationFilter [I] DEV_BROADCAST_HDR followed by some
591 * type-specific data.
592 * dwFlags [I] See notes
594 * RETURNS
596 * A handle to the device notification.
598 * NOTES
600 * The dwFlags parameter can be one of two values:
601 *| DEVICE_NOTIFY_WINDOW_HANDLE - hRecipient is a window handle
602 *| DEVICE_NOTIFY_SERVICE_HANDLE - hRecipient is a service status handle
604 HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecipient, LPVOID pNotificationFilter, DWORD dwFlags)
606 FIXME("(hwnd=%p, filter=%p,flags=0x%08x) returns a fake device notification handle!\n",
607 hRecipient,pNotificationFilter,dwFlags );
608 return (HDEVNOTIFY) 0xcafeaffe;
611 /***********************************************************************
612 * UnregisterDeviceNotification (USER32.@)
615 BOOL WINAPI UnregisterDeviceNotification(HDEVNOTIFY hnd)
617 FIXME("(handle=%p), STUB!\n", hnd);
618 return TRUE;
621 /***********************************************************************
622 * GetAppCompatFlags (USER32.@)
624 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
626 FIXME("(%p) stub\n", hTask);
627 return 0;
630 /***********************************************************************
631 * GetAppCompatFlags2 (USER32.@)
633 DWORD WINAPI GetAppCompatFlags2( HTASK hTask )
635 FIXME("(%p) stub\n", hTask);
636 return 0;
640 /***********************************************************************
641 * AlignRects (USER32.@)
643 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
645 FIXME("(%p, %d, %d, %d): stub\n", rect, b, c, d);
646 if (rect)
647 FIXME("rect: %s\n", wine_dbgstr_rect(rect));
648 /* Calls OffsetRect */
649 return FALSE;
653 /***********************************************************************
654 * LoadLocalFonts (USER32.@)
656 VOID WINAPI LoadLocalFonts(VOID)
658 /* are loaded. */
659 return;
663 /***********************************************************************
664 * User32InitializeImmEntryTable
666 BOOL WINAPI User32InitializeImmEntryTable(DWORD magic)
668 static const WCHAR imm32_dllW[] = {'i','m','m','3','2','.','d','l','l',0};
669 HMODULE imm32 = GetModuleHandleW(imm32_dllW);
671 TRACE("(%x)\n", magic);
673 if (!imm32 || magic != IMM_INIT_MAGIC)
674 return FALSE;
676 if (imm_get_ui_window)
677 return TRUE;
679 WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService");
680 WM_MSIME_RECONVERTOPTIONS = RegisterWindowMessageA("MSIMEReconvertOptions");
681 WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation");
682 WM_MSIME_RECONVERTREQUEST = RegisterWindowMessageA("MSIMEReconvertRequest");
683 WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
684 WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
685 WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
687 /* this part is not compatible with native imm32.dll */
688 imm_get_ui_window = (void*)GetProcAddress(imm32, "__wine_get_ui_window");
689 imm_register_window = (void*)GetProcAddress(imm32, "__wine_register_window");
690 imm_unregister_window = (void*)GetProcAddress(imm32, "__wine_unregister_window");
691 if (!imm_get_ui_window)
692 FIXME("native imm32.dll not supported\n");
693 return TRUE;
696 /**********************************************************************
697 * WINNLSGetIMEHotkey [USER32.@]
700 UINT WINAPI WINNLSGetIMEHotkey(HWND hwnd)
702 FIXME("hwnd %p: stub!\n", hwnd);
703 return 0; /* unknown */
706 /**********************************************************************
707 * WINNLSEnableIME [USER32.@]
710 BOOL WINAPI WINNLSEnableIME(HWND hwnd, BOOL enable)
712 FIXME("hwnd %p enable %d: stub!\n", hwnd, enable);
713 return TRUE; /* success (?) */
716 /**********************************************************************
717 * WINNLSGetEnableStatus [USER32.@]
720 BOOL WINAPI WINNLSGetEnableStatus(HWND hwnd)
722 FIXME("hwnd %p: stub!\n", hwnd);
723 return TRUE; /* success (?) */
726 /**********************************************************************
727 * SendIMEMessageExA [USER32.@]
730 LRESULT WINAPI SendIMEMessageExA(HWND hwnd, LPARAM lparam)
732 FIXME("(%p,%lx): stub\n", hwnd, lparam);
733 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
734 return 0;
737 /**********************************************************************
738 * SendIMEMessageExW [USER32.@]
741 LRESULT WINAPI SendIMEMessageExW(HWND hwnd, LPARAM lparam)
743 FIXME("(%p,%lx): stub\n", hwnd, lparam);
744 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
745 return 0;
748 /**********************************************************************
749 * DisableProcessWindowsGhosting [USER32.@]
752 VOID WINAPI DisableProcessWindowsGhosting(VOID)
754 FIXME(": stub\n");
755 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
756 return;
759 /**********************************************************************
760 * UserHandleGrantAccess [USER32.@]
763 BOOL WINAPI UserHandleGrantAccess(HANDLE handle, HANDLE job, BOOL grant)
765 FIXME("(%p,%p,%d): stub\n", handle, job, grant);
766 return TRUE;
769 /**********************************************************************
770 * RegisterPowerSettingNotification [USER32.@]
772 HPOWERNOTIFY WINAPI RegisterPowerSettingNotification(HANDLE recipient, const GUID *guid, DWORD flags)
774 FIXME("(%p,%s,%x): stub\n", recipient, debugstr_guid(guid), flags);
775 return (HPOWERNOTIFY)0xdeadbeef;
778 /**********************************************************************
779 * UnregisterPowerSettingNotification [USER32.@]
781 BOOL WINAPI UnregisterPowerSettingNotification(HPOWERNOTIFY handle)
783 FIXME("(%p): stub\n", handle);
784 return TRUE;
787 /*****************************************************************************
788 * GetGestureConfig (USER32.@)
790 BOOL WINAPI GetGestureConfig( HWND hwnd, DWORD reserved, DWORD flags, UINT *count, GESTURECONFIG *config, UINT size )
792 FIXME("(%p %08x %08x %p %p %u): stub\n", hwnd, reserved, flags, count, config, size);
793 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
794 return FALSE;
797 /**********************************************************************
798 * SetGestureConfig [USER32.@]
800 BOOL WINAPI SetGestureConfig( HWND hwnd, DWORD reserved, UINT id, PGESTURECONFIG config, UINT size )
802 FIXME("(%p %08x %u %p %u): stub\n", hwnd, reserved, id, config, size);
803 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
804 return FALSE;
807 /**********************************************************************
808 * IsTouchWindow [USER32.@]
810 BOOL WINAPI IsTouchWindow( HWND hwnd, PULONG flags )
812 FIXME("(%p %p): stub\n", hwnd, flags);
813 return FALSE;
816 /**********************************************************************
817 * IsWindowRedirectedForPrint [USER32.@]
819 BOOL WINAPI IsWindowRedirectedForPrint( HWND hwnd )
821 FIXME("(%p): stub\n", hwnd);
822 return FALSE;
825 /**********************************************************************
826 * GetDisplayConfigBufferSizes [USER32.@]
828 LONG WINAPI GetDisplayConfigBufferSizes(UINT32 flags, UINT32 *num_path_info, UINT32 *num_mode_info)
830 FIXME("(0x%x %p %p): stub\n", flags, num_path_info, num_mode_info);
832 if (!num_path_info || !num_mode_info)
833 return ERROR_INVALID_PARAMETER;
835 *num_path_info = 0;
836 *num_mode_info = 0;
837 return ERROR_NOT_SUPPORTED;
840 static const WCHAR imeW[] = {'I','M','E',0};
841 const struct builtin_class_descr IME_builtin_class =
843 imeW, /* name */
844 0, /* style */
845 WINPROC_IME, /* proc */
846 2*sizeof(LONG_PTR), /* extra */
847 IDC_ARROW, /* cursor */
848 0 /* brush */
851 static BOOL is_ime_ui_msg( UINT msg )
853 switch(msg) {
854 case WM_IME_STARTCOMPOSITION:
855 case WM_IME_ENDCOMPOSITION:
856 case WM_IME_COMPOSITION:
857 case WM_IME_SETCONTEXT:
858 case WM_IME_NOTIFY:
859 case WM_IME_CONTROL:
860 case WM_IME_COMPOSITIONFULL:
861 case WM_IME_SELECT:
862 case WM_IME_CHAR:
863 case WM_IME_REQUEST:
864 case WM_IME_KEYDOWN:
865 case WM_IME_KEYUP:
866 return TRUE;
867 default:
868 if ((msg == WM_MSIME_RECONVERTOPTIONS) ||
869 (msg == WM_MSIME_SERVICE) ||
870 (msg == WM_MSIME_MOUSE) ||
871 (msg == WM_MSIME_RECONVERTREQUEST) ||
872 (msg == WM_MSIME_RECONVERT) ||
873 (msg == WM_MSIME_QUERYPOSITION) ||
874 (msg == WM_MSIME_DOCUMENTFEED))
875 return TRUE;
877 return FALSE;
881 LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
883 HWND uiwnd;
885 if (msg==WM_CREATE)
886 return TRUE;
888 if (imm_get_ui_window && is_ime_ui_msg(msg))
890 if ((uiwnd = imm_get_ui_window(GetKeyboardLayout(0))))
891 return SendMessageA(uiwnd, msg, wParam, lParam);
892 return FALSE;
895 return DefWindowProcA(hwnd, msg, wParam, lParam);
898 LRESULT WINAPI ImeWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
900 HWND uiwnd;
902 if (msg==WM_CREATE)
903 return TRUE;
905 if (imm_get_ui_window && is_ime_ui_msg(msg))
907 if ((uiwnd = imm_get_ui_window(GetKeyboardLayout(0))))
908 return SendMessageW(uiwnd, msg, wParam, lParam);
909 return FALSE;
912 return DefWindowProcW(hwnd, msg, wParam, lParam);