- Check if server side window proc is set when clearing or setting dialog window...
[reactos.git] / reactos / subsystems / win32 / win32k / ntuser / simplecall.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: NtUserCallXxx call stubs
5 * FILE: subsystem/win32/win32k/ntuser/simplecall.c
6 * PROGRAMER: Ge van Geldorp (ge@gse.nl)
7 * REVISION HISTORY:
8 * 2008/03/20 Split from misc.c
9 */
10
11 #include <w32k.h>
12
13 #define NDEBUG
14 #include <debug.h>
15
16
17 /* registered Logon process */
18 PPROCESSINFO LogonProcess = NULL;
19
20 BOOL FASTCALL
21 co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
22 {
23 PEPROCESS Process;
24 NTSTATUS Status;
25 CSR_API_MESSAGE Request;
26
27 Status = PsLookupProcessByProcessId(ProcessId,
28 &Process);
29 if (!NT_SUCCESS(Status))
30 {
31 SetLastWin32Error(RtlNtStatusToDosError(Status));
32 return FALSE;
33 }
34
35 if (Register)
36 {
37 /* Register the logon process */
38 if (LogonProcess != NULL)
39 {
40 ObDereferenceObject(Process);
41 return FALSE;
42 }
43
44 LogonProcess = (PPROCESSINFO)Process->Win32Process;
45 }
46 else
47 {
48 /* Deregister the logon process */
49 if (LogonProcess != (PPROCESSINFO)Process->Win32Process)
50 {
51 ObDereferenceObject(Process);
52 return FALSE;
53 }
54
55 LogonProcess = NULL;
56 }
57
58 ObDereferenceObject(Process);
59
60 Request.Type = MAKE_CSR_API(REGISTER_LOGON_PROCESS, CSR_GUI);
61 Request.Data.RegisterLogonProcessRequest.ProcessId = ProcessId;
62 Request.Data.RegisterLogonProcessRequest.Register = Register;
63
64 Status = co_CsrNotify(&Request);
65 if (! NT_SUCCESS(Status))
66 {
67 DPRINT1("Failed to register logon process with CSRSS\n");
68 return FALSE;
69 }
70
71 return TRUE;
72 }
73
74 /*
75 * @unimplemented
76 */
77 DWORD
78 APIENTRY
79 NtUserCallNoParam(DWORD Routine)
80 {
81 DWORD Result = 0;
82 DECLARE_RETURN(DWORD);
83
84 DPRINT("Enter NtUserCallNoParam\n");
85 UserEnterExclusive();
86
87 switch(Routine)
88 {
89 case NOPARAM_ROUTINE_CREATEMENU:
90 Result = (DWORD)UserCreateMenu(FALSE);
91 break;
92
93 case NOPARAM_ROUTINE_CREATEMENUPOPUP:
94 Result = (DWORD)UserCreateMenu(TRUE);
95 break;
96
97 case NOPARAM_ROUTINE_DESTROY_CARET:
98 Result = (DWORD)co_IntDestroyCaret(PsGetCurrentThread()->Tcb.Win32Thread);
99 break;
100
101 case NOPARAM_ROUTINE_INIT_MESSAGE_PUMP:
102 Result = (DWORD)IntInitMessagePumpHook();
103 break;
104
105 case NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP:
106 Result = (DWORD)IntUninitMessagePumpHook();
107 break;
108
109 case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO:
110 Result = (DWORD)MsqGetMessageExtraInfo();
111 break;
112
113 case NOPARAM_ROUTINE_ANYPOPUP:
114 Result = (DWORD)IntAnyPopup();
115 break;
116
117 case NOPARAM_ROUTINE_CSRSS_INITIALIZED:
118 Result = (DWORD)CsrInit();
119 break;
120
121 case NOPARAM_ROUTINE_MSQCLEARWAKEMASK:
122 RETURN( (DWORD)IntMsqClearWakeMask());
123
124 default:
125 DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
126 SetLastWin32Error(ERROR_INVALID_PARAMETER);
127 break;
128 }
129 RETURN(Result);
130
131 CLEANUP:
132 DPRINT("Leave NtUserCallNoParam, ret=%i\n",_ret_);
133 UserLeave();
134 END_CLEANUP;
135 }
136
137
138 /*
139 * @implemented
140 */
141 DWORD
142 APIENTRY
143 NtUserCallOneParam(
144 DWORD Param,
145 DWORD Routine)
146 {
147 DECLARE_RETURN(DWORD);
148
149 DPRINT("Enter NtUserCallOneParam\n");
150
151 UserEnterExclusive();
152
153 switch(Routine)
154 {
155 case ONEPARAM_ROUTINE_POSTQUITMESSAGE:
156 {
157 PTHREADINFO pti;
158 pti = PsGetCurrentThreadWin32Thread();
159 MsqPostQuitMessage(pti->MessageQueue, Param);
160 RETURN(TRUE);
161 }
162 case ONEPARAM_ROUTINE_SHOWCURSOR:
163 RETURN( (DWORD)UserShowCursor((BOOL)Param) );
164
165 case ONEPARAM_ROUTINE_GETDESKTOPMAPPING:
166 {
167 PW32THREADINFO ti;
168 ti = GetW32ThreadInfo();
169 if (ti != NULL)
170 {
171 /* Try convert the pointer to a user mode pointer if the desktop is
172 mapped into the process */
173 RETURN((DWORD)DesktopHeapAddressToUser((PVOID)Param));
174 }
175 else
176 {
177 RETURN(0);
178 }
179 }
180
181 case ONEPARAM_ROUTINE_GETMENU:
182 {
183 PWINDOW_OBJECT Window;
184 DWORD Result;
185
186 if(!(Window = UserGetWindowObject((HWND)Param)))
187 {
188 RETURN( FALSE);
189 }
190
191 Result = (DWORD)Window->Wnd->IDMenu;
192
193 RETURN( Result);
194 }
195
196 case ONEPARAM_ROUTINE_ISWINDOWUNICODE:
197 {
198 PWINDOW_OBJECT Window;
199 DWORD Result;
200
201 Window = UserGetWindowObject((HWND)Param);
202 if(!Window)
203 {
204 RETURN( FALSE);
205 }
206 Result = Window->Wnd->Unicode;
207 RETURN( Result);
208 }
209
210 case ONEPARAM_ROUTINE_WINDOWFROMDC:
211 RETURN( (DWORD)IntWindowFromDC((HDC)Param));
212
213 case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
214 {
215 DWORD Result;
216
217 Result = gspv.bMouseBtnSwap;
218 gspv.bMouseBtnSwap = Param ? TRUE : FALSE;
219 gpsi->aiSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap;
220 RETURN(Result);
221 }
222
223 case ONEPARAM_ROUTINE_SWITCHCARETSHOWING:
224 RETURN( (DWORD)IntSwitchCaretShowing((PVOID)Param));
225
226 case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
227 RETURN( (DWORD)IntSetCaretBlinkTime((UINT)Param));
228
229 case ONEPARAM_ROUTINE_GETWINDOWINSTANCE:
230 {
231 PWINDOW_OBJECT Window;
232 DWORD Result;
233
234 if(!(Window = UserGetWindowObject((HWND)Param)))
235 {
236 RETURN( FALSE);
237 }
238
239 Result = (DWORD)Window->Wnd->hModule;
240 RETURN( Result);
241 }
242
243 case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
244 RETURN( (DWORD)MsqSetMessageExtraInfo((LPARAM)Param));
245
246 case ONEPARAM_ROUTINE_CREATECURICONHANDLE:
247 {
248 PCURICON_OBJECT CurIcon;
249 PWINSTATION_OBJECT WinSta;
250
251 WinSta = IntGetWinStaObj();
252 if(WinSta == NULL)
253 {
254 RETURN(0);
255 }
256
257 if (!(CurIcon = IntCreateCurIconHandle(WinSta)))
258 {
259 SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
260 ObDereferenceObject(WinSta);
261 RETURN(0);
262 }
263
264 ObDereferenceObject(WinSta);
265 RETURN((DWORD)CurIcon->Self);
266 }
267
268 case ONEPARAM_ROUTINE_GETCURSORPOSITION:
269 {
270 PWINSTATION_OBJECT WinSta;
271 NTSTATUS Status;
272 POINT Pos;
273
274 if(!Param)
275 RETURN( (DWORD)FALSE);
276 Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
277 KernelMode,
278 0,
279 &WinSta);
280 if (!NT_SUCCESS(Status))
281 RETURN( (DWORD)FALSE);
282
283 /* FIXME - check if process has WINSTA_READATTRIBUTES */
284 IntGetCursorLocation(WinSta, &Pos);
285
286 Status = MmCopyToCaller((PPOINT)Param, &Pos, sizeof(POINT));
287 if(!NT_SUCCESS(Status))
288 {
289 ObDereferenceObject(WinSta);
290 SetLastNtError(Status);
291 RETURN( FALSE);
292 }
293
294 ObDereferenceObject(WinSta);
295
296 RETURN( (DWORD)TRUE);
297 }
298
299 case ONEPARAM_ROUTINE_ISWINDOWINDESTROY:
300 {
301 PWINDOW_OBJECT Window;
302 DWORD Result;
303
304 if(!(Window = UserGetWindowObject((HWND)Param)))
305 {
306 RETURN( FALSE);
307 }
308
309 Result = (DWORD)IntIsWindowInDestroy(Window);
310
311 RETURN( Result);
312 }
313
314 case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
315 {
316 BOOL Enable;
317 PPROCESSINFO Process = PsGetCurrentProcessWin32Process();
318
319 if(Process != NULL)
320 {
321 Enable = (BOOL)(Param != 0);
322
323 if(Enable)
324 {
325 Process->W32PF_flags &= ~W32PF_NOWINDOWGHOSTING;
326 }
327 else
328 {
329 Process->W32PF_flags |= W32PF_NOWINDOWGHOSTING;
330 }
331
332 RETURN( TRUE);
333 }
334
335 RETURN( FALSE);
336 }
337
338 case ONEPARAM_ROUTINE_MSQSETWAKEMASK:
339 RETURN( (DWORD)IntMsqSetWakeMask(Param));
340
341 case ONEPARAM_ROUTINE_GETKEYBOARDTYPE:
342 RETURN( UserGetKeyboardType(Param));
343
344 case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT:
345 RETURN( (DWORD)UserGetKeyboardLayout(Param));
346
347 case ONEPARAM_ROUTINE_RELEASEDC:
348 RETURN (UserReleaseDC(NULL, (HDC) Param, FALSE));
349
350 case ONEPARAM_ROUTINE_REALIZEPALETTE:
351 RETURN (UserRealizePalette((HDC) Param));
352
353 case ONEPARAM_ROUTINE_GETQUEUESTATUS:
354 {
355 DWORD Ret;
356 WORD changed_bits, wake_bits;
357 Ret = IntGetQueueStatus(FALSE);
358 changed_bits = LOWORD(Ret);
359 wake_bits = HIWORD(Ret);
360 RETURN( MAKELONG(changed_bits & Param, wake_bits & Param));
361 }
362 case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS:
363 /* FIXME: Should use UserEnterShared */
364 RETURN(IntEnumClipboardFormats(Param));
365
366 case ONEPARAM_ROUTINE_CSRSS_GUICHECK:
367 IntUserManualGuiCheck(Param);
368 RETURN(TRUE);
369
370 case ONEPARAM_ROUTINE_GETCURSORPOS:
371 {
372 BOOL Ret = TRUE;
373 PPOINTL pptl;
374 PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
375 if (pti->hDesktop != InputDesktopHandle) RETURN(FALSE);
376 _SEH2_TRY
377 {
378 pptl = (PPOINTL)Param;
379 *pptl = gpsi->ptCursor;
380 }
381 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
382 {
383 Ret = FALSE;
384 }
385 _SEH2_END;
386 RETURN(Ret);
387 }
388 }
389 DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
390 Routine, Param);
391 SetLastWin32Error(ERROR_INVALID_PARAMETER);
392 RETURN( 0);
393
394 CLEANUP:
395 DPRINT("Leave NtUserCallOneParam, ret=%i\n",_ret_);
396 UserLeave();
397 END_CLEANUP;
398 }
399
400
401 /*
402 * @implemented
403 */
404 DWORD
405 APIENTRY
406 NtUserCallTwoParam(
407 DWORD Param1,
408 DWORD Param2,
409 DWORD Routine)
410 {
411 NTSTATUS Status;
412 PWINDOW_OBJECT Window;
413 DECLARE_RETURN(DWORD);
414
415 DPRINT("Enter NtUserCallTwoParam\n");
416 UserEnterExclusive();
417
418 switch(Routine)
419 {
420 case TWOPARAM_ROUTINE_GETWINDOWRGNBOX:
421 {
422 DWORD Ret;
423 RECTL rcRect;
424 Window = UserGetWindowObject((HWND)Param1);
425 if (!Window) RETURN(ERROR);
426
427 Ret = (DWORD)IntGetWindowRgnBox(Window, &rcRect);
428 Status = MmCopyToCaller((PVOID)Param2, &rcRect, sizeof(RECT));
429 if(!NT_SUCCESS(Status))
430 {
431 SetLastNtError(Status);
432 RETURN( ERROR);
433 }
434 RETURN( Ret);
435 }
436 case TWOPARAM_ROUTINE_GETWINDOWRGN:
437 {
438 Window = UserGetWindowObject((HWND)Param1);
439 if (!Window) RETURN(ERROR);
440
441 RETURN( (DWORD)IntGetWindowRgn(Window, (HRGN)Param2));
442 }
443 case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
444 {
445 DWORD Ret;
446 PMENU_OBJECT MenuObject = IntGetMenuObject((HMENU)Param1);
447 if(!MenuObject)
448 RETURN( 0);
449
450 if(Param2 > 0)
451 {
452 Ret = (MenuObject->MenuInfo.Height == (int)Param2);
453 MenuObject->MenuInfo.Height = (int)Param2;
454 }
455 else
456 Ret = (DWORD)MenuObject->MenuInfo.Height;
457 IntReleaseMenuObject(MenuObject);
458 RETURN( Ret);
459 }
460 case TWOPARAM_ROUTINE_SETMENUITEMRECT:
461 {
462 BOOL Ret;
463 SETMENUITEMRECT smir;
464 PMENU_OBJECT MenuObject = IntGetMenuObject((HMENU)Param1);
465 if(!MenuObject)
466 RETURN( 0);
467
468 if(!NT_SUCCESS(MmCopyFromCaller(&smir, (PVOID)Param2, sizeof(SETMENUITEMRECT))))
469 {
470 IntReleaseMenuObject(MenuObject);
471 RETURN( 0);
472 }
473
474 Ret = IntSetMenuItemRect(MenuObject, smir.uItem, smir.fByPosition, &smir.rcRect);
475
476 IntReleaseMenuObject(MenuObject);
477 RETURN( (DWORD)Ret);
478 }
479
480 case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
481 {
482 PUSER_MESSAGE_QUEUE MsgQueue = ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
483
484 ASSERT(MsgQueue);
485 RETURN( (DWORD)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));
486 }
487
488 case TWOPARAM_ROUTINE_ENABLEWINDOW:
489 UNIMPLEMENTED
490 RETURN( 0);
491
492 case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS:
493 {
494 Window = UserGetWindowObject((HWND)Param1);
495 if (!Window) RETURN(0);
496
497 RETURN( (DWORD)IntShowOwnedPopups(Window, (BOOL) Param2));
498 }
499
500 case TWOPARAM_ROUTINE_ROS_UPDATEUISTATE:
501 {
502 WPARAM wParam;
503 Window = UserGetWindowObject((HWND)Param1);
504 if (!Window) RETURN(0);
505
506 /* Unpack wParam */
507 wParam = MAKEWPARAM((Param2 >> 3) & 0x3,
508 Param2 & (UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE));
509
510 RETURN( UserUpdateUiState(Window->Wnd, wParam) );
511 }
512
513 case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW:
514 UNIMPLEMENTED
515 RETURN( 0);
516
517 case TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID:
518
519 if(!(Window = UserGetWindowObject((HWND)Param1)))
520 {
521 RETURN( (DWORD)FALSE);
522 }
523
524 if ( Param2 )
525 IntSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param2);
526 else
527 IntRemoveProp(Window, gpsi->atomContextHelpIdProp);
528
529 RETURN( (DWORD)TRUE);
530
531 case TWOPARAM_ROUTINE_SETCARETPOS:
532 RETURN( (DWORD)co_IntSetCaretPos((int)Param1, (int)Param2));
533
534 case TWOPARAM_ROUTINE_GETWINDOWINFO:
535 {
536 WINDOWINFO wi;
537 DWORD Ret;
538
539 if(!(Window = UserGetWindowObject((HWND)Param1)))
540 {
541 RETURN( FALSE);
542 }
543
544 #if 0
545 /*
546 * According to WINE, Windows' doesn't check the cbSize field
547 */
548
549 Status = MmCopyFromCaller(&wi.cbSize, (PVOID)Param2, sizeof(wi.cbSize));
550 if(!NT_SUCCESS(Status))
551 {
552 SetLastNtError(Status);
553 RETURN( FALSE);
554 }
555
556 if(wi.cbSize != sizeof(WINDOWINFO))
557 {
558 SetLastWin32Error(ERROR_INVALID_PARAMETER);
559 RETURN( FALSE);
560 }
561 #endif
562
563 if((Ret = (DWORD)IntGetWindowInfo(Window, &wi)))
564 {
565 Status = MmCopyToCaller((PVOID)Param2, &wi, sizeof(WINDOWINFO));
566 if(!NT_SUCCESS(Status))
567 {
568 SetLastNtError(Status);
569 RETURN( FALSE);
570 }
571 }
572
573 RETURN( Ret);
574 }
575
576 case TWOPARAM_ROUTINE_REGISTERLOGONPROC:
577 RETURN( (DWORD)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
578
579 case TWOPARAM_ROUTINE_ROS_REGSYSCLASSES:
580 {
581 DWORD Ret = 0;
582 DWORD Count = Param1;
583 PREGISTER_SYSCLASS RegSysClassArray = (PREGISTER_SYSCLASS)Param2;
584
585 if (Count != 0 && RegSysClassArray != NULL)
586 {
587 _SEH2_TRY
588 {
589 ProbeArrayForRead(RegSysClassArray,
590 sizeof(RegSysClassArray[0]),
591 Count,
592 2);
593
594 Ret = (DWORD)UserRegisterSystemClasses(Count,
595 RegSysClassArray);
596 }
597 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
598 {
599 SetLastNtError(_SEH2_GetExceptionCode());
600 }
601 _SEH2_END;
602 }
603
604 RETURN( Ret);
605 }
606 }
607 DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
608 Routine, Param1, Param2);
609 SetLastWin32Error(ERROR_INVALID_PARAMETER);
610 RETURN( 0);
611
612 CLEANUP:
613 DPRINT("Leave NtUserCallTwoParam, ret=%i\n",_ret_);
614 UserLeave();
615 END_CLEANUP;
616 }
617
618
619 /*
620 * @unimplemented
621 */
622 BOOL
623 APIENTRY
624 NtUserCallHwndLock(
625 HWND hWnd,
626 DWORD Routine)
627 {
628 BOOL Ret = 0;
629 PWINDOW_OBJECT Window;
630 PWND Wnd;
631 USER_REFERENCE_ENTRY Ref;
632 DECLARE_RETURN(BOOLEAN);
633
634 DPRINT("Enter NtUserCallHwndLock\n");
635 UserEnterExclusive();
636
637 if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd)
638 {
639 RETURN( FALSE);
640 }
641 UserRefObjectCo(Window, &Ref);
642
643 Wnd = Window->Wnd;
644
645 /* FIXME: Routine can be 0x53 - 0x5E */
646 switch (Routine)
647 {
648 case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS:
649 co_WinPosArrangeIconicWindows(Window);
650 break;
651
652 case HWNDLOCK_ROUTINE_DRAWMENUBAR:
653 {
654 PMENU_OBJECT Menu;
655 DPRINT("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
656 Ret = FALSE;
657 if (!((Wnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD))
658 break;
659
660 if(!(Menu = UserGetMenuObject((HMENU) Wnd->IDMenu)))
661 break;
662
663 Menu->MenuInfo.WndOwner = hWnd;
664 Menu->MenuInfo.Height = 0;
665
666 co_WinPosSetWindowPos( Window,
667 HWND_DESKTOP,
668 0,0,0,0,
669 SWP_NOSIZE|
670 SWP_NOMOVE|
671 SWP_NOZORDER|
672 SWP_NOACTIVATE|
673 SWP_FRAMECHANGED );
674
675 Ret = TRUE;
676 break;
677 }
678
679 case HWNDLOCK_ROUTINE_REDRAWFRAME:
680 co_WinPosSetWindowPos( Window,
681 HWND_DESKTOP,
682 0,0,0,0,
683 SWP_NOSIZE|
684 SWP_NOMOVE|
685 SWP_NOZORDER|
686 SWP_NOACTIVATE|
687 SWP_FRAMECHANGED );
688 Ret = TRUE;
689 break;
690
691 case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK:
692 co_WinPosSetWindowPos( Window,
693 HWND_DESKTOP,
694 0,0,0,0,
695 SWP_NOSIZE|
696 SWP_NOMOVE|
697 SWP_NOZORDER|
698 SWP_NOACTIVATE|
699 SWP_FRAMECHANGED );
700 if (!IntGetOwner(Window) && !IntGetParent(Window))
701 {
702 co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd);
703 }
704 Ret = TRUE;
705 break;
706
707 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW:
708 Ret = co_IntSetForegroundWindow(Window);
709 break;
710
711 case HWNDLOCK_ROUTINE_UPDATEWINDOW:
712 Ret = co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN);
713 break;
714 }
715
716 UserDerefObjectCo(Window);
717
718 RETURN( Ret);
719
720 CLEANUP:
721 DPRINT("Leave NtUserCallHwndLock, ret=%i\n",_ret_);
722 UserLeave();
723 END_CLEANUP;
724 }
725
726 /*
727 * @unimplemented
728 */
729 HWND
730 APIENTRY
731 NtUserCallHwndOpt(
732 HWND hWnd,
733 DWORD Routine)
734 {
735 switch (Routine)
736 {
737 case HWNDOPT_ROUTINE_SETPROGMANWINDOW:
738 GetW32ThreadInfo()->pDeskInfo->hProgmanWindow = hWnd;
739 break;
740
741 case HWNDOPT_ROUTINE_SETTASKMANWINDOW:
742 GetW32ThreadInfo()->pDeskInfo->hTaskManWindow = hWnd;
743 break;
744 }
745
746 return hWnd;
747 }
748
749 DWORD
750 APIENTRY
751 NtUserCallHwnd(
752 HWND hWnd,
753 DWORD Routine)
754 {
755 switch (Routine)
756 {
757 case HWND_ROUTINE_GETWNDCONTEXTHLPID:
758 {
759 PWINDOW_OBJECT Window;
760 PPROPERTY HelpId;
761 USER_REFERENCE_ENTRY Ref;
762
763 UserEnterExclusive();
764
765 if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd)
766 {
767 UserLeave();
768 return 0;
769 }
770 UserRefObjectCo(Window, &Ref);
771
772 HelpId = IntGetProp(Window, gpsi->atomContextHelpIdProp);
773
774 UserDerefObjectCo(Window);
775 UserLeave();
776 return (DWORD)HelpId;
777 }
778 case HWND_ROUTINE_REGISTERSHELLHOOKWINDOW:
779 if (IntIsWindow(hWnd))
780 return IntRegisterShellHookWindow(hWnd);
781 return FALSE;
782 break;
783 case HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW:
784 if (IntIsWindow(hWnd))
785 return IntDeRegisterShellHookWindow(hWnd);
786 return FALSE;
787 }
788 UNIMPLEMENTED;
789
790 return 0;
791 }
792
793 DWORD
794 APIENTRY
795 NtUserCallHwndParam(
796 HWND hWnd,
797 DWORD Param,
798 DWORD Routine)
799 {
800
801 switch (Routine)
802 {
803 case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
804 return IntKillTimer(hWnd, (UINT_PTR)Param, TRUE);
805
806 case HWNDPARAM_ROUTINE_SETDIALOGPOINTER:
807 {
808 PWINDOW_OBJECT Window;
809 PWND pWnd;
810 USER_REFERENCE_ENTRY Ref;
811
812 UserEnterExclusive();
813
814 if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd)
815 {
816 UserLeave();
817 return 0;
818 }
819 UserRefObjectCo(Window, &Ref);
820
821 pWnd = Window->Wnd;
822 if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
823 pWnd->cbwndExtra == DLGWINDOWEXTRA &&
824 !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
825 {
826 if (Param)
827 {
828 if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
829 pWnd->state |= WNDS_DIALOGWINDOW;
830 }
831 else
832 {
833 pWnd->fnid |= FNID_DESTROY;
834 pWnd->state &= ~WNDS_DIALOGWINDOW;
835 }
836 }
837
838 UserDerefObjectCo(Window);
839 UserLeave();
840 return 0;
841 }
842 }
843
844 UNIMPLEMENTED;
845
846 return 0;
847 }
848
849 DWORD
850 APIENTRY
851 NtUserCallHwndParamLock(
852 HWND hWnd,
853 DWORD Param,
854 DWORD Routine)
855 {
856 UNIMPLEMENTED;
857
858 return 0;
859 }
860
861 /* EOF */