ifndef __CRYPTDLG_H__
define __CRYPTDLG_H__

include winapifamily.inc

if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

if (_WIN32_WINNT GE 0x0400) OR defined(_MAC) OR defined(WIN16)

include prsht.inc

CRYTPDLG_FLAGS_MASK	equ 0xff000000
CRYPTDLG_REVOCATION_DEFAULT equ 0x00000000
CRYPTDLG_REVOCATION_ONLINE equ 0x80000000
CRYPTDLG_REVOCATION_CACHE equ 0x40000000
CRYPTDLG_REVOCATION_NONE equ 0x20000000
CRYPTDLG_CACHE_ONLY_URL_RETRIEVAL equ 0x10000000
CRYPTDLG_DISABLE_AIA	equ 0x08000000


CRYPTDLG_POLICY_MASK	equ 0x0000FFFF
POLICY_IGNORE_NON_CRITICAL_BC equ 0x00000001

CRYPTDLG_ACTION_MASK	equ 0xFFFF0000
ACTION_REVOCATION_DEFAULT_ONLINE equ 0x00010000
ACTION_REVOCATION_DEFAULT_CACHE equ 0x00020000

CALLBACK(PFNCMFILTERPROC, :PCCERT_CONTEXT, :LPARAM, :DWORD, :DWORD)

CERT_DISPWELL_SELECT	equ 1
CERT_DISPWELL_TRUST_CA_CERT equ 2
CERT_DISPWELL_TRUST_LEAF_CERT equ 3
CERT_DISPWELL_TRUST_ADD_CA_CERT equ 4
CERT_DISPWELL_TRUST_ADD_LEAF_CERT equ 5
CERT_DISPWELL_DISTRUST_CA_CERT equ 6
CERT_DISPWELL_DISTRUST_LEAF_CERT equ 7
CERT_DISPWELL_DISTRUST_ADD_CA_CERT equ 8
CERT_DISPWELL_DISTRUST_ADD_LEAF_CERT equ 9

CALLBACK(PFNCMHOOKPROC, :HWND, :UINT, :WPARAM, :LPARAM)

CSS_SELECTCERT_MASK	equ 0x00ffffff
CSS_HIDE_PROPERTIES	equ 0x00000001
CSS_ENABLEHOOK		equ 0x00000002
CSS_ALLOWMULTISELECT	equ 0x00000004
CSS_SHOW_HELP		equ 0x00000010
CSS_ENABLETEMPLATE	equ 0x00000020
CSS_ENABLETEMPLATEHANDLE equ 0x00000040

SELCERT_OK		equ IDOK
SELCERT_CANCEL		equ IDCANCE
SELCERT_PROPERTIES	equ 100
SELCERT_FINEPRINT	equ 101
SELCERT_CERTLIST	equ 102
SELCERT_HELP		equ IDHELP
SELCERT_ISSUED_TO	equ 103
SELCERT_VALIDITY	equ 104
SELCERT_ALGORITHM	equ 105
SELCERT_SERIAL_NUM	equ 106
SELCERT_THUMBPRINT	equ 107

CERT_SELECT_STRUCT_A	STRUC
dwSize			dd ?
hwndParent		HWND ?
hInstance		HINSTANCE ?
pTemplateName		LPCSTR ?
dwFlags			dd ?
szTitle			LPCSTR ?
cCertStore		dd ?
arrayCertStore		LPHCERTSTORE ?
szPurposeOid		LPCSTR ?
cCertContext		dd ?
arrayCertContext	PCCERT_CONTEXT ?
lCustData		LPARAM ?
pfnHook			PFNCMHOOKPROC ?
pfnFilter		PFNCMFILTERPROC ?
szHelpFileName		LPCSTR ?
dwHelpId		dd ?
hprov			HCRYPTPROV ?
CERT_SELECT_STRUCT_A	ENDS
PCERT_SELECT_STRUCT_A	typedef ptr CERT_SELECT_STRUCT_A

CERT_SELECT_STRUCT_W	STRUC
dwSize			dd ?
hwndParent		HWND ?
hInstance		HINSTANCE ?
pTemplateName		LPCWSTR ?
dwFlags			dd ?
szTitle			LPCWSTR ?
cCertStore		dd ?
arrayCertStore		LPHCERTSTORE ?
szPurposeOid		LPCSTR ?
cCertContext		dd ?
arrayCertContext	PCCERT_CONTEXT ?
lCustData		LPARAM ?
pfnHook			PFNCMHOOKPROC ?
pfnFilter		PFNCMFILTERPROC ?
szHelpFileName		LPCWSTR ?
dwHelpId		dd ?
hprov			HCRYPTPROV ?
CERT_SELECT_STRUCT_W	ENDS
PCERT_SELECT_STRUCT_W	typedef ptr CERT_SELECT_STRUCT_W

ifdef _UNICODE
CERT_SELECT_STRUCT	typedef CERT_SELECT_STRUCT_W
PCERT_SELECT_STRUCT	typedef PCERT_SELECT_STRUCT_W
else
CERT_SELECT_STRUCT	typedef CERT_SELECT_STRUCT_A
PCERT_SELECT_STRUCT	typedef PCERT_SELECT_STRUCT_A
endif

CertSelectCertificateA proto WINAPI :PCERT_SELECT_STRUCT_A

ifdef MAC
CertSelectCertificate	equ <CertSelectCertificateA>
else
CertSelectCertificateW proto WINAPI :PCERT_SELECT_STRUCT_W
ifdef _UNICODE
CertSelectCertificate	equ <CertSelectCertificateW>
else
CertSelectCertificate	equ <CertSelectCertificateA>
endif
endif


CM_VIEWFLAGS_MASK	equ 0x00ffffff
CM_ENABLEHOOK		equ 0x00000001
CM_SHOW_HELP		equ 0x00000002
CM_SHOW_HELPICON	equ 0x00000004
CM_ENABLETEMPLATE	equ 0x00000008
CM_HIDE_ADVANCEPAGE	equ 0x00000010
CM_HIDE_TRUSTPAGE	equ 0x00000020
CM_NO_NAMECHANGE	equ 0x00000040
CM_NO_EDITTRUST		equ 0x00000080
CM_HIDE_DETAILPAGE	equ 0x00000100
CM_ADD_CERT_STORES	equ 0x00000200
CERTVIEW_CRYPTUI_LPARAM equ 0x00800000

CERT_VIEWPROPERTIES_STRUCT_A  STRUC
dwSize			dd ?
hwndParent		HWND ?
hInstance		HINSTANCE ?
dwFlags			dd ?
szTitle			LPCSTR ?
pCertContext		PCCERT_CONTEXT ?
arrayPurposes		LPSTR ?
cArrayPurposes		dd ?
cRootStores		dd ?
rghstoreRoots		LPHCERTSTORE ?
cStores			dd ?
rghstoreCAs		LPHCERTSTORE ?
cTrustStores		dd ?
rghstoreTrust		LPHCERTSTORE ?
hprov			HCRYPTPROV ?
lCustData		LPARAM ?
dwPad			dd ?
szHelpFileName		LPCSTR ?
dwHelpId		dd ?
nStartPage		dd ?
cArrayPropSheetPages	dd ?
arrayPropSheetPages	PVOID ? ; LPPROPSHEETPAGE
CERT_VIEWPROPERTIES_STRUCT_A ENDS
PCERT_VIEWPROPERTIES_STRUCT_A typedef ptr CERT_VIEWPROPERTIES_STRUCT_A

