dmime/tests: Test tempo track Play and DMUS_PMSGT_TEMPO messages.
[wine.git] / dlls / user32 / misc.c
blob497d40e9dc65e82804736fc31b9319c98a581715
1 /*
2 * Misc USER functions
4 * Copyright 1995 Thomas Sandford
5 * Copyright 1997 Marcus Meissner
6 * Copyright 1998 Turchanov Sergey
7 * Copyright 2019 Micah N Gorrell for CodeWeavers
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "wine/windef16.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "controls.h"
31 #include "imm.h"
32 #include "user_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(win);
38 BOOL WINAPI ImmSetActiveContext(HWND, HIMC, BOOL);
40 #define IMM_INIT_MAGIC 0x19650412
41 static LRESULT (WINAPI *imm_ime_wnd_proc)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi);
43 /* USER signal proc flags and codes */
44 /* See UserSignalProc for comments */
45 #define USIG_FLAGS_WIN32 0x0001
46 #define USIG_FLAGS_GUI 0x0002
47 #define USIG_FLAGS_FEEDBACK 0x0004
48 #define USIG_FLAGS_FAULT 0x0008
50 #define USIG_DLL_UNLOAD_WIN16 0x0001
51 #define USIG_DLL_UNLOAD_WIN32 0x0002
52 #define USIG_FAULT_DIALOG_PUSH 0x0003
53 #define USIG_FAULT_DIALOG_POP 0x0004
54 #define USIG_DLL_UNLOAD_ORPHANS 0x0005
55 #define USIG_THREAD_INIT 0x0010
56 #define USIG_THREAD_EXIT 0x0020
57 #define USIG_PROCESS_CREATE 0x0100
58 #define USIG_PROCESS_INIT 0x0200
59 #define USIG_PROCESS_EXIT 0x0300
60 #define USIG_PROCESS_DESTROY 0x0400
61 #define USIG_PROCESS_RUNNING 0x0500
62 #define USIG_PROCESS_LOADED 0x0600
64 /***********************************************************************
65 * SignalProc32 (USER.391)
66 * UserSignalProc (USER32.@)
68 * The exact meaning of the USER signals is undocumented, but this
69 * should cover the basic idea:
71 * USIG_DLL_UNLOAD_WIN16
72 * This is sent when a 16-bit module is unloaded.
74 * USIG_DLL_UNLOAD_WIN32
75 * This is sent when a 32-bit module is unloaded.
77 * USIG_DLL_UNLOAD_ORPHANS
78 * This is sent after the last Win3.1 module is unloaded,
79 * to allow removal of orphaned menus.
81 * USIG_FAULT_DIALOG_PUSH
82 * USIG_FAULT_DIALOG_POP
83 * These are called to allow USER to prepare for displaying a
84 * fault dialog, even though the fault might have happened while
85 * inside a USER critical section.
87 * USIG_THREAD_INIT
88 * This is called from the context of a new thread, as soon as it
89 * has started to run.
91 * USIG_THREAD_EXIT
92 * This is called, still in its context, just before a thread is
93 * about to terminate.
95 * USIG_PROCESS_CREATE
96 * This is called, in the parent process context, after a new process
97 * has been created.
99 * USIG_PROCESS_INIT
100 * This is called in the new process context, just after the main thread
101 * has started execution (after the main thread's USIG_THREAD_INIT has
102 * been sent).
104 * USIG_PROCESS_LOADED
105 * This is called after the executable file has been loaded into the
106 * new process context.
108 * USIG_PROCESS_RUNNING
109 * This is called immediately before the main entry point is called.
111 * USIG_PROCESS_EXIT
112 * This is called in the context of a process that is about to
113 * terminate (but before the last thread's USIG_THREAD_EXIT has
114 * been sent).
116 * USIG_PROCESS_DESTROY
117 * This is called after a process has terminated.
120 * The meaning of the dwFlags bits is as follows:
122 * USIG_FLAGS_WIN32
123 * Current process is 32-bit.
125 * USIG_FLAGS_GUI
126 * Current process is a (Win32) GUI process.
128 * USIG_FLAGS_FEEDBACK
129 * Current process needs 'feedback' (determined from the STARTUPINFO
130 * flags STARTF_FORCEONFEEDBACK / STARTF_FORCEOFFFEEDBACK).
132 * USIG_FLAGS_FAULT
133 * The signal is being sent due to a fault.
135 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
136 DWORD dwFlags, HMODULE16 hModule )
138 FIXME("(%04x, %08lx, %04lx, %04x)\n",
139 uCode, dwThreadOrProcessID, dwFlags, hModule );
140 /* FIXME: Should chain to GdiSignalProc now. */
141 return 0;
145 /**********************************************************************
146 * SetLastErrorEx [USER32.@]
148 * Sets the last-error code.
150 * RETURNS
151 * None.
153 void WINAPI SetLastErrorEx(
154 DWORD error, /* [in] Per-thread error code */
155 DWORD type) /* [in] Error type */
157 TRACE("(0x%08lx, 0x%08lx)\n", error,type);
158 switch(type) {
159 case 0:
160 break;
161 case SLE_ERROR:
162 case SLE_MINORERROR:
163 case SLE_WARNING:
164 /* Fall through for now */
165 default:
166 FIXME("(error=%08lx, type=%08lx): Unhandled type\n", error,type);
167 break;
169 SetLastError( error );
172 /******************************************************************************
173 * GetAltTabInfoA [USER32.@]
175 BOOL WINAPI GetAltTabInfoA(HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
177 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
178 return FALSE;
181 /******************************************************************************
182 * GetAltTabInfoW [USER32.@]
184 BOOL WINAPI GetAltTabInfoW(HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
186 FIXME("(%p, 0x%08x, %p, %p, 0x%08x)\n", hwnd, iItem, pati, pszItemText, cchItemText);
187 return FALSE;
190 /******************************************************************************
191 * SetDebugErrorLevel [USER32.@]
192 * Sets the minimum error level for generating debugging events
194 * PARAMS
195 * dwLevel [I] Debugging error level
197 * RETURNS
198 * Nothing.
200 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
202 FIXME("(%ld): stub\n", dwLevel);
206 /***********************************************************************
207 * SetWindowStationUser (USER32.@)
209 DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2)
211 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
212 return 1;
215 /***********************************************************************
216 * RegisterLogonProcess (USER32.@)
218 DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x)
220 FIXME("(%p,%d),stub!\n",hprocess,x);
221 return 1;
224 /***********************************************************************
225 * SetLogonNotifyWindow (USER32.@)
227 DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
229 FIXME("(%p,%p),stub!\n",hwinsta,hwnd);
230 return 1;
233 /***********************************************************************
234 * RegisterSystemThread (USER32.@)
236 void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
238 FIXME("(%08lx, %08lx)\n", flags, reserved);
241 /***********************************************************************
242 * RegisterShellHookWindow [USER32.@]
244 BOOL WINAPI RegisterShellHookWindow(HWND hWnd)
246 FIXME("(%p): stub\n", hWnd);
247 return FALSE;
251 /***********************************************************************
252 * DeregisterShellHookWindow [USER32.@]
254 BOOL WINAPI DeregisterShellHookWindow(HWND hWnd)
256 FIXME("(%p): stub\n", hWnd);
257 return FALSE;
261 /***********************************************************************
262 * RegisterTasklist [USER32.@]
264 DWORD WINAPI RegisterTasklist (DWORD x)
266 FIXME("0x%08lx\n",x);
267 return TRUE;
270 /***********************************************************************
271 * GetAppCompatFlags (USER32.@)
273 DWORD WINAPI GetAppCompatFlags( HTASK hTask )
275 FIXME("(%p) stub\n", hTask);
276 return 0;
279 /***********************************************************************
280 * GetAppCompatFlags2 (USER32.@)
282 DWORD WINAPI GetAppCompatFlags2( HTASK hTask )
284 FIXME("(%p) stub\n", hTask);
285 return 0;
289 /***********************************************************************
290 * AlignRects (USER32.@)
292 BOOL WINAPI AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
294 FIXME("(%p, %ld, %ld, %ld): stub\n", rect, b, c, d);
295 if (rect)
296 FIXME("rect: %s\n", wine_dbgstr_rect(rect));
297 /* Calls OffsetRect */
298 return FALSE;
302 /***********************************************************************
303 * LoadLocalFonts (USER32.@)
305 VOID WINAPI LoadLocalFonts(VOID)
307 /* are loaded. */
308 return;
312 /***********************************************************************
313 * User32InitializeImmEntryTable
315 BOOL WINAPI User32InitializeImmEntryTable(DWORD magic)
317 HMODULE imm32 = GetModuleHandleW(L"imm32.dll");
319 TRACE("(%lx)\n", magic);
321 if (!imm32 || magic != IMM_INIT_MAGIC)
322 return FALSE;
324 if (imm_ime_wnd_proc)
325 return TRUE;
327 /* this part is not compatible with native imm32.dll */
328 imm_ime_wnd_proc = (void*)GetProcAddress(imm32, "__wine_ime_wnd_proc");
329 if (!imm_ime_wnd_proc)
330 FIXME("native imm32.dll not supported\n");
331 return TRUE;
334 /**********************************************************************
335 * WINNLSGetIMEHotkey [USER32.@]
338 UINT WINAPI WINNLSGetIMEHotkey(HWND hwnd)
340 FIXME("hwnd %p: stub!\n", hwnd);
341 return 0; /* unknown */
344 /**********************************************************************
345 * WINNLSEnableIME [USER32.@]
348 BOOL WINAPI WINNLSEnableIME(HWND hwnd, BOOL enable)
350 FIXME("hwnd %p enable %d: stub!\n", hwnd, enable);
351 return TRUE; /* success (?) */
354 /**********************************************************************
355 * WINNLSGetEnableStatus [USER32.@]
358 BOOL WINAPI WINNLSGetEnableStatus(HWND hwnd)
360 FIXME("hwnd %p: stub!\n", hwnd);
361 return TRUE; /* success (?) */
364 /**********************************************************************
365 * SendIMEMessageExA [USER32.@]
368 LRESULT WINAPI SendIMEMessageExA(HWND hwnd, LPARAM lparam)
370 FIXME("(%p,%Ix): stub\n", hwnd, lparam);
371 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
372 return 0;
375 /**********************************************************************
376 * SendIMEMessageExW [USER32.@]
379 LRESULT WINAPI SendIMEMessageExW(HWND hwnd, LPARAM lparam)
381 FIXME("(%p,%Ix): stub\n", hwnd, lparam);
382 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
383 return 0;
386 /**********************************************************************
387 * DisableProcessWindowsGhosting [USER32.@]
390 VOID WINAPI DisableProcessWindowsGhosting(VOID)
392 FIXME(": stub\n");
393 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
394 return;
397 /**********************************************************************
398 * UserHandleGrantAccess [USER32.@]
401 BOOL WINAPI UserHandleGrantAccess(HANDLE handle, HANDLE job, BOOL grant)
403 FIXME("(%p,%p,%d): stub\n", handle, job, grant);
404 return TRUE;
407 /**********************************************************************
408 * RegisterPowerSettingNotification [USER32.@]
410 HPOWERNOTIFY WINAPI RegisterPowerSettingNotification(HANDLE recipient, const GUID *guid, DWORD flags)
412 FIXME("(%p,%s,%lx): stub\n", recipient, debugstr_guid(guid), flags);
413 return (HPOWERNOTIFY)0xdeadbeef;
416 /**********************************************************************
417 * UnregisterPowerSettingNotification [USER32.@]
419 BOOL WINAPI UnregisterPowerSettingNotification(HPOWERNOTIFY handle)
421 FIXME("(%p): stub\n", handle);
422 return TRUE;
425 /**********************************************************************
426 * RegisterSuspendResumeNotification (USER32.@)
428 HPOWERNOTIFY WINAPI RegisterSuspendResumeNotification(HANDLE recipient, DWORD flags)
430 FIXME("%p, %#lx: stub.\n", recipient, flags);
431 return (HPOWERNOTIFY)0xdeadbeef;
434 /**********************************************************************
435 * UnregisterSuspendResumeNotification (USER32.@)
437 BOOL WINAPI UnregisterSuspendResumeNotification(HPOWERNOTIFY handle)
439 FIXME("%p: stub.\n", handle);
440 return TRUE;
443 /**********************************************************************
444 * IsWindowRedirectedForPrint [USER32.@]
446 BOOL WINAPI IsWindowRedirectedForPrint( HWND hwnd )
448 FIXME("(%p): stub\n", hwnd);
449 return FALSE;
452 /**********************************************************************
453 * RegisterPointerDeviceNotifications [USER32.@]
455 BOOL WINAPI RegisterPointerDeviceNotifications(HWND hwnd, BOOL notifyrange)
457 FIXME("(%p %d): stub\n", hwnd, notifyrange);
458 return TRUE;
461 /**********************************************************************
462 * GetPointerDevices [USER32.@]
464 BOOL WINAPI GetPointerDevices(UINT32 *device_count, POINTER_DEVICE_INFO *devices)
466 FIXME("(%p %p): partial stub\n", device_count, devices);
468 if (!device_count)
469 return FALSE;
471 if (devices)
472 return FALSE;
474 *device_count = 0;
475 return TRUE;
478 /**********************************************************************
479 * RegisterTouchHitTestingWindow [USER32.@]
481 BOOL WINAPI RegisterTouchHitTestingWindow(HWND hwnd, ULONG value)
483 FIXME("(%p %ld): stub\n", hwnd, value);
484 return TRUE;
487 /**********************************************************************
488 * GetPointerType [USER32.@]
490 BOOL WINAPI GetPointerType(UINT32 id, POINTER_INPUT_TYPE *type)
492 FIXME("(%d %p): stub\n", id, type);
494 if(!id || !type)
496 SetLastError(ERROR_INVALID_PARAMETER);
497 return FALSE;
500 *type = PT_MOUSE;
501 return TRUE;
504 BOOL WINAPI GetPointerInfo(UINT32 id, POINTER_INFO *info)
506 FIXME("(%d %p): stub\n", id, info);
508 SetLastError(ERROR_INVALID_PARAMETER);
509 return FALSE;
512 LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
514 if (!imm_ime_wnd_proc) return DefWindowProcA(hwnd, msg, wParam, lParam);
515 return imm_ime_wnd_proc( hwnd, msg, wParam, lParam, TRUE );
518 LRESULT WINAPI ImeWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
520 if (!imm_ime_wnd_proc) return DefWindowProcW(hwnd, msg, wParam, lParam);
521 return imm_ime_wnd_proc( hwnd, msg, wParam, lParam, FALSE );