Commit db8cce3f authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

wintrust/tests: Make the catalog properties test a bit more flexible.

parent 39361dea
...@@ -551,7 +551,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void) ...@@ -551,7 +551,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
DeleteFileA(tmpfile); DeleteFileA(tmpfile);
} }
static void test_catalog_properties(void) static void test_catalog_properties(int members, int attributes)
{ {
static const WCHAR hashmeW[] = {'h','a','s','h','m','e',0}; static const WCHAR hashmeW[] = {'h','a','s','h','m','e',0};
static const WCHAR attr1W[] = {'a','t','t','r','1',0}; static const WCHAR attr1W[] = {'a','t','t','r','1',0};
...@@ -566,7 +566,7 @@ static void test_catalog_properties(void) ...@@ -566,7 +566,7 @@ static void test_catalog_properties(void)
DWORD written; DWORD written;
HANDLE file; HANDLE file;
BOOL ret; BOOL ret;
int attrcount = 0; int attrcount = 0, membercount = 0;
if (!GetTempFileNameA(CURR_DIR, "cat", 0, catalog)) return; if (!GetTempFileNameA(CURR_DIR, "cat", 0, catalog)) return;
file = CreateFileA(catalog, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); file = CreateFileA(catalog, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
...@@ -585,16 +585,23 @@ static void test_catalog_properties(void) ...@@ -585,16 +585,23 @@ static void test_catalog_properties(void)
m = pCryptCATEnumerateMember(NULL, NULL); m = pCryptCATEnumerateMember(NULL, NULL);
ok(m == NULL, "CryptCATEnumerateMember succeeded\n"); ok(m == NULL, "CryptCATEnumerateMember succeeded\n");
m = pCryptCATEnumerateMember(hcat, NULL); m = NULL;
ok(m != NULL, "CryptCATEnumerateMember failed %u\n", GetLastError()); while ((m = pCryptCATEnumerateMember(hcat, m)))
{
ok(m->cbStruct == sizeof(CRYPTCATMEMBER), "unexpected size %u\n", m->cbStruct); ok(m->cbStruct == sizeof(CRYPTCATMEMBER), "unexpected size %u\n", m->cbStruct);
todo_wine ok(!lstrcmpW(m->pwszReferenceTag, hashmeW), "unexpected tag\n"); todo_wine ok(!lstrcmpW(m->pwszReferenceTag, hashmeW), "unexpected tag\n");
ok(!memcmp(&m->gSubjectType, &subject, sizeof(subject)), "guid differs\n"); ok(!memcmp(&m->gSubjectType, &subject, sizeof(subject)), "guid differs\n");
ok(!m->fdwMemberFlags, "got %x expected 0\n", m->fdwMemberFlags); ok(!m->fdwMemberFlags, "got %x expected 0\n", m->fdwMemberFlags);
ok(m->dwCertVersion == 0x200, "got %x expected 0x200\n", m->dwCertVersion); ok(m->dwCertVersion == 0x200, "got %x expected 0x200\n", m->dwCertVersion);
ok(!m->dwReserved, "got %x expected 0\n", m->dwReserved); ok(!m->dwReserved, "got %x expected 0\n", m->dwReserved);
ok(m->hReserved == NULL, "got %p expected NULL\n", m->hReserved); ok(m->hReserved == NULL, "got %p expected NULL\n", m->hReserved);
attr = pCryptCATEnumerateAttr(hcat, m, NULL);
ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n");
membercount++;
}
ok(membercount == members, "Expected %d member, got %d\n", members, membercount);
attr = pCryptCATEnumerateAttr(NULL, NULL, NULL); attr = pCryptCATEnumerateAttr(NULL, NULL, NULL);
ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n"); ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n");
...@@ -602,12 +609,6 @@ static void test_catalog_properties(void) ...@@ -602,12 +609,6 @@ static void test_catalog_properties(void)
attr = pCryptCATEnumerateAttr(hcat, NULL, NULL); attr = pCryptCATEnumerateAttr(hcat, NULL, NULL);
ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n"); ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n");
attr = pCryptCATEnumerateAttr(hcat, m, NULL);
ok(attr == NULL, "CryptCATEnumerateAttr succeeded\n");
m = pCryptCATEnumerateMember(hcat, m);
ok(m == NULL, "CryptCATEnumerateMember succeeded\n");
attr = NULL; attr = NULL;
while ((attr = pCryptCATEnumerateCatAttr(hcat, attr))) while ((attr = pCryptCATEnumerateCatAttr(hcat, attr)))
{ {
...@@ -618,7 +619,7 @@ static void test_catalog_properties(void) ...@@ -618,7 +619,7 @@ static void test_catalog_properties(void)
attrcount++; attrcount++;
} }
todo_wine todo_wine
ok(attrcount == 2, "Expected 2 catalog attributes, got %d\n", attrcount); ok(attrcount == attributes, "Expected %d catalog attributes, got %d\n", attributes, attrcount);
ret = pCryptCATClose(hcat); ret = pCryptCATClose(hcat);
ok(ret, "CryptCATClose failed\n"); ok(ret, "CryptCATClose failed\n");
...@@ -656,5 +657,5 @@ START_TEST(crypt) ...@@ -656,5 +657,5 @@ START_TEST(crypt)
/* Parameter checking only */ /* Parameter checking only */
test_CryptCATCDF_params(); test_CryptCATCDF_params();
test_CryptCATAdminAddRemoveCatalog(); test_CryptCATAdminAddRemoveCatalog();
test_catalog_properties(); test_catalog_properties(1, 2);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment