1 /* Unit test suite for wintrust asn functions
3 * Copyright 2007 Juan Lang
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/test.h"
29 static BOOL (WINAPI
*pCryptDecodeObjectEx
)(DWORD
,LPCSTR
,const BYTE
*,DWORD
,DWORD
,PCRYPT_DECODE_PARA
,void*,DWORD
*);
30 static BOOL (WINAPI
*pCryptEncodeObjectEx
)(DWORD
,LPCSTR
,const void*,DWORD
,PCRYPT_ENCODE_PARA
,void*,DWORD
*);
32 static const BYTE falseCriteria
[] = { 0x30,0x06,0x01,0x01,0x00,0x01,0x01,0x00 };
33 static const BYTE trueCriteria
[] = { 0x30,0x06,0x01,0x01,0xff,0x01,0x01,0xff };
35 static void test_encodeSPCFinancialCriteria(void)
40 SPC_FINANCIAL_CRITERIA criteria
= { FALSE
, FALSE
};
42 if (!pCryptEncodeObjectEx
)
44 win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeFinancialCriteria tests\n");
47 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_FINANCIAL_CRITERIA_STRUCT
,
48 &criteria
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
49 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
52 ok(size
== sizeof(falseCriteria
), "Unexpected size %d\n", size
);
53 ok(!memcmp(buf
, falseCriteria
, size
), "Unexpected value\n");
56 criteria
.fFinancialInfoAvailable
= criteria
.fMeetsCriteria
= TRUE
;
57 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_FINANCIAL_CRITERIA_STRUCT
,
58 &criteria
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
59 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
62 ok(size
== sizeof(trueCriteria
), "Unexpected size %d\n", size
);
63 ok(!memcmp(buf
, trueCriteria
, size
), "Unexpected value\n");
68 static void test_decodeSPCFinancialCriteria(void)
71 SPC_FINANCIAL_CRITERIA criteria
;
72 DWORD size
= sizeof(criteria
);
74 if (!pCryptDecodeObjectEx
)
76 win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeSPCFinancialCriteria tests\n");
80 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_FINANCIAL_CRITERIA_STRUCT
,
81 falseCriteria
, sizeof(falseCriteria
), 0, NULL
, &criteria
, &size
);
82 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
85 ok(!criteria
.fFinancialInfoAvailable
, "expected FALSE\n");
86 ok(!criteria
.fMeetsCriteria
, "expected FALSE\n");
88 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_FINANCIAL_CRITERIA_STRUCT
,
89 trueCriteria
, sizeof(trueCriteria
), 0, NULL
, &criteria
, &size
);
90 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
93 ok(criteria
.fFinancialInfoAvailable
, "expected TRUE\n");
94 ok(criteria
.fMeetsCriteria
, "expected TRUE\n");
98 static WCHAR url
[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.',
100 static const WCHAR nihongoURL
[] = { 'h','t','t','p',':','/','/',0x226f,
102 static const BYTE emptyURLSPCLink
[] = { 0x80,0x00 };
103 static const BYTE urlSPCLink
[] = {
104 0x80,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,0x71,
105 0x2e,0x6f,0x72,0x67};
106 static const BYTE fileSPCLink
[] = {
107 0xa2,0x14,0x80,0x12,0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,0x3a,0x00,
108 0x2f,0x00,0x2f,0x22,0x6f,0x57,0x5b };
109 static const BYTE emptyMonikerSPCLink
[] = {
110 0xa1,0x14,0x04,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
111 0x00,0x00,0x00,0x00,0x00,0x04,0x00 };
112 static BYTE data
[] = { 0xba, 0xad, 0xf0, 0x0d };
113 static const BYTE monikerSPCLink
[] = {
114 0xa1,0x18,0x04,0x10,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,
115 0xea,0xea,0xea,0xea,0xea,0x04,0x04,0xba,0xad,0xf0,0x0d };
117 static void test_encodeSPCLink(void)
122 SPC_LINK link
= { 0 };
124 if (!pCryptEncodeObjectEx
)
126 win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeSPCLink tests\n");
130 SetLastError(0xdeadbeef);
131 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
, &link
,
132 CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
133 ok(!ret
&& GetLastError() == E_INVALIDARG
,
134 "Expected E_INVALIDARG, got %08x\n", GetLastError());
135 link
.dwLinkChoice
= SPC_URL_LINK_CHOICE
;
136 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
, &link
,
137 CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
138 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
141 ok(size
== sizeof(emptyURLSPCLink
), "Unexpected size %d\n", size
);
142 ok(!memcmp(buf
, emptyURLSPCLink
, size
), "Unexpected value\n");
145 /* With an invalid char: */
146 U(link
).pwszUrl
= (LPWSTR
)nihongoURL
;
148 SetLastError(0xdeadbeef);
149 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
, &link
,
150 CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
152 (GetLastError() == CRYPT_E_INVALID_IA5_STRING
||
153 GetLastError() == OSS_BAD_PTR
/* WinNT */),
154 "Expected CRYPT_E_INVALID_IA5_STRING, got %08x\n", GetLastError());
155 /* Unlike the crypt32 string encoding routines, size is not set to the
156 * index of the first invalid character.
158 ok(size
== 0, "Expected size 0, got %d\n", size
);
159 U(link
).pwszUrl
= url
;
160 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
, &link
,
161 CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
162 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
165 ok(size
== sizeof(urlSPCLink
), "Unexpected size %d\n", size
);
166 ok(!memcmp(buf
, urlSPCLink
, size
), "Unexpected value\n");
169 link
.dwLinkChoice
= SPC_FILE_LINK_CHOICE
;
170 U(link
).pwszFile
= (LPWSTR
)nihongoURL
;
171 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
, &link
,
172 CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
173 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
176 ok(size
== sizeof(fileSPCLink
), "Unexpected size %d\n", size
);
177 ok(!memcmp(buf
, fileSPCLink
, size
), "Unexpected value\n");
180 link
.dwLinkChoice
= SPC_MONIKER_LINK_CHOICE
;
181 memset(&U(link
).Moniker
, 0, sizeof(U(link
).Moniker
));
182 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
, &link
,
183 CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
184 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
187 ok(size
== sizeof(emptyMonikerSPCLink
), "Unexpected size %d\n", size
);
188 ok(!memcmp(buf
, emptyMonikerSPCLink
, size
), "Unexpected value\n");
191 memset(&U(link
).Moniker
.ClassId
, 0xea, sizeof(U(link
).Moniker
.ClassId
));
192 U(link
).Moniker
.SerializedData
.pbData
= data
;
193 U(link
).Moniker
.SerializedData
.cbData
= sizeof(data
);
194 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
, &link
,
195 CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
196 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
199 ok(size
== sizeof(monikerSPCLink
), "Unexpected size %d\n", size
);
200 ok(!memcmp(buf
, monikerSPCLink
, size
), "Unexpected value\n");
205 static const BYTE badMonikerSPCLink
[] = {
206 0xa1,0x19,0x04,0x11,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,
207 0xea,0xea,0xea,0xea,0xea,0xea,0x04,0x04,0xba,0xad,0xf0,0x0d };
209 static void test_decodeSPCLink(void)
216 if (!pCryptDecodeObjectEx
)
218 win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeSPCLink tests\n");
222 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
,
223 emptyURLSPCLink
, sizeof(emptyURLSPCLink
), CRYPT_DECODE_ALLOC_FLAG
, NULL
,
225 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
228 link
= (SPC_LINK
*)buf
;
229 ok(link
->dwLinkChoice
== SPC_URL_LINK_CHOICE
,
230 "Expected SPC_URL_LINK_CHOICE, got %d\n", link
->dwLinkChoice
);
231 ok(lstrlenW(U(*link
).pwszUrl
) == 0, "Expected empty string\n");
234 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
,
235 urlSPCLink
, sizeof(urlSPCLink
), CRYPT_DECODE_ALLOC_FLAG
, NULL
,
237 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
240 link
= (SPC_LINK
*)buf
;
241 ok(link
->dwLinkChoice
== SPC_URL_LINK_CHOICE
,
242 "Expected SPC_URL_LINK_CHOICE, got %d\n", link
->dwLinkChoice
);
243 ok(!lstrcmpW(U(*link
).pwszUrl
, url
), "Unexpected URL\n");
246 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
,
247 fileSPCLink
, sizeof(fileSPCLink
), CRYPT_DECODE_ALLOC_FLAG
, NULL
,
249 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
252 link
= (SPC_LINK
*)buf
;
253 ok(link
->dwLinkChoice
== SPC_FILE_LINK_CHOICE
,
254 "Expected SPC_FILE_LINK_CHOICE, got %d\n", link
->dwLinkChoice
);
255 ok(!lstrcmpW(U(*link
).pwszFile
, nihongoURL
), "Unexpected file\n");
258 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
,
259 emptyMonikerSPCLink
, sizeof(emptyMonikerSPCLink
), CRYPT_DECODE_ALLOC_FLAG
,
261 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
264 SPC_SERIALIZED_OBJECT emptyMoniker
= { { 0 } };
266 link
= (SPC_LINK
*)buf
;
267 ok(link
->dwLinkChoice
== SPC_MONIKER_LINK_CHOICE
,
268 "Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link
->dwLinkChoice
);
269 ok(!memcmp(&U(*link
).Moniker
.ClassId
, &emptyMoniker
.ClassId
,
270 sizeof(emptyMoniker
.ClassId
)), "Unexpected value\n");
271 ok(U(*link
).Moniker
.SerializedData
.cbData
== 0,
272 "Expected no serialized data\n");
275 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
,
276 monikerSPCLink
, sizeof(monikerSPCLink
), CRYPT_DECODE_ALLOC_FLAG
, NULL
,
278 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
283 link
= (SPC_LINK
*)buf
;
284 ok(link
->dwLinkChoice
== SPC_MONIKER_LINK_CHOICE
,
285 "Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link
->dwLinkChoice
);
286 memset(&id
, 0xea, sizeof(id
));
287 ok(!memcmp(&U(*link
).Moniker
.ClassId
, &id
, sizeof(id
)),
288 "Unexpected value\n");
289 ok(U(*link
).Moniker
.SerializedData
.cbData
== sizeof(data
),
290 "Unexpected data size %d\n", U(*link
).Moniker
.SerializedData
.cbData
);
291 ok(!memcmp(U(*link
).Moniker
.SerializedData
.pbData
, data
, sizeof(data
)),
292 "Unexpected value\n");
295 SetLastError(0xdeadbeef);
296 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_LINK_STRUCT
,
297 badMonikerSPCLink
, sizeof(badMonikerSPCLink
), CRYPT_DECODE_ALLOC_FLAG
,
300 (GetLastError() == CRYPT_E_BAD_ENCODE
||
301 GetLastError() == OSS_DATA_ERROR
/* WinNT */),
302 "Expected CRYPT_E_BAD_ENCODE, got %08x\n", GetLastError());
305 static const BYTE emptySequence
[] = { 0x30,0x00 };
306 static BYTE flags
[] = { 1 };
307 static const BYTE onlyFlagsPEImage
[] = { 0x30,0x04,0x03,0x02,0x00,0x01 };
308 static const BYTE onlyEmptyFilePEImage
[] = {
309 0x30,0x06,0xa0,0x04,0xa2,0x02,0x80,0x00 };
310 static const BYTE flagsAndEmptyFilePEImage
[] = {
311 0x30,0x0a,0x03,0x02,0x00,0x01,0xa0,0x04,0xa2,0x02,0x80,0x00 };
312 static const BYTE flagsAndFilePEImage
[] = {
313 0x30,0x1c,0x03,0x02,0x00,0x01,0xa0,0x16,0xa2,0x14,0x80,0x12,0x00,0x68,0x00,
314 0x74,0x00,0x74,0x00,0x70,0x00,0x3a,0x00,0x2f,0x00,0x2f,0x22,0x6f,0x57,0x5b };
316 static void test_encodeSPCPEImage(void)
321 SPC_PE_IMAGE_DATA imageData
= { { 0 } };
322 SPC_LINK link
= { 0 };
324 if (!pCryptEncodeObjectEx
)
326 win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeSPCPEImage tests\n");
330 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
331 &imageData
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
332 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
335 ok(size
== sizeof(emptySequence
), "Unexpected size %d\n", size
);
336 ok(!memcmp(buf
, emptySequence
, sizeof(emptySequence
)),
337 "Unexpected value\n");
340 /* With an invalid link: */
341 imageData
.pFile
= &link
;
342 SetLastError(0xdeadbeef);
343 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
344 &imageData
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
345 ok(!ret
&& GetLastError () == E_INVALIDARG
,
346 "Expected E_INVALIDARG, got %08x\n", GetLastError());
347 /* With just unused bits field set: */
348 imageData
.pFile
= NULL
;
349 imageData
.Flags
.cUnusedBits
= 1;
350 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
351 &imageData
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
352 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
355 ok(size
== sizeof(emptySequence
), "Unexpected size %d\n", size
);
356 ok(!memcmp(buf
, emptySequence
, sizeof(emptySequence
)),
357 "Unexpected value\n");
360 /* With flags set: */
361 imageData
.Flags
.cUnusedBits
= 0;
362 imageData
.Flags
.pbData
= flags
;
363 imageData
.Flags
.cbData
= sizeof(flags
);
364 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
365 &imageData
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
366 if (!ret
&& GetLastError() == OSS_TOO_LONG
)
368 skip("SPC_PE_IMAGE_DATA_STRUCT not supported\n");
371 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
374 ok(size
== sizeof(onlyFlagsPEImage
), "Unexpected size %d\n", size
);
375 ok(!memcmp(buf
, onlyFlagsPEImage
, sizeof(onlyFlagsPEImage
)),
376 "Unexpected value\n");
379 /* With just an empty file: */
380 imageData
.Flags
.cbData
= 0;
381 link
.dwLinkChoice
= SPC_FILE_LINK_CHOICE
;
382 imageData
.pFile
= &link
;
383 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
384 &imageData
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
385 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
388 ok(size
== sizeof(onlyEmptyFilePEImage
), "Unexpected size %d\n", size
);
389 ok(!memcmp(buf
, onlyEmptyFilePEImage
, sizeof(onlyEmptyFilePEImage
)),
390 "Unexpected value\n");
393 /* With flags and an empty file: */
394 imageData
.Flags
.pbData
= flags
;
395 imageData
.Flags
.cbData
= sizeof(flags
);
396 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
397 &imageData
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
398 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
401 ok(size
== sizeof(flagsAndEmptyFilePEImage
), "Unexpected size %d\n",
403 ok(!memcmp(buf
, flagsAndEmptyFilePEImage
,
404 sizeof(flagsAndEmptyFilePEImage
)), "Unexpected value\n");
407 /* Finally, a non-empty file: */
408 U(link
).pwszFile
= (LPWSTR
)nihongoURL
;
409 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
410 &imageData
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
411 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
414 ok(size
== sizeof(flagsAndFilePEImage
), "Unexpected size %d\n", size
);
415 ok(!memcmp(buf
, flagsAndFilePEImage
, sizeof(flagsAndFilePEImage
)),
416 "Unexpected value\n");
421 static void test_decodeSPCPEImage(void)
423 static const WCHAR emptyString
[] = { 0 };
427 SPC_PE_IMAGE_DATA
*imageData
;
429 if (!pCryptDecodeObjectEx
)
431 win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeSPCPEImage tests\n");
435 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
436 emptySequence
, sizeof(emptySequence
),
437 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
438 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
441 imageData
= (SPC_PE_IMAGE_DATA
*)buf
;
442 ok(imageData
->Flags
.cbData
== 0, "Expected empty flags, got %d\n",
443 imageData
->Flags
.cbData
);
444 ok(imageData
->pFile
== NULL
, "Expected no file\n");
447 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
448 onlyFlagsPEImage
, sizeof(onlyFlagsPEImage
),
449 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
450 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
453 imageData
= (SPC_PE_IMAGE_DATA
*)buf
;
454 ok(imageData
->Flags
.cbData
== sizeof(flags
),
455 "Unexpected flags size %d\n", imageData
->Flags
.cbData
);
456 if (imageData
->Flags
.cbData
)
457 ok(!memcmp(imageData
->Flags
.pbData
, flags
, sizeof(flags
)),
458 "Unexpected flags\n");
459 ok(imageData
->pFile
== NULL
, "Expected no file\n");
462 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
463 onlyEmptyFilePEImage
, sizeof(onlyEmptyFilePEImage
),
464 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
465 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
468 imageData
= (SPC_PE_IMAGE_DATA
*)buf
;
469 ok(imageData
->Flags
.cbData
== 0, "Expected empty flags, got %d\n",
470 imageData
->Flags
.cbData
);
471 ok(imageData
->pFile
!= NULL
, "Expected a file\n");
472 if (imageData
->pFile
)
474 ok(imageData
->pFile
->dwLinkChoice
== SPC_FILE_LINK_CHOICE
,
475 "Expected SPC_FILE_LINK_CHOICE, got %d\n",
476 imageData
->pFile
->dwLinkChoice
);
477 ok(!lstrcmpW(U(*imageData
->pFile
).pwszFile
, emptyString
),
478 "Unexpected file\n");
482 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
483 flagsAndEmptyFilePEImage
, sizeof(flagsAndEmptyFilePEImage
),
484 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
485 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
488 imageData
= (SPC_PE_IMAGE_DATA
*)buf
;
489 ok(imageData
->Flags
.cbData
== sizeof(flags
),
490 "Unexpected flags size %d\n", imageData
->Flags
.cbData
);
491 if (imageData
->Flags
.cbData
)
492 ok(!memcmp(imageData
->Flags
.pbData
, flags
, sizeof(flags
)),
493 "Unexpected flags\n");
494 ok(imageData
->pFile
!= NULL
, "Expected a file\n");
495 if (imageData
->pFile
)
497 ok(imageData
->pFile
->dwLinkChoice
== SPC_FILE_LINK_CHOICE
,
498 "Expected SPC_FILE_LINK_CHOICE, got %d\n",
499 imageData
->pFile
->dwLinkChoice
);
500 ok(!lstrcmpW(U(*imageData
->pFile
).pwszFile
, emptyString
),
501 "Unexpected file\n");
505 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_PE_IMAGE_DATA_STRUCT
,
506 flagsAndFilePEImage
, sizeof(flagsAndFilePEImage
),
507 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
508 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
511 imageData
= (SPC_PE_IMAGE_DATA
*)buf
;
512 ok(imageData
->Flags
.cbData
== sizeof(flags
),
513 "Unexpected flags size %d\n", imageData
->Flags
.cbData
);
514 if (imageData
->Flags
.cbData
)
515 ok(!memcmp(imageData
->Flags
.pbData
, flags
, sizeof(flags
)),
516 "Unexpected flags\n");
517 ok(imageData
->pFile
!= NULL
, "Expected a file\n");
518 if (imageData
->pFile
)
520 ok(imageData
->pFile
->dwLinkChoice
== SPC_FILE_LINK_CHOICE
,
521 "Expected SPC_FILE_LINK_CHOICE, got %d\n",
522 imageData
->pFile
->dwLinkChoice
);
523 ok(!lstrcmpW(U(*imageData
->pFile
).pwszFile
, nihongoURL
),
524 "Unexpected file\n");
530 static WCHAR foo
[] = { 'f','o','o',0 };
531 static WCHAR guidStr
[] = { '{','8','b','c','9','6','b','0','0','-',
532 '8','d','a','1','-','1','1','c','f','-','8','7','3','6','-','0','0',
533 'a','a','0','0','a','4','8','5','e','b','}',0 };
535 static const BYTE emptyCatMemberInfo
[] = { 0x30,0x05,0x1e,0x00,0x02,0x01,0x00 };
536 static const BYTE catMemberInfoWithSillyGuid
[] = {
537 0x30,0x0b,0x1e,0x06,0x00,0x66,0x00,0x6f,0x00,0x6f,0x02,0x01,0x00 };
538 static const BYTE catMemberInfoWithGuid
[] = {
539 0x30,0x51,0x1e,0x4c,0x00,0x7b,0x00,0x38,0x00,0x62,0x00,0x63,0x00,0x39,0x00,0x36,
540 0x00,0x62,0x00,0x30,0x00,0x30,0x00,0x2d,0x00,0x38,0x00,0x64,0x00,0x61,0x00,0x31,
541 0x00,0x2d,0x00,0x31,0x00,0x31,0x00,0x63,0x00,0x66,0x00,0x2d,0x00,0x38,0x00,0x37,
542 0x00,0x33,0x00,0x36,0x00,0x2d,0x00,0x30,0x00,0x30,0x00,0x61,0x00,0x61,0x00,0x30,
543 0x00,0x30,0x00,0x61,0x00,0x34,0x00,0x38,0x00,0x35,0x00,0x65,0x00,0x62,0x00,0x7d,
546 static void test_encodeCatMemberInfo(void)
553 memset(&info
, 0, sizeof(info
));
555 if (!pCryptEncodeObjectEx
)
557 win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeCatMemberInfo tests\n");
561 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, CAT_MEMBERINFO_STRUCT
,
562 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
563 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
566 ok(size
== sizeof(emptyCatMemberInfo
), "Unexpected size %d\n", size
);
567 ok(!memcmp(buf
, emptyCatMemberInfo
, sizeof(emptyCatMemberInfo
)),
568 "Unexpected value\n");
571 info
.pwszSubjGuid
= foo
;
572 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, CAT_MEMBERINFO_STRUCT
,
573 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
574 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
577 ok(size
== sizeof(catMemberInfoWithSillyGuid
), "Unexpected size %d\n",
579 ok(!memcmp(buf
, catMemberInfoWithSillyGuid
,
580 sizeof(catMemberInfoWithSillyGuid
)), "Unexpected value\n");
583 info
.pwszSubjGuid
= guidStr
;
584 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, CAT_MEMBERINFO_STRUCT
,
585 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
586 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
589 ok(size
== sizeof(catMemberInfoWithGuid
), "Unexpected size %d\n",
591 ok(!memcmp(buf
, catMemberInfoWithGuid
, sizeof(catMemberInfoWithGuid
)),
592 "Unexpected value\n");
597 static void test_decodeCatMemberInfo(void)
602 CAT_MEMBERINFO
*info
;
604 if (!pCryptDecodeObjectEx
)
606 win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeCatMemberInfo tests\n");
610 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, CAT_MEMBERINFO_STRUCT
,
611 emptyCatMemberInfo
, sizeof(emptyCatMemberInfo
),
612 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
613 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
616 info
= (CAT_MEMBERINFO
*)buf
;
617 ok(!info
->pwszSubjGuid
|| !info
->pwszSubjGuid
[0],
618 "expected empty pwszSubjGuid\n");
619 ok(info
->dwCertVersion
== 0, "expected dwCertVersion == 0, got %d\n",
620 info
->dwCertVersion
);
623 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, CAT_MEMBERINFO_STRUCT
,
624 catMemberInfoWithSillyGuid
, sizeof(catMemberInfoWithSillyGuid
),
625 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
626 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
629 info
= (CAT_MEMBERINFO
*)buf
;
630 ok(info
->pwszSubjGuid
&& !lstrcmpW(info
->pwszSubjGuid
, foo
),
631 "unexpected pwszSubjGuid\n");
632 ok(info
->dwCertVersion
== 0, "expected dwCertVersion == 0, got %d\n",
633 info
->dwCertVersion
);
636 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, CAT_MEMBERINFO_STRUCT
,
637 catMemberInfoWithGuid
, sizeof(catMemberInfoWithGuid
),
638 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
639 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
642 info
= (CAT_MEMBERINFO
*)buf
;
643 ok(info
->pwszSubjGuid
&& !lstrcmpW(info
->pwszSubjGuid
, guidStr
),
644 "unexpected pwszSubjGuid\n");
645 ok(info
->dwCertVersion
== 0, "expected dwCertVersion == 0, got %d\n",
646 info
->dwCertVersion
);
651 static const BYTE emptyCatNameValue
[] = {
652 0x30,0x07,0x1e,0x00,0x02,0x01,0x00,0x04,0x00 };
653 static const BYTE catNameValueWithTag
[] = {
654 0x30,0x0d,0x1e,0x06,0x00,0x66,0x00,0x6f,0x00,0x6f,0x02,0x01,0x00,0x04,0x00 };
655 static const BYTE catNameValueWithFlags
[] = {
656 0x30,0x0a,0x1e,0x00,0x02,0x04,0xf0,0x0d,0xd0,0x0d,0x04,0x00 };
657 static const BYTE catNameValueWithValue
[] = {
658 0x30,0x0b,0x1e,0x00,0x02,0x01,0x00,0x04,0x04,0x01,0x02,0x03,0x04 };
660 static BYTE aVal
[] = { 1,2,3,4 };
662 static void test_encodeCatNameValue(void)
664 static WCHAR foo
[] = { 'f','o','o',0 };
670 memset(&value
, 0, sizeof(value
));
671 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
672 &value
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
673 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
676 ok(size
== sizeof(emptyCatNameValue
), "Unexpected size %d\n", size
);
677 ok(!memcmp(buf
, emptyCatNameValue
, sizeof(emptyCatNameValue
)),
678 "Unexpected value\n");
682 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
683 &value
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
684 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
687 ok(size
== sizeof(catNameValueWithTag
), "Unexpected size %d\n", size
);
688 ok(!memcmp(buf
, catNameValueWithTag
, sizeof(catNameValueWithTag
)),
689 "Unexpected value\n");
692 value
.pwszTag
= NULL
;
693 value
.fdwFlags
= 0xf00dd00d;
694 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
695 &value
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
696 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
699 ok(size
== sizeof(catNameValueWithFlags
), "Unexpected size %d\n", size
);
700 ok(!memcmp(buf
, catNameValueWithFlags
, sizeof(catNameValueWithFlags
)),
701 "Unexpected value\n");
705 value
.Value
.cbData
= sizeof(aVal
);
706 value
.Value
.pbData
= aVal
;
707 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
708 &value
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
709 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
712 ok(size
== sizeof(catNameValueWithValue
), "Unexpected size %d\n", size
);
713 ok(!memcmp(buf
, catNameValueWithValue
, sizeof(catNameValueWithValue
)),
714 "Unexpected value\n");
719 static void test_decodeCatNameValue(void)
724 CAT_NAMEVALUE
*value
;
727 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
728 emptyCatNameValue
, sizeof(emptyCatNameValue
),
729 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
730 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
733 value
= (CAT_NAMEVALUE
*)buf
;
734 ok(!value
->pwszTag
|| !value
->pwszTag
[0], "expected empty pwszTag\n");
735 ok(value
->fdwFlags
== 0, "expected fdwFlags == 0, got %08x\n",
737 ok(value
->Value
.cbData
== 0, "expected 0-length value, got %d\n",
738 value
->Value
.cbData
);
742 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
743 catNameValueWithTag
, sizeof(catNameValueWithTag
),
744 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
745 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
748 value
= (CAT_NAMEVALUE
*)buf
;
749 ok(value
->pwszTag
&& !lstrcmpW(value
->pwszTag
, foo
),
750 "unexpected pwszTag\n");
751 ok(value
->fdwFlags
== 0, "expected fdwFlags == 0, got %08x\n",
753 ok(value
->Value
.cbData
== 0, "expected 0-length value, got %d\n",
754 value
->Value
.cbData
);
758 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
759 catNameValueWithFlags
, sizeof(catNameValueWithFlags
),
760 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
761 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
764 value
= (CAT_NAMEVALUE
*)buf
;
765 ok(!value
->pwszTag
|| !value
->pwszTag
[0], "expected empty pwszTag\n");
766 ok(value
->fdwFlags
== 0xf00dd00d,
767 "expected fdwFlags == 0xf00dd00d, got %08x\n", value
->fdwFlags
);
768 ok(value
->Value
.cbData
== 0, "expected 0-length value, got %d\n",
769 value
->Value
.cbData
);
773 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, CAT_NAMEVALUE_STRUCT
,
774 catNameValueWithValue
, sizeof(catNameValueWithValue
),
775 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
776 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
779 value
= (CAT_NAMEVALUE
*)buf
;
780 ok(!value
->pwszTag
|| !value
->pwszTag
[0], "expected empty pwszTag\n");
781 ok(value
->fdwFlags
== 0, "expected fdwFlags == 0, got %08x\n",
783 ok(value
->Value
.cbData
== sizeof(aVal
), "unexpected size %d\n",
784 value
->Value
.cbData
);
785 ok(!memcmp(value
->Value
.pbData
, aVal
, value
->Value
.cbData
),
786 "unexpected value\n");
791 static const WCHAR progName
[] = { 'A',' ','p','r','o','g','r','a','m',0 };
792 static const BYTE spOpusInfoWithProgramName
[] = {
793 0x30,0x16,0xa0,0x14,0x80,0x12,0x00,0x41,0x00,0x20,0x00,0x70,0x00,0x72,0x00,0x6f,
794 0x00,0x67,0x00,0x72,0x00,0x61,0x00,0x6d };
795 static WCHAR winehq
[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q',
796 '.','o','r','g','/',0 };
797 static const BYTE spOpusInfoWithMoreInfo
[] = {
798 0x30,0x16,0xa1,0x14,0x80,0x12,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,
799 0x65,0x68,0x71,0x2e,0x6f,0x72,0x67,0x2f };
800 static const BYTE spOpusInfoWithPublisherInfo
[] = {
801 0x30,0x16,0xa2,0x14,0x80,0x12,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,
802 0x65,0x68,0x71,0x2e,0x6f,0x72,0x67,0x2f };
804 static void test_encodeSpOpusInfo(void)
809 SPC_SP_OPUS_INFO info
;
812 memset(&info
, 0, sizeof(info
));
813 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
814 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
815 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
818 ok(size
== sizeof(emptySequence
), "unexpected size %d\n", size
);
819 ok(!memcmp(buf
, emptySequence
, size
), "unexpected value\n");
822 info
.pwszProgramName
= progName
;
823 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
824 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
825 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
828 ok(size
== sizeof(spOpusInfoWithProgramName
), "unexpected size %d\n",
830 ok(!memcmp(buf
, spOpusInfoWithProgramName
, size
),
831 "unexpected value\n");
834 info
.pwszProgramName
= NULL
;
835 memset(&moreInfo
, 0, sizeof(moreInfo
));
836 info
.pMoreInfo
= &moreInfo
;
837 SetLastError(0xdeadbeef);
838 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
839 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
840 ok(!ret
&& GetLastError() == E_INVALIDARG
,
841 "expected E_INVALIDARG, got %08x\n", GetLastError());
842 moreInfo
.dwLinkChoice
= SPC_URL_LINK_CHOICE
;
843 U(moreInfo
).pwszUrl
= winehq
;
844 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
845 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
846 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
849 ok(size
== sizeof(spOpusInfoWithMoreInfo
),
850 "unexpected size %d\n", size
);
851 ok(!memcmp(buf
, spOpusInfoWithMoreInfo
, size
),
852 "unexpected value\n");
855 info
.pMoreInfo
= NULL
;
856 info
.pPublisherInfo
= &moreInfo
;
857 ret
= pCryptEncodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
858 &info
, CRYPT_ENCODE_ALLOC_FLAG
, NULL
, &buf
, &size
);
859 ok(ret
, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
862 ok(size
== sizeof(spOpusInfoWithPublisherInfo
),
863 "unexpected size %d\n", size
);
864 ok(!memcmp(buf
, spOpusInfoWithPublisherInfo
, size
),
865 "unexpected value\n");
870 static void test_decodeSpOpusInfo(void)
874 SPC_SP_OPUS_INFO
*info
;
876 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
877 emptySequence
, sizeof(emptySequence
), CRYPT_DECODE_ALLOC_FLAG
, NULL
,
879 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
882 ok(!info
->pwszProgramName
, "expected NULL\n");
883 ok(!info
->pMoreInfo
, "expected NULL\n");
884 ok(!info
->pPublisherInfo
, "expected NULL\n");
887 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
888 spOpusInfoWithProgramName
, sizeof(spOpusInfoWithProgramName
),
889 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &info
, &size
);
890 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
893 ok(info
->pwszProgramName
&& !lstrcmpW(info
->pwszProgramName
,
894 progName
), "unexpected program name\n");
895 ok(!info
->pMoreInfo
, "expected NULL\n");
896 ok(!info
->pPublisherInfo
, "expected NULL\n");
899 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
900 spOpusInfoWithMoreInfo
, sizeof(spOpusInfoWithMoreInfo
),
901 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &info
, &size
);
902 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
905 ok(!info
->pwszProgramName
, "expected NULL\n");
906 ok(info
->pMoreInfo
!= NULL
, "expected a value for pMoreInfo\n");
909 ok(info
->pMoreInfo
->dwLinkChoice
== SPC_URL_LINK_CHOICE
,
910 "unexpected link choice %d\n", info
->pMoreInfo
->dwLinkChoice
);
911 ok(!lstrcmpW(U(*info
->pMoreInfo
).pwszUrl
, winehq
),
912 "unexpected link value\n");
914 ok(!info
->pPublisherInfo
, "expected NULL\n");
917 ret
= pCryptDecodeObjectEx(X509_ASN_ENCODING
, SPC_SP_OPUS_INFO_STRUCT
,
918 spOpusInfoWithPublisherInfo
, sizeof(spOpusInfoWithPublisherInfo
),
919 CRYPT_DECODE_ALLOC_FLAG
, NULL
, &info
, &size
);
920 ok(ret
, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
923 ok(!info
->pwszProgramName
, "expected NULL\n");
924 ok(!info
->pMoreInfo
, "expected NULL\n");
925 ok(info
->pPublisherInfo
!= NULL
,
926 "expected a value for pPublisherInfo\n");
927 if (info
->pPublisherInfo
)
929 ok(info
->pPublisherInfo
->dwLinkChoice
== SPC_URL_LINK_CHOICE
,
930 "unexpected link choice %d\n",
931 info
->pPublisherInfo
->dwLinkChoice
);
932 ok(!lstrcmpW(U(*info
->pPublisherInfo
).pwszUrl
, winehq
),
933 "unexpected link value\n");
941 HMODULE hCrypt32
= LoadLibraryA("crypt32.dll");
942 pCryptDecodeObjectEx
= (void*)GetProcAddress(hCrypt32
, "CryptDecodeObjectEx");
943 pCryptEncodeObjectEx
= (void*)GetProcAddress(hCrypt32
, "CryptEncodeObjectEx");
945 test_encodeSPCFinancialCriteria();
946 test_decodeSPCFinancialCriteria();
947 test_encodeSPCLink();
948 test_decodeSPCLink();
949 test_encodeSPCPEImage();
950 test_decodeSPCPEImage();
951 test_encodeCatMemberInfo();
952 test_decodeCatMemberInfo();
953 test_encodeCatNameValue();
954 test_decodeCatNameValue();
955 test_encodeSpOpusInfo();
956 test_decodeSpOpusInfo();
958 FreeLibrary(hCrypt32
);