* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: NtUserCallXxx call stubs
- * FILE: subsystem/win32/win32k/ntuser/simplecall.c
+ * FILE: win32ss/user/ntuser/simplecall.c
* PROGRAMER: Ge van Geldorp (ge@gse.nl)
*/
#include <win32k.h>
+
DBG_DEFAULT_CHANNEL(UserMisc);
-/* registered Logon process */
-PPROCESSINFO LogonProcess = NULL;
+/* Registered logon process ID */
+HANDLE gpidLogon = 0;
BOOL FASTCALL
co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
NTSTATUS Status;
PEPROCESS Process;
- Status = PsLookupProcessByProcessId(ProcessId,
- &Process);
+ Status = PsLookupProcessByProcessId(ProcessId, &Process);
if (!NT_SUCCESS(Status))
{
EngSetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
+ ProcessId = Process->UniqueProcessId;
+
+ ObDereferenceObject(Process);
+
if (Register)
{
/* Register the logon process */
- if (LogonProcess != NULL)
- {
- ObDereferenceObject(Process);
+ if (gpidLogon != 0)
return FALSE;
- }
- LogonProcess = (PPROCESSINFO)Process->Win32Process;
+ gpidLogon = ProcessId;
}
else
{
/* Deregister the logon process */
- if (LogonProcess != (PPROCESSINFO)Process->Win32Process)
- {
- ObDereferenceObject(Process);
+ if (gpidLogon != ProcessId)
return FALSE;
- }
- LogonProcess = NULL;
+ gpidLogon = 0;
}
- ObDereferenceObject(Process);
-
return TRUE;
}
switch(Routine)
{
case NOPARAM_ROUTINE_CREATEMENU:
- Result = (DWORD_PTR)UserCreateMenu(FALSE);
+ Result = (DWORD_PTR)UserCreateMenu(GetW32ThreadInfo()->rpdesk, FALSE);
break;
case NOPARAM_ROUTINE_CREATEMENUPOPUP:
- Result = (DWORD_PTR)UserCreateMenu(TRUE);
+ Result = (DWORD_PTR)UserCreateMenu(GetW32ThreadInfo()->rpdesk, TRUE);
break;
case NOPARAM_ROUTINE_DESTROY_CARET:
Result = (DWORD_PTR)IntUninitMessagePumpHook();
break;
- case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO:
- Result = (DWORD_PTR)MsqGetMessageExtraInfo();
- break;
-
case NOPARAM_ROUTINE_MSQCLEARWAKEMASK:
RETURN( (DWORD_PTR)IntMsqClearWakeMask());
RETURN(0);
}
- /* this is a Reactos only case and is needed for gui-on-demand */
+ /* this is a ReactOS only case and is needed for gui-on-demand */
case NOPARAM_ROUTINE_ISCONSOLEMODE:
RETURN( ScreenDeviceContext == NULL );
{
PTHREADINFO pti;
pti = PsGetCurrentThreadWin32Thread();
- MsqPostQuitMessage(pti->MessageQueue, Param);
+ MsqPostQuitMessage(pti, Param);
RETURN(TRUE);
}
if (count == 0) count = 8;
psmwp = (PSMWP) UserCreateObject( gHandleTable,
- NULL,
- NULL,
+ NULL,
+ NULL,
(PHANDLE)&hDwp,
TYPE_SETWINDOWPOS,
sizeof(SMWP));
RETURN(Result);
}
- case ONEPARAM_ROUTINE_SWITCHCARETSHOWING:
- RETURN( (DWORD_PTR)IntSwitchCaretShowing((PVOID)Param));
-
case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
RETURN( (DWORD_PTR)IntSetCaretBlinkTime((UINT)Param));
case ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT:
{
- PCURICON_OBJECT CurIcon;
DWORD_PTR Result ;
- if (!(CurIcon = IntCreateCurIconHandle((DWORD)Param)))
+ if (!(Result = (DWORD_PTR)IntCreateCurIconHandle((DWORD)Param)))
{
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
RETURN(0);
}
-
- Result = (DWORD_PTR)CurIcon->Self;
- UserDereferenceObject(CurIcon);
RETURN(Result);
}
/* FIXME: Should use UserEnterShared */
RETURN(UserEnumClipboardFormats(Param));
- case ONEPARAM_ROUTINE_CSRSS_GUICHECK:
- IntUserManualGuiCheck(Param);
- RETURN(TRUE);
-
case ONEPARAM_ROUTINE_GETCURSORPOS:
{
BOOL Ret = TRUE;
case ONEPARAM_ROUTINE_REPLYMESSAGE:
RETURN (co_MsqReplyMessage((LRESULT) Param));
case ONEPARAM_ROUTINE_MESSAGEBEEP:
+ /* TODO: Implement sound sentry */
RETURN ( UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, Param) );
- /* TODO: Implement sound sentry */
case ONEPARAM_ROUTINE_CREATESYSTEMTHREADS:
RETURN(CreateSystemThreads(Param));
case ONEPARAM_ROUTINE_LOCKFOREGNDWINDOW:
switch(Routine)
{
+ case TWOPARAM_ROUTINE_REDRAWTITLE:
+ {
+ DWORD_PTR Ret;
+ Window = UserGetWindowObject((HWND)Param1);
+ Ret = (DWORD_PTR)UserPaintCaption(Window, (INT)Param2);
+ RETURN(Ret);
+ }
case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
{
DWORD_PTR Ret;
- PMENU_OBJECT MenuObject = IntGetMenuObject((HMENU)Param1);
+ PMENU MenuObject = IntGetMenuObject((HMENU)Param1);
if(!MenuObject)
RETURN( 0);
if(Param2 > 0)
{
- Ret = (MenuObject->MenuInfo.Height == (int)Param2);
- MenuObject->MenuInfo.Height = (int)Param2;
+ Ret = (MenuObject->cyMenu == (int)Param2);
+ MenuObject->cyMenu = (int)Param2;
}
else
- Ret = (DWORD_PTR)MenuObject->MenuInfo.Height;
+ Ret = (DWORD_PTR)MenuObject->cyMenu;
IntReleaseMenuObject(MenuObject);
RETURN( Ret);
}
case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
{
- PUSER_MESSAGE_QUEUE MsgQueue = ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
-
- ASSERT(MsgQueue);
- RETURN( (DWORD_PTR)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));
+ PTHREADINFO pti = (PTHREADINFO)PsGetCurrentThreadWin32Thread();
+ ASSERT(pti->MessageQueue);
+ RETURN( (DWORD_PTR)MsqSetStateWindow(pti, (ULONG)Param1, (HWND)Param2));
}
case TWOPARAM_ROUTINE_ENABLEWINDOW:
STUB
RETURN( 0);
-
case TWOPARAM_ROUTINE_SETCARETPOS:
RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
- case TWOPARAM_ROUTINE_EXITREACTOS:
- if(hwndSAS == NULL)
- {
- ASSERT(hwndSAS);
- RETURN(STATUS_NOT_FOUND);
- }
- RETURN( co_IntSendMessage (hwndSAS, PM_WINLOGON_EXITWINDOWS, (WPARAM) Param1, (LPARAM)Param2));
}
ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
Routine, Param1, Param2);
break;
case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW:
- TRACE("co_IntSetForegroundWindow 1 %p\n",hWnd);
+ TRACE("co_IntSetForegroundWindow 1 0x%p\n",hWnd);
Ret = co_IntSetForegroundWindow(Window);
- TRACE("co_IntSetForegroundWindow 2 \n");
+ TRACE("co_IntSetForegroundWindow 2 0x%p\n",hWnd);
break;
case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE:
- TRACE("co_IntSetForegroundWindow 1 0x%p\n",hWnd);
+ TRACE("co_IntSetForegroundWindow M 1 0x%p\n",hWnd);
Ret = co_IntSetForegroundWindowMouse(Window);
- TRACE("co_IntSetForegroundWindow 2 0x%p\n",hWnd);
+ TRACE("co_IntSetForegroundWindow M 2 0x%p\n",hWnd);
break;
case HWNDLOCK_ROUTINE_UPDATEWINDOW:
- Ret = co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN);
+ co_IntUpdateWindows(Window, RDW_ALLCHILDREN, FALSE);
+ Ret = TRUE;
break;
}
case HWND_ROUTINE_GETWNDCONTEXTHLPID:
{
PWND Window;
- PPROPERTY HelpId;
- USER_REFERENCE_ENTRY Ref;
+ DWORD HelpId;
- UserEnterExclusive();
+ UserEnterShared();
if (!(Window = UserGetWindowObject(hWnd)))
{
UserLeave();
return 0;
}
- UserRefObjectCo(Window, &Ref);
- HelpId = IntGetProp(Window, gpsi->atomContextHelpIdProp);
+ HelpId = (DWORD)(DWORD_PTR)UserGetProp(Window, gpsi->atomContextHelpIdProp, TRUE);
- UserDerefObjectCo(Window);
UserLeave();
- return (DWORD)HelpId->Data;
+ return HelpId;
}
case HWND_ROUTINE_REGISTERSHELLHOOKWINDOW:
if (IntIsWindow(hWnd))
}
if ( Param )
- IntSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param);
+ UserSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param, TRUE);
else
- IntRemoveProp(Window, gpsi->atomContextHelpIdProp);
+ UserRemoveProp(Window, gpsi->atomContextHelpIdProp, TRUE);
UserLeave();
return TRUE;
switch (Routine)
{
case TWOPARAM_ROUTINE_VALIDATERGN:
- Ret = (DWORD)co_UserRedrawWindow( Window, NULL, (HRGN)Param, RDW_VALIDATE);
- break;
+ {
+ PREGION Rgn = REGION_LockRgn((HRGN)Param);
+ Ret = (DWORD)co_UserRedrawWindow( Window, NULL, Rgn, RDW_VALIDATE);
+ if (Rgn) REGION_UnlockRgn(Rgn);
+ break;
+ }
}
UserDerefObjectCo(Window);