ifndef __CRYPTUIAPI_H__
define __CRYPTUIAPI_H__

include winapifamily.inc

if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

include wintrust.inc
include wincrypt.inc
include prsht.inc

.pragma pack(push, 8)

CERT_CREDENTIAL_PROVIDER_ID equ -509

CryptUIDlgViewContext proto WINAPI :DWORD, :ptr, :HWND, :LPCWSTR, :DWORD, :ptr
CryptUIDlgSelectCertificateFromStore proto WINAPI :HCERTSTORE, :HWND, :LPCWSTR, :LPCWSTR, :DWORD, :DWORD, :ptr

CRYPTUI_SELECT_ISSUEDTO_COLUMN equ 0x000000001
CRYPTUI_SELECT_ISSUEDBY_COLUMN equ 0x000000002
CRYPTUI_SELECT_INTENDEDUSE_COLUMN equ 0x000000004
CRYPTUI_SELECT_FRIENDLYNAME_COLUMN equ 0x000000008
CRYPTUI_SELECT_LOCATION_COLUMN equ 0x000000010
CRYPTUI_SELECT_EXPIRATION_COLUMN equ 0x000000020

CALLBACK(PFNCFILTERPROC, :PCCERT_CONTEXT, :ptr, :ptr)

CERT_SELECTUI_INPUT	STRUC
hStore			HCERTSTORE ?
prgpChain		PCCERT_CHAIN_CONTEXT ?
cChain			dd ?
CERT_SELECTUI_INPUT	ENDS
PCERT_SELECTUI_INPUT	typedef ptr CERT_SELECTUI_INPUT

CertSelectionGetSerializedBlob proto WINAPI :PCERT_SELECTUI_INPUT, :ptr, :ptr ULONG

CRYPTUI_CERT_MGR_TAB_MASK equ 0x0000000F
CRYPTUI_CERT_MGR_PUBLISHER_TAB equ 0x00000004
CRYPTUI_CERT_MGR_SINGLE_TAB_FLAG equ 0x00008000

CRYPTUI_CERT_MGR_STRUCT STRUC
dwSize			dd ?
hwndParent		HWND ?
dwFlags			dd ?
pwszTitle		LPCWSTR ?
pszInitUsageOID		LPCSTR ?
CRYPTUI_CERT_MGR_STRUCT ENDS
PCRYPTUI_CERT_MGR_STRUCT typedef ptr CRYPTUI_CERT_MGR_STRUCT

PCCRYPTUI_CERT_MGR_STRUCT typedef ptr CRYPTUI_CERT_MGR_STRUCT

CryptUIDlgCertMgr proto WINAPI :PCCRYPTUI_CERT_MGR_STRUCT

CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO STRUC
dwSize			dd ?
pGuidSubject		LPGUID ?
cbBlob			dd ?
pbBlob			LPBYTE ?
pwszDisplayName		LPCWSTR ?
CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO ENDS
PCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO
PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO

CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO STRUC
dwSize			dd ?
cCertStore		dd ?
rghCertStore		LPHCERTSTORE ?
pFilterCallback		PFNCFILTERPROC ?
pvCallbackData		PVOID ?
CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO ENDS
PCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO

PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO

CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO STRUC
dwSize			dd ?
pwszPvkFileName		LPWSTR ?
pwszProvName		LPWSTR ?
dwProvType		dd ?
CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO ENDS
PCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO

PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO

CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE equ 0x01
CRYPTUI_WIZ_DIGITAL_SIGN_PVK_PROV equ 0x02

CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO STRUC
dwSize			dd ?
pwszSigningCertFileName LPWSTR ?
dwPvkChoice		dd ?
UNION
pPvkFileInfo		PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO ?
pPvkProvInfo		PCRYPT_KEY_PROV_INFO ?
ENDS
CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO ENDS
PCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO
PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO

CRYPTUI_WIZ_DIGITAL_SIGN_COMMERCIAL equ 0x0001
CRYPTUI_WIZ_DIGITAL_SIGN_INDIVIDUAL equ 0x0002

CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO STRUC
dwSize			dd ?
dwAttrFlags		dd ?
pwszDescription		LPCWSTR ?
pwszMoreInfoLocation	LPCWSTR ?
pszHashAlg		LPCSTR ?
pwszSigningCertDisplayString LPCWSTR ?
hAdditionalCertStore	HCERTSTORE ?
psAuthenticated		PCRYPT_ATTRIBUTES ?
psUnauthenticated	PCRYPT_ATTRIBUTES ?
CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO ENDS
PCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO

CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_FILE equ 0x01
CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB equ 0x02

CRYPTUI_WIZ_DIGITAL_SIGN_CERT equ 0x01
CRYPTUI_WIZ_DIGITAL_SIGN_STORE equ 0x02
CRYPTUI_WIZ_DIGITAL_SIGN_PVK equ 0x03

CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN equ 0x00000001
CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN_NO_ROOT equ 0x00000002

CRYPTUI_WIZ_DIGITAL_SIGN_INFO STRUC
dwSize			dd ?
dwSubjectChoice		dd ?
UNION
pwszFileName		LPCWSTR ?
pSignBlobInfo		PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO ?
ENDS
dwSigningCertChoice	dd ?
UNION
pSigningCertContext	PCCERT_CONTEXT ?
pSigningCertStore	PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO ?
pSigningCertPvkInfo	PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO ?
ENDS
pwszTimestampURL	LPCWSTR ?
dwAdditionalCertChoice	dd ?
pSignExtInfo		PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO ?
CRYPTUI_WIZ_DIGITAL_SIGN_INFO ENDS
PCRYPTUI_WIZ_DIGITAL_SIGN_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_INFO
PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_INFO


CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT STRUC
dwSize			dd ?
cbBlob			dd ?
pbBlob			LPBYTE ?
CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT ENDS
PCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT

PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT typedef ptr CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT

CRYPTUI_WIZ_NO_UI	equ 0x0001
CRYPTUI_WIZ_DIGITAL_SIGN_EXCLUDE_PAGE_HASHES equ 0x0002
CRYPTUI_WIZ_DIGITAL_SIGN_INCLUDE_PAGE_HASHES equ 0x0004

CryptUIWizDigitalSign proto WINAPI :DWORD, :HWND, :LPCWSTR, :PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO, :PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT
CryptUIWizFreeDigitalSignContext proto WINAPI :PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT

CRYPTUI_HIDE_HIERARCHYPAGE equ 0x00000001
CRYPTUI_HIDE_DETAILPAGE equ 0x00000002
CRYPTUI_DISABLE_EDITPROPERTIES equ 0x00000004
CRYPTUI_ENABLE_EDITPROPERTIES equ 0x00000008
CRYPTUI_DISABLE_ADDTOSTORE equ 0x00000010
CRYPTUI_ENABLE_ADDTOSTORE equ 0x00000020
CRYPTUI_ACCEPT_DECLINE_STYLE equ 0x00000040
CRYPTUI_IGNORE_UNTRUSTED_ROOT equ 0x00000080
CRYPTUI_DONT_OPEN_STORES equ 0x00000100
CRYPTUI_ONLY_OPEN_ROOT_STORE equ 0x00000200
CRYPTUI_WARN_UNTRUSTED_ROOT equ 0x00000400
CRYPTUI_ENABLE_REVOCATION_CHECKING equ 0x00000800
CRYPTUI_WARN_REMOTE_TRUST equ 0x00001000
CRYPTUI_DISABLE_EXPORT	equ 0x00002000

CRYPTUI_ENABLE_REVOCATION_CHECK_END_CERT equ 0x00004000
CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN equ 0x00008000
CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT equ CRYPTUI_ENABLE_REVOCATION_CHECKING

CRYPTUI_DISABLE_HTMLLINK equ 0x00010000
CRYPTUI_DISABLE_ISSUERSTATEMENT equ 0x00020000

CRYPTUI_CACHE_ONLY_URL_RETRIEVAL equ 0x00040000
CRYPTUI_INITDIALOG_STRUCT STRUC
lParam			LPARAM ?
pCertContext		PCCERT_CONTEXT ?
CRYPTUI_INITDIALOG_STRUCT ENDS
PCRYPTUI_INITDIALOG_STRUCT typedef ptr CRYPTUI_INITDIALOG_STRUCT


