1127 PSID pInteractiveSid = (
PSID)InteractiveBuffer;
1128 DWORD SidSize, AclSize;
1153 AclSize =
sizeof(
ACL)
1158 if (!pDefaultAcl || !pUserDesktopAcl)
1160 ERR(
"WL: HeapAlloc() failed\n");
1177 ERR(
"WL: AddAccessAllowedAce() failed (error %lu)\n",
GetLastError());
1186 ERR(
"WL: InitializeSecurityDescriptor() failed (error %lu)\n",
GetLastError());
1192 ERR(
"WL: SetSecurityDescriptorDacl() failed (error %lu)\n",
GetLastError());
1206 ERR(
"WL: AddAccessAllowedAce() failed (error %lu)\n",
GetLastError());
1215 ERR(
"WL: InitializeSecurityDescriptor() failed (error %lu)\n",
GetLastError());
1221 ERR(
"WL: SetSecurityDescriptorDacl() failed (error %lu)\n",
GetLastError());
1232 Session->InteractiveWindowStationName =
L"WinSta0";
1234 Session->InteractiveWindowStationName,
1238 if (!Session->InteractiveWindowStation)
1245 ERR(
"WL: SetProcessWindowStation() failed (error %lu)\n",
GetLastError());
1258 &UserDesktopSecurity);
1259 if (!Session->ApplicationDesktop)
1275 if (!Session->WinlogonDesktop)
1291 if(!Session->ScreenSaverDesktop)
1293 ERR(
"WL: Failed to create Screen-Saver desktop (%lu)\n",
GetLastError());
1315 if (Session->ApplicationDesktop)
1318 Session->ApplicationDesktop =
NULL;
1320 if (Session->WinlogonDesktop)
1323 Session->WinlogonDesktop =
NULL;
1325 if (Session->ScreenSaverDesktop)
1328 Session->ScreenSaverDesktop =
NULL;
1330 if (Session->InteractiveWindowStation)
1333 Session->InteractiveWindowStation =
NULL;
BOOL WINAPI SetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
#define SECURITY_MAX_SID_SIZE
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
BOOL WINAPI AddAccessAllowedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
DWORD WINAPI GetLastError(VOID)
BOOL WINAPI SetProcessWindowStation(_In_ HWINSTA)
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
#define SECURITY_DESCRIPTOR_REVISION
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI GetLengthSid(PSID pSid)
BOOL WINAPI SwitchDesktop(_In_ HDESK)
static PSID pLocalSystemSid
LPVOID lpSecurityDescriptor
#define FIELD_OFFSET(t, f)
HWINSTA WINAPI CreateWindowStationW(_In_opt_ LPCWSTR lpwinsta, _In_ DWORD dwFlags, _In_ ACCESS_MASK dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpsa)
BOOL WINAPI CloseDesktop(_In_ HDESK)
char * cleanup(char *str)
HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop, LPCWSTR lpszDevice, LPDEVMODEW pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
BOOL WINAPI CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType, IN PSID DomainSid OPTIONAL, OUT PSID pSid, IN OUT DWORD *cbSid)
#define HeapFree(x, y, z)
BOOL WINAPI CloseWindowStation(_In_ HWINSTA)
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES