From 985646f07aeaf6c70f37bfb7cc9c78cc220d97bc Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 16 Aug 2004 21:07:50 +0000 Subject: [PATCH] Declaration, implemention and test for BuildTrusteeWithSid. --- dlls/advapi32/security.c | 18 ++++++++++++++++-- dlls/advapi32/tests/security.c | 26 ++++++++++++++++++++++++++ include/aclapi.h | 4 ++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index c6747af239d..db37bed8da4 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -1486,7 +1486,14 @@ DWORD WINAPI GetSecurityInfoExW( */ VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid) { - FIXME("%p %p\n", pTrustee, pSid); + TRACE("%p %p\n", pTrustee, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPSTR) pSid; } /****************************************************************************** @@ -1494,7 +1501,14 @@ VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid) */ VOID WINAPI BuildTrusteeWithSidW(PTRUSTEEW pTrustee, PSID pSid) { - FIXME("%p %p\n", pTrustee, pSid); + TRACE("%p %p\n", pTrustee, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPWSTR) pSid; } /****************************************************************************** diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 217e2b500ad..ff978a15cae 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -24,6 +24,7 @@ #include "windef.h" #include "winbase.h" #include "winerror.h" +#include "aclapi.h" typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str ); typedef BOOL (WINAPI *fnConvertSidToStringSidW)( PSID pSid, LPWSTR *str ); @@ -53,9 +54,34 @@ void test_sid() ok( r, "failed to convert sid\n" ); ok( !lstrcmpW( str, refstr ), "incorrect sid\n" ); LocalFree( str ); + FreeSid( psid ); +} + +void test_trustee() +{ + TRUSTEE trustee; + PSID psid; + DWORD r; + + SID_IDENTIFIER_AUTHORITY auth = { {0x11,0x22,0,0,0, 0} }; + + r = AllocateAndInitializeSid( &auth, 1, 42, 0,0,0,0,0,0,0,&psid ); + ok( r, "failed to init SID\n" ); + + memset( &trustee, 0xff, sizeof trustee ); + BuildTrusteeWithSidA( &trustee, psid ); + + ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n"); + ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE, + "MultipleTrusteeOperation wrong\n"); + ok( trustee.TrusteeForm == TRUSTEE_IS_SID, "TrusteeForm wrong\n"); + ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); + ok( trustee.ptstrName == (LPSTR) psid, "ptstrName wrong\n" ); + FreeSid( psid ); } START_TEST(security) { test_sid(); + test_trustee(); } diff --git a/include/aclapi.h b/include/aclapi.h index 1f6a26bb9bf..0853426fbd8 100644 --- a/include/aclapi.h +++ b/include/aclapi.h @@ -72,6 +72,10 @@ void BuildTrusteeWithObjectsAndSidW( PTRUSTEEW, POBJECTS_AND_SID, GUID*, GUID*, PSID ); #define BuildTrusteeWithObjectsAndSid WINELIB_NAME_AW(BuildTrusteeWithObjectsAndSid) +VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid); +VOID WINAPI BuildTrusteeWithSidW(PTRUSTEEW pTrustee, PSID pSid); +#define BuildTrusteeWithSid WINELIB_NAME_AW(BuildTrusteeWithSid) + #ifdef __cplusplus } #endif