xref: /reactos/win32ss/user/ntuser/winsta.h (revision 09dde2cf)
1 #pragma once
2 
3 #define WINSTA_OBJ_DIR L"\\Windows\\WindowStations"
4 #define SESSION_DIR L"\\Sessions"
5 
6 /* Window Station Status Flags */
7 #define WSS_LOCKED        (1)
8 #define WSS_NOINTERACTIVE (2)
9 #define WSS_NOIO          (4)
10 #define WSS_SHUTDOWN      (8)
11 #define WSS_DYING         (16)
12 #define WSS_REALSHUTDOWN  (32)
13 
14 // See also: https://reactos.org/wiki/Techwiki:Win32k/WINDOWSTATION
15 typedef struct _WINSTATION_OBJECT
16 {
17     DWORD dwSessionId;
18 
19     LIST_ENTRY DesktopListHead;
20     PRTL_ATOM_TABLE AtomTable;
21 
22     ULONG          Flags;
23     struct tagKL*  spklList;
24     PTHREADINFO    ptiClipLock;
25     PTHREADINFO    ptiDrawingClipboard;
26     PWND           spwndClipOpen;
27     PWND           spwndClipViewer;
28     PWND           spwndClipOwner;
29     PCLIP          pClipBase;     // Not a clip object.
30     DWORD          cNumClipFormats;
31     INT            iClipSerialNumber;
32     INT            iClipSequenceNumber;
33     INT            fClipboardChanged : 1;
34     INT            fInDelayedRendering : 1;
35 
36     PWND           spwndClipboardListener;
37     LUID           luidEndSession;
38     LUID           luidUser;
39     PVOID          psidUser;
40 
41     /* ReactOS-specific */
42     struct _DESKTOP* ActiveDesktop;
43     HANDLE         ShellWindow;
44     HANDLE         ShellListView;
45 } WINSTATION_OBJECT, *PWINSTATION_OBJECT;
46 
47 #ifndef _WIN64
48 C_ASSERT(offsetof(WINSTATION_OBJECT, Flags) == 0x10);
49 C_ASSERT(offsetof(WINSTATION_OBJECT, spklList) == 0x14);
50 C_ASSERT(offsetof(WINSTATION_OBJECT, ptiClipLock) == 0x18);
51 C_ASSERT(offsetof(WINSTATION_OBJECT, ptiDrawingClipboard) == 0x1c);
52 C_ASSERT(offsetof(WINSTATION_OBJECT, spwndClipOpen) == 0x20);
53 C_ASSERT(offsetof(WINSTATION_OBJECT, spwndClipViewer) == 0x24);
54 C_ASSERT(offsetof(WINSTATION_OBJECT, spwndClipOwner) == 0x28);
55 #endif
56 
57 extern WINSTATION_OBJECT *InputWindowStation;
58 extern HANDLE gpidLogon;
59 extern HWND hwndSAS;
60 extern UNICODE_STRING gustrWindowStationsDir;
61 
62 CODE_SEG("INIT")
63 NTSTATUS
64 NTAPI
65 InitWindowStationImpl(VOID);
66 
67 NTSTATUS
68 NTAPI
69 UserCreateWinstaDirectory(VOID);
70 
71 NTSTATUS
72 NTAPI
73 IntWinStaObjectDelete(
74     _In_ PVOID Parameters);
75 
76 NTSTATUS
77 NTAPI
78 IntWinStaObjectParse(
79     _In_ PVOID Parameters);
80 
81 NTSTATUS
82 NTAPI
83 IntWinStaOkToClose(
84     _In_ PVOID Parameters);
85 
86 NTSTATUS
87 FASTCALL
88 IntValidateWindowStationHandle(
89    HWINSTA WindowStation,
90    KPROCESSOR_MODE AccessMode,
91    ACCESS_MASK DesiredAccess,
92    PWINSTATION_OBJECT *Object,
93    POBJECT_HANDLE_INFORMATION pObjectHandleInfo);
94 
95 NTSTATUS
96 FASTCALL
97 IntCreateWindowStation(
98     OUT HWINSTA* phWinSta,
99     IN POBJECT_ATTRIBUTES ObjectAttributes,
100     IN KPROCESSOR_MODE AccessMode,
101     IN KPROCESSOR_MODE OwnerMode,
102     IN ACCESS_MASK dwDesiredAccess,
103     DWORD Unknown2,
104     DWORD Unknown3,
105     DWORD Unknown4,
106     DWORD Unknown5,
107     DWORD Unknown6);
108 
109 PWINSTATION_OBJECT FASTCALL IntGetProcessWindowStation(HWINSTA *phWinSta OPTIONAL);
110 BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation);
111 
112 BOOL FASTCALL co_IntInitializeDesktopGraphics(VOID);
113 VOID FASTCALL IntEndDesktopGraphics(VOID);
114 BOOL FASTCALL CheckWinstaAttributeAccess(ACCESS_MASK);
115 
116 /* EOF */
117