Juan Lang : wintrust: Add tests for WVTAsn1SpcSpOpusInfoDecode.

Alexandre Julliard julliard at winehq.org
Wed Dec 10 07:41:51 CST 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue Dec  9 16:42:32 2008 -0800

wintrust: Add tests for WVTAsn1SpcSpOpusInfoDecode.

---

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

diff --git a/dlls/wintrust/tests/asn.c b/dlls/wintrust/tests/asn.c
index 29b30d2..5cb5cb6 100644
--- a/dlls/wintrust/tests/asn.c
+++ b/dlls/wintrust/tests/asn.c
@@ -865,6 +865,79 @@ static void test_encodeSpOpusInfo(void)
     }
 }
 
+static void test_decodeSpOpusInfo(void)
+{
+    BOOL ret;
+    DWORD size;
+    SPC_SP_OPUS_INFO *info;
+
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
+     emptySequence, sizeof(emptySequence), CRYPT_DECODE_ALLOC_FLAG, NULL,
+     &info, &size);
+    todo_wine
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(!info->pwszProgramName, "expected NULL\n");
+        ok(!info->pMoreInfo, "expected NULL\n");
+        ok(!info->pPublisherInfo, "expected NULL\n");
+        LocalFree(info);
+    }
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
+     spOpusInfoWithProgramName, sizeof(spOpusInfoWithProgramName),
+     CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
+    todo_wine
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(info->pwszProgramName && !lstrcmpW(info->pwszProgramName,
+         progName), "unexpected program name\n");
+        ok(!info->pMoreInfo, "expected NULL\n");
+        ok(!info->pPublisherInfo, "expected NULL\n");
+        LocalFree(info);
+    }
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
+     spOpusInfoWithMoreInfo, sizeof(spOpusInfoWithMoreInfo),
+     CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
+    todo_wine
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(!info->pwszProgramName, "expected NULL\n");
+        ok(info->pMoreInfo != NULL, "expected a value for pMoreInfo\n");
+        if (info->pMoreInfo)
+        {
+            ok(info->pMoreInfo->dwLinkChoice == SPC_URL_LINK_CHOICE,
+             "unexpected link choice %d\n", info->pMoreInfo->dwLinkChoice);
+            ok(!lstrcmpW(info->pMoreInfo->pwszUrl, winehq),
+             "unexpected link value\n");
+        }
+        ok(!info->pPublisherInfo, "expected NULL\n");
+        LocalFree(info);
+    }
+    ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
+     spOpusInfoWithPublisherInfo, sizeof(spOpusInfoWithPublisherInfo),
+     CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
+    todo_wine
+    ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(!info->pwszProgramName, "expected NULL\n");
+        ok(!info->pMoreInfo, "expected NULL\n");
+        ok(info->pPublisherInfo != NULL,
+         "expected a value for pPublisherInfo\n");
+        if (info->pPublisherInfo)
+        {
+            ok(info->pPublisherInfo->dwLinkChoice == SPC_URL_LINK_CHOICE,
+             "unexpected link choice %d\n",
+             info->pPublisherInfo->dwLinkChoice);
+            ok(!lstrcmpW(info->pPublisherInfo->pwszUrl, winehq),
+             "unexpected link value\n");
+        }
+        LocalFree(info);
+    }
+}
+
 START_TEST(asn)
 {
     HMODULE hCrypt32 = LoadLibraryA("crypt32.dll");
@@ -882,6 +955,7 @@ START_TEST(asn)
     test_encodeCatNameValue();
     test_decodeCatNameValue();
     test_encodeSpOpusInfo();
+    test_decodeSpOpusInfo();
 
     FreeLibrary(hCrypt32);
 }




More information about the wine-cvs mailing list