Commit 6b13b356 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

wintrust: Add tests for WVTAsn1CatMemberInfoDecode.

parent 65c5d3e4
......@@ -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);
}
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