TRACE("Deleting window station (0x%p)\n", WinSta);
+ WinSta->Flags |= WSS_DYING;
+
UserEmptyClipboardData(WinSta);
RtlDestroyAtomTable(WinSta->AtomTable);
HWINSTA WindowStation,
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
- PWINSTATION_OBJECT *Object)
+ PWINSTATION_OBJECT *Object,
+ POBJECT_HANDLE_INFORMATION pObjectHandleInfo)
{
NTSTATUS Status;
ExWindowStationObjectType,
AccessMode,
(PVOID*)Object,
- NULL);
+ pObjectHandleInfo);
if (!NT_SUCCESS(Status))
SetLastNtError(Status);
/* Setup the cursor */
co_IntLoadDefaultCursors();
+ /* Setup the icons */
+ //co_IntSetWndIcons();
+
/* Show the desktop */
pdesk = IntGetActiveDesktop();
ASSERT(pdesk);
return ScreenDeviceContext;
}
+BOOL FASTCALL
+CheckWinstaAttributeAccess(ACCESS_MASK DesiredAccess)
+{
+ PPROCESSINFO ppi = PsGetCurrentProcessWin32Process();
+ if ( gpidLogon != PsGetCurrentProcessId() )
+ {
+ if (!(ppi->W32PF_flags & W32PF_IOWINSTA))
+ {
+ ERR("Requires Interactive Window Station\n");
+ EngSetLastError(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ return FALSE;
+ }
+ if (!RtlAreAllAccessesGranted(ppi->amwinsta, DesiredAccess))
+ {
+ ERR("Access Denied\n");
+ EngSetLastError(ERROR_ACCESS_DENIED);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+
/* PUBLIC FUNCTIONS ***********************************************************/
/*
if (InputWindowStation == NULL)
{
- TRACE("Initializeing input window station\n");
+ ERR("Initializeing input window station\n");
InputWindowStation = WindowStationObject;
+ WindowStationObject->Flags &= ~WSS_NOIO;
+
InitCursorImpl();
}
+ else
+ {
+ WindowStationObject->Flags |= WSS_NOIO;
+ }
TRACE("NtUserCreateWindowStation created object %p with name %wZ handle %p\n",
WindowStation, &WindowStationObject->Name, WindowStation);
hWinSta,
KernelMode,
0,
- &Object);
+ &Object,
+ 0);
if (!NT_SUCCESS(Status))
{
PPROCESSINFO ppi;
NTSTATUS Status;
HWINSTA hwinstaOld;
+ OBJECT_HANDLE_INFORMATION ObjectHandleInfo;
PWINSTATION_OBJECT NewWinSta = NULL, OldWinSta;
ppi = PsGetCurrentProcessWin32Process();
Status = IntValidateWindowStationHandle( hWindowStation,
KernelMode,
0,
- &NewWinSta);
+ &NewWinSta,
+ &ObjectHandleInfo);
if (!NT_SUCCESS(Status))
{
TRACE("Validation of window station handle (%p) failed\n",
ppi->prpwinsta = NewWinSta;
ppi->hwinsta = hWindowStation;
+ ppi->amwinsta = ObjectHandleInfo.GrantedAccess;
+ ERR("WS : Granted Access %p\n",ppi->amwinsta);
+ if (RtlAreAllAccessesGranted(ppi->amwinsta, WINSTA_READSCREEN))
+ {
+ ppi->W32PF_flags |= W32PF_READSCREENACCESSGRANTED;
+ }
+ else
+ {
+ ppi->W32PF_flags &= ~W32PF_READSCREENACCESSGRANTED;
+ }
+
+ if (NewWinSta && !(NewWinSta->Flags & WSS_NOIO) )
+ {
+ ppi->W32PF_flags |= W32PF_IOWINSTA;
+ }
+ else // Might be closed if the handle is null.
+ {
+ ppi->W32PF_flags &= ~W32PF_IOWINSTA;
+ }
return TRUE;
}
hWindowStation,
KernelMode,
0,
- &Object);
+ &Object,
+ 0);
if (!NT_SUCCESS(Status))
{
TRACE("Validation of window station handle (%p) failed\n",
hWindowStation,
KernelMode,
0,
- &Object);
+ &Object,
+ 0);
if (!NT_SUCCESS(Status))
{
TRACE("Validation of window station handle (%p) failed\n",
Status = IntValidateWindowStationHandle(hWindowStation,
KernelMode,
0,
- &WindowStation);
+ &WindowStation,
+ 0);
if (! NT_SUCCESS(Status))
{
return Status;
return ret;
}
+BOOL APIENTRY
+NEW_NtUserSetWindowStationUser(
+ HWINSTA hWindowStation,
+ PLUID pluid,
+ PSID psid,
+ DWORD size)
+{
+ NTSTATUS Status;
+ PWINSTATION_OBJECT WindowStation = NULL;
+ BOOL Ret = FALSE;
+
+ UserEnterExclusive();
+
+ if (gpidLogon != PsGetCurrentProcessId())
+ {
+ EngSetLastError(ERROR_ACCESS_DENIED);
+ goto Leave;
+ }
+
+ Status = IntValidateWindowStationHandle(hWindowStation,
+ KernelMode,
+ 0,
+ &WindowStation,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ goto Leave;
+ }
+
+ if (WindowStation->psidUser)
+ {
+ ExFreePoolWithTag(WindowStation->psidUser, USERTAG_SECURITY);
+ }
+
+ WindowStation->psidUser = ExAllocatePoolWithTag(PagedPool, size, USERTAG_SECURITY);
+ if (WindowStation->psidUser == NULL)
+ {
+ EngSetLastError(ERROR_OUTOFMEMORY);
+ goto Leave;
+ }
+
+ _SEH2_TRY
+ {
+ ProbeForRead( psid, size, 1);
+ ProbeForRead( pluid, sizeof(LUID), 1);
+
+ RtlCopyMemory(WindowStation->psidUser, psid, size);
+ WindowStation->luidUser = *pluid;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+
+ if (!NT_SUCCESS(Status))
+ {
+ ExFreePoolWithTag(WindowStation->psidUser, 0);
+ WindowStation->psidUser = 0;
+ goto Leave;
+ }
+
+ Ret = TRUE;
+
+Leave:
+ if (WindowStation) ObDereferenceObject(WindowStation);
+ UserLeave();
+ return Ret;
+}
+
+
/* EOF */
#define SESSION_DIR L"\\Sessions"
/* Window Station Status Flags */
-#define WSS_LOCKED (1)
-#define WSS_NOINTERACTIVE (2)
+#define WSS_LOCKED (1)
+#define WSS_NOINTERACTIVE (2)
+#define WSS_NOIO (4)
+#define WSS_SHUTDOWN (8)
+#define WSS_DYING (16)
+#define WSS_REALSHUTDOWN (32)
typedef struct _WINSTATION_OBJECT
{
INT fClipboardChanged : 1;
INT fInDelayedRendering : 1;
+ PWND spwndClipboardListener;
+ LUID luidEndSession;
+ LUID luidUser;
+ PVOID psidUser;
+
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
extern WINSTATION_OBJECT *InputWindowStation;
HWINSTA WindowStation,
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
- PWINSTATION_OBJECT *Object);
+ PWINSTATION_OBJECT *Object,
+ POBJECT_HANDLE_INFORMATION pObjectHandleInfo);
BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation);
BOOL FASTCALL co_IntInitializeDesktopGraphics(VOID);
VOID FASTCALL IntEndDesktopGraphics(VOID);
+BOOL FASTCALL CheckWinstaAttributeAccess(ACCESS_MASK);
/* EOF */