ReactOS  0.4.14-dev-583-g2a1ba2c
simplecall.c File Reference
#include <win32k.h>
Include dependency graph for simplecall.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (UserMisc)
 
BOOL FASTCALL co_IntRegisterLogonProcess (HANDLE ProcessId, BOOL Register)
 
DWORD_PTR APIENTRY NtUserCallNoParam (DWORD Routine)
 
DWORD_PTR APIENTRY NtUserCallOneParam (DWORD_PTR Param, DWORD Routine)
 
DWORD_PTR APIENTRY NtUserCallTwoParam (DWORD_PTR Param1, DWORD_PTR Param2, DWORD Routine)
 
BOOL APIENTRY NtUserCallHwndLock (HWND hWnd, DWORD Routine)
 
HWND APIENTRY NtUserCallHwndOpt (HWND hWnd, DWORD Routine)
 
DWORD APIENTRY NtUserCallHwnd (HWND hWnd, DWORD Routine)
 
DWORD APIENTRY NtUserCallHwndParam (HWND hWnd, DWORD_PTR Param, DWORD Routine)
 
DWORD APIENTRY NtUserCallHwndParamLock (HWND hWnd, DWORD_PTR Param, DWORD Routine)
 

Variables

HANDLE gpidLogon = 0
 

Function Documentation

◆ co_IntRegisterLogonProcess()

BOOL FASTCALL co_IntRegisterLogonProcess ( HANDLE  ProcessId,
BOOL  Register 
)

Definition at line 18 of file simplecall.c.

19 {
22 
24  if (!NT_SUCCESS(Status))
25  {
27  return FALSE;
28  }
29 
30  ProcessId = Process->UniqueProcessId;
31 
33 
34  if (Register)
35  {
36  /* Register the logon process */
37  if (gpidLogon != 0)
38  return FALSE;
39 
41  }
42  else
43  {
44  /* Deregister the logon process */
45  if (gpidLogon != ProcessId)
46  return FALSE;
47 
48  gpidLogon = 0;
49  }
50 
51  return TRUE;
52 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
Definition: process.c:919
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
HANDLE gpidLogon
Definition: simplecall.c:15

Referenced by NtUserCallTwoParam().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserMisc  )

◆ NtUserCallHwnd()

DWORD APIENTRY NtUserCallHwnd ( HWND  hWnd,
DWORD  Routine 
)

Definition at line 699 of file simplecall.c.

702 {
703  switch (Routine)
704  {
706  {
707  PWND Window;
708  DWORD HelpId;
709 
710  UserEnterShared();
711 
712  if (!(Window = UserGetWindowObject(hWnd)))
713  {
714  UserLeave();
715  return 0;
716  }
717 
719 
720  UserLeave();
721  return HelpId;
722  }
723 
725  if (IntIsWindow(hWnd))
727  return FALSE;
728  break;
729 
731  if (IntIsWindow(hWnd))
733  return FALSE;
734 
736  {
737  PWND Window;
740  {
741  Window->state |= WNDS_MSGBOX;
742  }
743  UserLeave();
744  return FALSE;
745  }
746  }
747 
748  STUB;
749 
750  return 0;
751 }
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:241
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
ATOM atomContextHelpIdProp
Definition: ntuser.h:1020
#define DWORD
Definition: nt_native.h:44
PSERVERINFO gpsi
Definition: main.c:27
Definition: window.c:28
BOOL IntRegisterShellHookWindow(HWND hWnd)
Definition: desktop.c:1716
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
Definition: desktop.c:1748
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
int Window
Definition: x11stubs.h:26
#define WNDS_MSGBOX
Definition: ntuser.h:578
uint32_t DWORD_PTR
Definition: typedefs.h:63
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define STUB
Definition: kernel32.h:27

Referenced by NtUserxDeregisterShellHookWindow(), NtUserxGetWindowContextHelpId(), NtUserxRegisterShellHookWindow(), NtUserxSetMessageBox(), START_TEST(), Test_HwndParamRoutine_SetWindowContextHelpId(), Test_HwndRoutine_DeregisterShellHookWindow(), Test_HwndRoutine_GetWindowContextHelpId(), and Test_HwndRoutine_SetMsgBox().

◆ NtUserCallHwndLock()

