ReactOS 0.4.17-dev-470-gf9e3448
str.c
Go to the documentation of this file.
1/*
2 * Copyright 2006 Juan Lang for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18#include <stdarg.h>
19
20#include "windef.h"
21#include "winbase.h"
22#include "winnls.h"
23#include "winuser.h"
24#include "wincrypt.h"
25#include "wine/debug.h"
26#include "crypt32_private.h"
27
29
31 LPSTR value, DWORD value_len)
32{
33 DWORD len, len_mb, ret;
35
36 TRACE("(%ld, %p, %p, %ld)\n", type, value_blob, value, value_len);
37
38 len = CertRDNValueToStrW(type, value_blob, NULL, 0);
39
40 if (!(valueW = CryptMemAlloc(len * sizeof(*valueW))))
41 {
42 ERR("No memory.\n");
43 if (value && value_len) *value = 0;
44 return 1;
45 }
46
47 len = CertRDNValueToStrW(type, value_blob, valueW, len);
48 len_mb = WideCharToMultiByte(CP_ACP, 0, valueW, len, NULL, 0, NULL, NULL);
49 if (!value || !value_len)
50 {
52 return len_mb;
53 }
54
55 ret = WideCharToMultiByte(CP_ACP, 0, valueW, len, value, value_len, NULL, NULL);
56 if (ret < len_mb)
57 {
58 value[0] = 0;
59 ret = 1;
60 }
62 return ret;
63}
64
66 LPWSTR psz, DWORD csz, BOOL partial_copy)
67{
68 DWORD ret = 0, len, i;
69
70 TRACE("(%ld, %p, %p, %ld)\n", dwValueType, pValue, psz, csz);
71
72 switch (dwValueType)
73 {
75 break;
84 len = pValue->cbData;
85 if (!psz || !csz) ret = len;
86 else if (len < csz || partial_copy)
87 {
88 len = min(len, csz - 1);
89 for (i = 0; i < len; ++i)
90 psz[i] = pValue->pbData[i];
91 ret = len;
92 }
93 break;
96 len = pValue->cbData / sizeof(WCHAR);
97 if (!psz || !csz)
98 ret = len;
99 else if (len < csz || partial_copy)
100 {
101 WCHAR *ptr = psz;
102
103 len = min(len, csz - 1);
104 for (i = 0; i < len; ++i)
105 ptr[i] = ((LPCWSTR)pValue->pbData)[i];
106 ret = len;
107 }
108 break;
109 default:
110 FIXME("string type %ld unimplemented\n", dwValueType);
111 }
112 if (psz && csz) psz[ret] = 0;
113 TRACE("returning %ld (%s)\n", ret + 1, debugstr_w(psz));
114 return ret + 1;
115}
116
118 LPWSTR psz, DWORD csz)
119{
120 return rdn_value_to_strW(dwValueType, pValue, psz, csz, FALSE);
121}
122
124{
125 switch(c)
126 {
127 case '+':
128 case ',':
129 case '"':
130 case '=':
131 case '<':
132 case '>':
133 case ';':
134 case '#':
135 case '\n':
136 return TRUE;
137 default:
138 return FALSE;
139 }
140}
141
142static inline BOOL is_spaceW(WCHAR c)
143{
144 return c <= 0x7f && isspace((char)c);
145}
146
148 DWORD dwStrType, LPWSTR psz, DWORD csz)
149{
150 DWORD ret = 0, len, i, strLen;
151 BOOL needsQuotes = FALSE;
152
153 TRACE("(%ld, %p, %p, %ld)\n", dwValueType, pValue, psz, csz);
154
155 switch (dwValueType)
156 {
158 break;
167 len = pValue->cbData;
168 if (!(dwStrType & CERT_NAME_STR_NO_QUOTING_FLAG))
169 {
170 if (pValue->cbData && isspace(pValue->pbData[0]))
171 needsQuotes = TRUE;
172 if (pValue->cbData && isspace(pValue->pbData[pValue->cbData - 1]))
173 needsQuotes = TRUE;
174 for (i = 0; i < pValue->cbData; i++)
175 {
176 if (is_quotable_char(pValue->pbData[i]))
177 needsQuotes = TRUE;
178 if (pValue->pbData[i] == '"')
179 len += 1;
180 }
181 if (needsQuotes)
182 len += 2;
183 }
184 if (!psz || !csz)
185 ret = len;
186 else
187 {
188 WCHAR *ptr = psz;
189
190 if (needsQuotes)
191 *ptr++ = '"';
192 for (i = 0; i < pValue->cbData && ptr - psz < csz; ptr++, i++)
193 {
194 *ptr = pValue->pbData[i];
195 if (!(dwStrType & CERT_NAME_STR_NO_QUOTING_FLAG) &&
196 pValue->pbData[i] == '"' && ptr - psz < csz - 1)
197 *(++ptr) = '"';
198 }
199 if (needsQuotes && ptr - psz < csz)
200 *ptr++ = '"';
201 ret = ptr - psz;
202 }
203 break;
206 strLen = len = pValue->cbData / sizeof(WCHAR);
207 if (!(dwStrType & CERT_NAME_STR_NO_QUOTING_FLAG))
208 {
209 if (strLen && is_spaceW(((LPCWSTR)pValue->pbData)[0]))
210 needsQuotes = TRUE;
211 if (strLen && is_spaceW(((LPCWSTR)pValue->pbData)[strLen - 1]))
212 needsQuotes = TRUE;
213 for (i = 0; i < strLen; i++)
214 {
215 if (is_quotable_char(((LPCWSTR)pValue->pbData)[i]))
216 needsQuotes = TRUE;
217 if (((LPCWSTR)pValue->pbData)[i] == '"')
218 len += 1;
219 }
220 if (needsQuotes)
221 len += 2;
222 }
223 if (!psz || !csz)
224 ret = len;
225 else
226 {
227 WCHAR *ptr = psz;
228
229 if (needsQuotes)
230 *ptr++ = '"';
231 for (i = 0; i < strLen && ptr - psz < csz; ptr++, i++)
232 {
233 *ptr = ((LPCWSTR)pValue->pbData)[i];
234 if (!(dwStrType & CERT_NAME_STR_NO_QUOTING_FLAG) &&
235 ((LPCWSTR)pValue->pbData)[i] == '"' && ptr - psz < csz - 1)
236 *(++ptr) = '"';
237 }
238 if (needsQuotes && ptr - psz < csz)
239 *ptr++ = '"';
240 ret = ptr - psz;
241 }
242 break;
243 default:
244 FIXME("string type %ld unimplemented\n", dwValueType);
245 }
246 TRACE("returning %ld (%s)\n", ret, debugstr_w(psz));
247 return ret;
248}
249
251{
252 DWORD len, len_mb, ret;
253 LPWSTR strW;
254
255 TRACE("(%ld, %p, %08lx, %p, %ld)\n", encoding_type, name_blob, str_type, str, str_len);
256
257 len = CertNameToStrW(encoding_type, name_blob, str_type, NULL, 0);
258
259 if (!(strW = CryptMemAlloc(len * sizeof(*strW))))
260 {
261 ERR("No memory.\n");
262 if (str && str_len) *str = 0;
263 return 1;
264 }
265
266 len = CertNameToStrW(encoding_type, name_blob, str_type, strW, len);
267 len_mb = WideCharToMultiByte(CP_ACP, 0, strW, len, NULL, 0, NULL, NULL);
268 if (!str || !str_len)
269 {
271 return len_mb;
272 }
273
275 if (ret < len_mb)
276 {
277 str[0] = 0;
278 ret = 1;
279 }
281 return ret;
282}
283
284/* Adds the prefix prefix to the wide-character string pointed to by psz,
285 * followed by the character '='. Copies no more than csz characters. Returns
286 * the number of characters copied. If psz is NULL, returns the number of
287 * characters that would be copied.
288 * Assumes the characters in prefix are ASCII (not multibyte characters.)
289 */
291{
292 DWORD chars;
293
294 TRACE("(%s, %p, %ld)\n", debugstr_a(prefix), psz, csz);
295
296 if (psz)
297 {
298 DWORD i;
299
300 chars = min(strlen(prefix), csz);
301 for (i = 0; i < chars; i++)
302 *(psz + i) = prefix[i];
303 *(psz + chars) = '=';
304 chars++;
305 }
306 else
307 chars = lstrlenA(prefix) + 1;
308 return chars;
309}
310
311/* Adds the prefix prefix to the string pointed to by psz, followed by the
312 * character '='. Copies no more than csz characters. Returns the number of
313 * characters copied. If psz is NULL, returns the number of characters that
314 * would be copied.
315 */
317{
318 DWORD chars;
319
320 TRACE("(%s, %p, %ld)\n", debugstr_w(prefix), psz, csz);
321
322 if (psz)
323 {
324 chars = min(lstrlenW(prefix), csz);
325 memcpy(psz, prefix, chars * sizeof(WCHAR));
326 *(psz + chars) = '=';
327 chars++;
328 }
329 else
330 chars = lstrlenW(prefix) + 1;
331 return chars;
332}
333
334static const WCHAR indent[] = L" ";
335
336DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel,
337 const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
338{
339 static const DWORD unsupportedFlags = CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG;
340 DWORD ret = 0, bytes = 0;
341 BOOL bRet;
343 DWORD chars;
344
345 if (dwStrType & unsupportedFlags)
346 FIXME("unsupported flags: %08lx\n", dwStrType & unsupportedFlags);
347
348 bRet = CryptDecodeObjectEx(dwCertEncodingType, X509_NAME, pName->pbData,
350 if (bRet)
351 {
352 DWORD i, j, sepLen, rdnSepLen;
353 LPCWSTR sep, rdnSep;
355 const CERT_RDN *rdn = info->rgRDN;
356
357 if(reverse && info->cRDN > 1) rdn += (info->cRDN - 1);
358
359 if (dwStrType & CERT_NAME_STR_SEMICOLON_FLAG)
360 sep = L"; ";
361 else if (dwStrType & CERT_NAME_STR_CRLF_FLAG)
362 sep = L"\r\n";
363 else
364 sep = L", ";
365 sepLen = lstrlenW(sep);
366 if (dwStrType & CERT_NAME_STR_NO_PLUS_FLAG)
367 rdnSep = L" ";
368 else
369 rdnSep = L" + ";
370 rdnSepLen = lstrlenW(rdnSep);
371 if (!csz) psz = NULL;
372 for (i = 0; i < info->cRDN; i++)
373 {
374 if (psz && ret + 1 == csz) break;
375 for (j = 0; j < rdn->cRDNAttr; j++)
376 {
377 LPCSTR prefixA = NULL;
378 LPCWSTR prefixW = NULL;
379
380 if (psz && ret + 1 == csz) break;
381
382 if ((dwStrType & 0x000000ff) == CERT_OID_NAME_STR)
383 prefixA = rdn->rgRDNAttr[j].pszObjId;
384 else if ((dwStrType & 0x000000ff) == CERT_X500_NAME_STR)
385 {
388 rdn->rgRDNAttr[j].pszObjId,
390
391 if (oidInfo)
392 prefixW = oidInfo->pwszName;
393 else
394 prefixA = rdn->rgRDNAttr[j].pszObjId;
395 }
396 if (dwStrType & CERT_NAME_STR_CRLF_FLAG)
397 {
398 DWORD k;
399
400 for (k = 0; k < indentLevel; k++)
401 {
402 if (psz)
403 {
404 chars = min(lstrlenW(indent), csz - ret - 1);
405 memcpy(psz + ret, indent, chars * sizeof(WCHAR));
406 }
407 else
408 chars = lstrlenW(indent);
409 ret += chars;
410 }
411 if (psz && ret + 1 == csz) break;
412 }
413 if (prefixW)
414 {
415 /* - 1 is needed to account for the NULL terminator. */
416 chars = CRYPT_AddPrefixW(prefixW,
417 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
418 ret += chars;
419 }
420 else if (prefixA)
421 {
422 /* - 1 is needed to account for the NULL terminator. */
423 chars = CRYPT_AddPrefixAToW(prefixA,
424 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
425 ret += chars;
426 }
427 if (psz && ret + 1 == csz) break;
428
429 chars = quote_rdn_value_to_str_w(rdn->rgRDNAttr[j].dwValueType, &rdn->rgRDNAttr[j].Value, dwStrType,
430 psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
431 ret += chars;
432 if (j < rdn->cRDNAttr - 1)
433 {
434 if (psz)
435 {
436 chars = min(rdnSepLen, csz - ret - 1);
437 memcpy(psz + ret, rdnSep, chars * sizeof(WCHAR));
438 ret += chars;
439 }
440 else ret += rdnSepLen;
441 }
442 }
443 if (psz && ret + 1 == csz) break;
444 if (i < info->cRDN - 1)
445 {
446 if (psz)
447 {
448 chars = min(sepLen, csz - ret - 1);
449 memcpy(psz + ret, sep, chars * sizeof(WCHAR));
450 ret += chars;
451 }
452 else ret += sepLen;
453 }
454 if(reverse) rdn--;
455 else rdn++;
456 }
458 }
459 if (psz && csz) psz[ret] = 0;
460 return ret + 1;
461}
462
464 DWORD dwStrType, LPWSTR psz, DWORD csz)
465{
466 BOOL ret;
467
468 TRACE("(%ld, %p, %08lx, %p, %ld)\n", dwCertEncodingType, pName, dwStrType,
469 psz, csz);
470
471 ret = cert_name_to_str_with_indent(dwCertEncodingType, 0, pName, dwStrType,
472 psz, csz);
473 TRACE("Returning %s\n", debugstr_w(psz));
474 return ret;
475}
476
477BOOL WINAPI CertStrToNameA(DWORD dwCertEncodingType, LPCSTR pszX500,
478 DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded,
479 LPCSTR *ppszError)
480{
481 BOOL ret;
482 int len;
483
484 TRACE("(%08lx, %s, %08lx, %p, %p, %p, %p)\n", dwCertEncodingType,
485 debugstr_a(pszX500), dwStrType, pvReserved, pbEncoded, pcbEncoded,
486 ppszError);
487
488 len = MultiByteToWideChar(CP_ACP, 0, pszX500, -1, NULL, 0);
489 if (len)
490 {
491 LPWSTR x500, errorStr;
492
493 if ((x500 = CryptMemAlloc(len * sizeof(WCHAR))))
494 {
495 MultiByteToWideChar(CP_ACP, 0, pszX500, -1, x500, len);
496 ret = CertStrToNameW(dwCertEncodingType, x500, dwStrType,
497 pvReserved, pbEncoded, pcbEncoded,
498 ppszError ? (LPCWSTR *)&errorStr : NULL);
499 if (ppszError)
500 {
501 if (!ret)
502 {
503 LONG i;
504
505 *ppszError = pszX500;
506 for (i = 0; i < errorStr - x500; i++)
507 *ppszError = CharNextA(*ppszError);
508 }
509 else
510 *ppszError = NULL;
511 }
512 CryptMemFree(x500);
513 }
514 else
515 {
517 ret = FALSE;
518 }
519 }
520 else
521 {
523 if (ppszError)
524 *ppszError = pszX500;
525 ret = FALSE;
526 }
527 return ret;
528}
529
531{
532 WCHAR buf[10]; /* big enough for L"GivenName" */
533 LPWSTR keyName; /* usually = buf, but may be allocated */
534 DWORD keyLen; /* full available buffer size in WCHARs */
535};
536
538{
539 keeper->keyName = keeper->buf;
540 keeper->keyLen = ARRAY_SIZE(keeper->buf);
541}
542
543static void CRYPT_FreeKeynameKeeper(struct KeynameKeeper *keeper)
544{
545 if (keeper->keyName != keeper->buf)
546 CryptMemFree(keeper->keyName);
547}
548
550{
553};
554
556 const struct X500TokenW *key)
557{
558 DWORD len = key->end - key->start;
559
560 if (len >= keeper->keyLen)
561 {
562 CRYPT_FreeKeynameKeeper( keeper );
563 keeper->keyLen = len + 1;
564 keeper->keyName = CryptMemAlloc(keeper->keyLen * sizeof(WCHAR));
565 }
566 memcpy(keeper->keyName, key->start, len * sizeof(WCHAR));
567 keeper->keyName[len] = '\0';
568 TRACE("Keyname is %s\n", debugstr_w(keeper->keyName));
569}
570
572 LPCWSTR *ppszError)
573{
574 BOOL ret = TRUE;
575
576 while (*str && iswspace(*str))
577 str++;
578 if (*str)
579 {
580 token->start = str;
581 while (*str && *str != '=' && !iswspace(*str))
582 str++;
583 if (*str && (*str == '=' || iswspace(*str)))
584 token->end = str;
585 else
586 {
587 TRACE("missing equals char at %s\n", debugstr_w(token->start));
588 if (ppszError)
589 *ppszError = token->start;
591 ret = FALSE;
592 }
593 }
594 else
595 token->start = NULL;
596 return ret;
597}
598
599/* Assumes separators are characters in the 0-255 range */
601 WCHAR *separator_used, struct X500TokenW *token, LPCWSTR *ppszError)
602{
603 BOOL ret = TRUE;
604
605 TRACE("(%s, %s, %p, %p)\n", debugstr_w(str), debugstr_w(separators), token,
606 ppszError);
607
608 *separator_used = 0;
609 while (*str && iswspace(*str))
610 str++;
611 if (*str)
612 {
613 token->start = str;
614 if (!(dwFlags & CERT_NAME_STR_NO_QUOTING_FLAG) && *str == '"')
615 {
616 token->end = NULL;
617 str++;
618 while (!token->end && ret)
619 {
620 while (*str && *str != '"')
621 str++;
622 if (*str == '"')
623 {
624 if (*(str + 1) != '"')
625 token->end = str + 1;
626 else
627 str += 2;
628 }
629 else
630 {
631 TRACE("unterminated quote at %s\n", debugstr_w(str));
632 if (ppszError)
633 *ppszError = str;
635 ret = FALSE;
636 }
637 }
638 }
639 else
640 {
641 WCHAR map[256] = { 0 };
642
643 while (*separators)
644 map[*separators++] = 1;
645 while (*str && (*str >= 0xff || !map[*str]))
646 str++;
647 token->end = str;
648 if (map[*str]) *separator_used = *str;
649 }
650 }
651 else
652 {
653 TRACE("missing value at %s\n", debugstr_w(str));
654 if (ppszError)
655 *ppszError = str;
657 ret = FALSE;
658 }
659 return ret;
660}
661
662/* Encodes the string represented by value as the string type type into the
663 * CERT_NAME_BLOB output. If there is an error and ppszError is not NULL,
664 * *ppszError is set to the first failing character. If there is no error,
665 * output's pbData must be freed with LocalFree.
666 */
667static BOOL CRYPT_EncodeValueWithType(DWORD dwCertEncodingType,
668 const struct X500TokenW *value, PCERT_NAME_BLOB output, DWORD type,
669 LPCWSTR *ppszError)
670{
671 CERT_NAME_VALUE nameValue = { type, { 0, NULL } };
672 BOOL ret = TRUE;
673
674 if (value->end > value->start)
675 {
676 LONG i;
677 LPWSTR ptr;
678
679 nameValue.Value.pbData = CryptMemAlloc((value->end - value->start + 1) *
680 sizeof(WCHAR));
681 if (!nameValue.Value.pbData)
682 {
684 return FALSE;
685 }
686 ptr = (LPWSTR)nameValue.Value.pbData;
687 for (i = 0; i < value->end - value->start; i++)
688 {
689 *ptr++ = value->start[i];
690 if (value->start[i] == '"')
691 i++;
692 }
693 /* The string is NULL terminated because of a quirk in encoding
694 * unicode names values: if the length is given as 0, the value is
695 * assumed to be a NULL-terminated string.
696 */
697 *ptr = 0;
698 nameValue.Value.cbData = (LPBYTE)ptr - nameValue.Value.pbData;
699 }
700 ret = CryptEncodeObjectEx(dwCertEncodingType, X509_UNICODE_NAME_VALUE,
701 &nameValue, CRYPT_ENCODE_ALLOC_FLAG, NULL, &output->pbData,
702 &output->cbData);
703 if (!ret && ppszError)
704 {
707 *ppszError = value->start + output->cbData;
708 else if (type == CERT_RDN_PRINTABLE_STRING &&
710 *ppszError = value->start + output->cbData;
711 else if (type == CERT_RDN_IA5_STRING &&
713 *ppszError = value->start + output->cbData;
714 }
715 CryptMemFree(nameValue.Value.pbData);
716 return ret;
717}
718
719static BOOL CRYPT_EncodeValue(DWORD dwCertEncodingType,
720 const struct X500TokenW *value, PCERT_NAME_BLOB output, const DWORD *types,
721 LPCWSTR *ppszError)
722{
723 DWORD i;
724 BOOL ret;
725
726 ret = FALSE;
727 for (i = 0; !ret && types[i]; i++)
728 ret = CRYPT_EncodeValueWithType(dwCertEncodingType, value, output,
729 types[i], ppszError);
730 return ret;
731}
732
733static BOOL CRYPT_ValueToRDN(DWORD dwCertEncodingType, PCERT_NAME_INFO info,
734 PCCRYPT_OID_INFO keyOID, struct X500TokenW *value, DWORD dwStrType, LPCWSTR *ppszError)
735{
736 BOOL ret = FALSE;
737
738 TRACE("OID %s, value %s\n", debugstr_a(keyOID->pszOID),
739 debugstr_wn(value->start, value->end - value->start));
740
741 if (!info->rgRDN)
742 info->rgRDN = CryptMemAlloc(sizeof(CERT_RDN));
743 else
744 info->rgRDN = CryptMemRealloc(info->rgRDN,
745 (info->cRDN + 1) * sizeof(CERT_RDN));
746 if (info->rgRDN)
747 {
748 /* FIXME: support multiple RDN attrs */
749 info->rgRDN[info->cRDN].rgRDNAttr =
751 if (info->rgRDN[info->cRDN].rgRDNAttr)
752 {
753 static const DWORD defaultTypes[] = { CERT_RDN_PRINTABLE_STRING,
755 const DWORD *types;
756
757 info->rgRDN[info->cRDN].cRDNAttr = 1;
758 info->rgRDN[info->cRDN].rgRDNAttr[0].pszObjId =
759 (LPSTR)keyOID->pszOID;
760 info->rgRDN[info->cRDN].rgRDNAttr[0].dwValueType =
762 if (keyOID->ExtraInfo.cbData)
763 types = (const DWORD *)keyOID->ExtraInfo.pbData;
764 else
765 types = defaultTypes;
766
767 /* Remove surrounding quotes */
768 if (value->start[0] == '"' && !(dwStrType & CERT_NAME_STR_NO_QUOTING_FLAG))
769 {
770 value->start++;
771 value->end--;
772 }
773 ret = CRYPT_EncodeValue(dwCertEncodingType, value,
774 &info->rgRDN[info->cRDN].rgRDNAttr[0].Value, types, ppszError);
775 }
776 else
778 info->cRDN++;
779 }
780 else
782 return ret;
783}
784
785BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500,
786 DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded,
787 LPCWSTR *ppszError)
788{
789 CERT_NAME_INFO info = { 0, NULL };
790 LPCWSTR str;
791 struct KeynameKeeper keeper;
792 DWORD i;
793 BOOL ret = TRUE;
794
795 TRACE("(%08lx, %s, %08lx, %p, %p, %p, %p)\n", dwCertEncodingType,
796 debugstr_w(pszX500), dwStrType, pvReserved, pbEncoded, pcbEncoded,
797 ppszError);
798
800 str = pszX500;
801 while (str && *str && ret)
802 {
803 struct X500TokenW token;
804
805 ret = CRYPT_GetNextKeyW(str, &token, ppszError);
806 if (ret && token.start)
807 {
808 PCCRYPT_OID_INFO keyOID;
809
813 if (!keyOID)
814 {
815 if (ppszError)
816 *ppszError = token.start;
818 ret = FALSE;
819 }
820 else
821 {
822 str = token.end;
823 while (iswspace(*str))
824 str++;
825 if (*str != '=')
826 {
827 if (ppszError)
828 *ppszError = str;
830 ret = FALSE;
831 }
832 else
833 {
834 LPCWSTR sep;
835 WCHAR sep_used;
836
837 str++;
838 if (dwStrType & CERT_NAME_STR_COMMA_FLAG)
839 sep = L",";
840 else if (dwStrType & CERT_NAME_STR_SEMICOLON_FLAG)
841 sep = L";";
842 else if (dwStrType & CERT_NAME_STR_CRLF_FLAG)
843 sep = L"\r\n";
844 else if (dwStrType & CERT_NAME_STR_NO_PLUS_FLAG)
845 sep = L",;\r\n";
846 else
847 sep = L"+,;\r\n";
848 ret = CRYPT_GetNextValueW(str, dwStrType, sep, &sep_used, &token,
849 ppszError);
850 if (ret)
851 {
852 str = token.end;
853 /* if token.end points to the separator, skip it */
854 if (str && sep_used && *str == sep_used) str++;
855
856 ret = CRYPT_ValueToRDN(dwCertEncodingType, &info,
857 keyOID, &token, dwStrType, ppszError);
858 }
859 }
860 }
861 }
862 }
864 if (ret)
865 {
866 if (ppszError)
867 *ppszError = NULL;
868 ret = CryptEncodeObjectEx(dwCertEncodingType, X509_NAME, &info,
869 0, NULL, pbEncoded, pcbEncoded);
870 }
871 for (i = 0; i < info.cRDN; i++)
872 {
873 DWORD j;
874
875 for (j = 0; j < info.rgRDN[i].cRDNAttr; j++)
876 LocalFree(info.rgRDN[i].rgRDNAttr[j].Value.pbData);
877 CryptMemFree(info.rgRDN[i].rgRDNAttr);
878 }
879 CryptMemFree(info.rgRDN);
880 return ret;
881}
882
884 DWORD flags, void *type_para, LPSTR name, DWORD name_len)
885{
886 DWORD len, len_mb, ret;
888
889 TRACE("(%p, %ld, %08lx, %p, %p, %ld)\n", cert, type, flags, type_para, name, name_len);
890
891 len = CertGetNameStringW(cert, type, flags, type_para, NULL, 0);
892
893 if (!(nameW = CryptMemAlloc(len * sizeof(*nameW))))
894 {
895 ERR("No memory.\n");
896 if (name && name_len) *name = 0;
897 return 1;
898 }
899
900 len = CertGetNameStringW(cert, type, flags, type_para, nameW, len);
901 len_mb = WideCharToMultiByte(CP_ACP, 0, nameW, len, NULL, 0, NULL, NULL);
902 if (!name || !name_len)
903 {
905 return len_mb;
906 }
907
908 ret = WideCharToMultiByte(CP_ACP, 0, nameW, len, name, name_len, NULL, NULL);
909 if (ret < len_mb)
910 {
911 name[0] = 0;
912 ret = 1;
913 }
915 return ret;
916}
917
919{
920 static const char *oids[][2] =
921 {
924 };
926 DWORD bytes = 0;
927
928 ext = CertFindExtension(oids[!!alt_name_issuer][0], cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension);
929 if (!ext)
930 ext = CertFindExtension(oids[!!alt_name_issuer][1], cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension);
931 if (!ext) return FALSE;
932
933 return CryptDecodeObjectEx(cert->dwCertEncodingType, X509_ALTERNATE_NAME, ext->Value.pbData, ext->Value.cbData,
935}
936
938 unsigned int *index)
939{
940 unsigned int i;
941
942 for (i = *index; i < info->cAltEntry; ++i)
943 if (info->rgAltEntry[i].dwAltNameChoice == entry_type)
944 {
945 *index = i + 1;
946 return &info->rgAltEntry[i];
947 }
948 return NULL;
949}
950
951/* Searches cert's extensions for the alternate name extension with OID
952 * altNameOID, and if found, searches it for the alternate name type entryType.
953 * If found, returns a pointer to the entry, otherwise returns NULL.
954 * Regardless of whether an entry of the desired type is found, if the
955 * alternate name extension is present, sets *info to the decoded alternate
956 * name extension, which you must free using LocalFree.
957 * The return value is a pointer within *info, so don't free *info before
958 * you're done with the return value.
959 */
961 DWORD entry_type, PCERT_ALT_NAME_INFO *info)
962{
963 unsigned int index = 0;
964
965 if (!cert_get_alt_name_info(cert, alt_name_issuer, info)) return NULL;
966 return cert_find_next_alt_name_entry(*info, entry_type, &index);
967}
968
970 const CERT_NAME_BLOB *name, LPCSTR oid, LPWSTR pszNameString, DWORD cchNameString)
971{
972 CERT_NAME_INFO *nameInfo;
973 DWORD bytes = 0, ret = 0;
974
975 if (CryptDecodeObjectEx(encodingType, X509_NAME, name->pbData,
976 name->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &nameInfo, &bytes))
977 {
978 PCERT_RDN_ATTR nameAttr = NULL;
979
980 if (oid)
981 nameAttr = CertFindRDNAttr(oid, nameInfo);
982 else
983 {
984 static const LPCSTR attributeOIDs[] =
985 {
988 };
989 DWORD i;
990
991 for (i = 0; !nameAttr && i < ARRAY_SIZE(attributeOIDs); i++)
992 nameAttr = CertFindRDNAttr(attributeOIDs[i], nameInfo);
993 }
994 if (nameAttr)
995 ret = rdn_value_to_strW(nameAttr->dwValueType, &nameAttr->Value,
996 pszNameString, cchNameString, TRUE);
997 LocalFree(nameInfo);
998 }
999 return ret;
1000}
1001
1002static DWORD copy_output_str(WCHAR *dst, const WCHAR *src, DWORD dst_size)
1003{
1004 DWORD len = wcslen(src);
1005
1006 if (!dst || !dst_size) return len + 1;
1007 len = min(len, dst_size - 1);
1008 memcpy(dst, src, len * sizeof(*dst));
1009 dst[len] = 0;
1010 return len + 1;
1011}
1012
1014 LPWSTR name_string, DWORD name_len)
1015{
1016 static const DWORD supported_flags = CERT_NAME_ISSUER_FLAG | CERT_NAME_SEARCH_ALL_NAMES_FLAG;
1017 BOOL alt_name_issuer, search_all_names;
1021 DWORD ret = 0;
1022
1023 TRACE("(%p, %ld, %08lx, %p, %p, %ld)\n", cert, type, flags, type_para, name_string, name_len);
1024
1025 if (!cert)
1026 goto done;
1027
1028 if (flags & ~supported_flags)
1029 FIXME("Unsupported flags %#lx.\n", flags);
1030
1031 search_all_names = flags & CERT_NAME_SEARCH_ALL_NAMES_FLAG;
1032 if (search_all_names && type != CERT_NAME_DNS_TYPE)
1033 {
1034 WARN("CERT_NAME_SEARCH_ALL_NAMES_FLAG used with type %lu.\n", type);
1035 goto done;
1036 }
1037
1038 alt_name_issuer = flags & CERT_NAME_ISSUER_FLAG;
1039 name = alt_name_issuer ? &cert->pCertInfo->Issuer : &cert->pCertInfo->Subject;
1040
1041 switch (type)
1042 {
1044 {
1046
1047 if (entry)
1048 {
1049 ret = copy_output_str(name_string, entry->pwszRfc822Name, name_len);
1050 break;
1051 }
1053 name_string, name_len);
1054 break;
1055 }
1056 case CERT_NAME_RDN_TYPE:
1057 {
1058 DWORD param = type_para ? *(DWORD *)type_para : 0;
1059
1060 if (name->cbData)
1061 {
1062 ret = CertNameToStrW(cert->dwCertEncodingType, name, param, name_string, name_len);
1063 }
1064 else
1065 {
1067
1068 if (entry)
1069 ret = CertNameToStrW(cert->dwCertEncodingType, &entry->DirectoryName,
1070 param, name_string, name_len);
1071 }
1072 break;
1073 }
1075 ret = cert_get_name_from_rdn_attr(cert->dwCertEncodingType, name, type_para,
1076 name_string, name_len);
1077 if (ret) break;
1078
1080
1081 if (entry)
1083 0, name_string, name_len);
1084 break;
1086 {
1087 static const LPCSTR simpleAttributeOIDs[] =
1088 {
1090 };
1091 CERT_NAME_INFO *nameInfo = NULL;
1092 DWORD bytes = 0, i;
1093
1094 if (CryptDecodeObjectEx(cert->dwCertEncodingType, X509_NAME, name->pbData, name->cbData,
1095 CRYPT_DECODE_ALLOC_FLAG, NULL, &nameInfo, &bytes))
1096 {
1097 PCERT_RDN_ATTR nameAttr = NULL;
1098
1099 for (i = 0; !nameAttr && i < ARRAY_SIZE(simpleAttributeOIDs); i++)
1100 nameAttr = CertFindRDNAttr(simpleAttributeOIDs[i], nameInfo);
1101 if (nameAttr)
1102 ret = rdn_value_to_strW(nameAttr->dwValueType, &nameAttr->Value, name_string, name_len, TRUE);
1103 LocalFree(nameInfo);
1104 }
1105 if (ret) break;
1107 if (!info) break;
1108 if (!entry && info->cAltEntry)
1109 entry = &info->rgAltEntry[0];
1110 if (entry) ret = copy_output_str(name_string, entry->pwszRfc822Name, name_len);
1111 break;
1112 }
1114 {
1115 DWORD len = name_len;
1116
1118 ret = len;
1119 else
1121 type_para, name_string, name_len);
1122 break;
1123 }
1124 case CERT_NAME_DNS_TYPE:
1125 {
1126 unsigned int index = 0, len;
1127
1128 if (cert_get_alt_name_info(cert, alt_name_issuer, &info)
1130 {
1131 if (search_all_names)
1132 {
1133 do
1134 {
1135 if (name_string && name_len == 1) break;
1136 ret += len = copy_output_str(name_string, entry->pwszDNSName, name_len ? name_len - 1 : 0);
1137 if (name_string && name_len)
1138 {
1139 name_string += len;
1140 name_len -= len;
1141 }
1142 }
1144 }
1145 else ret = copy_output_str(name_string, entry->pwszDNSName, name_len);
1146 }
1147 else
1148 {
1149 if (!search_all_names || name_len != 1)
1150 {
1151 len = search_all_names && name_len ? name_len - 1 : name_len;
1153 name_string, len);
1154 if (name_string) name_string += ret;
1155 }
1156 }
1157
1158 if (search_all_names)
1159 {
1160 if (name_string && name_len) *name_string = 0;
1161 ++ret;
1162 }
1163 break;
1164 }
1165 case CERT_NAME_URL_TYPE:
1166 {
1167 if ((entry = cert_find_alt_name_entry(cert, alt_name_issuer, CERT_ALT_NAME_URL, &info)))
1168 ret = copy_output_str(name_string, entry->pwszURL, name_len);
1169 break;
1170 }
1171 default:
1172 FIXME("unimplemented for type %lu.\n", type);
1173 ret = 0;
1174 break;
1175 }
1176done:
1177 if (info)
1178 LocalFree(info);
1179
1180 if (!ret)
1181 {
1182 ret = 1;
1183 if (name_string && name_len) name_string[0] = 0;
1184 }
1185 return ret;
1186}
#define isspace(c)
Definition: acclib.h:69
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static const WCHAR nameW[]
Definition: main.c:49
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: _map.h:48
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6998
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2099
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:615
PCERT_RDN_ATTR WINAPI CertFindRDNAttr(LPCSTR pszObjId, PCERT_NAME_INFO pName)
Definition: cert.c:2122
BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded)
Definition: encode.c:4950
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:136
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
Definition: main.c:141
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:146
static struct list oidInfo
Definition: oid.c:1194
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1714
DWORD WINAPI CertGetNameStringA(PCCERT_CONTEXT cert, DWORD type, DWORD flags, void *type_para, LPSTR name, DWORD name_len)
Definition: str.c:883
BOOL WINAPI CertStrToNameA(DWORD dwCertEncodingType, LPCSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded, LPCSTR *ppszError)
Definition: str.c:477
static void CRYPT_FreeKeynameKeeper(struct KeynameKeeper *keeper)
Definition: str.c:543
DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel, const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:336
static BOOL CRYPT_GetNextValueW(LPCWSTR str, DWORD dwFlags, LPCWSTR separators, WCHAR *separator_used, struct X500TokenW *token, LPCWSTR *ppszError)
Definition: str.c:600
static PCERT_ALT_NAME_ENTRY cert_find_alt_name_entry(PCCERT_CONTEXT cert, BOOL alt_name_issuer, DWORD entry_type, PCERT_ALT_NAME_INFO *info)
Definition: str.c:960
static DWORD CRYPT_AddPrefixAToW(LPCSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:290
static BOOL cert_get_alt_name_info(PCCERT_CONTEXT cert, BOOL alt_name_issuer, PCERT_ALT_NAME_INFO *info)
Definition: str.c:918
static PCERT_ALT_NAME_ENTRY cert_find_next_alt_name_entry(PCERT_ALT_NAME_INFO info, DWORD entry_type, unsigned int *index)
Definition: str.c:937
static DWORD copy_output_str(WCHAR *dst, const WCHAR *src, DWORD dst_size)
Definition: str.c:1002
static DWORD quote_rdn_value_to_str_w(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:147
DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, void *type_para, LPWSTR name_string, DWORD name_len)
Definition: str.c:1013
static BOOL is_quotable_char(WCHAR c)
Definition: str.c:123
DWORD WINAPI CertNameToStrA(DWORD encoding_type, PCERT_NAME_BLOB name_blob, DWORD str_type, LPSTR str, DWORD str_len)
Definition: str.c:250
static BOOL CRYPT_EncodeValue(DWORD dwCertEncodingType, const struct X500TokenW *value, PCERT_NAME_BLOB output, const DWORD *types, LPCWSTR *ppszError)
Definition: str.c:719
static void CRYPT_InitializeKeynameKeeper(struct KeynameKeeper *keeper)
Definition: str.c:537
static BOOL is_spaceW(WCHAR c)
Definition: str.c:142
static void CRYPT_KeynameKeeperFromTokenW(struct KeynameKeeper *keeper, const struct X500TokenW *key)
Definition: str.c:555
DWORD WINAPI CertNameToStrW(DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:463
BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded, LPCWSTR *ppszError)
Definition: str.c:785
static DWORD rdn_value_to_strW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz, BOOL partial_copy)
Definition: str.c:65
static const WCHAR indent[]
Definition: str.c:334
static BOOL CRYPT_ValueToRDN(DWORD dwCertEncodingType, PCERT_NAME_INFO info, PCCRYPT_OID_INFO keyOID, struct X500TokenW *value, DWORD dwStrType, LPCWSTR *ppszError)
Definition: str.c:733
static BOOL CRYPT_GetNextKeyW(LPCWSTR str, struct X500TokenW *token, LPCWSTR *ppszError)
Definition: str.c:571
DWORD WINAPI CertRDNValueToStrA(DWORD type, PCERT_RDN_VALUE_BLOB value_blob, LPSTR value, DWORD value_len)
Definition: str.c:30
static BOOL CRYPT_EncodeValueWithType(DWORD dwCertEncodingType, const struct X500TokenW *value, PCERT_NAME_BLOB output, DWORD type, LPCWSTR *ppszError)
Definition: str.c:667
static DWORD cert_get_name_from_rdn_attr(DWORD encodingType, const CERT_NAME_BLOB *name, LPCSTR oid, LPWSTR pszNameString, DWORD cchNameString)
Definition: str.c:969
static DWORD CRYPT_AddPrefixW(LPCWSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:316
DWORD WINAPI CertRDNValueToStrW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz)
Definition: str.c:117
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
static const WCHAR *const ext[]
Definition: module.c:53
LPSTR WINAPI CharNextA(const char *ptr)
Definition: string.c:1151
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PWCHAR pValue
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum src
Definition: glext.h:6340
const GLubyte * c
Definition: glext.h:8905
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
if(dx< 0)
Definition: linetemp.h:194
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
static LPSTR pName
Definition: security.c:86
static BYTE cert[]
Definition: msg.c:1374
static LPCWSTR LPVOID pvReserved
Definition: asmcache.c:749
static WCHAR valueW[]
Definition: reg.c:1394
WCHAR strW[12]
Definition: clipboard.c:2216
#define min(a, b)
Definition: monoChain.cc:55
int k
Definition: mpi.c:3369
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)
const WCHAR * str
#define iswspace(_c)
Definition: ctype.h:669
#define TRACE(s)
Definition: solgame.cpp:4
DWORD keyLen
Definition: str.c:534
LPWSTR keyName
Definition: str.c:533
WCHAR buf[10]
Definition: str.c:532
LPCWSTR start
Definition: str.c:551
LPCWSTR end
Definition: str.c:552
Definition: wincrypt.h:341
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:282
LPSTR pszObjId
Definition: wincrypt.h:265
DWORD dwValueType
Definition: wincrypt.h:266
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:267
DWORD cRDNAttr
Definition: wincrypt.h:271
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:272
BYTE * pbData
Definition: wincrypt.h:112
CRYPT_DATA_BLOB ExtraInfo
Definition: wincrypt.h:1626
Definition: copy.c:22
Definition: name.c:39
Definition: cmds.c:130
Character const *const prefix
Definition: tempnam.cpp:195
#define str_len
Definition: treelist.c:89
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
Definition: pdh_main.c:96
static void reverse(int *pidx, int cch)
Definition: bidi.c:1153
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG
Definition: wincrypt.h:3652
#define CERT_NAME_STR_NO_QUOTING_FLAG
Definition: wincrypt.h:3647
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2940
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2931
#define CERT_RDN_GENERAL_STRING
Definition: wincrypt.h:2935
#define X509_NAME
Definition: wincrypt.h:3524
#define CERT_NAME_SIMPLE_DISPLAY_TYPE
Definition: wincrypt.h:3658
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2927
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:360
#define CERT_X500_NAME_STR
Definition: wincrypt.h:3644
#define CERT_NAME_EMAIL_TYPE
Definition: wincrypt.h:3655
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:358
#define szOID_ISSUER_ALT_NAME2
Definition: wincrypt.h:3344
#define CERT_ALT_NAME_RFC822_NAME
Definition: wincrypt.h:355
#define CERT_RDN_VISIBLE_STRING
Definition: wincrypt.h:2933
#define CERT_NAME_STR_NO_PLUS_FLAG
Definition: wincrypt.h:3646
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
#define CRYPT_OID_INFO_NAME_KEY
Definition: wincrypt.h:1956
#define CERT_NAME_STR_SEMICOLON_FLAG
Definition: wincrypt.h:3645
#define CERT_NAME_SEARCH_ALL_NAMES_FLAG
Definition: wincrypt.h:3665
#define CRYPT_RDN_ATTR_OID_GROUP_ID
Definition: wincrypt.h:1941
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3612
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3648
#define szOID_ORGANIZATIONAL_UNIT_NAME
Definition: wincrypt.h:3298
#define CERT_FRIENDLY_NAME_PROP_ID
Definition: wincrypt.h:2844
#define CERT_RDN_VIDEOTEX_STRING
Definition: wincrypt.h:2930
#define szOID_RSA_emailAddr
Definition: wincrypt.h:3188
#define CERT_NAME_DNS_TYPE
Definition: wincrypt.h:3660
#define szOID_SUBJECT_ALT_NAME
Definition: wincrypt.h:3336
#define CERT_ALT_NAME_DNS_NAME
Definition: wincrypt.h:356
#define CERT_NAME_RDN_TYPE
Definition: wincrypt.h:3656
#define szOID_SUBJECT_ALT_NAME2
Definition: wincrypt.h:3343
#define CERT_NAME_ISSUER_FLAG
Definition: wincrypt.h:3664
#define CERT_NAME_STR_COMMA_FLAG
Definition: wincrypt.h:3649
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3599
#define CERT_RDN_ENCODED_BLOB
Definition: wincrypt.h:2924
#define CERT_NAME_ATTR_TYPE
Definition: wincrypt.h:3657
#define CERT_NAME_URL_TYPE
Definition: wincrypt.h:3661
#define CERT_RDN_NUMERIC_STRING
Definition: wincrypt.h:2926
#define CRYPT_OID_INFO_OID_KEY
Definition: wincrypt.h:1955
#define X509_ALTERNATE_NAME
Definition: wincrypt.h:3529
#define szOID_COMMON_NAME
Definition: wincrypt.h:3290
#define CERT_NAME_STR_REVERSE_FLAG
Definition: wincrypt.h:3650
#define CERT_RDN_TELETEX_STRING
Definition: wincrypt.h:2928
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2938
#define CERT_OID_NAME_STR
Definition: wincrypt.h:3643
#define CERT_RDN_ANY_TYPE
Definition: wincrypt.h:2923
#define szOID_ISSUER_ALT_NAME
Definition: wincrypt.h:3337
#define CERT_RDN_GRAPHIC_STRING
Definition: wincrypt.h:2932
#define CERT_NAME_FRIENDLY_DISPLAY_TYPE
Definition: wincrypt.h:3659
#define szOID_ORGANIZATION_NAME
Definition: wincrypt.h:3297
#define X509_UNICODE_NAME_VALUE
Definition: wincrypt.h:3541
#define WINAPI
Definition: msvc.h:6
#define CRYPT_E_INVALID_PRINTABLE_STRING
Definition: winerror.h:4439
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:4440
#define CRYPT_E_INVALID_NUMERIC_STRING
Definition: winerror.h:4438
#define CRYPT_E_INVALID_X500_STRING
Definition: winerror.h:4441
unsigned char BYTE
Definition: xxhash.c:193