implemented SetEntriesInAclA/W and forward the call to the MARTA
provider
Modified: trunk/reactos/lib/advapi32/advapi32.def
Modified: trunk/reactos/lib/advapi32/advapi32.h
Modified: trunk/reactos/lib/advapi32/sec/ac.c
Modified: trunk/reactos/lib/advapi32/sec/misc.c
Modified: trunk/reactos/lib/ntmarta/ntmarta.c
Modified: trunk/reactos/lib/ntmarta/ntmarta.def
_____
Modified: trunk/reactos/lib/advapi32/advapi32.def
--- trunk/reactos/lib/advapi32/advapi32.def 2005-07-27 17:06:06 UTC
(rev 16805)
+++ trunk/reactos/lib/advapi32/advapi32.def 2005-07-27 17:20:57 UTC
(rev 16806)
@@ -550,8 +550,8 @@
SetAclInformation@16
;SetEntriesInAccessListA
;SetEntriesInAccessListW
-;SetEntriesInAclA@16
-;SetEntriesInAclW@16
+SetEntriesInAclA@16
+SetEntriesInAclW@16
;SetEntriesInAuditListA
;SetEntriesInAuditListW
SetFileSecurityA@12
_____
Modified: trunk/reactos/lib/advapi32/advapi32.h
--- trunk/reactos/lib/advapi32/advapi32.h 2005-07-27 17:06:06 UTC
(rev 16805)
+++ trunk/reactos/lib/advapi32/advapi32.h 2005-07-27 17:20:57 UTC
(rev 16806)
@@ -18,4 +18,82 @@
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
+/* Interface to ntmarta.dll
**************************************************/
+
+typedef struct _NTMARTA
+{
+ HINSTANCE hDllInstance;
+
+ PVOID LookupAccountTrustee;
+ PVOID LookupAccountName;
+ PVOID LookupAccountSid;
+ PVOID SetEntriesInAList;
+ PVOID ConvertAccessToSecurityDescriptor;
+ PVOID ConvertSDToAccess;
+ PVOID ConvertAclToAccess;
+ PVOID GetAccessForTrustee;
+ PVOID GetExplicitEntries;
+
+ DWORD (STDCALL *RewriteGetNamedRights)(LPWSTR pObjectName,
+ SE_OBJECT_TYPE ObjectType,
+ SECURITY_INFORMATION
SecurityInfo,
+ PSID* ppsidOwner,
+ PSID* ppsidGroup,
+ PACL* ppDacl,
+ PACL* ppSacl,
+ PSECURITY_DESCRIPTOR*
ppSecurityDescriptor);
+
+ DWORD (STDCALL *RewriteSetNamedRights)(LPWSTR pObjectName,
+ SE_OBJECT_TYPE ObjectType,
+ SECURITY_INFORMATION
SecurityInfo,
+ PSECURITY_DESCRIPTOR
pSecurityDescriptor);
+
+ DWORD (STDCALL *RewriteGetHandleRights)(HANDLE handle,
+ SE_OBJECT_TYPE ObjectType,
+ SECURITY_INFORMATION
SecurityInfo,
+ PSID* ppsidOwner,
+ PSID* ppsidGroup,
+ PACL* ppDacl,
+ PACL* ppSacl,
+ PSECURITY_DESCRIPTOR*
ppSecurityDescriptor);
+
+ DWORD (STDCALL *RewriteSetHandleRights)(HANDLE handle,
+ SE_OBJECT_TYPE ObjectType,
+ SECURITY_INFORMATION
SecurityInfo,
+ PSECURITY_DESCRIPTOR
pSecurityDescriptor);
+
+ DWORD (STDCALL *RewriteSetEntriesInAcl)(ULONG
cCountOfExplicitEntries,
+ PEXPLICIT_ACCESS_W
pListOfExplicitEntries,
+ PACL OldAcl,
+ PACL* NewAcl);
+
+ PVOID RewriteGetExplicitEntriesFromAcl;
+ PVOID TreeResetNamedSecurityInfo;
+ PVOID GetInheritanceSource;
+ PVOID FreeIndexArray;
+} NTMARTA, *PNTMARTA;
+
+#define AccLookupAccountTrustee NtMartaStatic.LookupAccountTrustee
+#define AccLookupAccountName NtMartaStatic.LookupAccountName
+#define AccLookupAccountSid NtMartaStatic.LookupAccountSid
+#define AccSetEntriesInAList NtMartaStatic.SetEntriesInAList
+#define AccConvertAccessToSecurityDescriptor
NtMartaStatic.ConvertAccessToSecurityDescriptor
+#define AccConvertSDToAccess NtMartaStatic.ConvertSDToAccess
+#define AccConvertAclToAccess NtMartaStatic.ConvertAclToAccess
+#define AccGetAccessForTrustee NtMartaStatic.GetAccessForTrustee
+#define AccGetExplicitEntries NtMartaStatic.GetExplicitEntries
+#define AccRewriteGetNamedRights NtMartaStatic.RewriteGetNamedRights
+#define AccRewriteSetNamedRights NtMartaStatic.RewriteSetNamedRights
+#define AccRewriteGetHandleRights NtMartaStatic.RewriteGetHandleRights
+#define AccRewriteSetHandleRights NtMartaStatic.RewriteSetHandleRights
+#define AccRewriteSetEntriesInAcl NtMartaStatic.RewriteSetEntriesInAcl
+#define AccRewriteGetExplicitEntriesFromAcl
NtMartaStatic.RewriteGetExplicitEntriesFromAcl
+#define AccTreeResetNamedSecurityInfo
NtMartaStatic.TreeResetNamedSecurityInfo
+#define AccGetInheritanceSource NtMartaStatic.GetInheritanceSource
+#define AccFreeIndexArray NtMartaStatic.FreeIndexArray
+
+extern NTMARTA NtMartaStatic;
+
+DWORD CheckNtMartaPresent(VOID);
+
/* EOF */
_____
Modified: trunk/reactos/lib/advapi32/sec/ac.c
--- trunk/reactos/lib/advapi32/sec/ac.c 2005-07-27 17:06:06 UTC (rev
16805)
+++ trunk/reactos/lib/advapi32/sec/ac.c 2005-07-27 17:20:57 UTC (rev
16806)
@@ -495,4 +495,147 @@
return ERROR_CALL_NOT_IMPLEMENTED;
}
+
+/*
+ * @implemented
+ */
+DWORD
+STDCALL
+SetEntriesInAclW(
+ ULONG cCountOfExplicitEntries,
+ PEXPLICIT_ACCESS_W pListOfExplicitEntries,
+ PACL OldAcl,
+ PACL* NewAcl)
+{
+ DWORD ErrorCode;
+
+ ErrorCode = CheckNtMartaPresent();
+ if (ErrorCode == ERROR_SUCCESS)
+ {
+ /* call the MARTA provider */
+ ErrorCode = AccRewriteSetEntriesInAcl(cCountOfExplicitEntries,
+ pListOfExplicitEntries,
+ OldAcl,
+ NewAcl);
+ }
+
+ return ErrorCode;
+}
+
+
+/*
+ * @implemented
+ */
+DWORD
+STDCALL
+SetEntriesInAclA(
+ ULONG cCountOfExplicitEntries,
+ PEXPLICIT_ACCESS_A pListOfExplicitEntries,
+ PACL OldAcl,
+ PACL* NewAcl)
+{
+ PEXPLICIT_ACCESS_W ListOfExplicitEntriesW;
+ ULONG i;
+ DWORD ErrorCode;
+
+ if (cCountOfExplicitEntries != 0)
+ {
+ ListOfExplicitEntriesW = HeapAlloc(GetProcessHeap(),
+ 0,
+ cCountOfExplicitEntries *
sizeof(EXPLICIT_ACCESS_W));
+ if (ListOfExplicitEntriesW != NULL)
+ {
+ /* directly copy the array, this works as the size of the
EXPLICIT_ACCESS_A
+ structure matches the size of the EXPLICIT_ACCESS_W
version */
+ ASSERT(sizeof(EXPLICIT_ACCESS_A) ==
sizeof(EXPLICIT_ACCESS_W));
+
+ RtlCopyMemory(ListOfExplicitEntriesW,
+ pListOfExplicitEntries,
+ cCountOfExplicitEntries *
sizeof(EXPLICIT_ACCESS_W));
+
+ /* convert the trustee names if required */
+ for (i = 0; i != cCountOfExplicitEntries; i++)
+ {
+ if (pListOfExplicitEntries[i].Trustee.TrusteeForm ==
TRUSTEE_IS_NAME)
+ {
+ UINT BufCount =
strlen(pListOfExplicitEntries[i].Trustee.ptstrName) + 1;
+ ListOfExplicitEntriesW[i].Trustee.ptstrName =
+ (LPWSTR)HeapAlloc(GetProcessHeap(),
+ 0,
+ BufCount * sizeof(WCHAR));
+
+ if (ListOfExplicitEntriesW[i].Trustee.ptstrName ==
NULL ||
+ MultiByteToWideChar(CP_ACP,
+ 0,
+
pListOfExplicitEntries[i].Trustee.ptstrName,
+ -1,
+
ListOfExplicitEntriesW[i].Trustee.ptstrName,
+ BufCount) == 0)
+ {
+ /* failed to allocate enough momory for the
strings or failed to
+ convert the ansi string to unicode, then
fail and free all
+ allocated memory */
+
+ ErrorCode = GetLastError();
+
+ while (i != 0)
+ {
+ if
(ListOfExplicitEntriesW[i].Trustee.TrusteeForm == TRUSTEE_IS_NAME &&
+
ListOfExplicitEntriesW[i].Trustee.ptstrName != NULL)
+ {
+ HeapFree(GetProcessHeap(),
+ 0,
+
ListOfExplicitEntriesW[i].Trustee.ptstrName);
+ }
+
+ i--;
+ }
+
+ /* free the allocated array */
+ HeapFree(GetProcessHeap(),
+ 0,
+ ListOfExplicitEntriesW);
+
+ return ErrorCode;
+ }
+ }
+ }
+ }
+ else
+ {
+ return GetLastError();
+ }
+ }
+ else
+ ListOfExplicitEntriesW = NULL;
+
+ ErrorCode = SetEntriesInAclW(cCountOfExplicitEntries,
+ ListOfExplicitEntriesW,
+ OldAcl,
+ NewAcl);
+
+ /* free the strings */
+ if (ListOfExplicitEntriesW != NULL)
+ {
+ /* free the converted strings */
+ for (i = 0; i != cCountOfExplicitEntries; i++)
+ {
+ if (ListOfExplicitEntriesW[i].Trustee.TrusteeForm ==
TRUSTEE_IS_NAME)
+ {
+ HeapFree(GetProcessHeap(),
+ 0,
+ ListOfExplicitEntriesW[i].Trustee.ptstrName);
+ }
+ }
+
+ /* free the allocated array */
+ HeapFree(GetProcessHeap(),
+ 0,
+ ListOfExplicitEntriesW);
+ }
+
+ return ErrorCode;
+}
+
+
/* EOF */
_____
Modified: trunk/reactos/lib/advapi32/sec/misc.c
--- trunk/reactos/lib/advapi32/sec/misc.c 2005-07-27 17:06:06 UTC
(rev 16805)
+++ trunk/reactos/lib/advapi32/sec/misc.c 2005-07-27 17:20:57 UTC
(rev 16806)
@@ -15,77 +15,9 @@
/* Interface to ntmarta.dll
***************************************************/
-typedef struct _NTMARTA
-{
- HINSTANCE hDllInstance;
-
- PVOID LookupAccountTrustee;
- PVOID LookupAccountName;
- PVOID LookupAccountSid;
- PVOID SetEntriesInAList;
- PVOID ConvertAccessToSecurityDescriptor;
- PVOID ConvertSDToAccess;
- PVOID ConvertAclToAccess;
- PVOID GetAccessForTrustee;
- PVOID GetExplicitEntries;
-
- DWORD (STDCALL *RewriteGetNamedRights)(LPWSTR pObjectName,
- SE_OBJECT_TYPE ObjectType,
- SECURITY_INFORMATION
SecurityInfo,
- PSID* ppsidOwner,
- PSID* ppsidGroup,
- PACL* ppDacl,
- PACL* ppSacl,
- PSECURITY_DESCRIPTOR*
ppSecurityDescriptor);
-
- DWORD (STDCALL *RewriteSetNamedRights)(LPWSTR pObjectName,
- SE_OBJECT_TYPE ObjectType,
- SECURITY_INFORMATION
SecurityInfo,
- PSECURITY_DESCRIPTOR
pSecurityDescriptor);
-
- DWORD (STDCALL *RewriteGetHandleRights)(HANDLE handle,
- SE_OBJECT_TYPE ObjectType,
- SECURITY_INFORMATION
SecurityInfo,
- PSID* ppsidOwner,
- PSID* ppsidGroup,
- PACL* ppDacl,
- PACL* ppSacl,
- PSECURITY_DESCRIPTOR*
ppSecurityDescriptor);
-
- DWORD (STDCALL *RewriteSetHandleRights)(HANDLE handle,
- SE_OBJECT_TYPE ObjectType,
- SECURITY_INFORMATION
SecurityInfo,
- PSECURITY_DESCRIPTOR
pSecurityDescriptor);
-
- PVOID RewriteSetEntriesInAcl;
- PVOID RewriteGetExplicitEntriesFromAcl;
- PVOID TreeResetNamedSecurityInfo;
- PVOID GetInheritanceSource;
- PVOID FreeIndexArray;
-} NTMARTA, *PNTMARTA;
-
-static NTMARTA NtMartaStatic = { 0 };
+NTMARTA NtMartaStatic = { 0 };
static PNTMARTA NtMarta = NULL;
-#define AccLookupAccountTrustee NtMartaStatic.LookupAccountTrustee
-#define AccLookupAccountName NtMartaStatic.LookupAccountName
-#define AccLookupAccountSid NtMartaStatic.LookupAccountSid
-#define AccSetEntriesInAList NtMartaStatic.SetEntriesInAList
-#define AccConvertAccessToSecurityDescriptor
NtMartaStatic.ConvertAccessToSecurityDescriptor
-#define AccConvertSDToAccess NtMartaStatic.ConvertSDToAccess
-#define AccConvertAclToAccess NtMartaStatic.ConvertAclToAccess
-#define AccGetAccessForTrustee NtMartaStatic.GetAccessForTrustee
-#define AccGetExplicitEntries NtMartaStatic.GetExplicitEntries
-#define AccRewriteGetNamedRights NtMartaStatic.RewriteGetNamedRights
-#define AccRewriteSetNamedRights NtMartaStatic.RewriteSetNamedRights
-#define AccRewriteGetHandleRights NtMartaStatic.RewriteGetHandleRights
-#define AccRewriteSetHandleRights NtMartaStatic.RewriteSetHandleRights
-#define AccRewriteSetEntriesInAcl NtMartaStatic.RewriteSetEntriesInAcl
-#define AccRewriteGetExplicitEntriesFromAcl
NtMartaStatic.RewriteGetExplicitEntriesFromAcl
-#define AccTreeResetNamedSecurityInfo
NtMartaStatic.TreeResetNamedSecurityInfo
-#define AccGetInheritanceSource NtMartaStatic.GetInheritanceSource
-#define AccFreeIndexArray NtMartaStatic.FreeIndexArray
-
#define FindNtMartaProc(Name)
\
NtMartaStatic.Name =
(PVOID)GetProcAddress(NtMartaStatic.hDllInstance, \
"Acc" # Name );
\
@@ -126,8 +58,8 @@
FindNtMartaProc(RewriteSetNamedRights);
FindNtMartaProc(RewriteGetHandleRights);
FindNtMartaProc(RewriteSetHandleRights);
-#if 0
FindNtMartaProc(RewriteSetEntriesInAcl);
+#if 0
FindNtMartaProc(RewriteGetExplicitEntriesFromAcl);
FindNtMartaProc(TreeResetNamedSecurityInfo);
FindNtMartaProc(GetInheritanceSource);
@@ -137,7 +69,7 @@
return ERROR_SUCCESS;
}
-static DWORD
+DWORD
CheckNtMartaPresent(VOID)
{
DWORD ErrorCode;
_____
Modified: trunk/reactos/lib/ntmarta/ntmarta.c
--- trunk/reactos/lib/ntmarta/ntmarta.c 2005-07-27 17:06:06 UTC (rev
16805)
+++ trunk/reactos/lib/ntmarta/ntmarta.c 2005-07-27 17:20:57 UTC (rev
16806)
@@ -105,6 +105,22 @@
}
+/**********************************************************************
+ * AccRewriteSetEntriesInAcl EXPORTED
+ *
+ * @unimplemented
+ */
+DWORD STDCALL
+AccRewriteSetEntriesInAcl(ULONG cCountOfExplicitEntries,
+ PEXPLICIT_ACCESS_W pListOfExplicitEntries,
+ PACL OldAcl,
+ PACL* NewAcl)
+{
+ UNIMPLEMENTED;
+ return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
BOOL STDCALL
DllMain(IN HINSTANCE hinstDLL,
IN DWORD dwReason,
_____
Modified: trunk/reactos/lib/ntmarta/ntmarta.def
--- trunk/reactos/lib/ntmarta/ntmarta.def 2005-07-27 17:06:06 UTC
(rev 16805)
+++ trunk/reactos/lib/ntmarta/ntmarta.def 2005-07-27 17:20:57 UTC
(rev 16806)
@@ -7,7 +7,7 @@
;AccRewriteGetExplicitEntriesFromAcl
AccRewriteGetHandleRights@32
AccRewriteGetNamedRights@32
-;AccRewriteSetEntriesInAcl
+AccRewriteSetEntriesInAcl@16
AccRewriteSetHandleRights@16
AccRewriteSetNamedRights@16
;AccTreeResetNamedSecurityInfo