mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
- Add Wine's GetPrivateObjectSecurity and use it instead of our that uses the unimplemented RtlQuerySecurityObject routine
svn path=/trunk/; revision=38508
This commit is contained in:
parent
124bf05832
commit
33e098eaaa
1 changed files with 72 additions and 5 deletions
|
@ -2250,19 +2250,25 @@ DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
//
|
||||||
|
// Use when RtlQuerySecurityObject is implemented
|
||||||
|
//
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,
|
GetPrivateObjectSecurity(IN PSECURITY_DESCRIPTOR ObjectDescriptor,
|
||||||
SECURITY_INFORMATION SecurityInformation,
|
IN SECURITY_INFORMATION SecurityInformation,
|
||||||
PSECURITY_DESCRIPTOR ResultantDescriptor,
|
OUT PSECURITY_DESCRIPTOR ResultantDescriptor OPTIONAL,
|
||||||
DWORD DescriptorLength,
|
IN DWORD DescriptorLength,
|
||||||
PDWORD ReturnLength)
|
OUT PDWORD ReturnLength)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Call RTL */
|
||||||
Status = RtlQuerySecurityObject(ObjectDescriptor,
|
Status = RtlQuerySecurityObject(ObjectDescriptor,
|
||||||
SecurityInformation,
|
SecurityInformation,
|
||||||
ResultantDescriptor,
|
ResultantDescriptor,
|
||||||
|
@ -2270,12 +2276,73 @@ GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,
|
||||||
ReturnLength);
|
ReturnLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
/* Fail */
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
//
|
||||||
|
// Wine's implementation (as of December 30th 2008)
|
||||||
|
//
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
GetPrivateObjectSecurity(IN PSECURITY_DESCRIPTOR ObjectDescriptor,
|
||||||
|
IN SECURITY_INFORMATION SecurityInformation,
|
||||||
|
OUT PSECURITY_DESCRIPTOR ResultantDescriptor OPTIONAL,
|
||||||
|
IN DWORD DescriptorLength,
|
||||||
|
OUT PDWORD ReturnLength)
|
||||||
|
{
|
||||||
|
SECURITY_DESCRIPTOR desc;
|
||||||
|
BOOL defaulted, present;
|
||||||
|
PACL pacl;
|
||||||
|
PSID psid;
|
||||||
|
|
||||||
|
TRACE("(%p,0x%08x,%p,0x%08x,%p)\n", ObjectDescriptor, SecurityInformation,
|
||||||
|
ResultantDescriptor, DescriptorLength, ReturnLength);
|
||||||
|
|
||||||
|
if (!InitializeSecurityDescriptor(&desc, SECURITY_DESCRIPTOR_REVISION))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (SecurityInformation & OWNER_SECURITY_INFORMATION)
|
||||||
|
{
|
||||||
|
if (!GetSecurityDescriptorOwner(ObjectDescriptor, &psid, &defaulted))
|
||||||
|
return FALSE;
|
||||||
|
SetSecurityDescriptorOwner(&desc, psid, defaulted);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SecurityInformation & GROUP_SECURITY_INFORMATION)
|
||||||
|
{
|
||||||
|
if (!GetSecurityDescriptorGroup(ObjectDescriptor, &psid, &defaulted))
|
||||||
|
return FALSE;
|
||||||
|
SetSecurityDescriptorGroup(&desc, psid, defaulted);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SecurityInformation & DACL_SECURITY_INFORMATION)
|
||||||
|
{
|
||||||
|
if (!GetSecurityDescriptorDacl(ObjectDescriptor, &present, &pacl, &defaulted))
|
||||||
|
return FALSE;
|
||||||
|
SetSecurityDescriptorDacl(&desc, present, pacl, defaulted);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SecurityInformation & SACL_SECURITY_INFORMATION)
|
||||||
|
{
|
||||||
|
if (!GetSecurityDescriptorSacl(ObjectDescriptor, &present, &pacl, &defaulted))
|
||||||
|
return FALSE;
|
||||||
|
SetSecurityDescriptorSacl(&desc, present, pacl, defaulted);
|
||||||
|
}
|
||||||
|
|
||||||
|
*ReturnLength = DescriptorLength;
|
||||||
|
return MakeSelfRelativeSD(&desc, ResultantDescriptor, ReturnLength);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue