reactos/win32ss/user/ntuser/winsta.h
Hermès Bélusca-Maïto 7bc2ddd669
[WIN32K:NTUSER] Fixes for NtUserCreateWindowStation(), IntCreateWindowStation() and NtUserOpenWindowStation().
CORE-11933 and PR #621.

We are potentially going to modify the window station name to be
created or opened, by one with the format "Service-0x<luidhigh>-<luidlow>$",
in case the user provides an empty name.
Since we want to use the user-mode ObjectAttributes structure pointer so
that the Object manager can correctly perform the access checks and the
capture, we actually need to construct the new window station name in the
user memory space! This allows us then to fetch the new name in the
ObjectAttributes structure so that Ob can use it.
All of this is performed under SEH.

For NtUserOpenWindowStation(), we also need to be Windows-compatible and
detect whether user-mode gave instead the special "Service-0x00000000-00000000$"
name (observed via API monitoring) that is used when one tries to open a
window station with empty name.
2018-08-19 22:18:35 +02:00

128 lines
3.5 KiB
C

#pragma once
#define WINSTA_OBJ_DIR L"\\Windows\\WindowStations"
#define SESSION_DIR L"\\Sessions"
/* Window Station Status Flags */
#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
{
DWORD dwSessionId;
LIST_ENTRY DesktopListHead;
PRTL_ATOM_TABLE AtomTable;
HANDLE ShellWindow;
HANDLE ShellListView;
ULONG Flags;
struct _DESKTOP* ActiveDesktop;
PTHREADINFO ptiClipLock;
PTHREADINFO ptiDrawingClipboard;
PWND spwndClipOpen;
PWND spwndClipViewer;
PWND spwndClipOwner;
PCLIP pClipBase; // Not a clip object.
DWORD cNumClipFormats;
INT iClipSerialNumber;
INT iClipSequenceNumber;
INT fClipboardChanged : 1;
INT fInDelayedRendering : 1;
PWND spwndClipboardListener;
LUID luidEndSession;
LUID luidUser;
PVOID psidUser;
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
extern WINSTATION_OBJECT *InputWindowStation;
extern HANDLE gpidLogon;
extern HWND hwndSAS;
extern UNICODE_STRING gustrWindowStationsDir;
#define WINSTA_READ STANDARD_RIGHTS_READ | \
WINSTA_ENUMDESKTOPS | \
WINSTA_ENUMERATE | \
WINSTA_READATTRIBUTES | \
WINSTA_READSCREEN
#define WINSTA_WRITE STANDARD_RIGHTS_WRITE | \
WINSTA_ACCESSCLIPBOARD | \
WINSTA_CREATEDESKTOP | \
WINSTA_WRITEATTRIBUTES
#define WINSTA_EXECUTE STANDARD_RIGHTS_EXECUTE | \
WINSTA_ACCESSGLOBALATOMS | \
WINSTA_EXITWINDOWS
#define WINSTA_ACCESS_ALL STANDARD_RIGHTS_REQUIRED | \
WINSTA_ACCESSCLIPBOARD | \
WINSTA_ACCESSGLOBALATOMS | \
WINSTA_CREATEDESKTOP | \
WINSTA_ENUMDESKTOPS | \
WINSTA_ENUMERATE | \
WINSTA_EXITWINDOWS | \
WINSTA_READATTRIBUTES | \
WINSTA_READSCREEN | \
WINSTA_WRITEATTRIBUTES
INIT_FUNCTION
NTSTATUS
NTAPI
InitWindowStationImpl(VOID);
NTSTATUS
NTAPI
UserCreateWinstaDirectory(VOID);
NTSTATUS
NTAPI
IntWinStaObjectDelete(
_In_ PVOID Parameters);
NTSTATUS
NTAPI
IntWinStaObjectParse(
_In_ PVOID Parameters);
NTSTATUS
NTAPI
IntWinStaOkToClose(
_In_ PVOID Parameters);
NTSTATUS
FASTCALL
IntValidateWindowStationHandle(
HWINSTA WindowStation,
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
PWINSTATION_OBJECT *Object,
POBJECT_HANDLE_INFORMATION pObjectHandleInfo);
NTSTATUS
FASTCALL
IntCreateWindowStation(
OUT HWINSTA* phWinSta,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN KPROCESSOR_MODE AccessMode,
IN KPROCESSOR_MODE OwnerMode,
IN ACCESS_MASK dwDesiredAccess,
DWORD Unknown2,
DWORD Unknown3,
DWORD Unknown4,
DWORD Unknown5,
DWORD Unknown6);
BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation);
BOOL FASTCALL co_IntInitializeDesktopGraphics(VOID);
VOID FASTCALL IntEndDesktopGraphics(VOID);
BOOL FASTCALL CheckWinstaAttributeAccess(ACCESS_MASK);
/* EOF */