diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec index 159c78cea1..81de479d8c 100644 --- a/dlls/advapi32/advapi32.spec +++ b/dlls/advapi32/advapi32.spec @@ -20,8 +20,8 @@ @ stdcall BackupEventLogW (long wstr) @ stub BuildExplicitAccessWithNameA @ stub BuildExplicitAccessWithNameW -@ stub BuildTrusteeWithNameA # (ptr str) -@ stub BuildTrusteeWithNameW # (ptr wstr) +@ stdcall BuildTrusteeWithNameA(ptr str) +@ stdcall BuildTrusteeWithNameW(ptr wstr) @ stub BuildTrusteeWithObjectsAndNameA # (ptr ptr long str str str) @ stub BuildTrusteeWithObjectsAndNameW # (ptr ptr long wstr wstr wstr) @ stub BuildTrusteeWithObjectsAndSidA # (ptr ptr ptr ptr ptr) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index a1dcf4833f..efa19b9768 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -1519,8 +1519,7 @@ VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid) pTrustee->pMultipleTrustee = NULL; pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->TrusteeForm = TRUSTEE_IS_SID; pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; pTrustee->ptstrName = (LPSTR) pSid; } @@ -1534,12 +1533,39 @@ VOID WINAPI BuildTrusteeWithSidW(PTRUSTEEW pTrustee, PSID pSid) pTrustee->pMultipleTrustee = NULL; pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->TrusteeForm = TRUSTEE_IS_SID; pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; pTrustee->ptstrName = (LPWSTR) pSid; } +/****************************************************************************** + * BuildTrusteeWithNameA [ADVAPI32.@] + */ +VOID WINAPI BuildTrusteeWithNameA(PTRUSTEEA pTrustee, LPSTR name) +{ + TRACE("%p %s\n", pTrustee, debugstr_a(name) ); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = name; +} + +/****************************************************************************** + * BuildTrusteeWithNameW [ADVAPI32.@] + */ +VOID WINAPI BuildTrusteeWithNameW(PTRUSTEEW pTrustee, LPWSTR name) +{ + TRACE("%p %s\n", pTrustee, debugstr_w(name) ); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = name; +} + /****************************************************************************** * SetEntriesInAclA [ADVAPI32.@] */ diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index ff978a15ca..a143fd51d0 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -62,6 +62,7 @@ void test_trustee() TRUSTEE trustee; PSID psid; DWORD r; + LPSTR str = "2jjj"; SID_IDENTIFIER_AUTHORITY auth = { {0x11,0x22,0,0,0, 0} }; @@ -78,8 +79,19 @@ void test_trustee() ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); ok( trustee.ptstrName == (LPSTR) psid, "ptstrName wrong\n" ); FreeSid( psid ); -} + /* test BuildTrusteeWithNameA */ + memset( &trustee, 0xff, sizeof trustee ); + BuildTrusteeWithNameA( &trustee, str ); + + ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n"); + ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE, + "MultipleTrusteeOperation wrong\n"); + ok( trustee.TrusteeForm == TRUSTEE_IS_NAME, "TrusteeForm wrong\n"); + ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); + ok( trustee.ptstrName == str, "ptstrName wrong\n" ); +} + START_TEST(security) { test_sid();