8199c0222f73a95fa87dc96e7827fce36e43fa11
[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 HKL WINAPI LoadKeyboardLayoutEx(DWORD unknown,LPCWSTR pwszKLID,UINT Flags) //1st parameter unknown
448 {
449 UNIMPLEMENTED;
450 return FALSE;
451 }
452
453 /*
454 * @unimplemented
455 */
456 VOID WINAPI AllowForegroundActivation(VOID)
457 {
458 UNIMPLEMENTED;
459 }
460
461 /*
462 * @unimplemented
463 */
464 VOID WINAPI ShowStartGlass(DWORD unknown)
465 {
466 UNIMPLEMENTED;
467 }
468
469 /*
470 * @implemented
471 */
472 DWORD WINAPI GetMenuIndex(HMENU hMenu, HMENU hSubMenu)
473 {
474 return NtUserGetMenuIndex(hMenu, hSubMenu);
475 }
476
477 /*
478 * @unimplemented
479 */
480 DWORD WINAPI UserRegisterWowHandlers(PVOID Unknown1, PVOID Unknown2)
481 {
482 UNIMPLEMENTED;
483 return 0;
484 }
485
486 BOOL
487 WINAPI
488 BuildReasonArray(PVOID Pointer)
489 {
490 UNIMPLEMENTED;
491 return FALSE;
492 }
493
494 VOID
495 WINAPI
496 CreateSystemThreads(DWORD Unused)
497 {
498 /* Thread call for remote processes (non-CSRSS) only */
499 NtUserxCreateSystemThreads(TRUE);
500 ExitThread(0);
501 }
502
503 BOOL
504 WINAPI
505 DestroyReasons(PVOID Pointer)
506 {
507 UNIMPLEMENTED;
508 return FALSE;
509 }
510
511 NTSTATUS
512 WINAPI
513 DeviceEventWorker(HWND hwnd, WPARAM wParam, LPARAM lParam, DWORD Data, ULONG_PTR *uResult)
514 {
515 USER_API_MESSAGE ApiMessage;
516 PUSER_DEVICE_EVENT_MSG pusem = &ApiMessage.Data.DeviceEventMsg;
517
518 pusem->hwnd = hwnd;
519 pusem->wParam = wParam;
520 pusem->lParam = lParam;
521 pusem->Data = Data;
522 pusem->Result = 0;
523
524 TRACE("DeviceEventWorker : hwnd %p, wParam %d, lParam %d, Data %d, uResult %p\n", hwnd, wParam, lParam, Data, uResult);
525
526 if ( lParam == 0 )
527 {
528 CsrClientCallServer( (PCSR_API_MESSAGE)&ApiMessage,
529 NULL,
530 CSR_CREATE_API_NUMBER( USERSRV_SERVERDLL_INDEX, UserpDeviceEvent ),
531 sizeof(*pusem) );
532 }
533 else
534 {
535 PCSR_CAPTURE_BUFFER pcsrcb = NULL;
536 PDEV_BROADCAST_HDR pdev_br = (PDEV_BROADCAST_HDR)lParam;
537 ULONG BufferSize = pdev_br->dbch_size;
538
539 pcsrcb = CsrAllocateCaptureBuffer( 1, BufferSize );
540
541 if ( !pcsrcb )
542 {
543 return STATUS_NO_MEMORY;
544 }
545
546 CsrCaptureMessageBuffer( pcsrcb, (PVOID)lParam, BufferSize, (PVOID*)&pusem->lParam );
547
548 CsrClientCallServer( (PCSR_API_MESSAGE)&ApiMessage,
549 pcsrcb,
550 CSR_CREATE_API_NUMBER( USERSRV_SERVERDLL_INDEX, UserpDeviceEvent ),
551 sizeof(*pusem) );
552
553 CsrFreeCaptureBuffer( pcsrcb );
554 }
555
556 if (NT_SUCCESS(ApiMessage.Status))
557 {
558 *uResult = pusem->Result;
559 }
560
561 return ApiMessage.Status;
562 }
563
564 BOOL
565 WINAPI
566 GetReasonTitleFromReasonCode(DWORD dw1, DWORD dw2, DWORD dw3)
567 {
568 UNIMPLEMENTED;
569 return FALSE;
570 }
571
572 BOOL
573 WINAPI
574 IsSETEnabled(VOID)
575 {
576 /*
577 * Determines whether the Shutdown Event Tracker is enabled.
578 *
579 * See http://undoc.airesoft.co.uk/user32.dll/IsSETEnabled.php
580 * for more information.
581 */
582 UNIMPLEMENTED;
583 return FALSE;
584 }
585
586 BOOL
587 WINAPI
588 RecordShutdownReason(DWORD dw0)
589 {
590 UNIMPLEMENTED;
591 return FALSE;
592 }
593
594 BOOL
595 WINAPI
596 UserLpkTabbedTextOut(
597 DWORD dw1,
598 DWORD dw2,
599 DWORD dw3,
600 DWORD dw4,
601 DWORD dw5,
602 DWORD dw6,
603 DWORD dw7,
604 DWORD dw8,
605 DWORD dw9,
606 DWORD dw10,
607 DWORD dw11,
608 DWORD dw12)
609 {
610 UNIMPLEMENTED;
611 return FALSE;
612 }
613
614 BOOL
615 WINAPI
616 Win32PoolAllocationStats(DWORD dw1, DWORD dw2, DWORD dw3, DWORD dw4, DWORD dw5)
617 {
618 UNIMPLEMENTED;
619 return FALSE;
620 }
621