From 92f9cb6c5db52423f5fdc435486ddc232a85bcb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Thu, 30 Dec 2010 19:31:54 +0100 Subject: [PATCH] advapi32/tests: Don't test function directly when reporting GetLastError(). --- dlls/advapi32/tests/cred.c | 8 ++++---- dlls/advapi32/tests/security.c | 20 +++++++++++--------- dlls/advapi32/tests/service.c | 7 ++++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/dlls/advapi32/tests/cred.c b/dlls/advapi32/tests/cred.c index fbefa92ca2f..4d4e6c8c1b9 100644 --- a/dlls/advapi32/tests/cred.c +++ b/dlls/advapi32/tests/cred.c @@ -156,10 +156,10 @@ static void test_CredReadDomainCredentialsA(void) * does not check for NULL output pointers and try to zero them out early */ if(0) { - ok(!pCredReadDomainCredentialsA(&info, 0, NULL, &creds) && - GetLastError() == ERROR_INVALID_PARAMETER, "!\n"); - ok(!pCredReadDomainCredentialsA(&info, 0, &count, NULL) && - GetLastError() == ERROR_INVALID_PARAMETER, "!\n"); + ret = pCredReadDomainCredentialsA(&info, 0, NULL, &creds); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "!\n"); + ret = pCredReadDomainCredentialsA(&info, 0, &count, NULL); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "!\n"); } SetLastError(0xdeadbeef); diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 4d8c8cff591..ff07513f9fe 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -2293,8 +2293,8 @@ static void test_process_security(void) psa.bInheritHandle = TRUE; /* Doesn't matter what ACL say we should get full access for ourselves */ - ok(CreateProcessA( NULL, buffer, &psa, NULL, FALSE, 0, NULL, NULL, &startup, &info ), - "CreateProcess with err:%d\n", GetLastError()); + res = CreateProcessA( NULL, buffer, &psa, NULL, FALSE, 0, NULL, NULL, &startup, &info ); + ok(res, "CreateProcess with err:%d\n", GetLastError()); TEST_GRANTED_ACCESS2( info.hProcess, PROCESS_ALL_ACCESS, STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL ); winetest_wait_child_process( info.hProcess ); @@ -3008,6 +3008,7 @@ static void test_PrivateObjectSecurity(void) LPSTR string; ULONG len; PSECURITY_DESCRIPTOR buf; + BOOL ret; if (!pConvertStringSecurityDescriptorToSecurityDescriptorA) { @@ -3046,25 +3047,26 @@ static void test_PrivateObjectSecurity(void) GetSecurityDescriptorControl(sec, &ctrl, &dwRevision); expect_eq(ctrl, 0x9014, int, "%x"); - ok(GetPrivateObjectSecurity(sec, GROUP_SECURITY_INFORMATION, buf, dwDescSize, &retSize), - "GetPrivateObjectSecurity failed (err=%u)\n", GetLastError()); + ret = GetPrivateObjectSecurity(sec, GROUP_SECURITY_INFORMATION, buf, dwDescSize, &retSize); + ok(ret, "GetPrivateObjectSecurity failed (err=%u)\n", GetLastError()); ok(retSize <= dwDescSize, "Buffer too small (%d vs %d)\n", retSize, dwDescSize); ok(pConvertSecurityDescriptorToStringSecurityDescriptorA(buf, SDDL_REVISION_1, sec_info, &string, &len), "Conversion failed\n"); CHECK_RESULT_AND_FREE("G:S-1-5-21-93476-23408-4576"); GetSecurityDescriptorControl(buf, &ctrl, &dwRevision); expect_eq(ctrl, 0x8000, int, "%x"); - ok(GetPrivateObjectSecurity(sec, GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION, buf, dwDescSize, &retSize), - "GetPrivateObjectSecurity failed (err=%u)\n", GetLastError()); + ret = GetPrivateObjectSecurity(sec, GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION, buf, dwDescSize, &retSize); + ok(ret, "GetPrivateObjectSecurity failed (err=%u)\n", GetLastError()); ok(retSize <= dwDescSize, "Buffer too small (%d vs %d)\n", retSize, dwDescSize); - ok(pConvertSecurityDescriptorToStringSecurityDescriptorA(buf, SDDL_REVISION_1, sec_info, &string, &len), "Conversion failed err=%u\n", GetLastError()); + ret = pConvertSecurityDescriptorToStringSecurityDescriptorA(buf, SDDL_REVISION_1, sec_info, &string, &len); + ok(ret, "Conversion failed err=%u\n", GetLastError()); CHECK_ONE_OF_AND_FREE("G:S-1-5-21-93476-23408-4576D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)", "G:S-1-5-21-93476-23408-4576D:P(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)"); /* Win7 */ GetSecurityDescriptorControl(buf, &ctrl, &dwRevision); expect_eq(ctrl & (~ SE_DACL_PROTECTED), 0x8004, int, "%x"); - ok(GetPrivateObjectSecurity(sec, sec_info, buf, dwDescSize, &retSize), - "GetPrivateObjectSecurity failed (err=%u)\n", GetLastError()); + ret = GetPrivateObjectSecurity(sec, sec_info, buf, dwDescSize, &retSize); + ok(ret, "GetPrivateObjectSecurity failed (err=%u)\n", GetLastError()); ok(retSize == dwDescSize, "Buffer too small (%d vs %d)\n", retSize, dwDescSize); ok(pConvertSecurityDescriptorToStringSecurityDescriptorA(buf, SDDL_REVISION_1, sec_info, &string, &len), "Conversion failed\n"); CHECK_ONE_OF_AND_FREE("O:SY" diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c index 4605ffda4b4..5bacb1bde43 100644 --- a/dlls/advapi32/tests/service.c +++ b/dlls/advapi32/tests/service.c @@ -1840,9 +1840,10 @@ static void test_sequence(void) } ok(!strcmp(config->lpServiceStartName, localsystem), "Expected 'LocalSystem', got '%s'\n", config->lpServiceStartName); ok(!strcmp(config->lpDisplayName, displayname), "Expected '%s', got '%s'\n", displayname, config->lpDisplayName); - - ok(ChangeServiceConfigA(svc_handle, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, SERVICE_ERROR_NORMAL, NULL, "TestGroup2", NULL, NULL, NULL, NULL, displayname2), - "ChangeServiceConfig failed (err=%d)\n", GetLastError()); + + ret = ChangeServiceConfigA(svc_handle, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, SERVICE_ERROR_NORMAL, NULL, "TestGroup2", + NULL, NULL, NULL, NULL, displayname2); + ok(ret, "ChangeServiceConfig failed (err=%d)\n", GetLastError()); QueryServiceConfigA(svc_handle, NULL, 0, &needed); config = HeapReAlloc(GetProcessHeap(), 0, config, needed);