CRYPTUI_VIEWCERTIFICATE_STRUCTW STRUC
dwSize			dd ?
hwndParent		HWND ?
dwFlags			dd ?
szTitle			LPCWSTR ?
pCertContext		PCCERT_CONTEXT ?
rgszPurposes		LPCSTR ?
cPurposes		dd ?
UNION
pCryptProviderData	PCRYPT_PROVIDER_DATA ?
hWVTStateData		HANDLE ?
ENDS
fpCryptProviderDataTrustedUsage BOOL ?
idxSigner		dd ?
idxCert			dd ?
fCounterSigner		BOOL ?
idxCounterSigner	dd ?
cStores			dd ?
rghStores		LPHCERTSTORE ?
cPropSheetPages		dd ?
rgPropSheetPages	LPCPROPSHEETPAGEW ?
nStartPage		dd ?
CRYPTUI_VIEWCERTIFICATE_STRUCTW ENDS
PCRYPTUI_VIEWCERTIFICATE_STRUCTW typedef ptr CRYPTUI_VIEWCERTIFICATE_STRUCTW
PCCRYPTUI_VIEWCERTIFICATE_STRUCTW typedef ptr CRYPTUI_VIEWCERTIFICATE_STRUCTW


CRYPTUI_VIEWCERTIFICATE_STRUCTA	 STRUC
dwSize			dd ?
hwndParent		HWND ?
dwFlags			dd ?
szTitle			LPCSTR ?
pCertContext		PCCERT_CONTEXT ?
rgszPurposes		LPCSTR ?
cPurposes		dd ?
UNION
pCryptProviderData	PCRYPT_PROVIDER_DATA ?
hWVTStateData		HANDLE ?
ENDS
fpCryptProviderDataTrustedUsage BOOL ?
idxSigner		dd ?
idxCert			dd ?
fCounterSigner		BOOL ?
idxCounterSigner	dd ?
cStores			dd ?
rghStores		LPHCERTSTORE ?
cPropSheetPages		dd ?
rgPropSheetPages	LPCPROPSHEETPAGEA ?
nStartPage		dd ?
CRYPTUI_VIEWCERTIFICATE_STRUCTA ENDS
PCRYPTUI_VIEWCERTIFICATE_STRUCTA typedef ptr CRYPTUI_VIEWCERTIFICATE_STRUCTA
PCCRYPTUI_VIEWCERTIFICATE_STRUCTA typedef ptr CRYPTUI_VIEWCERTIFICATE_STRUCTA

CryptUIDlgViewCertificateW proto WINAPI :PCCRYPTUI_VIEWCERTIFICATE_STRUCTW, :ptr BOOL
CryptUIDlgViewCertificateA proto WINAPI :PCCRYPTUI_VIEWCERTIFICATE_STRUCTA, :ptr BOOL

ifdef _UNICODE
CryptUIDlgViewCertificate equ <CryptUIDlgViewCertificateW>
PCRYPTUI_VIEWCERTIFICATE_STRUCT equ <PCRYPTUI_VIEWCERTIFICATE_STRUCTW>
CRYPTUI_VIEWCERTIFICATE_STRUCT equ <CRYPTUI_VIEWCERTIFICATE_STRUCTW>
PCCRYPTUI_VIEWCERTIFICATE_STRUCT equ <PCCRYPTUI_VIEWCERTIFICATE_STRUCTW>
else
CryptUIDlgViewCertificate equ <CryptUIDlgViewCertificateA>
PCRYPTUI_VIEWCERTIFICATE_STRUCT equ <PCRYPTUI_VIEWCERTIFICATE_STRUCTA>
CRYPTUI_VIEWCERTIFICATE_STRUCT equ <CRYPTUI_VIEWCERTIFICATE_STRUCTA>
PCCRYPTUI_VIEWCERTIFICATE_STRUCT equ <PCCRYPTUI_VIEWCERTIFICATE_STRUCTA>
endif

