mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
implemented SetEntriesInAclA/W and forward the call to the MARTA provider
svn path=/trunk/; revision=16806
This commit is contained in:
parent
0acd7d503b
commit
a3b5b6b8a8
6 changed files with 243 additions and 74 deletions
|
@ -550,8 +550,8 @@ RevertToSelf@0
|
|||
SetAclInformation@16
|
||||
;SetEntriesInAccessListA
|
||||
;SetEntriesInAccessListW
|
||||
;SetEntriesInAclA@16
|
||||
;SetEntriesInAclW@16
|
||||
SetEntriesInAclA@16
|
||||
SetEntriesInAclW@16
|
||||
;SetEntriesInAuditListA
|
||||
;SetEntriesInAuditListW
|
||||
SetFileSecurityA@12
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -495,4 +495,147 @@ FreeInheritedFromArray (
|
|||
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 */
|
||||
|
|
|
@ -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 @@ LoadAndInitializeNtMarta(VOID)
|
|||
FindNtMartaProc(RewriteSetNamedRights);
|
||||
FindNtMartaProc(RewriteGetHandleRights);
|
||||
FindNtMartaProc(RewriteSetHandleRights);
|
||||
#if 0
|
||||
FindNtMartaProc(RewriteSetEntriesInAcl);
|
||||
#if 0
|
||||
FindNtMartaProc(RewriteGetExplicitEntriesFromAcl);
|
||||
FindNtMartaProc(TreeResetNamedSecurityInfo);
|
||||
FindNtMartaProc(GetInheritanceSource);
|
||||
|
@ -137,7 +69,7 @@ LoadAndInitializeNtMarta(VOID)
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static DWORD
|
||||
DWORD
|
||||
CheckNtMartaPresent(VOID)
|
||||
{
|
||||
DWORD ErrorCode;
|
||||
|
|
|
@ -105,6 +105,22 @@ AccRewriteSetNamedRights(LPWSTR pObjectName,
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* 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,
|
||||
|
|
|
@ -7,7 +7,7 @@ EXPORTS
|
|||
;AccRewriteGetExplicitEntriesFromAcl
|
||||
AccRewriteGetHandleRights@32
|
||||
AccRewriteGetNamedRights@32
|
||||
;AccRewriteSetEntriesInAcl
|
||||
AccRewriteSetEntriesInAcl@16
|
||||
AccRewriteSetHandleRights@16
|
||||
AccRewriteSetNamedRights@16
|
||||
;AccTreeResetNamedSecurityInfo
|
||||
|
|
Loading…
Reference in a new issue