CERT_VIEWPROPERTIES_STRUCT_W  STRUC
dwSize			dd ?
hwndParent		HWND ?
hInstance		HINSTANCE ?
dwFlags			dd ?
szTitle			LPCWSTR ?
pCertContext		PCCERT_CONTEXT ?
arrayPurposes		LPSTR ?
cArrayPurposes		dd ?
cRootStores		dd ?
rghstoreRoots		LPHCERTSTORE ?
cStores			dd ?
rghstoreCAs		LPHCERTSTORE ?
cTrustStores		dd ?
rghstoreTrust		LPHCERTSTORE ?
hprov			HCRYPTPROV ?
lCustData		LPARAM ?
dwPad			dd ?
szHelpFileName		LPCWSTR ?
dwHelpId		dd ?
nStartPage		dd ?
cArrayPropSheetPages	dd ?
arrayPropSheetPages	PVOID ? ; LPPROPSHEETPAGE
CERT_VIEWPROPERTIES_STRUCT_W ENDS
PCERT_VIEWPROPERTIES_STRUCT_W typedef ptr CERT_VIEWPROPERTIES_STRUCT_W

ifdef _UNICODE
CERT_VIEWPROPERTIES_STRUCT typedef CERT_VIEWPROPERTIES_STRUCT_W
PCERT_VIEWPROPERTIES_STRUCT typedef PCERT_VIEWPROPERTIES_STRUCT_W
else
CERT_VIEWPROPERTIES_STRUCT typedef CERT_VIEWPROPERTIES_STRUCT_A
PCERT_VIEWPROPERTIES_STRUCT typedef PCERT_VIEWPROPERTIES_STRUCT_A
endif

CertViewPropertiesA proto WINAPI :PCERT_VIEWPROPERTIES_STRUCT_A

ifdef MAC
CertViewProperties	equ <CertViewPropertiesA>
else
CertViewPropertiesW proto WINAPI :PCERT_VIEWPROPERTIES_STRUCT_W

ifdef _UNICODE
CertViewProperties	equ <CertViewPropertiesW>
else
CertViewProperties	equ <CertViewPropertiesA>
endif
endif



CERT_FILTER_OP_EXISTS	equ 1
CERT_FILTER_OP_NOT_EXISTS equ 2
CERT_FILTER_OP_EQUALITY equ 3

CERT_FILTER_EXTENSION_MATCH STRUC
szExtensionOID		LPCSTR ?
dwTestOperation		dd ?
pbTestData		LPBYTE ?
cbTestData		dd ?
CERT_FILTER_EXTENSION_MATCH ENDS
CMOID			typedef CERT_FILTER_EXTENSION_MATCH
PCERT_FILTER_EXTENSION_MATCH typedef ptr LPCERT_FILTER_EXTENSION_MATCH

CERT_FILTER_INCLUDE_V1_CERTS equ 0x0001
CERT_FILTER_VALID_TIME_RANGE equ 0x0002
CERT_FILTER_VALID_SIGNATURE equ 0x0004
CERT_FILTER_LEAF_CERTS_ONLY equ 0x0008
CERT_FILTER_ISSUER_CERTS_ONLY equ 0x0010
CERT_FILTER_KEY_EXISTS	equ 0x0020

CERT_FILTER_DATA	STRUC
dwSize			dd ?
cExtensionChecks	dd ?
arrayExtensionChecks	PCERT_FILTER_EXTENSION_MATCH ?
dwCheckingFlags		dd ?
CERT_FILTER_DATA	ENDS
CMFLTR			typedef CERT_FILTER_DATA

GetFriendlyNameOfCertA proto WINAPI :PCCERT_CONTEXT, :LPSTR, :DWORD
GetFriendlyNameOfCertW proto WINAPI :PCCERT_CONTEXT, :LPWSTR, :DWORD
ifdef _UNICODE
GetFriendlyNameOfCert	equ <GetFriendlyNameOfCertW>
else
GetFriendlyNameOfCert	equ <GetFriendlyNameOfCertA>
endif

CERT_CERTIFICATE_ACTION_VERIFY equ <{0x7801ebd0,0xcf4b,0x11d0,{0x85,0x1f,0x00,0x60,0x97,0x93,0x87,0xea}}>

szCERT_CERTIFICATE_ACTION_VERIFY equ <"{7801ebd0-cf4b-11d0-851f-0060979387ea}">

CALLBACK(PFNTRUSTHELPER, :PCCERT_CONTEXT, :LPARAM, :BOOL, :LPBYTE)

