advapi32/tests: Don't test function directly when reporting GetLastError().

This commit is contained in:
André Hentschel 2010-12-30 19:31:54 +01:00 committed by Alexandre Julliard
parent 145031b8d4
commit 92f9cb6c5d
3 changed files with 19 additions and 16 deletions

View file

@ -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);

View file

@ -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"

View file

@ -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);