BOOL APIENTRY NtUserCallHwndLock ( HWND  hWnd,
DWORD  Routine 
)

Definition at line 577 of file simplecall.c.

580 {
581  BOOL Ret = FALSE;
582  PWND Window;
584 
585  TRACE("Enter NtUserCallHwndLock\n");
587 
588  if (!(Window = UserGetWindowObject(hWnd)))
589  {
590  Ret = FALSE;
591  goto Exit;
592  }
593 
594  UserRefObjectCo(Window, &Ref);
595 
596  /* FIXME: Routine can be 0x53 - 0x5E */
597  switch (Routine)
598  {
601  break;
602 
604  {
605  TRACE("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
606  Ret = TRUE;
607  if ((Window->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
609  HWND_DESKTOP,
610  0, 0, 0, 0,
611  SWP_NOSIZE |
612  SWP_NOMOVE |
613  SWP_NOZORDER |
616  break;
617  }
618 
621  HWND_DESKTOP,
622  0, 0, 0, 0,
623  SWP_NOSIZE |
624  SWP_NOMOVE |
625  SWP_NOZORDER |
628  Ret = TRUE;
629  break;
630 
633  HWND_DESKTOP,
634  0, 0, 0, 0,
635  SWP_NOSIZE |
636  SWP_NOMOVE |
637  SWP_NOZORDER |
640  if (!Window->spwndOwner && !IntGetParent(Window))
641  {
642  co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM)hWnd, FALSE); // FIXME Flashing?
643  }
644  Ret = TRUE;
645  break;
646 
648  TRACE("co_IntSetForegroundWindow 1 0x%p\n", hWnd);
650  TRACE("co_IntSetForegroundWindow 2 0x%p\n", hWnd);
651  break;
652 
654  TRACE("co_IntSetForegroundWindow M 1 0x%p\n", hWnd);
656  TRACE("co_IntSetForegroundWindow M 2 0x%p\n", hWnd);
657  break;
658 
661  Ret = TRUE;
662  break;
663  }
664 
666 
667 Exit:
668  TRACE("Leave NtUserCallHwndLock, ret=%u\n", Ret);
669  UserLeave();
670 
671  return Ret;
672 }
#define TRUE
Definition: types.h:120
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define SWP_NOZORDER
Definition: winuser.h:1232
Definition: window.c:28
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
UINT FASTCALL co_WinPosArrangeIconicWindows(PWND parent)
Definition: winpos.c:728
#define SWP_NOACTIVATE
Definition: winuser.h:1227
static void Exit(void)
Definition: sock.c:1331
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:507
int Window
Definition: x11stubs.h:26
#define SWP_FRAMECHANGED
Definition: winuser.h:1225
#define SWP_NOSIZE
Definition: winuser.h:1230
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
#define HWND_DESKTOP
Definition: winuser.h:1195
#define WS_POPUP
Definition: pedump.c:616
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1656
#define HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE
Definition: ntuser.h:3542
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1443
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window)
Definition: focus.c:1432

Referenced by NtUserxArrangeIconicWindows(), NtUserxDrawMenuBar(), NtUserxMDIRedrawFrame(), NtUserxSetForegroundWindow(), NtUserxUpdateWindow(), START_TEST(), Test_HwndLockRoutine_CheckImeShowStatusInThread(), Test_HwndLockRoutine_DrawMenuBar(), Test_HwndLockRoutine_GetSysMenuHandle(), and Test_HwndLockRoutine_UpdateWindow().

◆ NtUserCallHwndOpt()

HWND APIENTRY NtUserCallHwndOpt ( HWND  hWnd,
DWORD  Routine 
)

Definition at line 679 of file simplecall.c.

682 {
683  switch (Routine)
684  {
686  GetW32ThreadInfo()->pDeskInfo->hProgmanWindow = hWnd;
687  break;
688 
690  GetW32ThreadInfo()->pDeskInfo->hTaskManWindow = hWnd;
691  break;
692  }
693 
694  return hWnd;
695 }
HWND hWnd
Definition: settings.c:17
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781

Referenced by NtUserxSetProgmanWindow(), and NtUserxSetTaskmanWindow().

◆ NtUserCallHwndParam()

DWORD APIENTRY NtUserCallHwndParam ( HWND  hWnd,
DWORD_PTR  Param,
DWORD  Routine 
)

Definition at line 755 of file simplecall.c.

759 {
760 
761  switch (Routine)
762  {
765 
767  {
768  PWND Window;
769 
771  if (!(Window = UserGetWindowObject(hWnd)))
772  {
773  UserLeave();
774  return FALSE;
775  }
776 
777  if (Param)
778  UserSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param, TRUE);
779  else
781 
782  UserLeave();
783  return TRUE;
784  }
785 
787  {
788  PWND pWnd;
790 
792 
793  if (!(pWnd = UserGetWindowObject(hWnd)))
794  {
795  UserLeave();
796  return 0;
797  }
798  UserRefObjectCo(pWnd, &Ref);
799 
800  if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
801  pWnd->cbwndExtra == DLGWINDOWEXTRA &&
802  !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
803  {
804  if (Param)
805  {
806  if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
807  pWnd->state |= WNDS_DIALOGWINDOW;
808  }
809  else
810  {
811  pWnd->fnid |= FNID_DESTROY;
812  pWnd->state &= ~WNDS_DIALOGWINDOW;
813  }
814  }
815 
816  UserDerefObjectCo(pWnd);
817  UserLeave();
818  return 0;
819  }
820 
822  {
823  PWND pWnd;
824  PNOTIFYEVENT pne;
826  pne = (PNOTIFYEVENT)Param;
827  if (hWnd)
828  pWnd = UserGetWindowObject(hWnd);
829  else
830  pWnd = NULL;
831  IntNotifyWinEvent(pne->event, pWnd, pne->idObject, pne->idChild, pne->flags);
832  UserLeave();
833  return 0;
834  }
835 
837  {
838  PWND pWnd;
840  pWnd = UserGetWindowObject(hWnd);
841  if (pWnd) IntClearWindowState(pWnd, (UINT)Param);
842  UserLeave();
843  return 0;
844  }
845 
847  {
848  PWND pWnd;
850  pWnd = UserGetWindowObject(hWnd);
851  if (pWnd) IntSetWindowState(pWnd, (UINT)Param);
852  UserLeave();
853  return 0;
854  }
855  }
856 
857  STUB;
858 
859  return 0;
860 }
#define TRUE
Definition: types.h:120
LONG idChild
Definition: hook.h:39
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
BOOL FASTCALL IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer)
Definition: timer.c:573
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define FNID_DESTROY
Definition: ntuser.h:859
ATOM atomContextHelpIdProp
Definition: ntuser.h:1020
PSERVERINFO gpsi
Definition: main.c:27
ULONG cbwndExtra
Definition: ntuser.h:702
Definition: window.c:28
DWORD fnid
Definition: ntuser.h:673
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
#define FNID_DIALOG
Definition: ntuser.h:831
THRDESKHEAD head
Definition: ntuser.h:659
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT
Definition: ntuser.h:3552
#define WNDS_DIALOGWINDOW
Definition: ntuser.h:589
VOID FASTCALL IntSetWindowState(PWND pWnd, UINT Flag)
Definition: misc.c:569
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int Window
Definition: x11stubs.h:26
DWORD event
Definition: hook.h:37
#define DLGWINDOWEXTRA
Definition: winuser.h:2540
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define STUB
Definition: kernel32.h:27
DWORD state
Definition: ntuser.h:665
unsigned int UINT
Definition: ndis.h:50
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
VOID FASTCALL IntClearWindowState(PWND pWnd, UINT Flag)
Definition: misc.c:590
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:591
HANDLE FASTCALL UserRemoveProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
DWORD flags
Definition: hook.h:40
struct _NOTIFYEVENT * PNOTIFYEVENT
LONG idObject
Definition: hook.h:38

Referenced by NtUserxClearWindowState(), NtUserxKillSystemTimer(), NtUserxNotifyWinEvent(), NtUserxSetDialogPointer(), NtUserxSetWindowContextHelpId(), NtUserxSetWindowState(), Test_HwndParamRoutine_SetWindowContextHelpId(), and Test_HwndRoutine_GetWindowContextHelpId().

◆ NtUserCallHwndParamLock()

DWORD APIENTRY NtUserCallHwndParamLock ( HWND  hWnd,
DWORD_PTR  Param,
DWORD  Routine 
)

Definition at line 864 of file simplecall.c.

