ReactOS 0.4.16-dev-852-gcfcc8d8
main.c
Go to the documentation of this file.
1/*
2 * Copyright 2008 Maarten Lankhorst
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
19#define NONAMELESSUNION
20
21#include <stdarg.h>
22#ifdef __REACTOS__
23#include <wchar.h>
24#endif
25
26#include "windef.h"
27#include "winbase.h"
28#include "winnls.h"
29#include "winreg.h"
30#include "wincrypt.h"
31#include "wintrust.h"
32#include "winuser.h"
33#include "objbase.h"
34#include "cryptdlg.h"
35#include "cryptuiapi.h"
36#include "cryptres.h"
37#include "wine/debug.h"
38
40
42
44{
45 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
46
47 switch (fdwReason)
48 {
49#ifndef __REACTOS__
50 case DLL_WINE_PREATTACH:
51 return FALSE; /* prefer native version */
52#endif
55 hInstance = hinstDLL;
56 break;
57 }
58 return TRUE;
59}
60
61/***********************************************************************
62 * GetFriendlyNameOfCertA (CRYPTDLG.@)
63 */
66{
68 pchBuffer, cchBuffer);
69}
70
71/***********************************************************************
72 * GetFriendlyNameOfCertW (CRYPTDLG.@)
73 */
76{
78 pchBuffer, cchBuffer);
79}
80
81/***********************************************************************
82 * CertTrustInit (CRYPTDLG.@)
83 */
85{
87
88 TRACE("(%p)\n", pProvData);
89
90 if (pProvData->padwTrustStepErrors &&
92 ret = S_OK;
93 TRACE("returning %08x\n", ret);
94 return ret;
95}
96
97/***********************************************************************
98 * CertTrustCertPolicy (CRYPTDLG.@)
99 */
100BOOL WINAPI CertTrustCertPolicy(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSignerChain, DWORD idxCounterSigner)
101{
102 FIXME("(%p, %d, %s, %d)\n", pProvData, idxSigner, fCounterSignerChain ? "TRUE" : "FALSE", idxCounterSigner);
103 return FALSE;
104}
105
106/***********************************************************************
107 * CertTrustCleanup (CRYPTDLG.@)
108 */
110{
111 FIXME("(%p)\n", pProvData);
112 return E_NOTIMPL;
113}
114
116{
117 static const WCHAR policyFlagsKey[] = { 'S','o','f','t','w','a','r','e',
118 '\\','M','i','c','r','o','s','o','f','t','\\','C','r','y','p','t','o','g',
119 'r','a','p','h','y','\\','{','7','8','0','1','e','b','d','0','-','c','f',
120 '4','b','-','1','1','d','0','-','8','5','1','f','-','0','0','6','0','9',
121 '7','9','3','8','7','e','a','}',0 };
122 static const WCHAR policyFlags[] = { 'P','o','l','i','c','y','F','l','a',
123 'g','s',0 };
124 HKEY key;
125 BOOL ret = FALSE;
126
127 if (!RegOpenKeyExW(HKEY_LOCAL_MACHINE, policyFlagsKey, 0, KEY_READ, &key))
128 {
129 DWORD type, flags, size = sizeof(flags);
130
131 if (!RegQueryValueExW(key, policyFlags, NULL, &type, (BYTE *)&flags,
132 &size) && type == REG_DWORD)
133 {
134 /* The flag values aren't defined in any header I'm aware of, but
135 * this value is well documented on the net.
136 */
137 if (flags & 0x00010000)
138 ret = TRUE;
139 }
141 }
142 return ret;
143}
144
145/* Returns TRUE if pCert is not in the Disallowed system store, or FALSE if it
146 * is.
147 */
149{
150 BOOL ret;
151 BYTE hash[20];
152 DWORD size = sizeof(hash);
153
156 {
157 static const WCHAR disallowedW[] =
158 { 'D','i','s','a','l','l','o','w','e','d',0 };
161
162 if (disallowed)
163 {
166
167 if (found)
168 {
169 ret = FALSE;
171 }
173 }
174 }
175 return ret;
176}
177
179{
180 DWORD confidence = 0;
181
182 confidence = 0;
183 if (!(errorStatus & CERT_TRUST_IS_NOT_SIGNATURE_VALID))
184 confidence |= CERT_CONFIDENCE_SIG;
185 if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_VALID))
186 confidence |= CERT_CONFIDENCE_TIME;
187 if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_NESTED))
188 confidence |= CERT_CONFIDENCE_TIMENEST;
189 return confidence;
190}
191
194{
195 BOOL ret;
196 CRYPT_PROVIDER_SGNR signer;
197 PCERT_SIMPLE_CHAIN simpleChain = chain->rgpChain[0];
198 DWORD i;
199
200 memset(&signer, 0, sizeof(signer));
201 signer.cbStruct = sizeof(signer);
202 ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
203 if (ret)
204 {
206 FALSE, 0);
207
208 if (sgnr)
209 {
210 sgnr->dwError = simpleChain->TrustStatus.dwErrorStatus;
212 }
213 else
214 ret = FALSE;
215 for (i = 0; ret && i < simpleChain->cElement; i++)
216 {
217 ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
218 simpleChain->rgpElement[i]->pCertContext);
219 if (ret)
220 {
222
223 if ((cert = WTHelperGetProvCertFromChain(sgnr, i)))
224 {
225 CERT_CHAIN_ELEMENT *element = simpleChain->rgpElement[i];
226
228 element->TrustStatus.dwErrorStatus);
229 cert->dwError = element->TrustStatus.dwErrorStatus;
230 cert->pChainElement = element;
231 }
232 else
233 ret = FALSE;
234 }
235 }
236 }
237 return ret;
238}
239
242{
244
245 /* This should always be true, but just in case the calling function is
246 * called directly:
247 */
248 if (data->pWintrustData->dwUnionChoice == WTD_CHOICE_BLOB &&
249 data->pWintrustData->u.pBlob && data->pWintrustData->u.pBlob->cbMemObject ==
251 data->pWintrustData->u.pBlob->pbMemObject)
253 data->pWintrustData->u.pBlob->pbMemObject;
254 return pCert;
255}
256
258{
259 HCERTCHAINENGINE engine = NULL;
260 HCERTSTORE root = NULL, trust = NULL;
261 DWORD i;
262
263 if (cert->cRootStores)
264 {
267 if (root)
268 {
269 for (i = 0; i < cert->cRootStores; i++)
270 CertAddStoreToCollection(root, cert->rghstoreRoots[i], 0, 0);
271 }
272 }
273 if (cert->cTrustStores)
274 {
277 if (trust)
278 {
279 for (i = 0; i < cert->cTrustStores; i++)
280 CertAddStoreToCollection(trust, cert->rghstoreTrust[i], 0, 0);
281 }
282 }
283 if (cert->cRootStores || cert->cStores || cert->cTrustStores)
284 {
286
287 memset(&config, 0, sizeof(config));
288 config.cbSize = sizeof(config);
289 config.hRestrictedRoot = root;
290 config.hRestrictedTrust = trust;
291 config.cAdditionalStore = cert->cStores;
292 config.rghAdditionalStore = cert->rghstoreCAs;
293 config.hRestrictedRoot = root;
296 CertCloseStore(trust, 0);
297 }
298 return engine;
299}
300
301/***********************************************************************
302 * CertTrustFinalPolicy (CRYPTDLG.@)
303 */
305{
306 BOOL ret;
307 DWORD err = S_OK;
309
310 TRACE("(%p)\n", data);
311
312 if (data->pWintrustData->dwUIChoice != WTD_UI_NONE)
313 FIXME("unimplemented for UI choice %d\n",
314 data->pWintrustData->dwUIChoice);
315 if (pCert)
316 {
317 DWORD flags = 0;
318 CERT_CHAIN_PARA chainPara;
319 HCERTCHAINENGINE engine;
320
321 memset(&chainPara, 0, sizeof(chainPara));
322 chainPara.cbSize = sizeof(chainPara);
325 engine = CRYPTDLG_MakeEngine(pCert);
326 GetSystemTimeAsFileTime(&data->sftSystemTime);
328 if (ret)
329 {
331
332 ret = CertGetCertificateChain(engine, pCert->pccert,
333 &data->sftSystemTime, NULL, &chainPara, flags, NULL, &chain);
334 if (ret)
335 {
336 if (chain->cChain != 1)
337 {
338 FIXME("unimplemented for more than 1 simple chain\n");
340 ret = FALSE;
341 }
342 else if ((ret = CRYPTDLG_CopyChain(data, chain)))
343 {
344 if (CertVerifyTimeValidity(&data->sftSystemTime,
345 pCert->pccert->pCertInfo))
346 {
347 ret = FALSE;
349 }
350 }
351 else
354 }
355 else
357 }
359 }
360 else
361 {
362 ret = FALSE;
364 }
365 /* Oddly, native doesn't set the error in the trust step error location,
366 * probably because this action is more advisory than anything else.
367 * Instead it stores it as the final error, but the function "succeeds" in
368 * any case.
369 */
370 if (!ret)
371 data->dwFinalError = err;
372 TRACE("returning %d (%08x)\n", S_OK, data->dwFinalError);
373 return S_OK;
374}
375
376/***********************************************************************
377 * CertViewPropertiesA (CRYPTDLG.@)
378 */
380{
382 LPWSTR title = NULL;
383 BOOL ret;
384
385 TRACE("(%p)\n", info);
386
387 memcpy(&infoW, info, sizeof(infoW));
388 if (info->szTitle)
389 {
390 int len = MultiByteToWideChar(CP_ACP, 0, info->szTitle, -1, NULL, 0);
391
392 title = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
393 if (title)
394 {
395 MultiByteToWideChar(CP_ACP, 0, info->szTitle, -1, title, len);
396 infoW.szTitle = title;
397 }
398 else
399 {
400 ret = FALSE;
401 goto error;
402 }
403 }
406error:
407 return ret;
408}
409
410/***********************************************************************
411 * CertViewPropertiesW (CRYPTDLG.@)
412 */
414{
415 static GUID cert_action_verify = CERT_CERTIFICATE_ACTION_VERIFY;
418 WINTRUST_DATA wtd;
419 LONG err;
420 BOOL ret;
421
422 TRACE("(%p)\n", info);
423
424 memset(&trust, 0, sizeof(trust));
425 trust.cbSize = sizeof(trust);
426 trust.pccert = info->pCertContext;
427 trust.cRootStores = info->cRootStores;
428 trust.rghstoreRoots = info->rghstoreRoots;
429 trust.cStores = info->cStores;
430 trust.rghstoreCAs = info->rghstoreCAs;
431 trust.cTrustStores = info->cTrustStores;
432 trust.rghstoreTrust = info->rghstoreTrust;
433 memset(&blob, 0, sizeof(blob));
434 blob.cbStruct = sizeof(blob);
435 blob.cbMemObject = sizeof(trust);
436 blob.pbMemObject = (BYTE *)&trust;
437 memset(&wtd, 0, sizeof(wtd));
438 wtd.cbStruct = sizeof(wtd);
441 wtd.u.pBlob = &blob;
443 err = WinVerifyTrust(NULL, &cert_action_verify, &wtd);
444 if (err == ERROR_SUCCESS)
445 {
447 BOOL propsChanged = FALSE;
448
449 memset(&uiInfo, 0, sizeof(uiInfo));
450 uiInfo.dwSize = sizeof(uiInfo);
451 uiInfo.hwndParent = info->hwndParent;
452 uiInfo.dwFlags =
454 uiInfo.szTitle = info->szTitle;
455 uiInfo.pCertContext = info->pCertContext;
456 uiInfo.cPurposes = info->cArrayPurposes;
457 uiInfo.rgszPurposes = (LPCSTR *)info->arrayPurposes;
458 uiInfo.u.hWVTStateData = wtd.hWVTStateData;
460 uiInfo.cPropSheetPages = info->cArrayPropSheetPages;
461 uiInfo.rgPropSheetPages = info->arrayPropSheetPages;
462 uiInfo.nStartPage = info->nStartPage;
463 ret = CryptUIDlgViewCertificateW(&uiInfo, &propsChanged);
465 WinVerifyTrust(NULL, &cert_action_verify, &wtd);
466 }
467 else
468 ret = FALSE;
469 return ret;
470}
471
473 WCHAR *str, DWORD *pcchStr)
474{
475 BOOL ret;
476 DWORD charsNeeded;
477
478 if (cbEncoded)
479 charsNeeded = (cbEncoded * 3);
480 else
481 charsNeeded = 1;
482 if (!str)
483 {
484 *pcchStr = charsNeeded;
485 ret = TRUE;
486 }
487 else if (*pcchStr < charsNeeded)
488 {
489 *pcchStr = charsNeeded;
491 ret = FALSE;
492 }
493 else
494 {
495 static const WCHAR fmt[] = { '%','0','2','x',' ',0 };
496 static const WCHAR endFmt[] = { '%','0','2','x',0 };
497 DWORD i;
498 LPWSTR ptr = str;
499
500 *pcchStr = charsNeeded;
501 if (cbEncoded)
502 {
503 for (i = 0; i < cbEncoded; i++)
504 {
505 if (i < cbEncoded - 1)
506 ptr += swprintf(ptr, fmt, pbEncoded[i]);
507 else
508 ptr += swprintf(ptr, endFmt, pbEncoded[i]);
509 }
510 }
511 else
512 *ptr = 0;
513 ret = TRUE;
514 }
515 return ret;
516}
517
518static const WCHAR indent[] = { ' ',' ',' ',' ',' ',0 };
519static const WCHAR colonCrlf[] = { ':','\r','\n',0 };
520static const WCHAR colonSpace[] = { ':',' ',0 };
521static const WCHAR crlf[] = { '\r','\n',0 };
522static const WCHAR commaSep[] = { ',',' ',0 };
523
525 DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded,
526 WCHAR *str, DWORD *pcchStr)
527{
528 BOOL ret;
529 DWORD size, charsNeeded = 1;
530 CERT_NAME_VALUE *cpsValue;
531
533 pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &cpsValue, &size)))
534 {
535 LPCWSTR sep;
536 DWORD sepLen;
537
538 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
539 sep = crlf;
540 else
541 sep = commaSep;
542
543 sepLen = lstrlenW(sep);
544
545 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
546 {
547 charsNeeded += 3 * lstrlenW(indent);
548 if (str && *pcchStr >= charsNeeded)
549 {
551 str += lstrlenW(indent);
553 str += lstrlenW(indent);
555 str += lstrlenW(indent);
556 }
557 }
558 charsNeeded += cpsValue->Value.cbData / sizeof(WCHAR);
559 if (str && *pcchStr >= charsNeeded)
560 {
561 lstrcpyW(str, (LPWSTR)cpsValue->Value.pbData);
562 str += cpsValue->Value.cbData / sizeof(WCHAR);
563 }
564 charsNeeded += sepLen;
565 if (str && *pcchStr >= charsNeeded)
566 {
567 lstrcpyW(str, sep);
568 str += sepLen;
569 }
570 LocalFree(cpsValue);
571 if (!str)
572 *pcchStr = charsNeeded;
573 else if (*pcchStr < charsNeeded)
574 {
575 *pcchStr = charsNeeded;
577 ret = FALSE;
578 }
579 else
580 *pcchStr = charsNeeded;
581 }
582 return ret;
583}
584
586 DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded,
587 WCHAR *str, DWORD *pcchStr)
588{
589 BOOL ret;
590 DWORD size, charsNeeded = 1;
592
596 {
597 static const WCHAR numFmt[] = { '%','d',0 };
599 notice->pNoticeReference;
600 LPCWSTR headingSep, sep;
601 DWORD headingSepLen, sepLen;
602 LPWSTR noticeRef, organization, noticeNum, noticeText;
603 DWORD noticeRefLen, organizationLen, noticeNumLen, noticeTextLen;
604 WCHAR noticeNumStr[11];
605
606 noticeRefLen = LoadStringW(hInstance, IDS_NOTICE_REF,
607 (LPWSTR)&noticeRef, 0);
608 organizationLen = LoadStringW(hInstance, IDS_ORGANIZATION,
609 (LPWSTR)&organization, 0);
610 noticeNumLen = LoadStringW(hInstance, IDS_NOTICE_NUM,
611 (LPWSTR)&noticeNum, 0);
612 noticeTextLen = LoadStringW(hInstance, IDS_NOTICE_TEXT,
613 (LPWSTR)&noticeText, 0);
614 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
615 {
616 headingSep = colonCrlf;
617 sep = crlf;
618 }
619 else
620 {
621 headingSep = colonSpace;
622 sep = commaSep;
623 }
624 sepLen = lstrlenW(sep);
625 headingSepLen = lstrlenW(headingSep);
626
627 if (pNoticeRef)
628 {
629 DWORD k;
630 LPCSTR src;
631
632 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
633 {
634 charsNeeded += 3 * lstrlenW(indent);
635 if (str && *pcchStr >= charsNeeded)
636 {
638 str += lstrlenW(indent);
640 str += lstrlenW(indent);
642 str += lstrlenW(indent);
643 }
644 }
645 charsNeeded += noticeRefLen;
646 if (str && *pcchStr >= charsNeeded)
647 {
648 memcpy(str, noticeRef, noticeRefLen * sizeof(WCHAR));
649 str += noticeRefLen;
650 }
651 charsNeeded += headingSepLen;
652 if (str && *pcchStr >= charsNeeded)
653 {
654 lstrcpyW(str, headingSep);
655 str += headingSepLen;
656 }
657 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
658 {
659 charsNeeded += 4 * lstrlenW(indent);
660 if (str && *pcchStr >= charsNeeded)
661 {
663 str += lstrlenW(indent);
665 str += lstrlenW(indent);
667 str += lstrlenW(indent);
669 str += lstrlenW(indent);
670 }
671 }
672 charsNeeded += organizationLen;
673 if (str && *pcchStr >= charsNeeded)
674 {
675 memcpy(str, organization, organizationLen * sizeof(WCHAR));
676 str += organizationLen;
677 }
678 charsNeeded += strlen(pNoticeRef->pszOrganization);
679 if (str && *pcchStr >= charsNeeded)
680 for (src = pNoticeRef->pszOrganization; src && *src;
681 src++, str++)
682 *str = *src;
683 charsNeeded += sepLen;
684 if (str && *pcchStr >= charsNeeded)
685 {
686 lstrcpyW(str, sep);
687 str += sepLen;
688 }
689 for (k = 0; k < pNoticeRef->cNoticeNumbers; k++)
690 {
691 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
692 {
693 charsNeeded += 4 * lstrlenW(indent);
694 if (str && *pcchStr >= charsNeeded)
695 {
697 str += lstrlenW(indent);
699 str += lstrlenW(indent);
701 str += lstrlenW(indent);
703 str += lstrlenW(indent);
704 }
705 }
706 charsNeeded += noticeNumLen;
707 if (str && *pcchStr >= charsNeeded)
708 {
709 memcpy(str, noticeNum, noticeNumLen * sizeof(WCHAR));
710 str += noticeNumLen;
711 }
712 swprintf(noticeNumStr, numFmt, k + 1);
713 charsNeeded += lstrlenW(noticeNumStr);
714 if (str && *pcchStr >= charsNeeded)
715 {
716 lstrcpyW(str, noticeNumStr);
717 str += lstrlenW(noticeNumStr);
718 }
719 charsNeeded += sepLen;
720 if (str && *pcchStr >= charsNeeded)
721 {
722 lstrcpyW(str, sep);
723 str += sepLen;
724 }
725 }
726 }
727 if (notice->pszDisplayText)
728 {
729 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
730 {
731 charsNeeded += 3 * lstrlenW(indent);
732 if (str && *pcchStr >= charsNeeded)
733 {
735 str += lstrlenW(indent);
737 str += lstrlenW(indent);
739 str += lstrlenW(indent);
740 }
741 }
742 charsNeeded += noticeTextLen;
743 if (str && *pcchStr >= charsNeeded)
744 {
745 memcpy(str, noticeText, noticeTextLen * sizeof(WCHAR));
746 str += noticeTextLen;
747 }
748 charsNeeded += lstrlenW(notice->pszDisplayText);
749 if (str && *pcchStr >= charsNeeded)
750 {
751 lstrcpyW(str, notice->pszDisplayText);
752 str += lstrlenW(notice->pszDisplayText);
753 }
754 charsNeeded += sepLen;
755 if (str && *pcchStr >= charsNeeded)
756 {
757 lstrcpyW(str, sep);
758 str += sepLen;
759 }
760 }
762 if (!str)
763 *pcchStr = charsNeeded;
764 else if (*pcchStr < charsNeeded)
765 {
766 *pcchStr = charsNeeded;
768 ret = FALSE;
769 }
770 else
771 *pcchStr = charsNeeded;
772 }
773 return ret;
774}
775
776/***********************************************************************
777 * FormatVerisignExtension (CRYPTDLG.@)
778 */
780 DWORD dwFormatType, DWORD dwFormatStrType, void *pFormatStruct,
781 LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, void *pbFormat,
782 DWORD *pcbFormat)
783{
784 CERT_POLICIES_INFO *policies;
785 DWORD size;
786 BOOL ret = FALSE;
787
788 if (!cbEncoded)
789 {
791 return FALSE;
792 }
794 pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &policies, &size)))
795 {
796 static const WCHAR numFmt[] = { '%','d',0 };
797 DWORD charsNeeded = 1; /* space for NULL terminator */
798 LPCWSTR headingSep, sep;
799 DWORD headingSepLen, sepLen;
800 WCHAR policyNum[11], policyQualifierNum[11];
801 LPWSTR certPolicy, policyId, policyQualifierInfo, policyQualifierId;
802 LPWSTR cps, userNotice, qualifier;
803 DWORD certPolicyLen, policyIdLen, policyQualifierInfoLen;
804 DWORD policyQualifierIdLen, cpsLen, userNoticeLen, qualifierLen;
805 DWORD i;
806 LPWSTR str = pbFormat;
807
808 certPolicyLen = LoadStringW(hInstance, IDS_CERT_POLICY,
809 (LPWSTR)&certPolicy, 0);
810 policyIdLen = LoadStringW(hInstance, IDS_POLICY_ID, (LPWSTR)&policyId,
811 0);
812 policyQualifierInfoLen = LoadStringW(hInstance,
813 IDS_POLICY_QUALIFIER_INFO, (LPWSTR)&policyQualifierInfo, 0);
814 policyQualifierIdLen = LoadStringW(hInstance, IDS_POLICY_QUALIFIER_ID,
815 (LPWSTR)&policyQualifierId, 0);
816 cpsLen = LoadStringW(hInstance, IDS_CPS, (LPWSTR)&cps, 0);
817 userNoticeLen = LoadStringW(hInstance, IDS_USER_NOTICE,
818 (LPWSTR)&userNotice, 0);
819 qualifierLen = LoadStringW(hInstance, IDS_QUALIFIER,
820 (LPWSTR)&qualifier, 0);
821 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
822 {
823 headingSep = colonCrlf;
824 sep = crlf;
825 }
826 else
827 {
828 headingSep = colonSpace;
829 sep = commaSep;
830 }
831 sepLen = lstrlenW(sep);
832 headingSepLen = lstrlenW(headingSep);
833
834 for (i = 0; ret && i < policies->cPolicyInfo; i++)
835 {
836 CERT_POLICY_INFO *policy = &policies->rgPolicyInfo[i];
837 DWORD j;
838 LPCSTR src;
839
840 charsNeeded += 1; /* '['*/
841 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
842 *str++ = '[';
843 swprintf(policyNum, numFmt, i + 1);
844 charsNeeded += lstrlenW(policyNum);
845 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
846 {
847 lstrcpyW(str, policyNum);
848 str += lstrlenW(policyNum);
849 }
850 charsNeeded += 1; /* ']'*/
851 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
852 *str++ = ']';
853 charsNeeded += certPolicyLen;
854 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
855 {
856 memcpy(str, certPolicy, certPolicyLen * sizeof(WCHAR));
857 str += certPolicyLen;
858 }
859 charsNeeded += headingSepLen;
860 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
861 {
862 lstrcpyW(str, headingSep);
863 str += headingSepLen;
864 }
865 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
866 {
867 charsNeeded += lstrlenW(indent);
868 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
869 {
871 str += lstrlenW(indent);
872 }
873 }
874 charsNeeded += policyIdLen;
875 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
876 {
877 memcpy(str, policyId, policyIdLen * sizeof(WCHAR));
878 str += policyIdLen;
879 }
880 charsNeeded += strlen(policy->pszPolicyIdentifier);
881 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
882 {
883 for (src = policy->pszPolicyIdentifier; src && *src;
884 src++, str++)
885 *str = *src;
886 }
887 charsNeeded += sepLen;
888 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
889 {
890 lstrcpyW(str, sep);
891 str += sepLen;
892 }
893 for (j = 0; j < policy->cPolicyQualifier; j++)
894 {
895 CERT_POLICY_QUALIFIER_INFO *qualifierInfo =
896 &policy->rgPolicyQualifier[j];
897 DWORD sizeRemaining;
898
899 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
900 {
901 charsNeeded += lstrlenW(indent);
902 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
903 {
905 str += lstrlenW(indent);
906 }
907 }
908 charsNeeded += 1; /* '['*/
909 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
910 *str++ = '[';
911 charsNeeded += lstrlenW(policyNum);
912 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
913 {
914 lstrcpyW(str, policyNum);
915 str += lstrlenW(policyNum);
916 }
917 charsNeeded += 1; /* ','*/
918 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
919 *str++ = ',';
920 swprintf(policyQualifierNum, numFmt, j + 1);
921 charsNeeded += lstrlenW(policyQualifierNum);
922 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
923 {
924 lstrcpyW(str, policyQualifierNum);
925 str += lstrlenW(policyQualifierNum);
926 }
927 charsNeeded += 1; /* ']'*/
928 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
929 *str++ = ']';
930 charsNeeded += policyQualifierInfoLen;
931 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
932 {
933 memcpy(str, policyQualifierInfo,
934 policyQualifierInfoLen * sizeof(WCHAR));
935 str += policyQualifierInfoLen;
936 }
937 charsNeeded += headingSepLen;
938 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
939 {
940 lstrcpyW(str, headingSep);
941 str += headingSepLen;
942 }
943 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
944 {
945 charsNeeded += 2 * lstrlenW(indent);
946 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
947 {
949 str += lstrlenW(indent);
951 str += lstrlenW(indent);
952 }
953 }
954 charsNeeded += policyQualifierIdLen;
955 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
956 {
957 memcpy(str, policyQualifierId,
958 policyQualifierIdLen * sizeof(WCHAR));
959 str += policyQualifierIdLen;
960 }
961 if (!strcmp(qualifierInfo->pszPolicyQualifierId,
963 {
964 charsNeeded += cpsLen;
965 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
966 {
967 memcpy(str, cps, cpsLen * sizeof(WCHAR));
968 str += cpsLen;
969 }
970 }
971 else if (!strcmp(qualifierInfo->pszPolicyQualifierId,
973 {
974 charsNeeded += userNoticeLen;
975 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
976 {
977 memcpy(str, userNotice, userNoticeLen * sizeof(WCHAR));
978 str += userNoticeLen;
979 }
980 }
981 else
982 {
983 charsNeeded += strlen(qualifierInfo->pszPolicyQualifierId);
984 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
985 {
986 for (src = qualifierInfo->pszPolicyQualifierId;
987 src && *src; src++, str++)
988 *str = *src;
989 }
990 }
991 charsNeeded += sepLen;
992 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
993 {
994 lstrcpyW(str, sep);
995 str += sepLen;
996 }
997 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
998 {
999 charsNeeded += 2 * lstrlenW(indent);
1000 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
1001 {
1003 str += lstrlenW(indent);
1005 str += lstrlenW(indent);
1006 }
1007 }
1008 charsNeeded += qualifierLen;
1009 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
1010 {
1011 memcpy(str, qualifier, qualifierLen * sizeof(WCHAR));
1012 str += qualifierLen;
1013 }
1014 charsNeeded += headingSepLen;
1015 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
1016 {
1017 lstrcpyW(str, headingSep);
1018 str += headingSepLen;
1019 }
1020 /* This if block is deliberately redundant with the same if
1021 * block above, in order to keep the code more readable (the
1022 * code flow follows the order in which the strings are output.)
1023 */
1024 if (!strcmp(qualifierInfo->pszPolicyQualifierId,
1026 {
1027 if (!str || *pcbFormat < charsNeeded * sizeof(WCHAR))
1028 {
1029 /* Insufficient space, determine how much is needed. */
1031 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1032 qualifierInfo->Qualifier.cbData, NULL, &size);
1033 if (ret)
1034 charsNeeded += size - 1;
1035 }
1036 else
1037 {
1038 sizeRemaining = *pcbFormat / sizeof(WCHAR);
1039 sizeRemaining -= str - (LPWSTR)pbFormat;
1041 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1042 qualifierInfo->Qualifier.cbData, str, &sizeRemaining);
1043 if (ret || GetLastError() == ERROR_MORE_DATA)
1044 {
1045 charsNeeded += sizeRemaining - 1;
1046 str += sizeRemaining - 1;
1047 }
1048 }
1049 }
1050 else if (!strcmp(qualifierInfo->pszPolicyQualifierId,
1052 {
1053 if (!str || *pcbFormat < charsNeeded * sizeof(WCHAR))
1054 {
1055 /* Insufficient space, determine how much is needed. */
1057 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1058 qualifierInfo->Qualifier.cbData, NULL, &size);
1059 if (ret)
1060 charsNeeded += size - 1;
1061 }
1062 else
1063 {
1064 sizeRemaining = *pcbFormat / sizeof(WCHAR);
1065 sizeRemaining -= str - (LPWSTR)pbFormat;
1067 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1068 qualifierInfo->Qualifier.cbData, str, &sizeRemaining);
1069 if (ret || GetLastError() == ERROR_MORE_DATA)
1070 {
1071 charsNeeded += sizeRemaining - 1;
1072 str += sizeRemaining - 1;
1073 }
1074 }
1075 }
1076 else
1077 {
1078 if (!str || *pcbFormat < charsNeeded * sizeof(WCHAR))
1079 {
1080 /* Insufficient space, determine how much is needed. */
1082 qualifierInfo->Qualifier.pbData,
1083 qualifierInfo->Qualifier.cbData, NULL, &size);
1084 if (ret)
1085 charsNeeded += size - 1;
1086 }
1087 else
1088 {
1089 sizeRemaining = *pcbFormat / sizeof(WCHAR);
1090 sizeRemaining -= str - (LPWSTR)pbFormat;
1092 qualifierInfo->Qualifier.pbData,
1093 qualifierInfo->Qualifier.cbData, str, &sizeRemaining);
1094 if (ret || GetLastError() == ERROR_MORE_DATA)
1095 {
1096 charsNeeded += sizeRemaining - 1;
1097 str += sizeRemaining - 1;
1098 }
1099 }
1100 }
1101 }
1102 }
1103 LocalFree(policies);
1104 if (ret)
1105 {
1106 if (!pbFormat)
1107 *pcbFormat = charsNeeded * sizeof(WCHAR);
1108 else if (*pcbFormat < charsNeeded * sizeof(WCHAR))
1109 {
1110 *pcbFormat = charsNeeded * sizeof(WCHAR);
1112 ret = FALSE;
1113 }
1114 else
1115 *pcbFormat = charsNeeded * sizeof(WCHAR);
1116 }
1117 }
1118 return ret;
1119}
1120
1121#define szOID_MICROSOFT_Encryption_Key_Preference "1.3.6.1.4.1.311.16.4"
1122
1123/***********************************************************************
1124 * DllRegisterServer (CRYPTDLG.@)
1125 */
1127{
1128 static WCHAR cryptdlg[] = { 'c','r','y','p','t','d','l','g','.',
1129 'd','l','l',0 };
1130 static WCHAR wintrust[] = { 'w','i','n','t','r','u','s','t','.',
1131 'd','l','l',0 };
1132 static WCHAR certTrustInit[] = { 'C','e','r','t','T','r','u','s','t',
1133 'I','n','i','t',0 };
1134 static WCHAR wintrustCertificateTrust[] = { 'W','i','n','t','r','u','s','t',
1135 'C','e','r','t','i','f','i','c','a','t','e','T','r','u','s','t',0 };
1136 static WCHAR certTrustCertPolicy[] = { 'C','e','r','t','T','r','u','s','t',
1137 'C','e','r','t','P','o','l','i','c','y',0 };
1138 static WCHAR certTrustFinalPolicy[] = { 'C','e','r','t','T','r','u','s','t',
1139 'F','i','n','a','l','P','o','l','i','c','y',0 };
1140 static WCHAR certTrustCleanup[] = { 'C','e','r','t','T','r','u','s','t',
1141 'C','l','e','a','n','u','p',0 };
1142 static const WCHAR cryptDlg[] = { 'c','r','y','p','t','d','l','g','.',
1143 'd','l','l',0 };
1146 HRESULT hr = S_OK;
1147
1148 memset(&reg, 0, sizeof(reg));
1149 reg.cbStruct = sizeof(reg);
1150 reg.sInitProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1151 reg.sInitProvider.pwszDLLName = cryptdlg;
1152 reg.sInitProvider.pwszFunctionName = certTrustInit;
1153 reg.sCertificateProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1154 reg.sCertificateProvider.pwszDLLName = wintrust;
1155 reg.sCertificateProvider.pwszFunctionName = wintrustCertificateTrust;
1156 reg.sCertificatePolicyProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1157 reg.sCertificatePolicyProvider.pwszDLLName = cryptdlg;
1158 reg.sCertificatePolicyProvider.pwszFunctionName = certTrustCertPolicy;
1159 reg.sFinalPolicyProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1160 reg.sFinalPolicyProvider.pwszDLLName = cryptdlg;
1161 reg.sFinalPolicyProvider.pwszFunctionName = certTrustFinalPolicy;
1162 reg.sCleanupProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1163 reg.sCleanupProvider.pwszDLLName = cryptdlg;
1164 reg.sCleanupProvider.pwszFunctionName = certTrustCleanup;
1166 hr = GetLastError();
1168 "1.3.6.1.4.1.311.16.1.1", cryptDlg, "EncodeAttrSequence");
1170 szOID_MICROSOFT_Encryption_Key_Preference, cryptDlg, "EncodeRecipientID");
1172 "1.3.6.1.4.1.311.16.1.1", cryptDlg, "DecodeAttrSequence");
1174 szOID_MICROSOFT_Encryption_Key_Preference, cryptDlg, "DecodeRecipientID");
1176 szOID_PKIX_KP_EMAIL_PROTECTION, cryptDlg, "FormatPKIXEmailProtection");
1178 szOID_CERT_POLICIES, cryptDlg, "FormatVerisignExtension");
1179 return hr;
1180}
1181
1182/***********************************************************************
1183 * DllUnregisterServer (CRYPTDLG.@)
1184 */
1186{
1188
1191 "1.3.6.1.4.1.311.16.1.1");
1195 "1.3.6.1.4.1.311.16.1.1");
1202 return S_OK;
1203}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static DWORD const fdwReason
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:47
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
int hash
Definition: main.c:58
#define FIXME(fmt,...)
Definition: precomp.h:53
#define RegCloseKey(hKey)
Definition: registry.h:49
struct _root root
HINSTANCE hInstance
Definition: charmap.c:19
BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority)
#define IDS_CPS
Definition: cryptres.h:49
#define IDS_ORGANIZATION
Definition: cryptres.h:65
#define IDS_USER_NOTICE
Definition: cryptres.h:50
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:6286
#define IDS_POLICY_QUALIFIER_INFO
Definition: cryptres.h:25
#define IDS_CERT_POLICY
Definition: cryptres.h:23
#define IDS_QUALIFIER
Definition: cryptres.h:29
#define IDS_NOTICE_TEXT
Definition: cryptres.h:33
#define IDS_NOTICE_NUM
Definition: cryptres.h:32
#define IDS_POLICY_ID
Definition: cryptres.h:24
#define IDS_NOTICE_REF
Definition: cryptres.h:30
#define IDS_POLICY_QUALIFIER_ID
Definition: cryptres.h:26
#define CERT_CERTIFICATE_ACTION_VERIFY
Definition: cryptdlg.h:236
#define CRYPTUI_ENABLE_EDITPROPERTIES
Definition: cryptuiapi.h:76
#define CRYPTUI_DISABLE_ADDTOSTORE
Definition: cryptuiapi.h:77
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
struct config_s config
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:212
HRESULT WINAPI DllUnregisterServer(void)
Definition: main.c:220
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, DWORD dwFlags, DWORD dwType, const void *pvPara, PCCERT_CONTEXT pPrevCertContext)
Definition: cert.c:1765
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:551
LONG WINAPI CertVerifyTimeValidity(LPFILETIME pTimeToVerify, PCERT_INFO pCertInfo)
Definition: cert.c:2158
BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, PCCERT_CONTEXT pCertContext, LPFILETIME pTime, HCERTSTORE hAdditionalStore, PCERT_CHAIN_PARA pChainPara, DWORD dwFlags, LPVOID pvReserved, PCCERT_CHAIN_CONTEXT *ppChainContext)
Definition: chain.c:2879
VOID WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2960
void WINAPI CertFreeCertificateChainEngine(HCERTCHAINENGINE hChainEngine)
Definition: chain.c:249
BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig, HCERTCHAINENGINE *phChainEngine)
Definition: chain.c:225
PCCERT_CHAIN_CONTEXT WINAPI CertDuplicateCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2948
BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, LPCWSTR pwszDll, LPCSTR pszOverrideFuncName)
Definition: oid.c:647
BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID)
Definition: oid.c:831
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127
DWORD WINAPI CertGetNameStringA(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPSTR pszNameString, DWORD cchNameString)
Definition: str.c:1127
DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPWSTR pszNameString, DWORD cchNameString)
Definition: str.c:1228
BOOL WINAPI CertViewPropertiesW(CERT_VIEWPROPERTIES_STRUCT_W *info)
Definition: main.c:413
static DWORD CRYPTDLG_TrustStatusToConfidence(DWORD errorStatus)
Definition: main.c:178
#define szOID_MICROSOFT_Encryption_Key_Preference
Definition: main.c:1121
static const WCHAR colonSpace[]
Definition: main.c:520
static const WCHAR commaSep[]
Definition: main.c:522
static BOOL CRYPTDLG_CheckOnlineCRL(void)
Definition: main.c:115
BOOL WINAPI CertViewPropertiesA(CERT_VIEWPROPERTIES_STRUCT_A *info)
Definition: main.c:379
static BOOL CRYPTDLG_CopyChain(CRYPT_PROVIDER_DATA *data, PCCERT_CHAIN_CONTEXT chain)
Definition: main.c:192
static BOOL CRYPT_FormatCPS(DWORD dwCertEncodingType, DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded, WCHAR *str, DWORD *pcchStr)
Definition: main.c:524
static const WCHAR colonCrlf[]
Definition: main.c:519
DWORD WINAPI GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert, LPWSTR pchBuffer, DWORD cchBuffer)
Definition: main.c:74
static CERT_VERIFY_CERTIFICATE_TRUST * CRYPTDLG_GetVerifyData(CRYPT_PROVIDER_DATA *data)
Definition: main.c:240
HRESULT WINAPI CertTrustInit(CRYPT_PROVIDER_DATA *pProvData)
Definition: main.c:84
BOOL WINAPI CertTrustCertPolicy(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSignerChain, DWORD idxCounterSigner)
Definition: main.c:100
static const WCHAR indent[]
Definition: main.c:518
static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType, DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded, WCHAR *str, DWORD *pcchStr)
Definition: main.c:585
static BOOL CRYPT_FormatHexString(const BYTE *pbEncoded, DWORD cbEncoded, WCHAR *str, DWORD *pcchStr)
Definition: main.c:472
static BOOL CRYPTDLG_IsCertAllowed(PCCERT_CONTEXT pCert)
Definition: main.c:148
static const WCHAR crlf[]
Definition: main.c:521
HRESULT WINAPI CertTrustFinalPolicy(CRYPT_PROVIDER_DATA *data)
Definition: main.c:304
BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType, DWORD dwFormatType, DWORD dwFormatStrType, void *pFormatStruct, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, void *pbFormat, DWORD *pcbFormat)
Definition: main.c:779
static HCERTCHAINENGINE CRYPTDLG_MakeEngine(CERT_VERIFY_CERTIFICATE_TRUST *cert)
Definition: main.c:257
HRESULT WINAPI CertTrustCleanup(CRYPT_PROVIDER_DATA *pProvData)
Definition: main.c:109
DWORD WINAPI GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert, LPSTR pchBuffer, DWORD cchBuffer)
Definition: main.c:64
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged)
Definition: main.c:4415
static const WCHAR disallowed[]
Definition: main.c:461
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
static DWORD cchBuffer
Definition: fusion.c:85
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define swprintf
Definition: precomp.h:40
BOOL WINAPI WintrustAddActionID(GUID *pgActionID, DWORD fdwFlags, CRYPT_REGISTER_ACTIONID *psProvInfo)
Definition: register.c:238
BOOL WINAPI WintrustRemoveActionID(GUID *pgActionID)
Definition: register.c:337
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum src
Definition: glext.h:6340
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
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 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
static int reg
Definition: i386-dis.c:1290
#define S_OK
Definition: intsafe.h:52
static const SecPkgInfoW infoW
Definition: kerberos.c:293
static IN DWORD IN LPVOID lpvReserved
const GUID * guid
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
static WCHAR noticeText[]
Definition: encode.c:7449
static BYTE cert[]
Definition: msg.c:1437
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:79
int k
Definition: mpi.c:3369
#define KEY_READ
Definition: nt_native.h:1023
long LONG
Definition: pedump.c:60
static char title[]
Definition: ps.c:92
#define err(...)
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:596
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
PCCERT_CONTEXT pCertContext
Definition: wincrypt.h:916
PCERT_INFO pCertInfo
Definition: wincrypt.h:482
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:273
CERT_POLICY_INFO * rgPolicyInfo
Definition: wincrypt.h:400
CRYPT_OBJID_BLOB Qualifier
Definition: wincrypt.h:389
CERT_TRUST_STATUS TrustStatus
Definition: wincrypt.h:926
PCERT_CHAIN_ELEMENT * rgpElement
Definition: wincrypt.h:928
BYTE * pbData
Definition: wincrypt.h:103
DWORD * padwTrustStepErrors
Definition: wintrust.h:358
PCCERT_CHAIN_CONTEXT pChainContext
Definition: wintrust.h:241
DWORD dwUnionChoice
Definition: wintrust.h:104
DWORD dwStateAction
Definition: wintrust.h:114
HANDLE hWVTStateData
Definition: wintrust.h:115
struct WINTRUST_BLOB_INFO_ * pBlob
Definition: wintrust.h:109
DWORD cbStruct
Definition: wintrust.h:99
DWORD dwUIChoice
Definition: wintrust.h:102
Definition: image.c:134
Definition: dsound.c:943
Definition: _hash_fun.h:40
Definition: copy.c:22
LPCPROPSHEETPAGEW rgPropSheetPages
Definition: cryptuiapi.h:140
notice
Definition: t1tokens.h:26
struct sock * chain
Definition: tcpcore.h:1
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define X509_UNICODE_ANY_STRING
Definition: wincrypt.h:3390
#define CRYPT_FORMAT_STR_MULTI_LINE
Definition: wincrypt.h:3510
#define CERT_STORE_PROV_COLLECTION
Definition: wincrypt.h:2261
#define szOID_PKIX_POLICY_QUALIFIER_CPS
Definition: wincrypt.h:3291
#define CERT_CHAIN_REVOCATION_CHECK_END_CERT
Definition: wincrypt.h:1056
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2464
#define CRYPT_OID_FORMAT_OBJECT_FUNC
Definition: wincrypt.h:2499
#define CRYPT_OID_DECODE_OBJECT_FUNC
Definition: wincrypt.h:2493
#define CERT_TRUST_IS_NOT_TIME_NESTED
Definition: wincrypt.h:871
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5037
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define X509_CERT_POLICIES
Definition: wincrypt.h:3381
#define szOID_CERT_POLICIES
Definition: wincrypt.h:3197
#define szOID_PKIX_KP_EMAIL_PROTECTION
Definition: wincrypt.h:3297
#define CERT_STORE_PROV_SYSTEM_W
Definition: wincrypt.h:2259
#define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE
Definition: wincrypt.h:3292
#define CERT_FIND_SIGNATURE_HASH
Definition: wincrypt.h:2869
#define CERT_SIGNATURE_HASH_PROP_ID
Definition: wincrypt.h:2701
#define CERT_SYSTEM_STORE_CURRENT_USER
Definition: wincrypt.h:2324
#define CERT_TRUST_IS_NOT_SIGNATURE_VALID
Definition: wincrypt.h:873
#define CRYPT_OID_ENCODE_OBJECT_FUNC
Definition: wincrypt.h:2492
#define X509_PKIX_POLICY_QUALIFIER_USERNOTICE
Definition: wincrypt.h:3414
#define CERT_TRUST_IS_NOT_TIME_VALID
Definition: wincrypt.h:870
#define CERT_NAME_FRIENDLY_DISPLAY_TYPE
Definition: wincrypt.h:3501
#define WINAPI
Definition: msvc.h:6
#define TRUST_E_SUBJECT_NOT_TRUSTED
Definition: winerror.h:3115
#define S_FALSE
Definition: winerror.h:2357
#define TRUST_E_SUBJECT_FORM_UNKNOWN
Definition: winerror.h:3114
#define TRUST_E_NOSIGNATURE
Definition: winerror.h:3116
#define TRUST_E_SYSTEM_ERROR
Definition: winerror.h:3104
#define CERT_E_EXPIRED
Definition: winerror.h:3117
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define WTD_CHOICE_BLOB
Definition: wintrust.h:93
#define WTD_STATEACTION_CLOSE
Definition: wintrust.h:124
#define TRUSTERROR_STEP_FINAL_WVTINIT
Definition: wintrust.h:273
#define WTD_STATEACTION_VERIFY
Definition: wintrust.h:123
#define WT_ADD_ACTION_ID_RET_RESULT_FLAG
Definition: wintrust.h:448
#define CERT_CONFIDENCE_TIME
Definition: wintrust.h:225
#define WTD_UI_NONE
Definition: wintrust.h:84
#define CERT_CONFIDENCE_TIMENEST
Definition: wintrust.h:226
#define CERT_CONFIDENCE_SIG
Definition: wintrust.h:224
struct _CRYPT_TRUST_REG_ENTRY CRYPT_TRUST_REG_ENTRY
CRYPT_PROVIDER_CERT *WINAPI WTHelperGetProvCertFromChain(CRYPT_PROVIDER_SGNR *pSgnr, DWORD idxCert)
CRYPT_PROVIDER_SGNR *WINAPI WTHelperGetProvSignerFromChain(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSigner, DWORD idxCounterSigner)
LONG WINAPI WinVerifyTrust(HWND hwnd, GUID *ActionID, LPVOID ActionData)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193