advapi32: Implement GetSecurityInfo.
Dan Hipschman
dsh at linux.ucla.edu
Mon Aug 4 15:56:31 CDT 2008
The indenting is consistent with the rest of the file.
---
dlls/advapi32/security.c | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 95b7a7b..8b661ce 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -19,6 +19,7 @@
*
*/
+#include <assert.h>
#include <stdarg.h>
#include <string.h>
@@ -2718,8 +2719,38 @@ DWORD WINAPI GetSecurityInfo(
PSECURITY_DESCRIPTOR *ppSecurityDescriptor
)
{
- FIXME("stub!\n");
- return ERROR_BAD_PROVIDER;
+ SECURITY_DESCRIPTOR *sd;
+ NTSTATUS status;
+ ULONG n1, n2;
+
+ status = NtQuerySecurityObject(hObject, SecurityInfo, NULL, 0, &n1);
+ assert(status != STATUS_SUCCESS);
+ if (status != STATUS_BUFFER_TOO_SMALL)
+ return RtlNtStatusToDosError(status);
+
+ sd = HeapAlloc(GetProcessHeap(), 0, n1);
+ if (!sd)
+ return ERROR_NOT_ENOUGH_MEMORY;
+
+ status = NtQuerySecurityObject(hObject, SecurityInfo, sd, n1, &n2);
+ if (status != STATUS_SUCCESS)
+ {
+ HeapFree(GetProcessHeap(), 0, sd);
+ return RtlNtStatusToDosError(status);
+ }
+
+ if (ppsidOwner)
+ *ppsidOwner = sd->Owner;
+ if (ppsidGroup)
+ *ppsidGroup = sd->Group;
+ if (ppDacl)
+ *ppDacl = sd->Dacl;
+ if (ppSacl)
+ *ppSacl = sd->Sacl;
+ if (ppSecurityDescriptor)
+ *ppSecurityDescriptor = sd;
+
+ return ERROR_SUCCESS;
}
/******************************************************************************
More information about the wine-patches
mailing list