ReactOS  0.4.13-dev-99-g7e18b6d
asn.c
Go to the documentation of this file.
1 /* Unit test suite for wintrust asn functions
2  *
3  * Copyright 2007 Juan Lang
4  *
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.
9  *
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.
14  *
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
18  *
19  */
20 #include <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winerror.h"
24 #include "wincrypt.h"
25 #include "wintrust.h"
26 
27 #include "wine/test.h"
28 
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*);
31 
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 };
34 
36 {
37  BOOL ret;
38  DWORD size = 0;
39  LPBYTE buf;
40  SPC_FINANCIAL_CRITERIA criteria = { FALSE, FALSE };
41 
42  if (!pCryptEncodeObjectEx)
43  {
44  win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeFinancialCriteria tests\n");
45  return;
46  }
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());
50  if (ret)
51  {
52  ok(size == sizeof(falseCriteria), "Unexpected size %d\n", size);
53  ok(!memcmp(buf, falseCriteria, size), "Unexpected value\n");
54  LocalFree(buf);
55  }
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());
60  if (ret)
61  {
62  ok(size == sizeof(trueCriteria), "Unexpected size %d\n", size);
63  ok(!memcmp(buf, trueCriteria, size), "Unexpected value\n");
64  LocalFree(buf);
65  }
66 }
67 
69 {
70  BOOL ret;
71  SPC_FINANCIAL_CRITERIA criteria;
72  DWORD size = sizeof(criteria);
73 
74  if (!pCryptDecodeObjectEx)
75  {
76  win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeSPCFinancialCriteria tests\n");
77  return;
78  }
79 
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());
83  if (ret)
84  {
85  ok(!criteria.fFinancialInfoAvailable, "expected FALSE\n");
86  ok(!criteria.fMeetsCriteria, "expected FALSE\n");
87  }
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());
91  if (ret)
92  {
93  ok(criteria.fFinancialInfoAvailable, "expected TRUE\n");
94  ok(criteria.fMeetsCriteria, "expected TRUE\n");
95  }
96 }
97 
98 static WCHAR url[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.',
99  'o','r','g',0 };
100 static const WCHAR nihongoURL[] = { 'h','t','t','p',':','/','/',0x226f,
101  0x575b, 0 };
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 };
116 
117 static void test_encodeSPCLink(void)
118 {
119  BOOL ret;
120  DWORD size = 0;
121  LPBYTE buf;
122  SPC_LINK link = { 0 };
123 
124  if (!pCryptEncodeObjectEx)
125  {
126  win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeSPCLink tests\n");
127  return;
128  }
129 
130  SetLastError(0xdeadbeef);
131  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
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,
138  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
139  if (ret)
140  {
141  ok(size == sizeof(emptyURLSPCLink), "Unexpected size %d\n", size);
142  ok(!memcmp(buf, emptyURLSPCLink, size), "Unexpected value\n");
143  LocalFree(buf);
144  }
145  /* With an invalid char: */
146  U(link).pwszUrl = (LPWSTR)nihongoURL;
147  size = 1;
148  SetLastError(0xdeadbeef);
149  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
151  ok(!ret &&
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.
157  */
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,
162  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
163  if (ret)
164  {
165  ok(size == sizeof(urlSPCLink), "Unexpected size %d\n", size);
166  ok(!memcmp(buf, urlSPCLink, size), "Unexpected value\n");
167  LocalFree(buf);
168  }
169  link.dwLinkChoice = SPC_FILE_LINK_CHOICE;
170  U(link).pwszFile = (LPWSTR)nihongoURL;
171  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
173  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
174  if (ret)
175  {
176  ok(size == sizeof(fileSPCLink), "Unexpected size %d\n", size);
177  ok(!memcmp(buf, fileSPCLink, size), "Unexpected value\n");
178  LocalFree(buf);
179  }
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,
184  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
185  if (ret)
186  {
187  ok(size == sizeof(emptyMonikerSPCLink), "Unexpected size %d\n", size);
188  ok(!memcmp(buf, emptyMonikerSPCLink, size), "Unexpected value\n");
189  LocalFree(buf);
190  }
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,
196  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
197  if (ret)
198  {
199  ok(size == sizeof(monikerSPCLink), "Unexpected size %d\n", size);
200  ok(!memcmp(buf, monikerSPCLink, size), "Unexpected value\n");
201  LocalFree(buf);
202  }
203 }
204 
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 };
208 
209 static void test_decodeSPCLink(void)
210 {
211  BOOL ret;
212  LPBYTE buf = NULL;
213  DWORD size = 0;
214  SPC_LINK *link;
215 
216  if (!pCryptDecodeObjectEx)
217  {
218  win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeSPCLink tests\n");
219  return;
220  }
221 
222  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
224  &buf, &size);
225  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
226  if (ret)
227  {
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");
232  LocalFree(buf);
233  }
234  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
236  &buf, &size);
237  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
238  if (ret)
239  {
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");
244  LocalFree(buf);
245  }
246  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
248  &buf, &size);
249  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
250  if (ret)
251  {
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");
256  LocalFree(buf);
257  }
258  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
260  NULL, &buf, &size);
261  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
262  if (ret)
263  {
264  SPC_SERIALIZED_OBJECT emptyMoniker = { { 0 } };
265 
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");
273  LocalFree(buf);
274  }
275  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
277  &buf, &size);
278  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
279  if (ret)
280  {
281  SPC_UUID id;
282 
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");
293  LocalFree(buf);
294  }
295  SetLastError(0xdeadbeef);
296  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
298  NULL, &buf, &size);
299  ok(!ret &&
301  GetLastError() == OSS_DATA_ERROR /* WinNT */),
302  "Expected CRYPT_E_BAD_ENCODE, got %08x\n", GetLastError());
303 }
304 
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 };
315 
316 static void test_encodeSPCPEImage(void)
317 {
318  BOOL ret;
319  DWORD size = 0;
320  LPBYTE buf;
321  SPC_PE_IMAGE_DATA imageData = { { 0 } };
322  SPC_LINK link = { 0 };
323 
324  if (!pCryptEncodeObjectEx)
325  {
326  win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeSPCPEImage tests\n");
327  return;
328  }
329 
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());
333  if (ret)
334  {
335  ok(size == sizeof(emptySequence), "Unexpected size %d\n", size);
337  "Unexpected value\n");
338  LocalFree(buf);
339  }
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());
353  if (ret)
354  {
355  ok(size == sizeof(emptySequence), "Unexpected size %d\n", size);
357  "Unexpected value\n");
358  LocalFree(buf);
359  }
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)
367  {
368  skip("SPC_PE_IMAGE_DATA_STRUCT not supported\n");
369  return;
370  }
371  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
372  if (ret)
373  {
374  ok(size == sizeof(onlyFlagsPEImage), "Unexpected size %d\n", size);
376  "Unexpected value\n");
377  LocalFree(buf);
378  }
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());
386  if (ret)
387  {
388  ok(size == sizeof(onlyEmptyFilePEImage), "Unexpected size %d\n", size);
390  "Unexpected value\n");
391  LocalFree(buf);
392  }
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());
399  if (ret)
400  {
401  ok(size == sizeof(flagsAndEmptyFilePEImage), "Unexpected size %d\n",
402  size);
404  sizeof(flagsAndEmptyFilePEImage)), "Unexpected value\n");
405  LocalFree(buf);
406  }
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());
412  if (ret)
413  {
414  ok(size == sizeof(flagsAndFilePEImage), "Unexpected size %d\n", size);
416  "Unexpected value\n");
417  LocalFree(buf);
418  }
419 }
420 
421 static void test_decodeSPCPEImage(void)
422 {
423  static const WCHAR emptyString[] = { 0 };
424  BOOL ret;
425  LPBYTE buf = NULL;
426  DWORD size = 0;
427  SPC_PE_IMAGE_DATA *imageData;
428 
429  if (!pCryptDecodeObjectEx)
430  {
431  win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeSPCPEImage tests\n");
432  return;
433  }
434 
435  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
436  emptySequence, sizeof(emptySequence),
438  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
439  if (ret)
440  {
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");
445  LocalFree(buf);
446  }
447  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
450  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
451  if (ret)
452  {
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");
460  LocalFree(buf);
461  }
462  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
465  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
466  if (ret)
467  {
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)
473  {
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");
479  }
480  LocalFree(buf);
481  }
482  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
485  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
486  if (ret)
487  {
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)
496  {
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");
502  }
503  LocalFree(buf);
504  }
505  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
508  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
509  if (ret)
510  {
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)
519  {
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");
525  }
526  LocalFree(buf);
527  }
528 }
529 
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 };
534 
535 static const BYTE emptyCatMemberInfo[] = { 0x30,0x05,0x1e,0x00,0x02,0x01,0x00 };
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,
544 0x02,0x01,0x00 };
545 
546 static void test_encodeCatMemberInfo(void)
547 {
549  BOOL ret;
550  DWORD size = 0;
551  LPBYTE buf;
552 
553  memset(&info, 0, sizeof(info));
554 
555  if (!pCryptEncodeObjectEx)
556  {
557  win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeCatMemberInfo tests\n");
558  return;
559  }
560 
561  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
563  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
564  if (ret)
565  {
566  ok(size == sizeof(emptyCatMemberInfo), "Unexpected size %d\n", size);
568  "Unexpected value\n");
569  LocalFree(buf);
570  }
571  info.pwszSubjGuid = foo;
572  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
574  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
575  if (ret)
576  {
577  ok(size == sizeof(catMemberInfoWithSillyGuid), "Unexpected size %d\n",
578  size);
580  sizeof(catMemberInfoWithSillyGuid)), "Unexpected value\n");
581  LocalFree(buf);
582  }
583  info.pwszSubjGuid = guidStr;
584  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
586  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
587  if (ret)
588  {
589  ok(size == sizeof(catMemberInfoWithGuid), "Unexpected size %d\n",
590  size);
592  "Unexpected value\n");
593  LocalFree(buf);
594  }
595 }
596 
597 static void test_decodeCatMemberInfo(void)
598 {
599  BOOL ret;
600  LPBYTE buf;
601  DWORD size;
603 
604  if (!pCryptDecodeObjectEx)
605  {
606  win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeCatMemberInfo tests\n");
607  return;
608  }
609 
610  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
613  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
614  if (ret)
615  {
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);
621  LocalFree(buf);
622  }
623  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
626  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
627  if (ret)
628  {
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);
634  LocalFree(buf);
635  }
636  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
639  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
640  if (ret)
641  {
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);
647  LocalFree(buf);
648  }
649 }
650 
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 };
659 
660 static BYTE aVal[] = { 1,2,3,4 };
661 
662 static void test_encodeCatNameValue(void)
663 {
664  static WCHAR foo[] = { 'f','o','o',0 };
665  BOOL ret;
666  LPBYTE buf;
667  DWORD size;
669 
670  memset(&value, 0, sizeof(value));
671  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
673  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
674  if (ret)
675  {
676  ok(size == sizeof(emptyCatNameValue), "Unexpected size %d\n", size);
678  "Unexpected value\n");
679  LocalFree(buf);
680  }
681  value.pwszTag = foo;
682  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
684  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
685  if (ret)
686  {
687  ok(size == sizeof(catNameValueWithTag), "Unexpected size %d\n", size);
689  "Unexpected value\n");
690  LocalFree(buf);
691  }
692  value.pwszTag = NULL;
693  value.fdwFlags = 0xf00dd00d;
694  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
696  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
697  if (ret)
698  {
699  ok(size == sizeof(catNameValueWithFlags), "Unexpected size %d\n", size);
701  "Unexpected value\n");
702  LocalFree(buf);
703  }
704  value.fdwFlags = 0;
705  value.Value.cbData = sizeof(aVal);
706  value.Value.pbData = aVal;
707  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
709  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
710  if (ret)
711  {
712  ok(size == sizeof(catNameValueWithValue), "Unexpected size %d\n", size);
714  "Unexpected value\n");
715  LocalFree(buf);
716  }
717 }
718 
719 static void test_decodeCatNameValue(void)
720 {
721  BOOL ret;
722  LPBYTE buf;
723  DWORD size;
725 
726  buf = NULL;
727  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
730  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
731  if (ret)
732  {
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",
736  value->fdwFlags);
737  ok(value->Value.cbData == 0, "expected 0-length value, got %d\n",
738  value->Value.cbData);
739  LocalFree(buf);
740  }
741  buf = NULL;
742  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
745  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
746  if (ret)
747  {
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",
752  value->fdwFlags);
753  ok(value->Value.cbData == 0, "expected 0-length value, got %d\n",
754  value->Value.cbData);
755  LocalFree(buf);
756  }
757  buf = NULL;
758  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
761  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
762  if (ret)
763  {
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);
770  LocalFree(buf);
771  }
772  buf = NULL;
773  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
776  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
777  if (ret)
778  {
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",
782  value->fdwFlags);
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");
787  LocalFree(buf);
788  }
789 }
790 
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 };
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 };
803 
804 static void test_encodeSpOpusInfo(void)
805 {
806  BOOL ret;
807  LPBYTE buf;
808  DWORD size;
810  SPC_LINK moreInfo;
811 
812  memset(&info, 0, sizeof(info));
813  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
815  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
816  if (ret)
817  {
818  ok(size == sizeof(emptySequence), "unexpected size %d\n", size);
819  ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
820  LocalFree(buf);
821  }
822  info.pwszProgramName = progName;
823  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
825  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
826  if (ret)
827  {
828  ok(size == sizeof(spOpusInfoWithProgramName), "unexpected size %d\n",
829  size);
831  "unexpected value\n");
832  LocalFree(buf);
833  }
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,
840  ok(!ret && GetLastError() == E_INVALIDARG,
841  "expected E_INVALIDARG, got %08x\n", GetLastError());
843  U(moreInfo).pwszUrl = winehq;
844  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
846  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
847  if (ret)
848  {
849  ok(size == sizeof(spOpusInfoWithMoreInfo),
850  "unexpected size %d\n", size);
852  "unexpected value\n");
853  LocalFree(buf);
854  }
855  info.pMoreInfo = NULL;
856  info.pPublisherInfo = &moreInfo;
857  ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
859  ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
860  if (ret)
861  {
863  "unexpected size %d\n", size);
865  "unexpected value\n");
866  LocalFree(buf);
867  }
868 }
869 
870 static void test_decodeSpOpusInfo(void)
871 {
872  BOOL ret;
873  DWORD size;
875 
876  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
878  &info, &size);
879  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
880  if (ret)
881  {
882  ok(!info->pwszProgramName, "expected NULL\n");
883  ok(!info->pMoreInfo, "expected NULL\n");
884  ok(!info->pPublisherInfo, "expected NULL\n");
885  LocalFree(info);
886  }
887  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
890  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
891  if (ret)
892  {
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");
897  LocalFree(info);
898  }
899  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
902  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
903  if (ret)
904  {
905  ok(!info->pwszProgramName, "expected NULL\n");
906  ok(info->pMoreInfo != NULL, "expected a value for pMoreInfo\n");
907  if (info->pMoreInfo)
908  {
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");
913  }
914  ok(!info->pPublisherInfo, "expected NULL\n");
915  LocalFree(info);
916  }
917  ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
920  ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
921  if (ret)
922  {
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)
928  {
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");
934  }
935  LocalFree(info);
936  }
937 }
938 
940 {
941  HMODULE hCrypt32 = LoadLibraryA("crypt32.dll");
942  pCryptDecodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptDecodeObjectEx");
943  pCryptEncodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptEncodeObjectEx");
944 
957 
958  FreeLibrary(hCrypt32);
959 }
static const BYTE spOpusInfoWithProgramName[]
Definition: asn.c:792
static void test_decodeSpOpusInfo(void)
Definition: asn.c:870
static void test_decodeSPCFinancialCriteria(void)
Definition: asn.c:68
static WCHAR url[]
Definition: asn.c:98
static const BYTE emptySequence[]
Definition: asn.c:305
#define TRUE
Definition: types.h:120
static const BYTE badMonikerSPCLink[]
Definition: asn.c:205
BYTE SPC_UUID[SPC_UUID_LENGTH]
Definition: wintrust.h:516
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static void test_decodeCatNameValue(void)
Definition: asn.c:719
static void test_decodeCatMemberInfo(void)
Definition: asn.c:597
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static void test_encodeCatMemberInfo(void)
Definition: asn.c:546
#define U(x)
Definition: wordpad.c:44
static BOOL(WINAPI *pCryptDecodeObjectEx)(DWORD
static const BYTE flagsAndFilePEImage[]
Definition: asn.c:312
#define SPC_LINK_STRUCT
Definition: wintrust.h:506
#define SPC_FILE_LINK_CHOICE
Definition: wintrust.h:537
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define CAT_MEMBERINFO_STRUCT
Definition: wintrust.h:513
static void test_encodeSPCPEImage(void)
Definition: asn.c:316
static void test_encodeCatNameValue(void)
Definition: asn.c:662
static const BYTE void DWORD *static const void void DWORD *static const BYTE falseCriteria[]
Definition: asn.c:32
static BYTE data[]
Definition: asn.c:112
static const WCHAR progName[]
Definition: asn.c:791
#define lstrlenW
Definition: compat.h:407
static const BYTE onlyFlagsPEImage[]
Definition: asn.c:307
struct _test_info info[]
Definition: SetCursorPos.c:19
static const BYTE catMemberInfoWithGuid[]
Definition: asn.c:538
static const BYTE flagsAndEmptyFilePEImage[]
Definition: asn.c:310
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
static const BYTE void DWORD *static const void PCRYPT_ENCODE_PARA
Definition: asn.c:30
static WCHAR guidStr[]
Definition: asn.c:531
unsigned char * LPBYTE
Definition: typedefs.h:52
static const BYTE onlyEmptyFilePEImage[]
Definition: asn.c:308
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CAT_NAMEVALUE_STRUCT
Definition: wintrust.h:512
#define SPC_SP_OPUS_INFO_STRUCT
Definition: wintrust.h:508
#define OSS_TOO_LONG
Definition: winerror.h:3053
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define ok(value,...)
static const BYTE urlSPCLink[]
Definition: asn.c:103
static const BYTE catMemberInfoWithSillyGuid[]
Definition: asn.c:536
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static void test_encodeSpOpusInfo(void)
Definition: asn.c:804
static const BYTE spOpusInfoWithPublisherInfo[]
Definition: asn.c:800
static const BYTE catNameValueWithTag[]
Definition: asn.c:653
#define SPC_URL_LINK_CHOICE
Definition: wintrust.h:535
static WCHAR winehq[]
Definition: asn.c:795
static const BYTE emptyMonikerSPCLink[]
Definition: asn.c:109
#define FreeLibrary(x)
Definition: compat.h:405
GLsizeiptr size
Definition: glext.h:5919
static const WCHAR nihongoURL[]
Definition: asn.c:100
DWORD cUnusedBits
Definition: wincrypt.h:198
#define CRYPT_E_BAD_ENCODE
Definition: winerror.h:3005
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
static const BYTE spOpusInfoWithMoreInfo[]
Definition: asn.c:797
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
PSPC_LINK pFile
Definition: wintrust.h:553
static BYTE flags[]
Definition: asn.c:306
GLbitfield flags
Definition: glext.h:7161
static const BYTE catNameValueWithFlags[]
Definition: asn.c:655
#define SPC_MONIKER_LINK_CHOICE
Definition: wintrust.h:536
int ret
static void test_decodeSPCPEImage(void)
Definition: asn.c:421
static const BYTE catNameValueWithValue[]
Definition: asn.c:657
static const BYTE PCRYPT_DECODE_PARA
Definition: asn.c:29
#define OSS_DATA_ERROR
Definition: winerror.h:3042
static const BYTE emptyURLSPCLink[]
Definition: asn.c:102
unsigned char BYTE
Definition: mem.h:68
static WCHAR foo[]
Definition: asn.c:530
static BYTE aVal[]
Definition: asn.c:660
GLsizei const GLfloat * value
Definition: glext.h:6069
static const BYTE emptyCatNameValue[]
Definition: asn.c:651
static void test_encodeSPCLink(void)
Definition: asn.c:117
static LPCSTR
Definition: asn.c:29
static const BYTE trueCriteria[]
Definition: asn.c:33
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static void test_decodeSPCLink(void)
Definition: asn.c:209
static void test_encodeSPCFinancialCriteria(void)
Definition: asn.c:35
static const BYTE emptyCatMemberInfo[]
Definition: asn.c:535
#define skip(...)
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:3026
CRYPT_BIT_BLOB Flags
Definition: wintrust.h:552
START_TEST(asn)
Definition: asn.c:939
#define SPC_FINANCIAL_CRITERIA_STRUCT
Definition: wintrust.h:503
GLenum GLuint id
Definition: glext.h:5579
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define OSS_BAD_PTR
Definition: winerror.h:3048
#define GetProcAddress(x, y)
Definition: compat.h:410
const WCHAR * link
Definition: db.cpp:985
static const BYTE DWORD
Definition: asn.c:29
static const BYTE monikerSPCLink[]
Definition: asn.c:113
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define SPC_PE_IMAGE_DATA_STRUCT
Definition: wintrust.h:505
static const BYTE fileSPCLink[]
Definition: asn.c:106
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
BYTE * pbData
Definition: wincrypt.h:197