Hi all, I've written a patch which should fix the failing advapi32 cred tests that mirrors the skips in the existing tests:
diff --git a/dlls/advapi32/tests/cred.c b/dlls/advapi32/tests/cred.c index 58103c6..bb6935b 100644 --- a/dlls/advapi32/tests/cred.c +++ b/dlls/advapi32/tests/cred.c @@ -238,7 +238,13 @@ static void test_generic(void) new_cred.UserName = (char *)"winetest";
ret = pCredWriteA(&new_cred, 0); - ok(ret, "CredWriteA failed with error %d\n", GetLastError()); + ok(ret || broken(GetLastError() == ERROR_NO_SUCH_LOGON_SESSION), + "CredWriteA failed with error %d\n", GetLastError()); + if (!ret) + { + skip("couldn't write generic credentials, skipping tests\n"); + return; + }
ret = pCredEnumerateA(NULL, 0, &count, &creds); ok(ret, "CredEnumerateA failed with error %d\n", GetLastError());
I'm wondering whether a better patch would be to change the persist type from CRED_PERSIST_ENTERPRISE to CRED_PERSIST_LOCAL_MACHINE. Rob, this is particularly aimed at you since you wrote the original tests: is there a good reason to use CRED_PERSIST_ENTERPRISE here? --Juan
2009/2/13 Juan Lang juan.lang@gmail.com:
Hi all, I've written a patch which should fix the failing advapi32 cred tests that mirrors the skips in the existing tests:
diff --git a/dlls/advapi32/tests/cred.c b/dlls/advapi32/tests/cred.c index 58103c6..bb6935b 100644 --- a/dlls/advapi32/tests/cred.c +++ b/dlls/advapi32/tests/cred.c @@ -238,7 +238,13 @@ static void test_generic(void) new_cred.UserName = (char *)"winetest";
ret = pCredWriteA(&new_cred, 0);
- ok(ret, "CredWriteA failed with error %d\n", GetLastError());
ok(ret || broken(GetLastError() == ERROR_NO_SUCH_LOGON_SESSION),
"CredWriteA failed with error %d\n", GetLastError());
if (!ret)
{
skip("couldn't write generic credentials, skipping tests\n");
return;
}
ret = pCredEnumerateA(NULL, 0, &count, &creds); ok(ret, "CredEnumerateA failed with error %d\n", GetLastError());
I'm wondering whether a better patch would be to change the persist type from CRED_PERSIST_ENTERPRISE to CRED_PERSIST_LOCAL_MACHINE. Rob, this is particularly aimed at you since you wrote the original tests: is there a good reason to use CRED_PERSIST_ENTERPRISE here?
No, CRED_PERSIST_LOCAL_MACHINE should be fine but does this change make any difference? I believe the ERROR_NO_SUCH_LOGON_SESSION is returned when the tests are being run as a user that doesn't have a profile, and therefore the credentials manager doesn't have anywhere to store the credentials. Changing the persist type shouldn't affect this, so I don't see why it would make these calls start working.
No, CRED_PERSIST_LOCAL_MACHINE should be fine but does this change make any difference? I believe the ERROR_NO_SUCH_LOGON_SESSION is returned when the tests are being run as a user that doesn't have a profile, and therefore the credentials manager doesn't have anywhere to store the credentials. Changing the persist type shouldn't affect this, so I don't see why it would make these calls start working.
I don't know whether it would make a difference, I don't see the failures myself. I just see a fairly consistent pattern of failure, and reading MSDN made me suppose that a different persist type might make a difference.
Never mind, I'll send the patch as-is then. Thanks for the feedback. --Juan