=?UTF-8?Q?Michael=20M=C3=BCller=20?=: advapi32: Set last error to ERROR_SUCCESS in GetSidIdentifierAuthority.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Dec 8 11:07:36 CST 2015
Module: wine
Branch: master
Commit: 79636bebbfa510b5f010098f57d422a4a2461e07
URL: http://source.winehq.org/git/wine.git/?a=commit;h=79636bebbfa510b5f010098f57d422a4a2461e07
Author: Michael Müller <michael at fds-team.de>
Date: Tue Dec 8 16:07:44 2015 +0100
advapi32: Set last error to ERROR_SUCCESS in GetSidIdentifierAuthority.
Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/advapi32/security.c | 3 ++-
dlls/advapi32/tests/security.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index c64981e..08f88c0 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -1167,7 +1167,8 @@ GetEffectiveRightsFromAclW( PACL pacl, PTRUSTEEW pTrustee, PACCESS_MASK pAccessR
PSID_IDENTIFIER_AUTHORITY WINAPI
GetSidIdentifierAuthority( PSID pSid )
{
- return RtlIdentifierAuthoritySid(pSid);
+ SetLastError(ERROR_SUCCESS);
+ return RtlIdentifierAuthoritySid(pSid);
}
/******************************************************************************
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index b171a81..c71e6fe 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -132,6 +132,7 @@ static NTSTATUS (WINAPI *pRtlAnsiStringToUnicodeString)(PUNICODE_STRING,PCANSI_S
static BOOL (WINAPI *pGetWindowsAccountDomainSid)(PSID,PSID,DWORD*);
static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ);
static NTSTATUS (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);
+static PSID_IDENTIFIER_AUTHORITY (WINAPI *pGetSidIdentifierAuthority)(PSID);
static HMODULE hmod;
static int myARGC;
@@ -196,6 +197,7 @@ static void init(void)
pGetAclInformation = (void *)GetProcAddress(hmod, "GetAclInformation");
pGetAce = (void *)GetProcAddress(hmod, "GetAce");
pGetWindowsAccountDomainSid = (void *)GetProcAddress(hmod, "GetWindowsAccountDomainSid");
+ pGetSidIdentifierAuthority = (void *)GetProcAddress(hmod, "GetSidIdentifierAuthority");
myARGC = winetest_get_mainargs( &myARGV );
}
@@ -6040,6 +6042,34 @@ static void test_GetWindowsAccountDomainSid(void)
HeapFree(GetProcessHeap(), 0, user);
}
+static void test_GetSidIdentifierAuthority(void)
+{
+ char buffer[SECURITY_MAX_SID_SIZE];
+ PSID authority_sid = (PSID *)buffer;
+ PSID_IDENTIFIER_AUTHORITY id;
+ BOOL ret;
+
+ if (!pGetSidIdentifierAuthority)
+ {
+ win_skip("GetSidIdentifierAuthority not available\n");
+ return;
+ }
+
+ memset(buffer, 0xcc, sizeof(buffer));
+ ret = IsValidSid(authority_sid);
+ ok(!ret, "expected FALSE, got %u\n", ret);
+
+ SetLastError(0xdeadbeef);
+ id = GetSidIdentifierAuthority(authority_sid);
+ ok(id != NULL, "got NULL pointer as identifier authority\n");
+ ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ id = GetSidIdentifierAuthority(NULL);
+ ok(id != NULL, "got NULL pointer as identifier authority\n");
+ ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", GetLastError());
+}
+
START_TEST(security)
{
init();
@@ -6084,4 +6114,5 @@ START_TEST(security)
test_AdjustTokenPrivileges();
test_AddAce();
test_system_security_access();
+ test_GetSidIdentifierAuthority();
}
More information about the wine-cvs
mailing list