implemented RegisterLogonProcess(), LockWindowStation() and UnlockWindowStation()

svn path=/trunk/; revision=9267
This commit is contained in:
Thomas Bluemel 2004-05-01 16:43:15 +00:00
parent 346aa0cca2
commit 56ee4446f0
10 changed files with 94 additions and 22 deletions

View file

@ -4624,7 +4624,7 @@ RegisterSystemThread(
DWORD reserved
);
DWORD
BOOL
STDCALL
RegisterLogonProcess(
HANDLE hprocess,

View file

@ -206,6 +206,7 @@ NtUserCallOneParam(
#define TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID 0x58
#define TWOPARAM_ROUTINE_SETCARETPOS 0x60
#define TWOPARAM_ROUTINE_GETWINDOWINFO 0x61
#define TWOPARAM_ROUTINE_REGISTERLOGONPROC 0x62
DWORD
STDCALL
NtUserCallTwoParam(

View file

@ -52,6 +52,9 @@ void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
#define NtUserGetWindowInfo(hwnd, pwi) \
(BOOL)NtUserCallTwoParam((DWORD)hwnd, (DWORD)pwi, TWOPARAM_ROUTINE_GETWINDOWINFO)
#define NtUserRegisterLogonProcess(hproc, x) \
(BOOL)NtUserCallTwoParam((DWORD)hproc, (DWORD)x, TWOPARAM_ROUTINE_REGISTERLOGONPROC)
#define NtUserSetCaretBlinkTime(uMSeconds) \
(BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: misc.c,v 1.3 2003/12/07 23:02:57 gvg Exp $
/* $Id: misc.c,v 1.4 2004/05/01 16:43:14 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/misc/misc.c
@ -56,3 +56,13 @@ PrivateCsrssManualGuiCheck(LONG Check)
{
NtUserManualGuiCheck(Check);
}
/*
* @implemented
*/
BOOL
STDCALL
RegisterLogonProcess ( HANDLE hprocess, BOOL x )
{
return NtUserRegisterLogonProcess(hprocess, x);
}

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.59 2004/04/29 20:26:35 weiden Exp $
/* $Id: stubs.c,v 1.60 2004/05/01 16:43:14 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -372,17 +372,6 @@ RegisterSystemThread ( DWORD flags, DWORD reserved )
UNIMPLEMENTED;
}
/*
* @unimplemented
*/
DWORD
STDCALL
RegisterLogonProcess ( HANDLE hprocess, BOOL x )
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/

View file

@ -59,7 +59,7 @@ typedef struct _WINSTATION_OBJECT
UINT CaretBlinkRate;
HANDLE ShellWindow;
HANDLE ShellListView;
BOOL DesktopLocked;
ULONG Flags;
struct _DESKTOP_OBJECT* ActiveDesktop;
/* FIXME: Clipboard */
LIST_ENTRY HotKeyListHead;

View file

@ -16,7 +16,12 @@
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
#define WINSTA_ROOT_NAME_LENGTH 23
/* Window Station Status Flags */
#define WSS_LOCKED (1)
#define WSS_NOINTERACTIVE (2)
extern WINSTATION_OBJECT *InputWindowStation;
extern PW32PROCESS LogonProcess;
NTSTATUS FASTCALL
InitWindowStationImpl(VOID);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dllmain.c,v 1.69 2004/04/29 20:26:35 weiden Exp $
/* $Id: dllmain.c,v 1.70 2004/05/01 16:43:14 weiden Exp $
*
* Entry Point for win32k.sys
*/
@ -138,6 +138,14 @@ Win32kProcessCallback (struct _EPROCESS *Process,
CleanupForProcess(Process, Process->UniqueProcessId);
IntGraphicsCheck(FALSE);
/*
* Deregister logon application automatically
*/
if(LogonProcess == Win32Process)
{
LogonProcess = NULL;
}
}
return STATUS_SUCCESS;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: desktop.c,v 1.10 2004/04/09 20:03:19 navaraf Exp $
* $Id: desktop.c,v 1.11 2004/05/01 16:43:15 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -720,6 +720,18 @@ NtUserSwitchDesktop(HDESK hDesktop)
return FALSE;
}
/*
* Don't allow applications switch the desktop if it's locked, unless the caller
* is the logon application itself
*/
if((DesktopObject->WindowStation->Flags & WSS_LOCKED) &&
LogonProcess != NULL && LogonProcess != PsGetWin32Process())
{
ObDereferenceObject(DesktopObject);
DPRINT1("Switching desktop 0x%x denied because the work station is locked!\n", hDesktop);
return FALSE;
}
/* FIXME: Fail if the desktop belong to an invisible window station */
/* FIXME: Fail if the process is associated with a secured
desktop such as Winlogon or Screen-Saver */

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.66 2004/05/01 11:38:28 weiden Exp $
/* $Id: misc.c,v 1.67 2004/05/01 16:43:15 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -36,6 +36,9 @@
#define NDEBUG
#include <debug.h>
/* registered Logon process */
PW32PROCESS LogonProcess = NULL;
/* FIXME - not yet defined in w32api :( */
#define SPI_GETFOCUSBORDERWIDTH (8206)
#define SPI_SETFOCUSBORDERWIDTH (8207)
@ -61,6 +64,43 @@ PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue() {
return pmPrimitiveMessageQueue;
}
BOOL FASTCALL
IntRegisterLogonProcess(HANDLE hProcess, BOOL x)
{
PEPROCESS Process;
NTSTATUS Status;
if(LogonProcess != NULL && LogonProcess != PsGetWin32Process())
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE;
}
if(hProcess)
{
Status = ObReferenceObjectByHandle(hProcess,
PROCESS_QUERY_INFORMATION,
PsProcessType,
ExGetPreviousMode(),
(PVOID*)&Process,
NULL);
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return 0;
}
LogonProcess = Process->Win32Process;
ObDereferenceObject(Process);
}
else
{
/* deregister the logon process */
LogonProcess = NULL;
}
return TRUE;
}
/*
* @unimplemented
*/
@ -94,7 +134,7 @@ NtUserCallNoParam(DWORD Routine)
break;
default:
DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam\n");
DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n");
SetLastWin32Error(ERROR_INVALID_PARAMETER);
break;
}
@ -223,7 +263,7 @@ NtUserCallOneParam(
return (DWORD)TRUE;
}
}
DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam()\n Param=0x%x\n",
DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
Routine, Param);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;
@ -394,8 +434,12 @@ NtUserCallTwoParam(
IntReleaseWindowObject(WindowObject);
return Ret;
}
case TWOPARAM_ROUTINE_REGISTERLOGONPROC:
return (DWORD)IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2);
}
DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam()\n Param1=0x%x Parm2=0x%x\n",
DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
Routine, Param1, Param2);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;