Commit 669aa20c authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

wintrust/tests: Add a test for enumerating catalog attributes.

parent 3355f3d6
...@@ -89,6 +89,7 @@ static BOOL (WINAPI * pCryptCATAdminRemoveCatalog)(HCATADMIN, LPCWSTR, DWORD); ...@@ -89,6 +89,7 @@ static BOOL (WINAPI * pCryptCATAdminRemoveCatalog)(HCATADMIN, LPCWSTR, DWORD);
static BOOL (WINAPI * pCryptCATAdminReleaseCatalogContext)(HCATADMIN, HCATINFO, DWORD); static BOOL (WINAPI * pCryptCATAdminReleaseCatalogContext)(HCATADMIN, HCATINFO, DWORD);
static HANDLE (WINAPI * pCryptCATOpen)(LPWSTR, DWORD, HCRYPTPROV, DWORD, DWORD); static HANDLE (WINAPI * pCryptCATOpen)(LPWSTR, DWORD, HCRYPTPROV, DWORD, DWORD);
static BOOL (WINAPI * pCryptCATCatalogInfoFromContext)(HCATINFO, CATALOG_INFO *, DWORD); static BOOL (WINAPI * pCryptCATCatalogInfoFromContext)(HCATINFO, CATALOG_INFO *, DWORD);
static CRYPTCATATTRIBUTE * (WINAPI * pCryptCATEnumerateCatAttr)(HANDLE, CRYPTCATATTRIBUTE *);
static CRYPTCATMEMBER * (WINAPI * pCryptCATEnumerateMember)(HANDLE, CRYPTCATMEMBER *); static CRYPTCATMEMBER * (WINAPI * pCryptCATEnumerateMember)(HANDLE, CRYPTCATMEMBER *);
static CRYPTCATATTRIBUTE * (WINAPI * pCryptCATEnumerateAttr)(HANDLE, CRYPTCATMEMBER *, CRYPTCATATTRIBUTE *); static CRYPTCATATTRIBUTE * (WINAPI * pCryptCATEnumerateAttr)(HANDLE, CRYPTCATMEMBER *, CRYPTCATATTRIBUTE *);
static BOOL (WINAPI * pCryptCATClose)(HANDLE); static BOOL (WINAPI * pCryptCATClose)(HANDLE);
...@@ -111,6 +112,7 @@ static void InitFunctionPtrs(void) ...@@ -111,6 +112,7 @@ static void InitFunctionPtrs(void)
WINTRUST_GET_PROC(CryptCATAdminReleaseCatalogContext) WINTRUST_GET_PROC(CryptCATAdminReleaseCatalogContext)
WINTRUST_GET_PROC(CryptCATOpen) WINTRUST_GET_PROC(CryptCATOpen)
WINTRUST_GET_PROC(CryptCATCatalogInfoFromContext) WINTRUST_GET_PROC(CryptCATCatalogInfoFromContext)
WINTRUST_GET_PROC(CryptCATEnumerateCatAttr)
WINTRUST_GET_PROC(CryptCATEnumerateMember) WINTRUST_GET_PROC(CryptCATEnumerateMember)
WINTRUST_GET_PROC(CryptCATEnumerateAttr) WINTRUST_GET_PROC(CryptCATEnumerateAttr)
WINTRUST_GET_PROC(CryptCATClose) WINTRUST_GET_PROC(CryptCATClose)
...@@ -483,6 +485,8 @@ static void test_CryptCATAdminAddRemoveCatalog(void) ...@@ -483,6 +485,8 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
static void test_catalog_properties(void) static void test_catalog_properties(void)
{ {
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 attr2W[] = {'a','t','t','r','2',0};
static const GUID subject = {0xde351a42,0x8e59,0x11d0,{0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee}}; static const GUID subject = {0xde351a42,0x8e59,0x11d0,{0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee}};
HANDLE hcat; HANDLE hcat;
...@@ -493,6 +497,7 @@ static void test_catalog_properties(void) ...@@ -493,6 +497,7 @@ static void test_catalog_properties(void)
DWORD written; DWORD written;
HANDLE file; HANDLE file;
BOOL ret; BOOL ret;
int attrcount = 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);
...@@ -534,6 +539,18 @@ static void test_catalog_properties(void) ...@@ -534,6 +539,18 @@ static void test_catalog_properties(void)
m = pCryptCATEnumerateMember(hcat, m); m = pCryptCATEnumerateMember(hcat, m);
ok(m == NULL, "CryptCATEnumerateMember succeeded\n"); ok(m == NULL, "CryptCATEnumerateMember succeeded\n");
attr = NULL;
while ((attr = pCryptCATEnumerateCatAttr(hcat, attr)))
{
ok(!lstrcmpW(attr->pwszReferenceTag, attr1W) ||
!lstrcmpW(attr->pwszReferenceTag, attr2W),
"Expected 'attr1' or 'attr2'\n");
attrcount++;
}
todo_wine
ok(attrcount == 2, "Expected 2 catalog attributes, got %d\n", attrcount);
ret = pCryptCATClose(hcat); ret = pCryptCATClose(hcat);
ok(ret, "CryptCATClose failed\n"); ok(ret, "CryptCATClose failed\n");
......
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