winsta: fix spec file
[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_PTR
78 APIENTRY
79 NtUserCallNoParam(DWORD Routine)
80 {
81 DWORD_PTR Result = 0;
82 DECLARE_RETURN(DWORD_PTR);
83
84 DPRINT("Enter NtUserCallNoParam\n");
85 UserEnterExclusive();
86
87 switch(Routine)
88 {
89 case NOPARAM_ROUTINE_CREATEMENU:
90 Result = (DWORD_PTR)UserCreateMenu(FALSE);
91 break;
92
93 case NOPARAM_ROUTINE_CREATEMENUPOPUP:
94 Result = (DWORD_PTR)UserCreateMenu(TRUE);
95 break;
96
97 case NOPARAM_ROUTINE_DESTROY_CARET:
98 Result = (DWORD_PTR)co_IntDestroyCaret(PsGetCurrentThread()->Tcb.Win32Thread);
99 break;
100
101 case NOPARAM_ROUTINE_INIT_MESSAGE_PUMP:
102 Result = (DWORD_PTR)IntInitMessagePumpHook();
103 break;
104
105 case NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP:
106 Result = (DWORD_PTR)IntUninitMessagePumpHook();
107 break;
108
109 case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO:
110 Result = (DWORD_PTR)MsqGetMessageExtraInfo();
111 break;
112
113 case NOPARAM_ROUTINE_ANYPOPUP:
114 Result = (DWORD_PTR)IntAnyPopup();
115 break;
116
117 case NOPARAM_ROUTINE_CSRSS_INITIALIZED:
118 Result = (DWORD_PTR)CsrInit();
119 break;
120
121 case NOPARAM_ROUTINE_MSQCLEARWAKEMASK:
122 RETURN( (DWORD_PTR)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_PTR
142 APIENTRY
143 NtUserCallOneParam(
144 DWORD_PTR Param,
145 DWORD Routine)
146 {
147 DECLARE_RETURN(DWORD_PTR);
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_PTR)UserShowCursor((BOOL)Param) );
164
165 case ONEPARAM_ROUTINE_GETDESKTOPMAPPING:
166 {
167 PTHREADINFO 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_PTR)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_PTR Result;
185
186 if(!(Window = UserGetWindowObject((HWND)Param)))
187 {
188 RETURN( FALSE);
189 }
190
191 Result = Window->Wnd->IDMenu;
192
193 RETURN( Result);
194 }
195
196 case ONEPARAM_ROUTINE_ISWINDOWUNICODE:
197 {
198 PWINDOW_OBJECT Window;
199 DWORD_PTR 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_PTR)IntWindowFromDC((HDC)Param));
212
213 case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
214 {
215 DWORD_PTR 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_PTR)IntSwitchCaretShowing((PVOID)Param));
225
226 case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
227 RETURN( (DWORD_PTR)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_PTR)Window->Wnd->hModule;
240 RETURN( Result);
241 }
242
243 case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
244 RETURN( (DWORD_PTR)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_PTR)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_PTR)FALSE);
276 Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
277 KernelMode,
278 0,
279 &WinSta);
280 if (!NT_SUCCESS(Status))
281 RETURN( (DWORD_PTR)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_PTR)TRUE);
297 }
298
299 case ONEPARAM_ROUTINE_ISWINDOWINDESTROY:
300 {
301 PWINDOW_OBJECT Window;
302 DWORD_PTR Result;
303
304 if(!(Window = UserGetWindowObject((HWND)Param)))
305 {
306 RETURN( FALSE);
307 }
308
309 Result = (DWORD_PTR)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_PTR)IntMsqSetWakeMask(Param));
340
341 case ONEPARAM_ROUTINE_GETKEYBOARDTYPE:
342 RETURN( UserGetKeyboardType(Param));
343
344 case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT:
345 RETURN( (DWORD_PTR)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_PTR
405 APIENTRY
406 NtUserCallTwoParam(
407 DWORD_PTR Param1,
408 DWORD_PTR Param2,
409 DWORD Routine)
410 {
411 NTSTATUS Status;
412 PWINDOW_OBJECT Window;
413 DECLARE_RETURN(DWORD_PTR);
414
415 DPRINT("Enter NtUserCallTwoParam\n");
416 UserEnterExclusive();
417
418 switch(Routine)
419 {
420 case TWOPARAM_ROUTINE_GETWINDOWRGNBOX:
421 {
422 DWORD_PTR Ret;
423 RECTL rcRect;
424 Window = UserGetWindowObject((HWND)Param1);
425 if (!Window) RETURN(ERROR);
426
427 Ret = (DWORD_PTR)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_PTR)IntGetWindowRgn(Window, (HRGN)Param2));
442 }
443 case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
444 {
445 DWORD_PTR 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_PTR)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_PTR)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_PTR)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_PTR)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
518 case TWOPARAM_ROUTINE_SETCARETPOS:
519 RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
520
521 case TWOPARAM_ROUTINE_REGISTERLOGONPROC:
522 RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
523
524 case TWOPARAM_ROUTINE_ROS_REGSYSCLASSES:
525 {
526 DWORD_PTR Ret = 0;
527 DWORD Count = Param1;
528 PREGISTER_SYSCLASS RegSysClassArray = (PREGISTER_SYSCLASS)Param2;
529
530 if (Count != 0 && RegSysClassArray != NULL)
531 {
532 _SEH2_TRY
533 {
534 ProbeArrayForRead(RegSysClassArray,
535 sizeof(RegSysClassArray[0]),
536 Count,
537 2);
538
539 Ret = (DWORD_PTR)UserRegisterSystemClasses(Count,
540 RegSysClassArray);
541 }
542 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
543 {
544 SetLastNtError(_SEH2_GetExceptionCode());
545 }
546 _SEH2_END;
547 }
548
549 RETURN( Ret);
550 }
551 }
552 DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
553 Routine, Param1, Param2);
554 SetLastWin32Error(ERROR_INVALID_PARAMETER);
555 RETURN( 0);
556
557 CLEANUP:
558 DPRINT("Leave NtUserCallTwoParam, ret=%i\n",_ret_);
559 UserLeave();
560 END_CLEANUP;
561 }
562
563
564 /*
565 * @unimplemented
566 */
567 BOOL
568 APIENTRY
569 NtUserCallHwndLock(
570 HWND hWnd,
571 DWORD Routine)
572 {
573 BOOL Ret = 0;
574 PWINDOW_OBJECT Window;
575 PWND Wnd;
576 USER_REFERENCE_ENTRY Ref;
577 DECLARE_RETURN(BOOLEAN);
578
579 DPRINT("Enter NtUserCallHwndLock\n");
580 UserEnterExclusive();
581
582 if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd)
583 {
584 RETURN( FALSE);
585 }
586 UserRefObjectCo(Window, &Ref);
587
588 Wnd = Window->Wnd;
589
590 /* FIXME: Routine can be 0x53 - 0x5E */
591 switch (Routine)
592 {
593 case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS:
594 co_WinPosArrangeIconicWindows(Window);
595 break;
596
597 case HWNDLOCK_ROUTINE_DRAWMENUBAR:
598 {
599 PMENU_OBJECT Menu;
600 DPRINT("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
601 Ret = FALSE;
602 if (!((Wnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD))
603 break;
604
605 if(!(Menu = UserGetMenuObject((HMENU)(DWORD_PTR) Wnd->IDMenu)))
606 break;
607
608 Menu->MenuInfo.WndOwner = hWnd;
609 Menu->MenuInfo.Height = 0;
610
611 co_WinPosSetWindowPos( Window,
612 HWND_DESKTOP,
613 0,0,0,0,
614 SWP_NOSIZE|
615 SWP_NOMOVE|
616 SWP_NOZORDER|
617 SWP_NOACTIVATE|
618 SWP_FRAMECHANGED );
619
620 Ret = TRUE;
621 break;
622 }
623
624 case HWNDLOCK_ROUTINE_REDRAWFRAME:
625 co_WinPosSetWindowPos( Window,
626 HWND_DESKTOP,
627 0,0,0,0,
628 SWP_NOSIZE|
629 SWP_NOMOVE|
630 SWP_NOZORDER|
631 SWP_NOACTIVATE|
632 SWP_FRAMECHANGED );
633 Ret = TRUE;
634 break;
635
636 case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK:
637 co_WinPosSetWindowPos( Window,
638 HWND_DESKTOP,
639 0,0,0,0,
640 SWP_NOSIZE|
641 SWP_NOMOVE|
642 SWP_NOZORDER|
643 SWP_NOACTIVATE|
644 SWP_FRAMECHANGED );
645 if (!IntGetOwner(Window) && !IntGetParent(Window))
646 {
647 co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd);
648 }
649 Ret = TRUE;
650 break;
651
652 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW:
653 Ret = co_IntSetForegroundWindow(Window);
654 break;
655
656 case HWNDLOCK_ROUTINE_UPDATEWINDOW:
657 Ret = co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN);
658 break;
659 }
660
661 UserDerefObjectCo(Window);
662
663 RETURN( Ret);
664
665 CLEANUP:
666 DPRINT("Leave NtUserCallHwndLock, ret=%i\n",_ret_);
667 UserLeave();
668 END_CLEANUP;
669 }
670
671 /*
672 * @unimplemented
673 */
674 HWND
675 APIENTRY
676 NtUserCallHwndOpt(
677 HWND hWnd,
678 DWORD Routine)
679 {
680 switch (Routine)
681 {
682 case HWNDOPT_ROUTINE_SETPROGMANWINDOW:
683 GetW32ThreadInfo()->pDeskInfo->hProgmanWindow = hWnd;
684 break;
685
686 case HWNDOPT_ROUTINE_SETTASKMANWINDOW:
687 GetW32ThreadInfo()->pDeskInfo->hTaskManWindow = hWnd;
688 break;
689 }
690
691 return hWnd;
692 }
693
694 DWORD
695 APIENTRY
696 NtUserCallHwnd(
697 HWND hWnd,
698 DWORD Routine)
699 {
700 switch (Routine)
701 {
702 case HWND_ROUTINE_GETWNDCONTEXTHLPID:
703 {
704 PWINDOW_OBJECT Window;
705 PPROPERTY HelpId;
706 USER_REFERENCE_ENTRY Ref;
707
708 UserEnterExclusive();
709
710 if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd)
711 {
712 UserLeave();
713 return 0;
714 }
715 UserRefObjectCo(Window, &Ref);
716
717 HelpId = IntGetProp(Window, gpsi->atomContextHelpIdProp);
718
719 UserDerefObjectCo(Window);
720 UserLeave();
721 return (DWORD)HelpId;
722 }
723 case HWND_ROUTINE_REGISTERSHELLHOOKWINDOW:
724 if (IntIsWindow(hWnd))
725 return IntRegisterShellHookWindow(hWnd);
726 return FALSE;
727 break;
728 case HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW:
729 if (IntIsWindow(hWnd))
730 return IntDeRegisterShellHookWindow(hWnd);
731 return FALSE;
732 }
733 UNIMPLEMENTED;
734
735 return 0;
736 }
737
738 DWORD
739 APIENTRY
740 NtUserCallHwndParam(
741 HWND hWnd,
742 DWORD Param,
743 DWORD Routine)
744 {
745
746 switch (Routine)
747 {
748 case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
749 return IntKillTimer(hWnd, (UINT_PTR)Param, TRUE);
750
751 case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
752 {
753 PWINDOW_OBJECT Window;
754
755 UserEnterExclusive();
756 if(!(Window = UserGetWindowObject(hWnd)))
757 {
758 UserLeave();
759 return FALSE;
760 }
761
762 if ( Param )
763 IntSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param);
764 else
765 IntRemoveProp(Window, gpsi->atomContextHelpIdProp);
766
767 UserLeave();
768 return TRUE;
769 }
770
771 case HWNDPARAM_ROUTINE_SETDIALOGPOINTER:
772 {
773 PWINDOW_OBJECT Window;
774 PWND pWnd;
775 USER_REFERENCE_ENTRY Ref;
776
777 UserEnterExclusive();
778
779 if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd)
780 {
781 UserLeave();
782 return 0;
783 }
784 UserRefObjectCo(Window, &Ref);
785
786 pWnd = Window->Wnd;
787 if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
788 pWnd->cbwndExtra == DLGWINDOWEXTRA &&
789 !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
790 {
791 if (Param)
792 {
793 if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
794 pWnd->state |= WNDS_DIALOGWINDOW;
795 }
796 else
797 {
798 pWnd->fnid |= FNID_DESTROY;
799 pWnd->state &= ~WNDS_DIALOGWINDOW;
800 }
801 }
802
803 UserDerefObjectCo(Window);
804 UserLeave();
805 return 0;
806 }
807 }
808
809 UNIMPLEMENTED;
810
811 return 0;
812 }
813
814 DWORD
815 APIENTRY
816 NtUserCallHwndParamLock(
817 HWND hWnd,
818 DWORD Param,
819 DWORD Routine)
820 {
821 UNIMPLEMENTED;
822
823 return 0;
824 }
825
826 /* EOF */