CERT_VALIDITY_BEFORE_START equ 0x00000001
CERT_VALIDITY_AFTER_END equ 0x00000002
CERT_VALIDITY_SIGNATURE_FAILS equ 0x00000004
CERT_VALIDITY_CERTIFICATE_REVOKED equ 0x00000008
CERT_VALIDITY_KEY_USAGE_EXT_FAILURE equ 0x00000010
CERT_VALIDITY_EXTENDED_USAGE_FAILURE equ 0x00000020
CERT_VALIDITY_NAME_CONSTRAINTS_FAILURE equ 0x00000040
CERT_VALIDITY_UNKNOWN_CRITICAL_EXTENSION equ 0x00000080
CERT_VALIDITY_ISSUER_INVALID equ 0x00000100
CERT_VALIDITY_OTHER_EXTENSION_FAILURE equ 0x00000200
CERT_VALIDITY_PERIOD_NESTING_FAILURE equ 0x00000400
CERT_VALIDITY_OTHER_ERROR equ 0x00000800
CERT_VALIDITY_ISSUER_DISTRUST equ 0x02000000
CERT_VALIDITY_EXPLICITLY_DISTRUSTED equ 0x01000000
CERT_VALIDITY_NO_ISSUER_CERT_FOUND equ 0x10000000
CERT_VALIDITY_NO_CRL_FOUND equ 0x20000000
CERT_VALIDITY_CRL_OUT_OF_DATE equ 0x40000000
CERT_VALIDITY_NO_TRUST_DATA equ 0x80000000
CERT_VALIDITY_MASK_TRUST equ 0xffff0000
CERT_VALIDITY_MASK_VALIDITY equ 0x0000ffff

CERT_TRUST_MASK		equ 0x00ffffff
CERT_TRUST_DO_FULL_SEARCH equ 0x00000001
CERT_TRUST_PERMIT_MISSING_CRLS equ 0x00000002
CERT_TRUST_DO_FULL_TRUST equ 0x00000005
CERT_TRUST_ADD_CERT_STORES equ CM_ADD_CERT_STORES


CERT_VERIFY_CERTIFICATE_TRUST  STRUC
cbSize			dd ?
pccert			PCCERT_CONTEXT ?
dwFlags			dd ?
dwIgnoreErr		dd ?
pdwErrors		LPDWORD ?
pszUsageOid		LPSTR ?
hprov			HCRYPTPROV ?
cRootStores		dd ?
rghstoreRoots		LPHCERTSTORE ?
cStores			dd ?
rghstoreCAs		LPHCERTSTORE ?
cTrustStores		dd ?
rghstoreTrust		LPHCERTSTORE ?
lCustData		LPARAM ?
pfnTrustHelper		PFNTRUSTHELPER ?
pcChain			LPDWORD ?
prgChain		PCCERT_CONTEXT ?
prgdwErrors		LPDWORD ?
prgpbTrustInfo		PDATA_BLOB ?
CERT_VERIFY_CERTIFICATE_TRUST ENDS
PCERT_VERIFY_CERTIFICATE_TRUST typedef ptr CERT_VERIFY_CERTIFICATE_TRUST


CTL_MODIFY_REQUEST_ADD_NOT_TRUSTED equ 1
CTL_MODIFY_REQUEST_REMOVE equ 2
CTL_MODIFY_REQUEST_ADD_TRUSTED equ 3

CTL_MODIFY_REQUEST	STRUC
pccert			PCCERT_CONTEXT ?
dwOperation		dd ?
dwError			dd ?
CTL_MODIFY_REQUEST	ENDS
PCTL_MODIFY_REQUEST	typedef ptr CTL_MODIFY_REQUEST

CertModifyCertificatesToTrust proto WINAPI :SINT, :PCTL_MODIFY_REQUEST, :LPCSTR, :HWND, :HCERTSTORE, :PCCERT_CONTEXT

ifdef WIN16
CertConfigureTrustA proto WINAPI
FormatVerisignExtension proto WINAPI :DWORD, :DWORD, :DWORD, :ptr, :LPCSTR, :ptr BYTE, :DWORD, :ptr, :ptr
endif
endif
endif
endif
