[USER32] Refactoring on LoadKeyboardLayout(W/Ex) (#4601)
[reactos.git] / win32ss / user / user32 / misc / stubs.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS user32.dll
4 * FILE: win32ss/user/user32/misc/stubs.c
5 * PURPOSE: User32.dll stubs
6 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * NOTES: If you implement a function, remove it from this file
8 * UPDATE HISTORY:
9 * 08-F05-2001 CSH Created
10 */
11
12 #include <user32.h>
13
14 WINE_DEFAULT_DEBUG_CHANNEL(user32);
15
16 /*
17 * @unimplemented
18 */
19 DWORD
20 WINAPI
21 WaitForInputIdle(
22 HANDLE hProcess,
23 DWORD dwMilliseconds)
24 {
25 // Need to call NtQueryInformationProcess and send ProcessId not hProcess.
26 return NtUserWaitForInputIdle(hProcess, dwMilliseconds, FALSE);
27 }
28
29 /******************************************************************************
30 * SetDebugErrorLevel [USER32.@]
31 * Sets the minimum error level for generating debugging events
32 *
33 * PARAMS
34 * dwLevel [I] Debugging error level
35 *
36 * @unimplemented
37 */
38 VOID
39 WINAPI
40 SetDebugErrorLevel( DWORD dwLevel )
41 {
42 FIXME("(%lu): stub\n", dwLevel);
43 }
44
45
46 /*
47 * @implemented
48 */
49 DWORD
50 WINAPI
51 GetAppCompatFlags(HTASK hTask)
52 {
53 PCLIENTINFO pci = GetWin32ClientInfo();
54
55 return pci->dwCompatFlags;
56 }
57
58 /*
59 * @implemented
60 */
61 DWORD
62 WINAPI
63 GetAppCompatFlags2(HTASK hTask)
64 {
65 PCLIENTINFO pci = GetWin32ClientInfo();
66
67 return pci->dwCompatFlags2;
68 }
69
70 /*
71 * @unimplemented
72 */
73 VOID
74 WINAPI
75 LoadLocalFonts ( VOID )
76 {
77 UNIMPLEMENTED;
78 }
79
80 /*
81 * @unimplemented
82 */
83 VOID
84 WINAPI
85 LoadRemoteFonts ( VOID )
86 {
87 UNIMPLEMENTED;
88 }
89
90 /*
91 * @unimplemented
92 */
93 VOID
94 WINAPI
95 RegisterSystemThread ( DWORD flags, DWORD reserved )
96 {
97 UNIMPLEMENTED;
98 }
99
100
101 /*
102 * @implemented
103 */
104 UINT
105 WINAPI
106 UserRealizePalette ( HDC hDC )
107 {
108 return NtUserxRealizePalette(hDC);
109 }
110
111
112 /*************************************************************************
113 * SetSysColorsTemp (USER32.@) (Wine 10/22/2008)
114 *
115 * UNDOCUMENTED !!
116 *
117 * Called by W98SE desk.cpl Control Panel Applet:
118 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
119 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
120 *
121 * pPens is an array of COLORREF values, which seems to be used
122 * to indicate the color values to create new pens with.
123 *
124 * pBrushes is an array of solid brush handles (returned by a previous
125 * CreateSolidBrush), which seems to contain the brush handles to set
126 * for the system colors.
127 *
128 * n seems to be used for
129 * a) indicating the number of entries to operate on (length of pPens,
130 * pBrushes)
131 * b) passing the handle that points to the previously used color settings.
132 * I couldn't figure out in hell what kind of handle this is on
133 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
134 *
135 * RETURNS
136 * heap handle of our own copy of the current syscolors in case of
137 * "set" call, i.e. pPens, pBrushes != NULL.
138 * TRUE (unconditionally !) in case of "restore" call,
139 * i.e. pPens, pBrushes == NULL.
140 * FALSE in case of either pPens != NULL and pBrushes == NULL
141 * or pPens == NULL and pBrushes != NULL.
142 *
143 * I'm not sure whether this implementation is 100% correct. [AM]
144 */
145
146 static HPEN SysColorPens[COLOR_MENUBAR + 1];
147 static HBRUSH SysColorBrushes[COLOR_MENUBAR + 1];
148
149 DWORD_PTR
150 WINAPI
151 SetSysColorsTemp(const COLORREF *pPens,
152 const HBRUSH *pBrushes,
153 DWORD_PTR n)
154 {
155 DWORD i;
156
157 if (pPens && pBrushes) /* "set" call */
158 {
159 /* allocate our structure to remember old colors */
160 LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
161 LPVOID p = pOldCol;
162 *(DWORD_PTR *)p = n; p = (char*)p + sizeof(DWORD);
163 memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
164 memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p = (char*)p + n*sizeof(HBRUSH);
165
166 for (i=0; i < n; i++)
167 {
168 SysColorPens[i] = CreatePen( PS_SOLID, 1, pPens[i] );
169 SysColorBrushes[i] = pBrushes[i];
170 }
171
172 return (DWORD_PTR) pOldCol;
173 }
174 if (!pPens && !pBrushes) /* "restore" call */
175 {
176 LPVOID pOldCol = (LPVOID)n;
177 LPVOID p = pOldCol;
178 DWORD nCount = *(DWORD *)p;
179 p = (char*)p + sizeof(DWORD);
180
181 for (i=0; i < nCount; i++)
182 {
183 DeleteObject(SysColorPens[i]);
184 SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
185 }
186 for (i=0; i < nCount; i++)
187 {
188 SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
189 }
190 /* get rid of storage structure */
191 HeapFree(GetProcessHeap(), 0, pOldCol);
192
193 return TRUE;
194 }
195 return FALSE;
196 }
197
198 /*
199 * @unimplemented
200 */
201 HDESK
202 WINAPI
203 GetInputDesktop ( VOID )
204 {
205 UNIMPLEMENTED;
206 return FALSE;
207 }
208
209 /*
210 * @unimplemented
211 */
212 BOOL
213 WINAPI
214 GetAccCursorInfo ( PCURSORINFO pci )
215 {
216 UNIMPLEMENTED;
217 return FALSE;
218 }
219
220 /*
221 * @unimplemented
222 */
223 UINT
224 WINAPI
225 GetRawInputDeviceInfoW(
226 HANDLE hDevice,
227 UINT uiCommand,
228 LPVOID pData,
229 PUINT pcbSize)
230 {
231 UNIMPLEMENTED;
232 return 0;
233 }
234
235 /*
236 * @unimplemented
237 */
238 LONG
239 WINAPI
240 CsrBroadcastSystemMessageExW(
241 DWORD dwflags,
242 LPDWORD lpdwRecipients,
243 UINT uiMessage,
244 WPARAM wParam,
245 LPARAM lParam,
246 PBSMINFO pBSMInfo)
247 {
248 UNIMPLEMENTED;
249 return FALSE;
250 }
251
252 /*
253 * @unimplemented
254 */
255 UINT
256 WINAPI
257 GetRawInputDeviceInfoA(
258 HANDLE hDevice,
259 UINT uiCommand,
260 LPVOID pData,
261 PUINT pcbSize)
262 {
263 UNIMPLEMENTED;
264 return 0;
265 }
266
267 /*
268 * @unimplemented
269 */
270 BOOL
271 WINAPI
272 AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
273 {
274 UNIMPLEMENTED;
275 return FALSE;
276 }
277
278 /*
279 * @implemented
280 */
281 LRESULT
282 WINAPI
283 DefRawInputProc(
284 PRAWINPUT* paRawInput,
285 INT nInput,
286 UINT cbSizeHeader)
287 {
288 if (cbSizeHeader == sizeof(RAWINPUTHEADER))
289 return S_OK;
290 return 1;
291 }
292
293 /*
294 * @unimplemented
295 */
296 UINT
297 WINAPI
298 DECLSPEC_HOTPATCH
299 GetRawInputBuffer(
300 PRAWINPUT pData,
301 PUINT pcbSize,
302 UINT cbSizeHeader)
303 {
304 UNIMPLEMENTED;
305 return 0;
306 }
307
308 /*
309 * @unimplemented
310 */
311 UINT
312 WINAPI
313 GetRawInputData(
314 HRAWINPUT hRawInput,
315 UINT uiCommand,
316 LPVOID pData,
317 PUINT pcbSize,
318 UINT cbSizeHeader)
319 {
320 UNIMPLEMENTED;
321 return 0;
322 }
323
324 /*
325 * @unimplemented
326 */
327 UINT
328 WINAPI
329 GetRawInputDeviceList(
330 PRAWINPUTDEVICELIST pRawInputDeviceList,
331 PUINT puiNumDevices,
332 UINT cbSize)
333 {
334 if(pRawInputDeviceList)
335 memset(pRawInputDeviceList, 0, sizeof *pRawInputDeviceList);
336 if(puiNumDevices)
337 *puiNumDevices = 0;
338
339 UNIMPLEMENTED;
340 return 0;
341 }
342
343 /*
344 * @unimplemented
345 */
346 UINT
347 WINAPI
348 DECLSPEC_HOTPATCH
349 GetRegisteredRawInputDevices(
350 PRAWINPUTDEVICE pRawInputDevices,
351 PUINT puiNumDevices,
352 UINT cbSize)
353 {
354 UNIMPLEMENTED;
355 return 0;
356 }
357
358 /*
359 * @unimplemented
360 */
361 BOOL
362 WINAPI
363 DECLSPEC_HOTPATCH
364 RegisterRawInputDevices(
365 PCRAWINPUTDEVICE pRawInputDevices,
366 UINT uiNumDevices,
367 UINT cbSize)
368 {
369 UNIMPLEMENTED;
370 return FALSE;
371 }
372
373 /*
374 * @unimplemented
375 */
376 BOOL WINAPI DisplayExitWindowsWarnings(ULONG flags)
377 {
378 UNIMPLEMENTED;
379 return FALSE;
380 }
381
382 /*
383 * @unimplemented
384 */
385 BOOL WINAPI ReasonCodeNeedsBugID(ULONG reasoncode)
386 {
387 UNIMPLEMENTED;
388 return FALSE;
389 }
390
391 /*
392 * @unimplemented
393 */
394 BOOL WINAPI ReasonCodeNeedsComment(ULONG reasoncode)
395 {
396 UNIMPLEMENTED;
397 return FALSE;
398 }
399
400 /*
401 * @unimplemented
402 */
403 BOOL WINAPI CtxInitUser32(VOID)
404 {
405 UNIMPLEMENTED;
406 return FALSE;
407 }
408
409 /*
410 * @unimplemented
411 */
412 BOOL WINAPI EnterReaderModeHelper(HWND hwnd)
413 {
414 UNIMPLEMENTED;
415 return FALSE;
416 }
417
418 /*
419 * @unimplemented
420 */
421 VOID WINAPI InitializeLpkHooks(FARPROC *hookfuncs)
422 {
423 UNIMPLEMENTED;
424 }
425
426 /*
427 * @unimplemented
428 */
429 WORD WINAPI InitializeWin32EntryTable(UCHAR* EntryTablePlus0x1000)
430 {
431 UNIMPLEMENTED;
432 return FALSE;
433 }
434
435 /*
436 * @unimplemented
437 */
438 BOOL WINAPI IsServerSideWindow(HWND wnd)
439 {
440 UNIMPLEMENTED;
441 return FALSE;
442 }
443
444 /*
445 * @unimplemented
446 */
447 VOID WINAPI AllowForegroundActivation(VOID)
448 {
449 UNIMPLEMENTED;
450 }
451
452 /*
453 * @unimplemented
454 */
455 VOID WINAPI ShowStartGlass(DWORD unknown)
456 {
457 UNIMPLEMENTED;
458 }
459
460 /*
461 * @implemented
462 */
463 DWORD WINAPI GetMenuIndex(HMENU hMenu, HMENU hSubMenu)
464 {
465 return NtUserGetMenuIndex(hMenu, hSubMenu);
466 }
467
468 /*
469 * @unimplemented
470 */
471 DWORD WINAPI UserRegisterWowHandlers(PVOID Unknown1, PVOID Unknown2)
472 {
473 UNIMPLEMENTED;
474 return 0;
475 }
476
477 BOOL
478 WINAPI
479 BuildReasonArray(PVOID Pointer)
480 {
481 UNIMPLEMENTED;
482 return FALSE;
483 }
484
485 VOID
486 WINAPI
487 CreateSystemThreads(DWORD Unused)
488 {
489 /* Thread call for remote processes (non-CSRSS) only */
490 NtUserxCreateSystemThreads(TRUE);
491 ExitThread(0);
492 }
493
494 BOOL
495 WINAPI
496 DestroyReasons(PVOID Pointer)
497 {
498 UNIMPLEMENTED;
499 return FALSE;
500 }
501
502 NTSTATUS
503 WINAPI
504 DeviceEventWorker(HWND hwnd, WPARAM wParam, LPARAM lParam, DWORD Data, ULONG_PTR *uResult)
505 {
506 USER_API_MESSAGE ApiMessage;
507 PUSER_DEVICE_EVENT_MSG pusem = &ApiMessage.Data.DeviceEventMsg;
508
509 pusem->hwnd = hwnd;
510 pusem->wParam = wParam;
511 pusem->lParam = lParam;
512 pusem->Data = Data;
513 pusem->Result = 0;
514
515 TRACE("DeviceEventWorker : hwnd %p, wParam %d, lParam %d, Data %d, uResult %p\n", hwnd, wParam, lParam, Data, uResult);
516
517 if ( lParam == 0 )
518 {
519 CsrClientCallServer( (PCSR_API_MESSAGE)&ApiMessage,
520 NULL,
521 CSR_CREATE_API_NUMBER( USERSRV_SERVERDLL_INDEX, UserpDeviceEvent ),
522 sizeof(*pusem) );
523 }
524 else
525 {
526 PCSR_CAPTURE_BUFFER pcsrcb = NULL;
527 PDEV_BROADCAST_HDR pdev_br = (PDEV_BROADCAST_HDR)lParam;
528 ULONG BufferSize = pdev_br->dbch_size;
529
530 pcsrcb = CsrAllocateCaptureBuffer( 1, BufferSize );
531
532 if ( !pcsrcb )
533 {
534 return STATUS_NO_MEMORY;
535 }
536
537 CsrCaptureMessageBuffer( pcsrcb, (PVOID)lParam, BufferSize, (PVOID*)&pusem->lParam );
538
539 CsrClientCallServer( (PCSR_API_MESSAGE)&ApiMessage,
540 pcsrcb,
541 CSR_CREATE_API_NUMBER( USERSRV_SERVERDLL_INDEX, UserpDeviceEvent ),
542 sizeof(*pusem) );
543
544 CsrFreeCaptureBuffer( pcsrcb );
545 }
546
547 if (NT_SUCCESS(ApiMessage.Status))
548 {
549 *uResult = pusem->Result;
550 }
551
552 return ApiMessage.Status;
553 }
554
555 BOOL
556 WINAPI
557 GetReasonTitleFromReasonCode(DWORD dw1, DWORD dw2, DWORD dw3)
558 {
559 UNIMPLEMENTED;
560 return FALSE;
561 }
562
563 BOOL
564 WINAPI
565 IsSETEnabled(VOID)
566 {
567 /*
568 * Determines whether the Shutdown Event Tracker is enabled.
569 *
570 * See http://undoc.airesoft.co.uk/user32.dll/IsSETEnabled.php
571 * for more information.
572 */
573 UNIMPLEMENTED;
574 return FALSE;
575 }
576
577 BOOL
578 WINAPI
579 RecordShutdownReason(DWORD dw0)
580 {
581 UNIMPLEMENTED;
582 return FALSE;
583 }
584
585 BOOL
586 WINAPI
587 UserLpkTabbedTextOut(
588 DWORD dw1,
589 DWORD dw2,
590 DWORD dw3,
591 DWORD dw4,
592 DWORD dw5,
593 DWORD dw6,
594 DWORD dw7,
595 DWORD dw8,
596 DWORD dw9,
597 DWORD dw10,
598 DWORD dw11,
599 DWORD dw12)
600 {
601 UNIMPLEMENTED;
602 return FALSE;
603 }
604
605 BOOL
606 WINAPI
607 Win32PoolAllocationStats(DWORD dw1, DWORD dw2, DWORD dw3, DWORD dw4, DWORD dw5)
608 {
609 UNIMPLEMENTED;
610 return FALSE;
611 }
612