From b9c033f3ecaa7e6499c5957ebbd2ba701963282e Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Thu, 5 May 2005 15:39:27 +0000 Subject: [PATCH] - ported BuildTrusteeWithObjectsAndNameA/W and BuildTrusteeWithObjectsAndSidA/W from wine - implemented RegOpenCurrentUser - directly forward GetSecurityDescriptorLength to NTDLL.RtlLengthSecurityDescriptorguard dumping the stack trace to prevent infinite exception loopsguard dumping the stack trace to prevent infinite exception loops svn path=/trunk/; revision=15003 --- reactos/lib/advapi32/advapi32.def | 12 ++--- reactos/lib/advapi32/reg/reg.c | 23 ++++++++++ reactos/lib/advapi32/sec/sec.c | 13 ------ reactos/lib/advapi32/sec/trustee.c | 72 ++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 19 deletions(-) diff --git a/reactos/lib/advapi32/advapi32.def b/reactos/lib/advapi32/advapi32.def index ea60f206513..012977faf0e 100644 --- a/reactos/lib/advapi32/advapi32.def +++ b/reactos/lib/advapi32/advapi32.def @@ -51,10 +51,10 @@ BuildImpersonateTrusteeW@8 ;BuildSecurityDescriptorW@36 BuildTrusteeWithNameA@8 BuildTrusteeWithNameW@8 -;BuildTrusteeWithObjectsAndNameA@24 -;BuildTrusteeWithObjectsAndNameW@24 -;BuildTrusteeWithObjectsAndSidA@20 -;BuildTrusteeWithObjectsAndSidW@20 +BuildTrusteeWithObjectsAndNameA@24 +BuildTrusteeWithObjectsAndNameW@24 +BuildTrusteeWithObjectsAndSidA@20 +BuildTrusteeWithObjectsAndSidW@20 BuildTrusteeWithSidA@8 BuildTrusteeWithSidW@8 ;CancelOverlappedAccess@4 @@ -271,7 +271,7 @@ GetOldestEventLogRecord@8 GetSecurityDescriptorControl@12 GetSecurityDescriptorDacl@16 GetSecurityDescriptorGroup@12 -GetSecurityDescriptorLength@4 +GetSecurityDescriptorLength@4=NTDLL.RtlLengthSecurityDescriptor GetSecurityDescriptorOwner@12 GetSecurityDescriptorRMControl@8 GetSecurityDescriptorSacl@16 @@ -487,7 +487,7 @@ RegGetKeySecurity@16 RegLoadKeyA@12 RegLoadKeyW@12 RegNotifyChangeKeyValue@20 -;RegOpenCurrentUser +RegOpenCurrentUser@8 RegOpenKeyA@12 RegOpenKeyExA@20 RegOpenKeyExW@20 diff --git a/reactos/lib/advapi32/reg/reg.c b/reactos/lib/advapi32/reg/reg.c index c7389356c6f..7391a22b3b2 100644 --- a/reactos/lib/advapi32/reg/reg.c +++ b/reactos/lib/advapi32/reg/reg.c @@ -1633,6 +1633,29 @@ RegNotifyChangeKeyValue (HKEY hKey, } +/************************************************************************ + * RegOpenCurrentUser + * + * @implemented + */ +LONG STDCALL +RegOpenCurrentUser (IN REGSAM samDesired, + OUT PHKEY phkResult) +{ + NTSTATUS Status; + + Status = RtlOpenCurrentUser((ACCESS_MASK)samDesired, + (PHANDLE)phkResult); + if (!NT_SUCCESS(Status)) + { + /* NOTE - don't set the last error code! just return the error! */ + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + + /************************************************************************ * RegOpenKeyA * diff --git a/reactos/lib/advapi32/sec/sec.c b/reactos/lib/advapi32/sec/sec.c index 790a33dc6e3..c672d9a7145 100644 --- a/reactos/lib/advapi32/sec/sec.c +++ b/reactos/lib/advapi32/sec/sec.c @@ -102,19 +102,6 @@ GetSecurityDescriptorGroup ( } -/* - * @implemented - */ -DWORD -STDCALL -GetSecurityDescriptorLength ( - PSECURITY_DESCRIPTOR pSecurityDescriptor - ) -{ - return RtlLengthSecurityDescriptor(pSecurityDescriptor); -} - - /* * @implemented */ diff --git a/reactos/lib/advapi32/sec/trustee.c b/reactos/lib/advapi32/sec/trustee.c index a408d7d71b2..d324a439be8 100644 --- a/reactos/lib/advapi32/sec/trustee.c +++ b/reactos/lib/advapi32/sec/trustee.c @@ -190,6 +190,78 @@ BuildTrusteeWithNameW(PTRUSTEE_W pTrustee, LPWSTR name) } +/****************************************************************************** + * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName, + SE_OBJECT_TYPE ObjectType, LPSTR ObjectTypeName, + LPSTR InheritedObjectTypeName, LPSTR Name) +{ + DPRINT("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_a(Name)); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = Name; +} + + +/****************************************************************************** + * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName, + SE_OBJECT_TYPE ObjectType, LPWSTR ObjectTypeName, + LPWSTR InheritedObjectTypeName, LPWSTR Name) +{ + DPRINT("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_w(Name)); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = Name; +} + + +/****************************************************************************** + * BuildTrusteeWithObjectsAndSidA [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee, POBJECTS_AND_SID pObjSid, + GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) +{ + DPRINT("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPSTR) pSid; +} + + +/****************************************************************************** + * BuildTrusteeWithObjectsAndSidW [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee, POBJECTS_AND_SID pObjSid, + GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) +{ + DPRINT("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPWSTR) pSid; +} + + /****************************************************************************** * GetMultipleTrusteeA [ADVAPI32.@] */