ReactOS 0.4.17-dev-806-gffa4164
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#include <stdarg.h>
20
21#include "windef.h"
22#include "winbase.h"
23#include "winnls.h"
24#include "winreg.h"
25#include "wincrypt.h"
26#include "wintrust.h"
27#include "winuser.h"
28#include "objbase.h"
29#include "cryptdlg.h"
30#include "cryptuiapi.h"
31#include "cryptres.h"
32#include "wine/debug.h"
33
35
37
39{
40 TRACE("(0x%p, %ld, %p)\n", hinstDLL, fdwReason, lpvReserved);
41
42 switch (fdwReason)
43 {
46 hInstance = hinstDLL;
47 break;
48 }
49 return TRUE;
50}
51
52/***********************************************************************
53 * GetFriendlyNameOfCertA (CRYPTDLG.@)
54 */
57{
59 pchBuffer, cchBuffer);
60}
61
62/***********************************************************************
63 * GetFriendlyNameOfCertW (CRYPTDLG.@)
64 */
67{
69 pchBuffer, cchBuffer);
70}
71
72/***********************************************************************
73 * CertTrustInit (CRYPTDLG.@)
74 */
76{
78
79 TRACE("(%p)\n", pProvData);
80
81 if (pProvData->padwTrustStepErrors &&
83 ret = S_OK;
84 TRACE("returning %08lx\n", ret);
85 return ret;
86}
87
88/***********************************************************************
89 * CertTrustCertPolicy (CRYPTDLG.@)
90 */
91BOOL WINAPI CertTrustCertPolicy(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSignerChain, DWORD idxCounterSigner)
92{
93 FIXME("(%p, %ld, %s, %ld)\n", pProvData, idxSigner, fCounterSignerChain ? "TRUE" : "FALSE", idxCounterSigner);
94 return FALSE;
95}
96
97/***********************************************************************
98 * CertTrustCleanup (CRYPTDLG.@)
99 */
101{
102 FIXME("(%p)\n", pProvData);
103 return E_NOTIMPL;
104}
105
107{
108 HKEY key;
109 BOOL ret = FALSE;
110
112 L"Software\\Microsoft\\Cryptography\\{7801ebd0-cf4b-11d0-851f-0060979387ea}", 0, KEY_READ, &key))
113 {
114 DWORD type, flags, size = sizeof(flags);
115
116 if (!RegQueryValueExW(key, L"PolicyFlags", NULL, &type, (BYTE *)&flags,
117 &size) && type == REG_DWORD)
118 {
119 /* The flag values aren't defined in any header I'm aware of, but
120 * this value is well documented on the net.
121 */
122 if (flags & 0x00010000)
123 ret = TRUE;
124 }
126 }
127 return ret;
128}
129
130/* Returns TRUE if pCert is not in the Disallowed system store, or FALSE if it
131 * is.
132 */
134{
135 BOOL ret;
136 BYTE hash[20];
137 DWORD size = sizeof(hash);
138
141 {
144
145 if (disallowed)
146 {
149
150 if (found)
151 {
152 ret = FALSE;
154 }
156 }
157 }
158 return ret;
159}
160
162{
163 DWORD confidence = 0;
164
165 confidence = 0;
166 if (!(errorStatus & CERT_TRUST_IS_NOT_SIGNATURE_VALID))
167 confidence |= CERT_CONFIDENCE_SIG;
168 if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_VALID))
169 confidence |= CERT_CONFIDENCE_TIME;
170 if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_NESTED))
171 confidence |= CERT_CONFIDENCE_TIMENEST;
172 return confidence;
173}
174
177{
178 BOOL ret;
179 CRYPT_PROVIDER_SGNR signer;
180 PCERT_SIMPLE_CHAIN simpleChain = chain->rgpChain[0];
181 DWORD i;
182
183 memset(&signer, 0, sizeof(signer));
184 signer.cbStruct = sizeof(signer);
185 ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
186 if (ret)
187 {
189 FALSE, 0);
190
191 if (sgnr)
192 {
193 sgnr->dwError = simpleChain->TrustStatus.dwErrorStatus;
195 }
196 else
197 ret = FALSE;
198 for (i = 0; ret && i < simpleChain->cElement; i++)
199 {
200 ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
201 simpleChain->rgpElement[i]->pCertContext);
202 if (ret)
203 {
205
206 if ((cert = WTHelperGetProvCertFromChain(sgnr, i)))
207 {
208 CERT_CHAIN_ELEMENT *element = simpleChain->rgpElement[i];
209
211 element->TrustStatus.dwErrorStatus);
212 cert->dwError = element->TrustStatus.dwErrorStatus;
213 cert->pChainElement = element;
214 }
215 else
216 ret = FALSE;
217 }
218 }
219 }
220 return ret;
221}
222
225{
227
228 /* This should always be true, but just in case the calling function is
229 * called directly:
230 */
231 if (data->pWintrustData->dwUnionChoice == WTD_CHOICE_BLOB &&
232 data->pWintrustData->pBlob && data->pWintrustData->pBlob->cbMemObject ==
234 data->pWintrustData->pBlob->pbMemObject)
236 data->pWintrustData->pBlob->pbMemObject;
237 return pCert;
238}
239
241{
242 HCERTCHAINENGINE engine = NULL;
243 HCERTSTORE root = NULL, trust = NULL;
244 DWORD i;
245
246 if (cert->cRootStores)
247 {
250 if (root)
251 {
252 for (i = 0; i < cert->cRootStores; i++)
253 CertAddStoreToCollection(root, cert->rghstoreRoots[i], 0, 0);
254 }
255 }
256 if (cert->cTrustStores)
257 {
260 if (trust)
261 {
262 for (i = 0; i < cert->cTrustStores; i++)
263 CertAddStoreToCollection(trust, cert->rghstoreTrust[i], 0, 0);
264 }
265 }
266 if (cert->cRootStores || cert->cStores || cert->cTrustStores)
267 {
269
270 memset(&config, 0, sizeof(config));
271 config.cbSize = sizeof(config);
272 config.hRestrictedRoot = root;
273 config.hRestrictedTrust = trust;
274 config.cAdditionalStore = cert->cStores;
275 config.rghAdditionalStore = cert->rghstoreCAs;
276 config.hRestrictedRoot = root;
279 CertCloseStore(trust, 0);
280 }
281 return engine;
282}
283
284/***********************************************************************
285 * CertTrustFinalPolicy (CRYPTDLG.@)
286 */
288{
289 BOOL ret;
290 DWORD err = S_OK;
292
293 TRACE("(%p)\n", data);
294
295 if (data->pWintrustData->dwUIChoice != WTD_UI_NONE)
296 FIXME("unimplemented for UI choice %ld\n",
297 data->pWintrustData->dwUIChoice);
298 if (pCert)
299 {
300 DWORD flags = 0;
301 CERT_CHAIN_PARA chainPara;
302 HCERTCHAINENGINE engine;
303
304 memset(&chainPara, 0, sizeof(chainPara));
305 chainPara.cbSize = sizeof(chainPara);
308 engine = CRYPTDLG_MakeEngine(pCert);
309 GetSystemTimeAsFileTime(&data->sftSystemTime);
311 if (ret)
312 {
314
315 ret = CertGetCertificateChain(engine, pCert->pccert,
316 &data->sftSystemTime, NULL, &chainPara, flags, NULL, &chain);
317 if (ret)
318 {
319 if (chain->cChain != 1)
320 {
321 FIXME("unimplemented for more than 1 simple chain\n");
323 ret = FALSE;
324 }
325 else if ((ret = CRYPTDLG_CopyChain(data, chain)))
326 {
327 if (CertVerifyTimeValidity(&data->sftSystemTime,
328 pCert->pccert->pCertInfo))
329 {
330 ret = FALSE;
332 }
333 }
334 else
337 }
338 else
340 }
342 }
343 else
344 {
345 ret = FALSE;
347 }
348 /* Oddly, native doesn't set the error in the trust step error location,
349 * probably because this action is more advisory than anything else.
350 * Instead it stores it as the final error, but the function "succeeds" in
351 * any case.
352 */
353 if (!ret)
354 data->dwFinalError = err;
355 TRACE("returning %ld (%08lx)\n", S_OK, data->dwFinalError);
356 return S_OK;
357}
358
359/***********************************************************************
360 * CertViewPropertiesA (CRYPTDLG.@)
361 */
363{
365 LPWSTR title = NULL;
366 BOOL ret;
367
368 TRACE("(%p)\n", info);
369
370 memcpy(&infoW, info, sizeof(infoW));
371 if (info->szTitle)
372 {
373 int len = MultiByteToWideChar(CP_ACP, 0, info->szTitle, -1, NULL, 0);
374
375 title = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
376 if (title)
377 {
378 MultiByteToWideChar(CP_ACP, 0, info->szTitle, -1, title, len);
379 infoW.szTitle = title;
380 }
381 else
382 {
383 ret = FALSE;
384 goto error;
385 }
386 }
389error:
390 return ret;
391}
392
393/***********************************************************************
394 * CertViewPropertiesW (CRYPTDLG.@)
395 */
397{
398 static GUID cert_action_verify = CERT_CERTIFICATE_ACTION_VERIFY;
401 WINTRUST_DATA wtd;
402 LONG err;
403 BOOL ret;
404
405 TRACE("(%p)\n", info);
406
407 memset(&trust, 0, sizeof(trust));
408 trust.cbSize = sizeof(trust);
409 trust.pccert = info->pCertContext;
410 trust.cRootStores = info->cRootStores;
411 trust.rghstoreRoots = info->rghstoreRoots;
412 trust.cStores = info->cStores;
413 trust.rghstoreCAs = info->rghstoreCAs;
414 trust.cTrustStores = info->cTrustStores;
415 trust.rghstoreTrust = info->rghstoreTrust;
416 memset(&blob, 0, sizeof(blob));
417 blob.cbStruct = sizeof(blob);
418 blob.cbMemObject = sizeof(trust);
419 blob.pbMemObject = (BYTE *)&trust;
420 memset(&wtd, 0, sizeof(wtd));
421 wtd.cbStruct = sizeof(wtd);
424 wtd.pBlob = &blob;
426 err = WinVerifyTrust(NULL, &cert_action_verify, &wtd);
427 if (err == ERROR_SUCCESS)
428 {
430 BOOL propsChanged = FALSE;
431
432 memset(&uiInfo, 0, sizeof(uiInfo));
433 uiInfo.dwSize = sizeof(uiInfo);
434 uiInfo.hwndParent = info->hwndParent;
435 uiInfo.dwFlags =
437 uiInfo.szTitle = info->szTitle;
438 uiInfo.pCertContext = info->pCertContext;
439 uiInfo.cPurposes = info->cArrayPurposes;
440 uiInfo.rgszPurposes = (LPCSTR *)info->arrayPurposes;
441 uiInfo.hWVTStateData = wtd.hWVTStateData;
443 uiInfo.cPropSheetPages = info->cArrayPropSheetPages;
444 uiInfo.rgPropSheetPages = info->arrayPropSheetPages;
445 uiInfo.nStartPage = info->nStartPage;
446 ret = CryptUIDlgViewCertificateW(&uiInfo, &propsChanged);
448 WinVerifyTrust(NULL, &cert_action_verify, &wtd);
449 }
450 else
451 ret = FALSE;
452 return ret;
453}
454
455static BOOL CRYPT_FormatHexString(const BYTE *pbEncoded, DWORD cbEncoded,
456 WCHAR *str, DWORD *pcchStr)
457{
458 BOOL ret;
459 DWORD charsNeeded;
460
461 if (cbEncoded)
462 charsNeeded = (cbEncoded * 3);
463 else
464 charsNeeded = 1;
465 if (!str)
466 {
467 *pcchStr = charsNeeded;
468 ret = TRUE;
469 }
470 else if (*pcchStr < charsNeeded)
471 {
472 *pcchStr = charsNeeded;
474 ret = FALSE;
475 }
476 else
477 {
478 DWORD i;
479 LPWSTR ptr = str;
480
481 *pcchStr = charsNeeded;
482 if (cbEncoded)
483 {
484 for (i = 0; i < cbEncoded; i++)
485 {
486 if (i < cbEncoded - 1)
487 ptr += swprintf(ptr, 4, L"%02x ", pbEncoded[i]);
488 else
489 ptr += swprintf(ptr, 3, L"%02x", pbEncoded[i]);
490 }
491 }
492 else
493 *ptr = 0;
494 ret = TRUE;
495 }
496 return ret;
497}
498
499static const WCHAR indent[] = L" ";
500
501static BOOL CRYPT_FormatCPS(DWORD dwCertEncodingType,
502 DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded,
503 WCHAR *str, DWORD *pcchStr)
504{
505 BOOL ret;
506 DWORD size, charsNeeded = 1;
507 CERT_NAME_VALUE *cpsValue;
508
509 if ((ret = CryptDecodeObjectEx(dwCertEncodingType, X509_UNICODE_ANY_STRING,
510 pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &cpsValue, &size)))
511 {
512 LPCWSTR sep;
513 DWORD sepLen;
514
515 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
516 sep = L"\r\n";
517 else
518 sep = L", ";
519
520 sepLen = lstrlenW(sep);
521
522 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
523 {
524 charsNeeded += 3 * lstrlenW(indent);
525 if (str && *pcchStr >= charsNeeded)
526 {
528 str += lstrlenW(indent);
530 str += lstrlenW(indent);
532 str += lstrlenW(indent);
533 }
534 }
535 charsNeeded += cpsValue->Value.cbData / sizeof(WCHAR);
536 if (str && *pcchStr >= charsNeeded)
537 {
538 lstrcpyW(str, (LPWSTR)cpsValue->Value.pbData);
539 str += cpsValue->Value.cbData / sizeof(WCHAR);
540 }
541 charsNeeded += sepLen;
542 if (str && *pcchStr >= charsNeeded)
543 {
544 lstrcpyW(str, sep);
545 str += sepLen;
546 }
547 LocalFree(cpsValue);
548 if (!str)
549 *pcchStr = charsNeeded;
550 else if (*pcchStr < charsNeeded)
551 {
552 *pcchStr = charsNeeded;
554 ret = FALSE;
555 }
556 else
557 *pcchStr = charsNeeded;
558 }
559 return ret;
560}
561
562static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
563 DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded,
564 WCHAR *str, DWORD *pcchStr)
565{
566 BOOL ret;
567 DWORD size, charsNeeded = 1;
569
570 if ((ret = CryptDecodeObjectEx(dwCertEncodingType,
571 X509_PKIX_POLICY_QUALIFIER_USERNOTICE, pbEncoded, cbEncoded,
573 {
575 notice->pNoticeReference;
576 LPCWSTR headingSep, sep;
577 DWORD headingSepLen, sepLen;
578 LPWSTR noticeRef, organization, noticeNum, noticeText;
579 DWORD noticeRefLen, organizationLen, noticeNumLen, noticeTextLen;
580 WCHAR noticeNumStr[11];
581
582 noticeRefLen = LoadStringW(hInstance, IDS_NOTICE_REF,
583 (LPWSTR)&noticeRef, 0);
584 organizationLen = LoadStringW(hInstance, IDS_ORGANIZATION,
585 (LPWSTR)&organization, 0);
586 noticeNumLen = LoadStringW(hInstance, IDS_NOTICE_NUM,
587 (LPWSTR)&noticeNum, 0);
588 noticeTextLen = LoadStringW(hInstance, IDS_NOTICE_TEXT,
589 (LPWSTR)&noticeText, 0);
590 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
591 {
592 headingSep = L":\r\n";
593 sep = L"\r\n";
594 }
595 else
596 {
597 headingSep = L": ";
598 sep = L", ";
599 }
600 sepLen = lstrlenW(sep);
601 headingSepLen = lstrlenW(headingSep);
602
603 if (pNoticeRef)
604 {
605 DWORD k;
606 LPCSTR src;
607
608 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
609 {
610 charsNeeded += 3 * lstrlenW(indent);
611 if (str && *pcchStr >= charsNeeded)
612 {
614 str += lstrlenW(indent);
616 str += lstrlenW(indent);
618 str += lstrlenW(indent);
619 }
620 }
621 charsNeeded += noticeRefLen;
622 if (str && *pcchStr >= charsNeeded)
623 {
624 memcpy(str, noticeRef, noticeRefLen * sizeof(WCHAR));
625 str += noticeRefLen;
626 }
627 charsNeeded += headingSepLen;
628 if (str && *pcchStr >= charsNeeded)
629 {
630 lstrcpyW(str, headingSep);
631 str += headingSepLen;
632 }
633 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
634 {
635 charsNeeded += 4 * lstrlenW(indent);
636 if (str && *pcchStr >= charsNeeded)
637 {
639 str += lstrlenW(indent);
641 str += lstrlenW(indent);
643 str += lstrlenW(indent);
645 str += lstrlenW(indent);
646 }
647 }
648 charsNeeded += organizationLen;
649 if (str && *pcchStr >= charsNeeded)
650 {
651 memcpy(str, organization, organizationLen * sizeof(WCHAR));
652 str += organizationLen;
653 }
654 charsNeeded += strlen(pNoticeRef->pszOrganization);
655 if (str && *pcchStr >= charsNeeded)
656 for (src = pNoticeRef->pszOrganization; src && *src;
657 src++, str++)
658 *str = *src;
659 charsNeeded += sepLen;
660 if (str && *pcchStr >= charsNeeded)
661 {
662 lstrcpyW(str, sep);
663 str += sepLen;
664 }
665 for (k = 0; k < pNoticeRef->cNoticeNumbers; k++)
666 {
667 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
668 {
669 charsNeeded += 4 * lstrlenW(indent);
670 if (str && *pcchStr >= charsNeeded)
671 {
673 str += lstrlenW(indent);
675 str += lstrlenW(indent);
677 str += lstrlenW(indent);
679 str += lstrlenW(indent);
680 }
681 }
682 charsNeeded += noticeNumLen;
683 if (str && *pcchStr >= charsNeeded)
684 {
685 memcpy(str, noticeNum, noticeNumLen * sizeof(WCHAR));
686 str += noticeNumLen;
687 }
688 swprintf(noticeNumStr, ARRAY_SIZE(noticeNumStr), L"%d", k + 1);
689 charsNeeded += lstrlenW(noticeNumStr);
690 if (str && *pcchStr >= charsNeeded)
691 {
692 lstrcpyW(str, noticeNumStr);
693 str += lstrlenW(noticeNumStr);
694 }
695 charsNeeded += sepLen;
696 if (str && *pcchStr >= charsNeeded)
697 {
698 lstrcpyW(str, sep);
699 str += sepLen;
700 }
701 }
702 }
703 if (notice->pszDisplayText)
704 {
705 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
706 {
707 charsNeeded += 3 * lstrlenW(indent);
708 if (str && *pcchStr >= charsNeeded)
709 {
711 str += lstrlenW(indent);
713 str += lstrlenW(indent);
715 str += lstrlenW(indent);
716 }
717 }
718 charsNeeded += noticeTextLen;
719 if (str && *pcchStr >= charsNeeded)
720 {
721 memcpy(str, noticeText, noticeTextLen * sizeof(WCHAR));
722 str += noticeTextLen;
723 }
724 charsNeeded += lstrlenW(notice->pszDisplayText);
725 if (str && *pcchStr >= charsNeeded)
726 {
727 lstrcpyW(str, notice->pszDisplayText);
728 str += lstrlenW(notice->pszDisplayText);
729 }
730 charsNeeded += sepLen;
731 if (str && *pcchStr >= charsNeeded)
732 {
733 lstrcpyW(str, sep);
734 str += sepLen;
735 }
736 }
738 if (!str)
739 *pcchStr = charsNeeded;
740 else if (*pcchStr < charsNeeded)
741 {
742 *pcchStr = charsNeeded;
744 ret = FALSE;
745 }
746 else
747 *pcchStr = charsNeeded;
748 }
749 return ret;
750}
751
752/***********************************************************************
753 * FormatVerisignExtension (CRYPTDLG.@)
754 */
756 DWORD dwFormatType, DWORD dwFormatStrType, void *pFormatStruct,
757 LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, void *pbFormat,
758 DWORD *pcbFormat)
759{
760 CERT_POLICIES_INFO *policies;
761 DWORD size;
762 BOOL ret = FALSE;
763
764 if (!cbEncoded)
765 {
767 return FALSE;
768 }
769 if ((ret = CryptDecodeObjectEx(dwCertEncodingType, X509_CERT_POLICIES,
770 pbEncoded, cbEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &policies, &size)))
771 {
772 DWORD charsNeeded = 1; /* space for NULL terminator */
773 LPCWSTR headingSep, sep;
774 DWORD headingSepLen, sepLen;
775 WCHAR policyNum[11], policyQualifierNum[11];
776 LPWSTR certPolicy, policyId, policyQualifierInfo, policyQualifierId;
777 LPWSTR cps, userNotice, qualifier;
778 DWORD certPolicyLen, policyIdLen, policyQualifierInfoLen;
779 DWORD policyQualifierIdLen, cpsLen, userNoticeLen, qualifierLen;
780 DWORD i;
781 LPWSTR str = pbFormat;
782
783 certPolicyLen = LoadStringW(hInstance, IDS_CERT_POLICY,
784 (LPWSTR)&certPolicy, 0);
785 policyIdLen = LoadStringW(hInstance, IDS_POLICY_ID, (LPWSTR)&policyId,
786 0);
787 policyQualifierInfoLen = LoadStringW(hInstance,
788 IDS_POLICY_QUALIFIER_INFO, (LPWSTR)&policyQualifierInfo, 0);
789 policyQualifierIdLen = LoadStringW(hInstance, IDS_POLICY_QUALIFIER_ID,
790 (LPWSTR)&policyQualifierId, 0);
791 cpsLen = LoadStringW(hInstance, IDS_CPS, (LPWSTR)&cps, 0);
792 userNoticeLen = LoadStringW(hInstance, IDS_USER_NOTICE,
793 (LPWSTR)&userNotice, 0);
794 qualifierLen = LoadStringW(hInstance, IDS_QUALIFIER,
795 (LPWSTR)&qualifier, 0);
796 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
797 {
798 headingSep = L":\r\n";
799 sep = L"\r\n";
800 }
801 else
802 {
803 headingSep = L": ";
804 sep = L", ";
805 }
806 sepLen = lstrlenW(sep);
807 headingSepLen = lstrlenW(headingSep);
808
809 for (i = 0; ret && i < policies->cPolicyInfo; i++)
810 {
811 CERT_POLICY_INFO *policy = &policies->rgPolicyInfo[i];
812 DWORD j;
813 LPCSTR src;
814
815 charsNeeded += 1; /* '['*/
816 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
817 *str++ = '[';
818 swprintf(policyNum, ARRAY_SIZE(policyNum), L"%d", i + 1);
819 charsNeeded += lstrlenW(policyNum);
820 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
821 {
822 lstrcpyW(str, policyNum);
823 str += lstrlenW(policyNum);
824 }
825 charsNeeded += 1; /* ']'*/
826 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
827 *str++ = ']';
828 charsNeeded += certPolicyLen;
829 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
830 {
831 memcpy(str, certPolicy, certPolicyLen * sizeof(WCHAR));
832 str += certPolicyLen;
833 }
834 charsNeeded += headingSepLen;
835 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
836 {
837 lstrcpyW(str, headingSep);
838 str += headingSepLen;
839 }
840 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
841 {
842 charsNeeded += lstrlenW(indent);
843 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
844 {
846 str += lstrlenW(indent);
847 }
848 }
849 charsNeeded += policyIdLen;
850 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
851 {
852 memcpy(str, policyId, policyIdLen * sizeof(WCHAR));
853 str += policyIdLen;
854 }
855 charsNeeded += strlen(policy->pszPolicyIdentifier);
856 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
857 {
858 for (src = policy->pszPolicyIdentifier; src && *src;
859 src++, str++)
860 *str = *src;
861 }
862 charsNeeded += sepLen;
863 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
864 {
865 lstrcpyW(str, sep);
866 str += sepLen;
867 }
868 for (j = 0; j < policy->cPolicyQualifier; j++)
869 {
870 CERT_POLICY_QUALIFIER_INFO *qualifierInfo =
871 &policy->rgPolicyQualifier[j];
872 DWORD sizeRemaining;
873
874 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
875 {
876 charsNeeded += lstrlenW(indent);
877 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
878 {
880 str += lstrlenW(indent);
881 }
882 }
883 charsNeeded += 1; /* '['*/
884 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
885 *str++ = '[';
886 charsNeeded += lstrlenW(policyNum);
887 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
888 {
889 lstrcpyW(str, policyNum);
890 str += lstrlenW(policyNum);
891 }
892 charsNeeded += 1; /* ','*/
893 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
894 *str++ = ',';
895 swprintf(policyQualifierNum, ARRAY_SIZE(policyQualifierNum), L"%d", j + 1);
896 charsNeeded += lstrlenW(policyQualifierNum);
897 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
898 {
899 lstrcpyW(str, policyQualifierNum);
900 str += lstrlenW(policyQualifierNum);
901 }
902 charsNeeded += 1; /* ']'*/
903 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
904 *str++ = ']';
905 charsNeeded += policyQualifierInfoLen;
906 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
907 {
908 memcpy(str, policyQualifierInfo,
909 policyQualifierInfoLen * sizeof(WCHAR));
910 str += policyQualifierInfoLen;
911 }
912 charsNeeded += headingSepLen;
913 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
914 {
915 lstrcpyW(str, headingSep);
916 str += headingSepLen;
917 }
918 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
919 {
920 charsNeeded += 2 * lstrlenW(indent);
921 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
922 {
924 str += lstrlenW(indent);
926 str += lstrlenW(indent);
927 }
928 }
929 charsNeeded += policyQualifierIdLen;
930 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
931 {
932 memcpy(str, policyQualifierId,
933 policyQualifierIdLen * sizeof(WCHAR));
934 str += policyQualifierIdLen;
935 }
936 if (!strcmp(qualifierInfo->pszPolicyQualifierId,
938 {
939 charsNeeded += cpsLen;
940 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
941 {
942 memcpy(str, cps, cpsLen * sizeof(WCHAR));
943 str += cpsLen;
944 }
945 }
946 else if (!strcmp(qualifierInfo->pszPolicyQualifierId,
948 {
949 charsNeeded += userNoticeLen;
950 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
951 {
952 memcpy(str, userNotice, userNoticeLen * sizeof(WCHAR));
953 str += userNoticeLen;
954 }
955 }
956 else
957 {
958 charsNeeded += strlen(qualifierInfo->pszPolicyQualifierId);
959 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
960 {
961 for (src = qualifierInfo->pszPolicyQualifierId;
962 src && *src; src++, str++)
963 *str = *src;
964 }
965 }
966 charsNeeded += sepLen;
967 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
968 {
969 lstrcpyW(str, sep);
970 str += sepLen;
971 }
972 if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
973 {
974 charsNeeded += 2 * lstrlenW(indent);
975 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
976 {
978 str += lstrlenW(indent);
980 str += lstrlenW(indent);
981 }
982 }
983 charsNeeded += qualifierLen;
984 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
985 {
986 memcpy(str, qualifier, qualifierLen * sizeof(WCHAR));
987 str += qualifierLen;
988 }
989 charsNeeded += headingSepLen;
990 if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
991 {
992 lstrcpyW(str, headingSep);
993 str += headingSepLen;
994 }
995 /* This if block is deliberately redundant with the same if
996 * block above, in order to keep the code more readable (the
997 * code flow follows the order in which the strings are output.)
998 */
999 if (!strcmp(qualifierInfo->pszPolicyQualifierId,
1001 {
1002 if (!str || *pcbFormat < charsNeeded * sizeof(WCHAR))
1003 {
1004 /* Insufficient space, determine how much is needed. */
1005 ret = CRYPT_FormatCPS(dwCertEncodingType,
1006 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1007 qualifierInfo->Qualifier.cbData, NULL, &size);
1008 if (ret)
1009 charsNeeded += size - 1;
1010 }
1011 else
1012 {
1013 sizeRemaining = *pcbFormat / sizeof(WCHAR);
1014 sizeRemaining -= str - (LPWSTR)pbFormat;
1015 ret = CRYPT_FormatCPS(dwCertEncodingType,
1016 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1017 qualifierInfo->Qualifier.cbData, str, &sizeRemaining);
1018 if (ret || GetLastError() == ERROR_MORE_DATA)
1019 {
1020 charsNeeded += sizeRemaining - 1;
1021 str += sizeRemaining - 1;
1022 }
1023 }
1024 }
1025 else if (!strcmp(qualifierInfo->pszPolicyQualifierId,
1027 {
1028 if (!str || *pcbFormat < charsNeeded * sizeof(WCHAR))
1029 {
1030 /* Insufficient space, determine how much is needed. */
1031 ret = CRYPT_FormatUserNotice(dwCertEncodingType,
1032 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1033 qualifierInfo->Qualifier.cbData, NULL, &size);
1034 if (ret)
1035 charsNeeded += size - 1;
1036 }
1037 else
1038 {
1039 sizeRemaining = *pcbFormat / sizeof(WCHAR);
1040 sizeRemaining -= str - (LPWSTR)pbFormat;
1041 ret = CRYPT_FormatUserNotice(dwCertEncodingType,
1042 dwFormatStrType, qualifierInfo->Qualifier.pbData,
1043 qualifierInfo->Qualifier.cbData, str, &sizeRemaining);
1044 if (ret || GetLastError() == ERROR_MORE_DATA)
1045 {
1046 charsNeeded += sizeRemaining - 1;
1047 str += sizeRemaining - 1;
1048 }
1049 }
1050 }
1051 else
1052 {
1053 if (!str || *pcbFormat < charsNeeded * sizeof(WCHAR))
1054 {
1055 /* Insufficient space, determine how much is needed. */
1057 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 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 }
1077 }
1078 LocalFree(policies);
1079 if (ret)
1080 {
1081 if (!pbFormat)
1082 *pcbFormat = charsNeeded * sizeof(WCHAR);
1083 else if (*pcbFormat < charsNeeded * sizeof(WCHAR))
1084 {
1085 *pcbFormat = charsNeeded * sizeof(WCHAR);
1087 ret = FALSE;
1088 }
1089 else
1090 *pcbFormat = charsNeeded * sizeof(WCHAR);
1091 }
1092 }
1093 return ret;
1094}
1095
1096#define szOID_MICROSOFT_Encryption_Key_Preference "1.3.6.1.4.1.311.16.4"
1097
1098/***********************************************************************
1099 * DllRegisterServer (CRYPTDLG.@)
1100 */
1102{
1103 static WCHAR cryptdlg[] = L"cryptdlg.dll";
1104 static WCHAR wintrust[] = L"wintrust.dll";
1105 static WCHAR certTrustInit[] = L"CertTrustInit";
1106 static WCHAR wintrustCertificateTrust[] = L"WintrustCertificateTrust";
1107 static WCHAR certTrustCertPolicy[] = L"CertTrustCertPolicy";
1108 static WCHAR certTrustFinalPolicy[] = L"CertTrustFinalPolicy";
1109 static WCHAR certTrustCleanup[] = L"CertTrustCleanup";
1112 HRESULT hr = S_OK;
1113
1114 memset(&reg, 0, sizeof(reg));
1115 reg.cbStruct = sizeof(reg);
1116 reg.sInitProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1117 reg.sInitProvider.pwszDLLName = cryptdlg;
1118 reg.sInitProvider.pwszFunctionName = certTrustInit;
1119 reg.sCertificateProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1120 reg.sCertificateProvider.pwszDLLName = wintrust;
1121 reg.sCertificateProvider.pwszFunctionName = wintrustCertificateTrust;
1122 reg.sCertificatePolicyProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1123 reg.sCertificatePolicyProvider.pwszDLLName = cryptdlg;
1124 reg.sCertificatePolicyProvider.pwszFunctionName = certTrustCertPolicy;
1125 reg.sFinalPolicyProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1126 reg.sFinalPolicyProvider.pwszDLLName = cryptdlg;
1127 reg.sFinalPolicyProvider.pwszFunctionName = certTrustFinalPolicy;
1128 reg.sCleanupProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
1129 reg.sCleanupProvider.pwszDLLName = cryptdlg;
1130 reg.sCleanupProvider.pwszFunctionName = certTrustCleanup;
1132 hr = GetLastError();
1134 "1.3.6.1.4.1.311.16.1.1", L"cryptdlg.dll", "EncodeAttrSequence");
1136 szOID_MICROSOFT_Encryption_Key_Preference, L"cryptdlg.dll", "EncodeRecipientID");
1138 "1.3.6.1.4.1.311.16.1.1", L"cryptdlg.dll", "DecodeAttrSequence");
1140 szOID_MICROSOFT_Encryption_Key_Preference, L"cryptdlg.dll", "DecodeRecipientID");
1142 szOID_PKIX_KP_EMAIL_PROTECTION, L"cryptdlg.dll", "FormatPKIXEmailProtection");
1144 szOID_CERT_POLICIES, L"cryptdlg.dll", "FormatVerisignExtension");
1145 return hr;
1146}
1147
1148/***********************************************************************
1149 * DllUnregisterServer (CRYPTDLG.@)
1150 */
1152{
1154
1157 "1.3.6.1.4.1.311.16.1.1");
1161 "1.3.6.1.4.1.311.16.1.1");
1168 return S_OK;
1169}
static DWORD const fdwReason
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:78
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
int hash
Definition: main.c:58
#define ARRAY_SIZE(A)
Definition: main.h:20
BOOL NTAPI DllMain(_In_ HINSTANCE hDll, _In_ ULONG dwReason, _In_opt_ PVOID pReserved)
Definition: main.c:33
#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:6998
#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
HRESULT hr
Definition: delayimp.cpp:582
#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
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:369
PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, DWORD dwFlags, DWORD dwType, const void *pvPara, PCCERT_CONTEXT pPrevCertContext)
Definition: cert.c:1830
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:615
LONG WINAPI CertVerifyTimeValidity(LPFILETIME pTimeToVerify, PCERT_INFO pCertInfo)
Definition: cert.c:2229
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:2875
VOID WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2956
void WINAPI CertFreeCertificateChainEngine(HCERTCHAINENGINE hChainEngine)
Definition: chain.c:245
BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig, HCERTCHAINENGINE *phChainEngine)
Definition: chain.c:221
PCCERT_CHAIN_CONTEXT WINAPI CertDuplicateCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2944
BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, LPCWSTR pwszDll, LPCSTR pszOverrideFuncName)
Definition: oid.c:635
BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID)
Definition: oid.c:819
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:809
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1121
DWORD WINAPI CertGetNameStringA(PCCERT_CONTEXT cert, DWORD type, DWORD flags, void *type_para, LPSTR name, DWORD name_len)
Definition: str.c:883
DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT cert, DWORD type, DWORD flags, void *type_para, LPWSTR name_string, DWORD name_len)
Definition: str.c:1013
BOOL WINAPI CertViewPropertiesW(CERT_VIEWPROPERTIES_STRUCT_W *info)
Definition: main.c:396
static DWORD CRYPTDLG_TrustStatusToConfidence(DWORD errorStatus)
Definition: main.c:161
#define szOID_MICROSOFT_Encryption_Key_Preference
Definition: main.c:1096
static BOOL CRYPTDLG_CheckOnlineCRL(void)
Definition: main.c:106
BOOL WINAPI CertViewPropertiesA(CERT_VIEWPROPERTIES_STRUCT_A *info)
Definition: main.c:362
static BOOL CRYPTDLG_CopyChain(CRYPT_PROVIDER_DATA *data, PCCERT_CHAIN_CONTEXT chain)
Definition: main.c:175
static BOOL CRYPT_FormatCPS(DWORD dwCertEncodingType, DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded, WCHAR *str, DWORD *pcchStr)
Definition: main.c:501
DWORD WINAPI GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert, LPWSTR pchBuffer, DWORD cchBuffer)
Definition: main.c:65
static CERT_VERIFY_CERTIFICATE_TRUST * CRYPTDLG_GetVerifyData(CRYPT_PROVIDER_DATA *data)
Definition: main.c:223
HRESULT WINAPI CertTrustInit(CRYPT_PROVIDER_DATA *pProvData)
Definition: main.c:75
BOOL WINAPI CertTrustCertPolicy(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSignerChain, DWORD idxCounterSigner)
Definition: main.c:91
static const WCHAR indent[]
Definition: main.c:499
static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType, DWORD dwFormatStrType, const BYTE *pbEncoded, DWORD cbEncoded, WCHAR *str, DWORD *pcchStr)
Definition: main.c:562
static BOOL CRYPT_FormatHexString(const BYTE *pbEncoded, DWORD cbEncoded, WCHAR *str, DWORD *pcchStr)
Definition: main.c:455
static BOOL CRYPTDLG_IsCertAllowed(PCCERT_CONTEXT pCert)
Definition: main.c:133
HRESULT WINAPI CertTrustFinalPolicy(CRYPT_PROVIDER_DATA *data)
Definition: main.c:287
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:755
static HCERTCHAINENGINE CRYPTDLG_MakeEngine(CERT_VERIFY_CERTIFICATE_TRUST *cert)
Definition: main.c:240
HRESULT WINAPI CertTrustCleanup(CRYPT_PROVIDER_DATA *pProvData)
Definition: main.c:100
DWORD WINAPI GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert, LPSTR pchBuffer, DWORD cchBuffer)
Definition: main.c:55
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged)
Definition: main.c:4370
static const WCHAR disallowed[]
Definition: main.c:447
#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
GUID guid
Definition: version.c:147
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
#define swprintf
Definition: precomp.h:40
BOOL WINAPI WintrustAddActionID(GUID *pgActionID, DWORD fdwFlags, CRYPT_REGISTER_ACTIONID *psProvInfo)
Definition: register.c:236
BOOL WINAPI WintrustRemoveActionID(GUID *pgActionID)
Definition: register.c:335
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
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
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
static BYTE cert[]
Definition: msg.c:1374
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:77
int k
Definition: mpi.c:3369
#define KEY_READ
Definition: nt_native.h:1026
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
static char title[]
Definition: ps.c:92
#define err(...)
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:615
#define LoadStringW
Definition: utils.h:64
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
PCCERT_CONTEXT pCertContext
Definition: wincrypt.h:1028
PCERT_INFO pCertInfo
Definition: wincrypt.h:491
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:282
CERT_POLICY_INFO * rgPolicyInfo
Definition: wincrypt.h:409
CRYPT_OBJID_BLOB Qualifier
Definition: wincrypt.h:398
CERT_TRUST_STATUS TrustStatus
Definition: wincrypt.h:1038
PCERT_CHAIN_ELEMENT * rgpElement
Definition: wincrypt.h:1040
BYTE * pbData
Definition: wincrypt.h:112
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: copy.c:22
LPCPROPSHEETPAGEW rgPropSheetPages
Definition: cryptuiapi.h:140
notice
Definition: t1tokens.h:26
struct sock * chain
Definition: tcpcore.h:1
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define X509_UNICODE_ANY_STRING
Definition: wincrypt.h:3542
#define CRYPT_FORMAT_STR_MULTI_LINE
Definition: wincrypt.h:3670
#define CERT_STORE_PROV_COLLECTION
Definition: wincrypt.h:2465
#define szOID_PKIX_POLICY_QUALIFIER_CPS
Definition: wincrypt.h:3447
#define CERT_CHAIN_REVOCATION_CHECK_END_CERT
Definition: wincrypt.h:1169
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2633
#define CRYPT_OID_FORMAT_OBJECT_FUNC
Definition: wincrypt.h:2668
#define CRYPT_OID_DECODE_OBJECT_FUNC
Definition: wincrypt.h:2662
#define CERT_TRUST_IS_NOT_TIME_NESTED
Definition: wincrypt.h:983
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3612
#define X509_CERT_POLICIES
Definition: wincrypt.h:3533
#define szOID_CERT_POLICIES
Definition: wincrypt.h:3353
#define szOID_PKIX_KP_EMAIL_PROTECTION
Definition: wincrypt.h:3453
#define CERT_STORE_PROV_SYSTEM_W
Definition: wincrypt.h:2463
#define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE
Definition: wincrypt.h:3448
#define CERT_FIND_SIGNATURE_HASH
Definition: wincrypt.h:3016
#define CERT_SIGNATURE_HASH_PROP_ID
Definition: wincrypt.h:2848
#define CERT_SYSTEM_STORE_CURRENT_USER
Definition: wincrypt.h:2528
#define CERT_TRUST_IS_NOT_SIGNATURE_VALID
Definition: wincrypt.h:985
#define CRYPT_OID_ENCODE_OBJECT_FUNC
Definition: wincrypt.h:2661
#define X509_PKIX_POLICY_QUALIFIER_USERNOTICE
Definition: wincrypt.h:3566
#define CERT_TRUST_IS_NOT_TIME_VALID
Definition: wincrypt.h:982
#define CERT_NAME_FRIENDLY_DISPLAY_TYPE
Definition: wincrypt.h:3659
#define WINAPI
Definition: msvc.h:6
#define TRUST_E_SUBJECT_NOT_TRUSTED
Definition: winerror.h:4622
#define S_FALSE
Definition: winerror.h:3451
#define TRUST_E_SUBJECT_FORM_UNKNOWN
Definition: winerror.h:4621
#define TRUST_E_NOSIGNATURE
Definition: winerror.h:4630
#define TRUST_E_SYSTEM_ERROR
Definition: winerror.h:4585
#define CERT_E_EXPIRED
Definition: winerror.h:4631
#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)
unsigned char BYTE
Definition: xxhash.c:193