1 added + 4 modified, total 5 files
reactos/w32api/include
diff -N sddl.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sddl.h 23 Aug 2004 21:16:25 -0000 1.1
@@ -0,0 +1,23 @@
+#ifndef _SDDL_H
+#define _SDDL_H
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+BOOL WINAPI ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid);
+BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid);
+
+#ifdef UNICODE
+#define ConvertSidToStringSid ConvertSidToStringSidW
+#else /* UNICODE */
+#define ConvertSidToStringSid ConvertSidToStringSidA
+#endif /* UNICODE */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* ! defined _SDDL_H */
reactos/lib/advapi32
diff -u -r1.20 -r1.21
--- advapi32.def 10 Jul 2004 14:38:23 -0000 1.20
+++ advapi32.def 23 Aug 2004 21:16:25 -0000 1.21
@@ -1,4 +1,4 @@
-; $Id: advapi32.def,v 1.20 2004/07/10 14:38:23 weiden Exp $
+; $Id: advapi32.def,v 1.21 2004/08/23 21:16:25 gvg Exp $
;
; advapi32.def
;
@@ -47,6 +47,8 @@
;CloseEventLog@4
CloseServiceHandle@4
ControlService@12
+ConvertSidToStringSidA@8
+ConvertSidToStringSidW@8
CopySid@12
;CreatePrivateObjectSecurity@24
CreateProcessAsUserA@44
reactos/lib/advapi32
diff -u -r1.40 -r1.41
--- advapi32.edf 10 Jul 2004 14:38:23 -0000 1.40
+++ advapi32.edf 23 Aug 2004 21:16:25 -0000 1.41
@@ -1,4 +1,4 @@
-; $Id: advapi32.edf,v 1.40 2004/07/10 14:38:23 weiden Exp $
+; $Id: advapi32.edf,v 1.41 2004/08/23 21:16:25 gvg Exp $
;
; advapi32.edf
;
@@ -44,6 +44,8 @@
CloseEventLog=CloseEventLog@4
CloseServiceHandle=CloseServiceHandle@4
ControlService=ControlService@12
+ConvertSidToStringSidA=ConvertSidToStringSidA@8
+ConvertSidToStringSidW=ConvertSidToStringSidW@8
CopySid=CopySid@12
;CreatePrivateObjectSecurity=CreatePrivateObjectSecurity@24
CreateProcessAsUserA=CreateProcessAsUserA@44
reactos/lib/advapi32
diff -u -r1.1 -r1.2
--- advapi32.h 15 Aug 2004 17:03:14 -0000 1.1
+++ advapi32.h 23 Aug 2004 21:16:25 -0000 1.2
@@ -6,4 +6,5 @@
#define NTOS_MODE_USER
#include <ntos.h>
#include <windows.h>
+#include <sddl.h>
#include <rosrtl/string.h>
reactos/lib/advapi32/sec
diff -u -r1.14 -r1.15
--- sid.c 15 Aug 2004 17:03:15 -0000 1.14
+++ sid.c 23 Aug 2004 21:16:26 -0000 1.15
@@ -1,4 +1,4 @@
-/* $Id: sid.c,v 1.14 2004/08/15 17:03:15 chorns Exp $
+/* $Id: sid.c,v 1.15 2004/08/23 21:16:26 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@@ -210,4 +210,97 @@
return (BOOL)RtlValidSid (pSid);
}
+/*
+ * @implemented
+ */
+BOOL STDCALL
+ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
+{
+ NTSTATUS Status;
+ UNICODE_STRING UnicodeString;
+ WCHAR FixedBuffer[64];
+
+ if (! RtlValidSid(Sid))
+ {
+ SetLastError(ERROR_INVALID_SID);
+ return FALSE;
+ }
+
+ UnicodeString.Length = 0;
+ UnicodeString.MaximumLength = sizeof(FixedBuffer);
+ UnicodeString.Buffer = FixedBuffer;
+ Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, FALSE);
+ if (STATUS_BUFFER_TOO_SMALL == Status)
+ {
+ Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, TRUE);
+ }
+ if (! NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+
+ *StringSid = LocalAlloc(LMEM_FIXED, UnicodeString.Length + sizeof(WCHAR));
+ if (NULL == *StringSid)
+ {
+ if (UnicodeString.Buffer != FixedBuffer)
+ {
+ RtlFreeUnicodeString(&UnicodeString);
+ }
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ MoveMemory(*StringSid, UnicodeString.Buffer, UnicodeString.Length);
+ ZeroMemory((PCHAR) *StringSid + UnicodeString.Length, sizeof(WCHAR));
+ if (UnicodeString.Buffer != FixedBuffer)
+ {
+ RtlFreeUnicodeString(&UnicodeString);
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL STDCALL
+ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
+{
+ LPWSTR StringSidW;
+ int Len;
+
+ if (! ConvertSidToStringSidW(Sid, &StringSidW))
+ {
+ return FALSE;
+ }
+
+ Len = WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, NULL, 0, NULL, NULL);
+ if (Len <= 0)
+ {
+ LocalFree(StringSidW);
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+ *StringSid = LocalAlloc(LMEM_FIXED, Len);
+ if (NULL == *StringSid)
+ {
+ LocalFree(StringSidW);
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ if (! WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, *StringSid, Len, NULL, NULL))
+ {
+ LocalFree(StringSid);
+ LocalFree(StringSidW);
+ return FALSE;
+ }
+
+ LocalFree(StringSidW);
+
+ return TRUE;
+}
+
/* EOF */
CVSspam 0.2.8