868 {
869  DWORD Ret = FALSE;
870  PWND Window;
872 
873  TRACE("Enter NtUserCallHwndParamLock\n");
875 
876  if (!(Window = UserGetWindowObject(hWnd)))
877  {
878  Ret = FALSE;
879  goto Exit;
880  }
881 
882  UserRefObjectCo(Window, &Ref);
883 
884  switch (Routine)
885  {
887  {
888  PREGION Rgn = REGION_LockRgn((HRGN)Param);
890  if (Rgn) REGION_UnlockRgn(Rgn);
891  break;
892  }
893  }
894 
896 
897 Exit:
898 
899  TRACE("Leave NtUserCallHwndParamLock, ret=%lu\n", Ret);
900  UserLeave();
901 
902  return Ret;
903 }
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define DWORD
Definition: nt_native.h:44
Definition: window.c:28
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
static void Exit(void)
Definition: sock.c:1331
unsigned long DWORD
Definition: ntddk_ex.h:95
int Window
Definition: x11stubs.h:26
#define RDW_VALIDATE
Definition: winuser.h:1204
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392

Referenced by NtUserxValidateRgn().

◆ NtUserCallNoParam()

DWORD_PTR APIENTRY NtUserCallNoParam ( DWORD  Routine)

Definition at line 59 of file simplecall.c.

60 {
61  DWORD_PTR Result = 0;
62 
63  TRACE("Enter NtUserCallNoParam\n");
65 
66  switch (Routine)
67  {
70  break;
71 
74  break;
75 
78  break;
79 
82  break;
83 
86  break;
87 
90  break;
91 
93  {
95  Result = (DWORD_PTR)MAKELONG(pti->ptLast.x, pti->ptLast.y);
96  break;
97  }
98 
101  break;
102 
105  break;
106 
108  {
110  TRACE("Zapping the Active and Focus window out of the Queue!\n");
111  pti->MessageQueue->spwndFocus = NULL;
112  pti->MessageQueue->spwndActive = NULL;
113  Result = 0;
114  break;
115  }
116 
117  /* this is a ReactOS only case and is needed for gui-on-demand */
120  break;
121 
123  gpsi->dwSRVIFlags |= SRVINFO_IMM32; // Always set.
124  Result = TRUE; // Always return TRUE.
125  break;
126 
127  default:
128  ERR("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
130  break;
131  }
132 
133  TRACE("Leave NtUserCallNoParam, ret=%p\n",(PVOID)Result);
134  UserLeave();
135 
136  return Result;
137 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
#define DWORD_PTR
Definition: treelist.c:76
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
long x
Definition: polytest.cpp:48
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1412
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
PSERVERINFO gpsi
Definition: main.c:27
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
BOOL APIENTRY IntUninitMessagePumpHook(VOID)
Definition: message.c:1957
BOOL FASTCALL UserLoadApiHook(VOID)
Definition: hook.c:132
DWORD dwSRVIFlags
Definition: ntuser.h:1004
BOOL FASTCALL co_IntDestroyCaret(PTHREADINFO Win32Thread)
Definition: caret.c:164
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
BOOL APIENTRY IntInitMessagePumpHook(VOID)
Definition: message.c:1944
uint32_t DWORD_PTR
Definition: typedefs.h:63
POINT ptLast
Definition: win32.h:127
#define ERR(fmt,...)
Definition: debug.h:109
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
BOOL FASTCALL IntMsqClearWakeMask(VOID)
Definition: msgqueue.c:392
#define SRVINFO_IMM32
Definition: ntuser.h:910
#define NOPARAM_ROUTINE_ISCONSOLEMODE
Definition: ntuser.h:3537
HDC ScreenDeviceContext
Definition: desktop.c:36
HMENU FASTCALL UserCreateMenu(PDESKTOP Desktop, BOOL PopupMenu)
Definition: menu.c:5029
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by EndDialog(), IsConsoleMode(), LoadUserApiHook(), NtUserxCreateMenu(), NtUserxCreatePopupMenu(), NtUserxDestroyCaret(), NtUserxGetMessagePos(), NtUserxInitMessagePump(), NtUserxMsqClearWakeMask(), NtUserxReleaseCapture(), NtUserxUnInitMessagePump(), Test_NoParamRoutine_CreateMenu(), Test_NoParamRoutine_CreatePopupMenu(), Test_NoParamRoutine_LoadUserApiHook(), and UpdatePerUserImmEnabling().

◆ NtUserCallOneParam()

DWORD_PTR APIENTRY NtUserCallOneParam ( DWORD_PTR  Param,
DWORD  Routine 
)

Definition at line 145 of file simplecall.c.

148 {
150 
151  TRACE("Enter NtUserCallOneParam\n");
152 
154 
155  switch (Routine)
156  {
158  {
159  PTHREADINFO pti;
161  MsqPostQuitMessage(pti, Param);
162  Result = TRUE;
163  break;
164  }
165 
167  {
168  PSMWP psmwp;
169  HDWP hDwp = NULL;
170  INT count = (INT)Param;
171 
172  if (count < 0)
173  {
175  Result = 0;
176  break;
177  }
178 
179  /* Windows allows zero count, in which case it allocates context for 8 moves */
180  if (count == 0) count = 8;
181 
183  NULL,
184  NULL,
185  (PHANDLE)&hDwp,
187  sizeof(SMWP));
188  if (!psmwp)
189  {
190  Result = 0;
191  break;
192  }
193 
195  if (!psmwp->acvr)
196  {
198  Result = 0;
199  break;
200  }
201 
202  RtlZeroMemory(psmwp->acvr, count * sizeof(CVR));
203  psmwp->bHandle = TRUE;
204  psmwp->ccvr = 0; // actualCount
205  psmwp->ccvrAlloc = count; // suggestedCount
206  Result = (DWORD_PTR)hDwp;
207  break;
208  }
209 
211  Result = (DWORD_PTR)UserShowCursor((BOOL)Param);
212  break;
213 
215  {
216  PTHREADINFO ti;
217  ti = GetW32ThreadInfo();
218  if (ti != NULL)
219  {
220  /* Try convert the pointer to a user mode pointer if the desktop is
221  mapped into the process */
223  }
224  else
225  {
226  Result = 0;
227  }
228  break;
229  }
230 
232  Result = (DWORD_PTR)IntWindowFromDC((HDC)Param);
233  break;
234 
236  {
238  gspv.bMouseBtnSwap = Param ? TRUE : FALSE;
239  gpsi->aiSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap;
240  break;
241  }
242 
245  break;
246 
249  break;
250 
252  {
253  if (!(Result = (DWORD_PTR)IntCreateCurIconHandle((DWORD)Param)))
254  {
256  Result = 0;
257  }
258  break;
259  }
260 
262  {
263  BOOL Enable;
265 
266  if (Process != NULL)
267  {
268  Enable = (BOOL)(Param != 0);
269 
270  if (Enable)
271  {
272  Process->W32PF_flags &= ~W32PF_NOWINDOWGHOSTING;
273  }
274  else
275  {
276  Process->W32PF_flags |= W32PF_NOWINDOWGHOSTING;
277  }
278 
279  Result = TRUE;
280  break;
281  }
282 
283  Result = FALSE;
284  break;
285  }
286 
289  break;
290 
292  Result = UserGetKeyboardType(Param);
293  break;
294 
297  break;
298 
300  Result = UserReleaseDC(NULL, (HDC) Param, FALSE);
301  break;
302 
304  Result = UserRealizePalette((HDC) Param);
305  break;
306 
308  {
309  Result = IntGetQueueStatus((DWORD)Param);
310  break;
311  }
312 
314  /* FIXME: Should use UserEnterShared */
316  break;
317 
318  case ONEPARAM_ROUTINE_GETCURSORPOS:
319  {
320  PPOINTL pptl;
322  Result = TRUE;
323  if (pti->rpdesk != IntGetActiveDesktop())
324  {
325  Result = FALSE;
326  break;
327  }
328  _SEH2_TRY
329  {
330  ProbeForWrite((POINT*)Param,sizeof(POINT),1);
331  pptl = (PPOINTL)Param;
332  *pptl = gpsi->ptCursor;
333  }
335  {
336  Result = FALSE;
337  }
338  _SEH2_END;
339  break;
340  }
341 
343  {
344  PPROCESSINFO ppi;
345  if (Param & LAYOUT_ORIENTATIONMASK || Param == LAYOUT_LTR)
346  {
348  ppi->dwLayout = Param;
349  Result = TRUE;
350  break;
351  }
353  Result = FALSE;
354  break;
355  }
356 
358  {
359  PPROCESSINFO ppi;
360  PDWORD pdwLayout;
361  Result = TRUE;
362 
364  {
366  Result = FALSE;
367  break;
368  }
369 
371  _SEH2_TRY
372  {
373  pdwLayout = (PDWORD)Param;
374  *pdwLayout = ppi->dwLayout;
375  }
377  {
379  Result = FALSE;
380  }
381  _SEH2_END;
382  break;
383  }
384 
387  break;
388 
390  /* TODO: Implement sound sentry */
392  break;
393 
394  case ONEPARAM_ROUTINE_CREATESYSTEMTHREADS:
395  Result = UserSystemThreadProc(Param);
396  break;
397 
400  break;
401 
404  break;
405 
406  default:
407  ERR("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
408  Routine, Param);
410  Result = 0;
411  break;
412  }
413 
414  TRACE("Leave NtUserCallOneParam, ret=%p\n", (PVOID)Result);
415  UserLeave();
416 
417  return Result;
418 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
struct _SMWP SMWP
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1181
#define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING
Definition: ntuser.h:3538
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:683
#define TRUE
Definition: types.h:120
struct _POINTL * PPOINTL
#define DWORD_PTR
Definition: treelist.c:76
BOOL bMouseBtnSwap
Definition: sysparams.h:82
GLuint GLuint GLsizei count
Definition: gl.h:1545
HANDLE FASTCALL IntMsqSetWakeMask(DWORD WakeMask)
Definition: msgqueue.c:362
UINT WINAPI UserRealizePalette(HDC hDC)
Definition: painting.c:2336
PEPROCESS gpepCSRSS
Definition: csr.c:15
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define INT
Definition: polytest.cpp:20
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
static HDC
Definition: imagelist.c:92
UINT APIENTRY UserEnumClipboardFormats(UINT fmt)
Definition: clipboard.c:440
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
#define BOOL
Definition: nt_native.h:43
struct _DESKTOP * rpdesk
Definition: win32.h:91
PSERVERINFO gpsi
Definition: main.c:27
int32_t INT
Definition: typedefs.h:56
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:535
DWORD dwLayout
Definition: win32.h:270
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopHeapAddressToUser(PVOID lpMem)
Definition: desktop.h:327
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
_In_ POINTL * pptl
Definition: winddi.h:3741
#define LAYOUT_LTR
Definition: dc.c:39
#define LAYOUT_ORIENTATIONMASK
Definition: wingdi.h:1373
INT ccvr
Definition: winpos.h:25
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD UserSystemThreadProc(BOOL bRemoteProcess)
Definition: csr.c:207
BOOL FASTCALL co_MsqReplyMessage(LRESULT lResult)
Definition: msgqueue.c:2510
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
DWORD APIENTRY IntGetQueueStatus(DWORD Changes)
Definition: message.c:1923
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG_PTR LPARAM
Definition: windef.h:208
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:893
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
HWND hwndSAS
Definition: winsta.c:24
struct _SMWP * PSMWP
#define TRACE(s)
Definition: solgame.cpp:4
HKL FASTCALL UserGetKeyboardLayout(DWORD dwThreadId)
Definition: kbdlayout.c:453
BOOL FASTCALL IntLockSetForegroundWindow(UINT uLockCode)
Definition: focus.c:1454
Definition: winpos.h:3
UINT bHandle
Definition: winpos.h:24
#define W32PF_NOWINDOWGHOSTING
Definition: win32.h:31
SPIVALUES gspv
Definition: sysparams.c:17
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: winpos.h:20
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
#define ERROR_INVALID_ACCESS
Definition: winerror.h:115
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
uint32_t DWORD_PTR
Definition: typedefs.h:63
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
#define ERR(fmt,...)
Definition: debug.h:109
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
_SEH2_END
Definition: create.c:4424
#define ONEPARAM_ROUTINE_GETDESKTOPMAPPING
Definition: ntuser.h:3539
INT ccvrAlloc
Definition: winpos.h:26
unsigned int UINT
Definition: ndis.h:50
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
HANDLE IntCreateCurIconHandle(BOOLEAN Animated)
Definition: cursoricon.c:281
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
DWORD * PDWORD
Definition: pedump.c:68
#define USERTAG_SWP
Definition: tags.h:280
DWORD FASTCALL UserGetKeyboardType(DWORD dwTypeFlag)
Definition: keyboard.c:1516
#define SM_SWAPBUTTON
Definition: winuser.h:974
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
VOID FASTCALL MsqPostQuitMessage(PTHREADINFO pti, ULONG ExitCode)
Definition: msgqueue.c:1380
PCVR acvr
Definition: winpos.h:27
BOOL FASTCALL IntAllowSetForegroundWindow(DWORD dwProcessId)
Definition: focus.c:1485
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam)
Definition: msgqueue.c:2473
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
PDESKTOP FASTCALL IntGetActiveDesktop(VOID)
Definition: desktop.c:1226
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define LN_MESSAGE_BEEP
Definition: undocuser.h:118
LONG_PTR LRESULT
Definition: windef.h:209
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
BOOL FASTCALL IntSetCaretBlinkTime(UINT uMSeconds)
Definition: caret.c:188

Referenced by CreateSystemThreads(), GetProcessDefaultLayout(), GetWinStationInfo(), NtUserxAllowSetForegroundWindow(), NtUserxBeginDeferWindowPos(), NtUserxCreateEmptyCurObject(), NtUserxCreateSystemThreads(), NtUserxEnableProcessWindowGhosting(), NtUserxEnumClipboardFormats(), NtUserxGetCursorPos(), NtUserxGetDesktopMapping(), NtUserxGetKeyboardLayout(), NtUserxGetKeyboardType(), NtUserxGetQueueStatus(), NtUserxLockSetForegroundWindow(), NtUserxMessageBeep(), NtUserxMsqSetWakeMask(), NtUserxPostQuitMessage(), NtUserxRealizePalette(), NtUserxReleaseDC(), NtUserxReplyMessage(), NtUserxSetCaretBlinkTime(), NtUserxSetMessageExtraInfo(), NtUserxShowCursor(), NtUserxSwapMouseButton(), NtUserxWindowFromDC(), SetProcessDefaultLayout(), START_TEST(), Test_OneParamRoutine_BeginDeferWindowPos(), Test_OneParamRoutine_CreateEmptyCurObject(), Test_OneParamRoutine_MapDesktopObject(), Test_OneParamRoutine_SwapMouseButtons(), and Test_OneParamRoutine_WindowFromDC().

◆ NtUserCallTwoParam()

DWORD_PTR APIENTRY NtUserCallTwoParam ( DWORD_PTR  Param1,
DWORD_PTR  Param2,
DWORD  Routine 
)

Definition at line 426 of file simplecall.c.

430 {
431  PWND Window;
432  DWORD_PTR Ret;
433  TRACE("Enter NtUserCallTwoParam\n");
435 
436  switch (Routine)
437  {
439  {
440  Window = UserGetWindowObject((HWND)Param1);
441  Ret = (DWORD_PTR)UserPaintCaption(Window, (INT)Param2);
442  break;
443  }
444 
446  {
447  PMENU MenuObject = IntGetMenuObject((HMENU)Param1);
448  if (!MenuObject)
449  {
450  Ret = 0;
451  break;
452  }
453 
454  if (Param2 > 0)
455  {
456  Ret = (MenuObject->cyMenu == (int)Param2);
457  MenuObject->cyMenu = (int)Param2;
458  }
459  else
460  Ret = (DWORD_PTR)MenuObject->cyMenu;
461  IntReleaseMenuObject(MenuObject);
462  break;
463  }
464 
466  {
468  ASSERT(pti->MessageQueue);
469  Ret = (DWORD_PTR)MsqSetStateWindow(pti, (ULONG)Param1, (HWND)Param2);
470  break;
471  }
472 
474  Ret = IntEnableWindow((HWND)Param1, (BOOL)Param2);
475  break;
476 
478  {
479  Window = UserGetWindowObject((HWND)Param1);
480  if (!Window)
481  {
482  Ret = 0;
483  break;
484  }
485 
486  Ret = (DWORD_PTR)IntShowOwnedPopups(Window, (BOOL)Param2);
487  break;
488  }
489 
491  {
492  WPARAM wParam;
493  Window = UserGetWindowObject((HWND)Param1);
494  if (!Window)
495  {
496  Ret = 0;
497  break;
498  }
499 
500  /* Unpack wParam */
501  wParam = MAKEWPARAM((Param2 >> 3) & 0x3,
502  Param2 & (UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE));
503 
505  break;
506  }
507 
509  {
510  HWND hwnd = (HWND)Param1;
511  BOOL fAltTab = (BOOL)Param2;
512  Ret = 0;
514  if (!Window)
515  {
516  break;
517  }
518  if (MsqIsHung(Window->head.pti))
519  {
520  // TODO: Make the window ghosted and activate.
521  break;
522  }
523  if (fAltTab)
524  {
525  if (Window->style & WS_MINIMIZE)
526  {
528  }
529  /* bring window to top and activate */
533  }
534  else
535  {
537  }
538  break;
539  }
540 
542  Ret = (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2);
543  break;
544 
546  Ret = (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2);
547  break;
548 
550  Ret = (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, 0, 0, FALSE);
551  break;
552 
554  Ret = IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2);
555  break;
556 
557  default:
558  ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
559  Routine, Param1, Param2);
561  Ret = 0;
562  }
563 
564 
565  TRACE("Leave NtUserCallTwoParam, ret=%p\n", (PVOID)Ret);
566  UserLeave();
567 
568  return Ret;
569 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1181
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
#define SC_RESTORE
Definition: winuser.h:2573
#define DWORD_PTR
Definition: treelist.c:76
BOOL FASTCALL co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
Definition: simplecall.c:18
BOOL FASTCALL MsqIsHung(PTHREADINFO pti)
Definition: msgqueue.c:2194
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
HANDLE HWND
Definition: compat.h:13
BOOL FASTCALL UserSetActiveWindow(_In_opt_ PWND Wnd)
Definition: focus.c:1143
BOOL FASTCALL IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow)
Definition: window.c:4446
#define HWND_TOP
Definition: winuser.h:1193
UINT_PTR WPARAM
Definition: windef.h:207
#define BOOL
Definition: nt_native.h:43
BOOL UserSetCursorPos(INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: cursoricon.c:238
int32_t INT
Definition: typedefs.h:56
#define SWP_NOSENDCHANGING
Definition: winuser.h:1236
WPARAM wParam
Definition: combotst.c:138
LRESULT(CALLBACK * HOOKPROC)(int, WPARAM, LPARAM)
Definition: winuser.h:2874
PMENU FASTCALL IntGetMenuObject(HMENU hMenu)
Definition: menu.c:192
Definition: window.c:28
#define WS_MINIMIZE
Definition: pedump.c:622
#define TWOPARAM_ROUTINE_ROS_UPDATEUISTATE
Definition: ntuser.h:3551
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam)
Definition: window.c:16
ULONG cyMenu
Definition: ntuser.h:391
#define SWP_ASYNCWINDOWPOS
Definition: winuser.h:1238
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2533
#define TRACE(s)
Definition: solgame.cpp:4
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
#define TWOPARAM_ROUTINE_SETMENUBARHEIGHT
Definition: ntuser.h:3540
int Window
Definition: x11stubs.h:26
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOL FASTCALL co_IntSetCaretPos(int X, int Y)
Definition: caret.c:205
uint32_t DWORD_PTR
Definition: typedefs.h:63
BOOL FASTCALL IntEnableWindow(HWND hWnd, BOOL bEnable)
Definition: window.c:201
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define TWOPARAM_ROUTINE_SETGUITHRDHANDLE
Definition: ntuser.h:3541
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:396
BOOL FASTCALL IntUnhookWindowsHook(int HookId, HOOKPROC pfnFilterProc)
Definition: hook.c:1320
unsigned int ULONG
Definition: retypes.h:1
#define SWP_NOMOVE
Definition: winuser.h:1229
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WM_SYSCOMMAND
Definition: winuser.h:1723
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Referenced by MDI_UpdateFrameText(), NtUserxEnableWindow(), NtUserxRegisterLogonProcess(), NtUserxSetCaretPos(), NtUserxSetCursorPos(), NtUserxSetGUIThreadHandle(), NtUserxSetMenuBarHeight(), NtUserxShowOwnedPopups(), NtUserxSwitchToThisWindow(), NtUserxUnhookWindowsHook(), and NtUserxUpdateUiState().

Variable Documentation

◆ gpidLogon