Juan Lang : wintrust: Add tests for WVTAsn1CatMemberInfoDecode.

Alexandre Julliard julliard at winehq.org
Sat Oct 18 13:38:46 CDT 2008


Module: wine
Branch: master
Commit: 6b13b356407fcd570e739c58a8258e357a2ca45c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6b13b356407fcd570e739c58a8258e357a2ca45c

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Oct 17 14:12:55 2008 -0700

wintrust: Add tests for WVTAsn1CatMemberInfoDecode.

---

 dlls/wintrust/tests/asn.c |   58 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/dlls/wintrust/tests/asn.c b/dlls/wintrust/tests/asn.c
index 5dd4eff..00f1ebc 100644
--- a/dlls/wintrust/tests/asn.c
+++ b/dlls/wintrust/tests/asn.c
@@ -531,6 +531,63 @@ static void test_encodeCatMemberInfo(void)
     }
 }
 
+static void test_decodeCatMemberInfo(void)
+{
+   BOOL ret;
+   LPBYTE buf;
+   DWORD size;
+   CAT_MEMBERINFO *info;
+
+    if (!pCryptDecodeObjectEx)
+    {
+        skip("CryptDecodeObjectEx() is not available. Skipping the decodeCatMemberInfo tests\n");
+        return;
+    }
+
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
+     emptyCatMemberInfo, sizeof(emptyCatMemberInfo),
+     CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size);
+    todo_wine
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        info = (CAT_MEMBERINFO *)buf;
+        ok(!info->pwszSubjGuid || !info->pwszSubjGuid[0],
+         "expected empty pwszSubjGuid\n");
+        ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %d\n",
+         info->dwCertVersion);
+        LocalFree(buf);
+    }
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
+     catMemberInfoWithSillyGuid, sizeof(catMemberInfoWithSillyGuid),
+     CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size);
+    todo_wine
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        info = (CAT_MEMBERINFO *)buf;
+        ok(info->pwszSubjGuid && !lstrcmpW(info->pwszSubjGuid, foo),
+         "unexpected pwszSubjGuid\n");
+        ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %d\n",
+         info->dwCertVersion);
+        LocalFree(buf);
+    }
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
+     catMemberInfoWithGuid, sizeof(catMemberInfoWithGuid),
+     CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size);
+    todo_wine
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        info = (CAT_MEMBERINFO *)buf;
+        ok(info->pwszSubjGuid && !lstrcmpW(info->pwszSubjGuid, guidStr),
+         "unexpected pwszSubjGuid\n");
+        ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %d\n",
+         info->dwCertVersion);
+        LocalFree(buf);
+    }
+}
+
 START_TEST(asn)
 {
     HMODULE hCrypt32 = LoadLibraryA("crypt32.dll");
@@ -542,6 +599,7 @@ START_TEST(asn)
     test_encodeSPCPEImage();
     test_decodeSPCPEImage();
     test_encodeCatMemberInfo();
+    test_decodeCatMemberInfo();
 
     FreeLibrary(hCrypt32);
 }




More information about the wine-cvs mailing list