fixed PhSetDesktopWinStaAccess on Windows 8 - create a DACL instead of setting it to NULL

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5114 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2012-11-30 12:44:53 +00:00
parent 7fef7aeee9
commit 33527f2f1c
2 changed files with 21 additions and 6 deletions
+1
View File
@@ -18,6 +18,7 @@ Process Hacker
* Fixed task scheduler information on Windows 8
* Fixed drag bug in tree list
* Fixed KProcessHacker bug affecting TmTx objects
* Fixed Run As feature on Windows 8
2.28
* NEW/IMPROVED:
+20 -6
View File
@@ -740,13 +740,25 @@ VOID PhSetDesktopWinStaAccess(
{
HWINSTA wsHandle;
HDESK desktopHandle;
SECURITY_DESCRIPTOR securityDescriptor;
ULONG allocationLength;
PSECURITY_DESCRIPTOR securityDescriptor;
PACL dacl;
// TODO: Set security on the correct window station and desktop.
// Create a security descriptor with a NULL DACL,
// thereby allowing everyone to access the object.
RtlCreateSecurityDescriptor(&securityDescriptor, SECURITY_DESCRIPTOR_REVISION);
// We create a DACL that allows everyone to access everything.
allocationLength = SECURITY_DESCRIPTOR_MIN_LENGTH +
(ULONG)sizeof(ACL) +
(ULONG)sizeof(ACCESS_ALLOWED_ACE) +
RtlLengthSid(&PhSeEveryoneSid);
securityDescriptor = PhAllocate(allocationLength);
dacl = (PACL)((PCHAR)securityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
RtlCreateSecurityDescriptor(securityDescriptor, SECURITY_DESCRIPTOR_REVISION);
RtlCreateAcl(dacl, allocationLength - SECURITY_DESCRIPTOR_MIN_LENGTH, ACL_REVISION);
RtlAddAccessAllowedAce(dacl, ACL_REVISION, GENERIC_ALL, &PhSeEveryoneSid);
RtlSetDaclSecurityDescriptor(securityDescriptor, TRUE, dacl, FALSE);
if (wsHandle = OpenWindowStation(
L"WinSta0",
@@ -754,7 +766,7 @@ VOID PhSetDesktopWinStaAccess(
WRITE_DAC
))
{
PhSetObjectSecurity(wsHandle, DACL_SECURITY_INFORMATION, &securityDescriptor);
PhSetObjectSecurity(wsHandle, DACL_SECURITY_INFORMATION, securityDescriptor);
CloseWindowStation(wsHandle);
}
@@ -765,9 +777,11 @@ VOID PhSetDesktopWinStaAccess(
WRITE_DAC | DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS
))
{
PhSetObjectSecurity(desktopHandle, DACL_SECURITY_INFORMATION, &securityDescriptor);
PhSetObjectSecurity(desktopHandle, DACL_SECURITY_INFORMATION, securityDescriptor);
CloseDesktop(desktopHandle);
}
PhFree(securityDescriptor);
}
/**