From 7f642e51670bc38a4ef782a363936850bc2b0ba9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 22 Apr 2021 06:38:23 -0700 Subject: Move dutil into libs/dutil --- src/libs/dutil/WixToolset.DUtil/inc/certutil.h | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/libs/dutil/WixToolset.DUtil/inc/certutil.h (limited to 'src/libs/dutil/WixToolset.DUtil/inc/certutil.h') diff --git a/src/libs/dutil/WixToolset.DUtil/inc/certutil.h b/src/libs/dutil/WixToolset.DUtil/inc/certutil.h new file mode 100644 index 00000000..8565c1cf --- /dev/null +++ b/src/libs/dutil/WixToolset.DUtil/inc/certutil.h @@ -0,0 +1,66 @@ +#pragma once +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + + +#define ReleaseCertStore(p) if (p) { ::CertCloseStore(p, 0); p = NULL; } +#define ReleaseCertContext(p) if (p) { ::CertFreeCertificateContext(p); p = NULL; } +#define ReleaseCertChain(p) if (p) { ::CertFreeCertificateChain(p); p = NULL; } + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT DAPI CertReadProperty( + __in PCCERT_CONTEXT pCertContext, + __in DWORD dwProperty, + __out_bcount(*pcbValue) LPVOID pvValue, + __out_opt DWORD* pcbValue + ); + +HRESULT DAPI CertGetAuthenticodeSigningTimestamp( + __in CMSG_SIGNER_INFO* pSignerInfo, + __out FILETIME* pft + ); + +HRESULT DAPI GetCryptProvFromCert( + __in_opt HWND hwnd, + __in PCCERT_CONTEXT pCert, + __out HCRYPTPROV *phCryptProv, + __out DWORD *pdwKeySpec, + __in BOOL *pfDidCryptAcquire, + __deref_opt_out LPWSTR *ppwszTmpContainer, + __deref_opt_out LPWSTR *ppwszProviderName, + __out DWORD *pdwProviderType + ); + +HRESULT DAPI FreeCryptProvFromCert( + __in BOOL fAcquired, + __in HCRYPTPROV hProv, + __in_opt LPWSTR pwszCapiProvider, + __in DWORD dwProviderType, + __in_opt LPWSTR pwszTmpContainer + ); + +HRESULT DAPI GetProvSecurityDesc( + __in HCRYPTPROV hProv, + __deref_out SECURITY_DESCRIPTOR** pSecurity + ); + +HRESULT DAPI SetProvSecurityDesc( + __in HCRYPTPROV hProv, + __in SECURITY_DESCRIPTOR* pSecurity + ); + +BOOL DAPI CertHasPrivateKey( + __in PCCERT_CONTEXT pCertContext, + __out_opt DWORD* pdwKeySpec + ); + +HRESULT DAPI CertInstallSingleCertificate( + __in HCERTSTORE hStore, + __in PCCERT_CONTEXT pCertContext, + __in LPCWSTR wzName + ); +#ifdef __cplusplus +} +#endif -- cgit v1.2.3-55-g6feb