CRYPTUI_WIZ_EXPORT_CERT_CONTEXT equ 1
CRYPTUI_WIZ_EXPORT_CTL_CONTEXT equ 2
CRYPTUI_WIZ_EXPORT_CRL_CONTEXT equ 3
CRYPTUI_WIZ_EXPORT_CERT_STORE equ 4
CRYPTUI_WIZ_EXPORT_CERT_STORE_CERTIFICATES_ONLY equ 5
CRYPTUI_WIZ_EXPORT_FORMAT_CRL equ 6
CRYPTUI_WIZ_EXPORT_FORMAT_CTL equ 7

CRYPTUI_WIZ_EXPORT_INFO STRUC
dwSize			dd ?
pwszExportFileName	LPCWSTR ?
dwSubjectChoice		dd ?
UNION
pCertContext		PCCERT_CONTEXT ?
pCTLContext		PCCTL_CONTEXT ?
pCRLContext		PCCRL_CONTEXT ?
hCertStore		HCERTSTORE ?
ENDS
cStores			dd ?
rghStores		LPHCERTSTORE ?
CRYPTUI_WIZ_EXPORT_INFO ENDS
PCRYPTUI_WIZ_EXPORT_INFO typedef ptr CRYPTUI_WIZ_EXPORT_INFO
PCCRYPTUI_WIZ_EXPORT_INFO typedef ptr CRYPTUI_WIZ_EXPORT_INFO


CRYPTUI_WIZ_EXPORT_FORMAT_DER equ 1
CRYPTUI_WIZ_EXPORT_FORMAT_PFX equ 2
CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7 equ 3
CRYPTUI_WIZ_EXPORT_FORMAT_BASE64 equ 4
CRYPTUI_WIZ_EXPORT_FORMAT_SERIALIZED_CERT_STORE equ 5

CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO STRUC
dwSize			dd ?
dwExportFormat		dd ?
fExportChain		BOOL ?
fExportPrivateKeys	BOOL ?
pwszPassword		LPCWSTR ?
fStrongEncryption	BOOL ?
CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO ENDS
PCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO typedef ptr CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO
PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO typedef ptr CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO

CryptUIWizExport proto WINAPI :DWORD, :HWND, :LPCWSTR, :PCCRYPTUI_WIZ_EXPORT_INFO, :ptr

CRYPTUI_WIZ_IMPORT_SUBJECT_FILE equ 1
CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT equ 2
CRYPTUI_WIZ_IMPORT_SUBJECT_CTL_CONTEXT equ 3
CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT equ 4
CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE equ 5

CRYPTUI_WIZ_IMPORT_SRC_INFO STRUC
dwSize			dd ?
dwSubjectChoice		dd ?
UNION
pwszFileName		LPCWSTR ?
pCertContext		PCCERT_CONTEXT ?
pCTLContext		PCCTL_CONTEXT ?
pCRLContext		PCCRL_CONTEXT ?
hCertStore		HCERTSTORE ?
ENDS
dwFlags			dd ?
pwszPassword		LPCWSTR ?
CRYPTUI_WIZ_IMPORT_SRC_INFO ENDS
PCRYPTUI_WIZ_IMPORT_SRC_INFO typedef ptr CRYPTUI_WIZ_IMPORT_SRC_INFO
PCCRYPTUI_WIZ_IMPORT_SRC_INFO typedef ptr CRYPTUI_WIZ_IMPORT_SRC_INFO

CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE equ 0x00010000
CRYPTUI_WIZ_IMPORT_ALLOW_CERT equ 0x00020000
CRYPTUI_WIZ_IMPORT_ALLOW_CRL equ 0x00040000
CRYPTUI_WIZ_IMPORT_ALLOW_CTL equ 0x00080000
CRYPTUI_WIZ_IMPORT_TO_LOCALMACHINE equ 0x00100000
CRYPTUI_WIZ_IMPORT_TO_CURRENTUSER equ 0x00200000
CRYPTUI_WIZ_IMPORT_REMOTE_DEST_STORE equ 0x00400000

CryptUIWizImport proto WINAPI :DWORD, :HWND, :LPCWSTR, :PCCRYPTUI_WIZ_IMPORT_SRC_INFO, :HCERTSTORE

.pragma pack(pop)

endif

endif
