ifndef WINTRUST_H
define WINTRUST_H
.pragma list(push, 0)

include wincrypt.inc

ifndef WIN_CERT_REVISION_1_0
WT_DEFINE_ALL_APIS equ 1
;else
;WT_DEFINE_ALL_APIS equ <>
endif

.pragma pack(push, 8)

WINTRUST_CONFIG_REGPATH			    equ <L"Software\\Microsoft\\Cryptography\\Wintrust\\Config">

WINTRUST_MAX_HEADER_BYTES_TO_MAP_VALUE_NAME equ <L"MaxHeaderBytesToMap">
WINTRUST_MAX_HEADER_BYTES_TO_MAP_DEFAULT    equ 0x00A00000

WINTRUST_MAX_HASH_BYTES_TO_MAP_VALUE_NAME   equ <L"MaxHashBytesToMap">
WINTRUST_MAX_HASH_BYTES_TO_MAP_DEFAULT	    equ 0x00100000

WTD_UI_ALL		equ 1
WTD_UI_NONE		equ 2
WTD_UI_NOBAD		equ 3
WTD_UI_NOGOOD		equ 4

WTD_REVOKE_NONE		equ 0x00000000
WTD_REVOKE_WHOLECHAIN	equ 0x00000001

WTD_CHOICE_FILE		equ 1
WTD_CHOICE_CATALOG	equ 2
WTD_CHOICE_BLOB		equ 3
WTD_CHOICE_SIGNER	equ 4
WTD_CHOICE_CERT		equ 5

WTD_STATEACTION_IGNORE		equ 0x00000000
WTD_STATEACTION_VERIFY		equ 0x00000001
WTD_STATEACTION_CLOSE		equ 0x00000002
WTD_STATEACTION_AUTO_CACHE	equ 0x00000003
WTD_STATEACTION_AUTO_CACHE_FLUSH equ 0x00000004

WTD_PROV_FLAGS_MASK		equ 0x0000FFFF
WTD_USE_IE4_TRUST_FLAG		equ 0x00000001
WTD_NO_IE4_CHAIN_FLAG		equ 0x00000002
WTD_NO_POLICY_USAGE_FLAG	equ 0x00000004
WTD_REVOCATION_CHECK_NONE	equ 0x00000010
WTD_REVOCATION_CHECK_END_CERT	equ 0x00000020
WTD_REVOCATION_CHECK_CHAIN	equ 0x00000040
WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT equ 0x00000080
WTD_SAFER_FLAG			equ 0x00000100
WTD_HASH_ONLY_FLAG		equ 0x00000200
WTD_USE_DEFAULT_OSVER_CHECK	equ 0x00000400
WTD_LIFETIME_SIGNING_FLAG	equ 0x00000800
WTD_CACHE_ONLY_URL_RETRIEVAL	equ 0x00001000	; affects CRL retrieval and AIA retrieval

WTD_UICONTEXT_EXECUTE	equ 0
WTD_UICONTEXT_INSTALL	equ 1

WINTRUST_FILE_INFO	STRUC
cbStruct		dd ?
pcwszFilePath		LPCWSTR ?
hFile			HANDLE ?
pgKnownSubject		LPGUID ?
WINTRUST_FILE_INFO	ENDS
PWINTRUST_FILE_INFO	typedef ptr WINTRUST_FILE_INFO

WINTRUST_CATALOG_INFO	STRUC
cbStruct		dd ?
dwCatalogVersion	dd ?
pcwszCatalogFilePath	LPCWSTR ?
pcwszMemberTag		LPCWSTR ?
pcwszMemberFilePath	LPCWSTR ?
hMemberFile		HANDLE ?
pbCalculatedFileHash	LPBYTE ?
cbCalculatedFileHash	dd ?
pcCatalogContext	PCCTL_CONTEXT ?
WINTRUST_CATALOG_INFO	ENDS
PWINTRUST_CATALOG_INFO	typedef ptr WINTRUST_CATALOG_INFO

WINTRUST_BLOB_INFO	STRUC
cbStruct		dd ?
gSubject		GUID <>
pcwszDisplayName	LPCWSTR ?
cbMemObject		dd ?
pbMemObject		LPBYTE ?
cbMemSignedMsg		dd ?
pbMemSignedMsg		LPBYTE ?
WINTRUST_BLOB_INFO	ENDS
PWINTRUST_BLOB_INFO	typedef ptr WINTRUST_BLOB_INFO

WINTRUST_SGNR_INFO	STRUC
cbStruct		dd ?
pcwszDisplayName	LPCWSTR ?
psSignerInfo		PCMSG_SIGNER_INFO ?
chStores		dd ?
pahStores		HCERTSTORE ?
WINTRUST_SGNR_INFO	ENDS
PWINTRUST_SGNR_INFO	typedef ptr WINTRUST_SGNR_INFO

WTCI_DONT_OPEN_STORES	equ 0x00000001	; only open dummy "root" all other are in pahStores.
WTCI_OPEN_ONLY_ROOT	equ 0x00000002
WTCI_USE_LOCAL_MACHINE	equ 0x00000004	; Local machine context

WINTRUST_CERT_INFO	STRUC
cbStruct		dd ?
pcwszDisplayName	LPCWSTR ?
psCertContext		PCERT_CONTEXT ?
chStores		dd ?
pahStores		HCERTSTORE ?
dwFlags			dd ?
psftVerifyAsOf		LPFILETIME ?
WINTRUST_CERT_INFO	ENDS
PWINTRUST_CERT_INFO	typedef ptr WINTRUST_CERT_INFO

WINTRUST_DATA		STRUC
cbStruct		dd ?
pPolicyCallbackData	PVOID ?
pSIPClientData		PVOID ?
dwUIChoice		dd ?
fdwRevocationChecks	dd ?
dwUnionChoice		dd ?
UNION
 pFile			PWINTRUST_FILE_INFO ?
 pCatalog		PWINTRUST_CATALOG_INFO ?
 pBlob			PWINTRUST_BLOB_INFO ?
 pSgnr			PWINTRUST_SGNR_INFO ?
 pCert			PWINTRUST_CERT_INFO ?
ENDS
dwStateAction		dd ?
hWVTStateData		HANDLE ?
pwszURLReference	LPWSTR ?
dwProvFlags		dd ?
dwUIContext		dd ?
WINTRUST_DATA		ENDS
PWINTRUST_DATA		typedef ptr WINTRUST_DATA

.pragma pack(pop)

WinVerifyTrust proto WINAPI :HWND, :ptr, :ptr
WinVerifyTrustEx proto WINAPI :HWND, :ptr, :PWINTRUST_DATA

WTPF_TRUSTTEST		equ 0x00000020
WTPF_TESTCANBEVALID	equ 0x00000080
WTPF_IGNOREEXPIRATION	equ 0x00000100
WTPF_IGNOREREVOKATION	equ 0x00000200
WTPF_OFFLINEOK_IND	equ 0x00000400
WTPF_OFFLINEOK_COM	equ 0x00000800
WTPF_OFFLINEOKNBU_IND	equ 0x00001000
WTPF_OFFLINEOKNBU_COM	equ 0x00002000
WTPF_VERIFY_V1_OFF	equ 0x00010000
WTPF_IGNOREREVOCATIONONTS equ 0x00020000
WTPF_ALLOWONLYPERTRUST	equ 0x00040000

WintrustGetRegPolicyFlags proto WINAPI :LPDWORD
WintrustSetRegPolicyFlags proto WINAPI :DWORD

TRUSTERROR_STEP_WVTPARAMS	equ 0
TRUSTERROR_STEP_FILEIO		equ 2
TRUSTERROR_STEP_SIP		equ 3
TRUSTERROR_STEP_SIPSUBJINFO	equ 5
TRUSTERROR_STEP_CATALOGFILE	equ 6
TRUSTERROR_STEP_CERTSTORE	equ 7
TRUSTERROR_STEP_MESSAGE		equ 8
TRUSTERROR_STEP_MSG_SIGNERCOUNT equ 9
TRUSTERROR_STEP_MSG_INNERCNTTYPE equ 10
TRUSTERROR_STEP_MSG_INNERCNT	equ 11
TRUSTERROR_STEP_MSG_STORE	equ 12
TRUSTERROR_STEP_MSG_SIGNERINFO	equ 13
TRUSTERROR_STEP_MSG_SIGNERCERT	equ 14
TRUSTERROR_STEP_MSG_CERTCHAIN	equ 15
TRUSTERROR_STEP_MSG_COUNTERSIGINFO equ 16
TRUSTERROR_STEP_MSG_COUNTERSIGCERT equ 17
TRUSTERROR_STEP_VERIFY_MSGHASH	equ 18
TRUSTERROR_STEP_VERIFY_MSGINDIRECTDATA equ 19

TRUSTERROR_STEP_FINAL_WVTINIT	equ 30
TRUSTERROR_STEP_FINAL_INITPROV	equ 31
TRUSTERROR_STEP_FINAL_OBJPROV	equ 32
TRUSTERROR_STEP_FINAL_SIGPROV	equ 33
TRUSTERROR_STEP_FINAL_CERTPROV	equ 34
TRUSTERROR_STEP_FINAL_CERTCHKPROV equ 35
TRUSTERROR_STEP_FINAL_POLICYPROV equ 36
TRUSTERROR_STEP_FINAL_UIPROV	equ 37

TRUSTERROR_MAX_STEPS		equ 38

CALLBACK(PFN_CPD_MEM_ALLOC, :DWORD)
CALLBACK(PFN_CPD_MEM_FREE, :ptr)

;typedef CRYPT_PROVIDER_DATA
;typedef CRYPT_PROVIDER_SGNR
;typedef CRYPT_PROVIDER_PRIVDATA

CALLBACK(PFN_CPD_ADD_STORE, :ptr CRYPT_PROVIDER_DATA, :HCERTSTORE)
CALLBACK(PFN_CPD_ADD_SGNR, :ptr CRYPT_PROVIDER_DATA, :BOOL, :DWORD, :ptr CRYPT_PROVIDER_SGNR)
CALLBACK(PFN_CPD_ADD_CERT, :ptr CRYPT_PROVIDER_DATA, :DWORD, :BOOL, :DWORD, :PCCERT_CONTEXT)
CALLBACK(PFN_CPD_ADD_PRIVDATA, :ptr CRYPT_PROVIDER_DATA, :ptr CRYPT_PROVIDER_PRIVDATA)
CALLBACK(PFN_PROVIDER_INIT_CALL, :ptr CRYPT_PROVIDER_DATA)
CALLBACK(PFN_PROVIDER_OBJTRUST_CALL, :ptr CRYPT_PROVIDER_DATA)
CALLBACK(PFN_PROVIDER_SIGTRUST_CALL, :ptr CRYPT_PROVIDER_DATA)
CALLBACK(PFN_PROVIDER_CERTTRUST_CALL, :ptr CRYPT_PROVIDER_DATA)
CALLBACK(PFN_PROVIDER_FINALPOLICY_CALL, :ptr CRYPT_PROVIDER_DATA)
CALLBACK(PFN_PROVIDER_TESTFINALPOLICY_CALL, :ptr CRYPT_PROVIDER_DATA)
CALLBACK(PFN_PROVIDER_CLEANUP_CALL, :ptr CRYPT_PROVIDER_DATA)
CALLBACK(PFN_PROVIDER_CERTCHKPOLICY_CALL, :ptr CRYPT_PROVIDER_DATA, :DWORD, :BOOL, :DWORD)

WVT_OFFSETOF macro t,f
	exitm<t.f>
	endm

WVT_ISINSTRUCT macro structtypedef, structpassedsize, member
	if (structtypedef.member + sizeof(structtypedef.member)) LE structpassedsize
	   exitm<1>
	endif
	exitm<0>
	endm

WVT_IS_CBSTRUCT_GT_MEMBEROFFSET macro structtypedef, structpassedsize, member
	exitm<WVT_ISINSTRUCT(structtypedef, structpassedsize, member)>
	endm

.pragma pack(push, 8)

CPD_CHOICE_SIP				equ 1
CPD_USE_NT5_CHAIN_FLAG			equ 0x80000000
CPD_REVOCATION_CHECK_NONE		equ 0x00010000
CPD_REVOCATION_CHECK_END_CERT		equ 0x00020000
CPD_REVOCATION_CHECK_CHAIN		equ 0x00040000
CPD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT equ 0x00080000
CPD_UISTATE_MODE_PROMPT			equ 0x00000000
CPD_UISTATE_MODE_BLOCK			equ 0x00000001
CPD_UISTATE_MODE_ALLOW			equ 0x00000002
CPD_UISTATE_MODE_MASK			equ 0x00000003

PCRYPT_PROVIDER_FUNCTIONS typedef ptr CRYPT_PROVIDER_FUNCTIONS
PCRYPT_PROVIDER_SGNR	typedef ptr CRYPT_PROVIDER_SGNR
PCRYPT_PROVIDER_PRIVDATA typedef ptr CRYPT_PROVIDER_PRIVDATA
PPROVDATA_SIP		typedef ptr PROVDATA_SIP
PCERT_USAGE_MATCH	typedef ptr CERT_USAGE_MATCH
PCRYPT_PROVUI_FUNCS	typedef ptr CRYPT_PROVUI_FUNCS
PCRYPT_PROVIDER_CERT	typedef ptr CRYPT_PROVIDER_CERT
PCRYPT_PROVUI_DATA	typedef ptr CRYPT_PROVUI_DATA

CRYPT_PROVIDER_DATA	STRUC
cbStruct		dd ?
pWintrustData		PWINTRUST_DATA ?
fOpenedFile		BOOL ?
hWndParent		HWND ?
pgActionID		LPGUID ?
hProv			HCRYPTPROV ?
dwError			dd ?
dwRegSecuritySettings	dd ?
dwRegPolicySettings	dd ?
psPfns			PCRYPT_PROVIDER_FUNCTIONS ?
cdwTrustStepErrors	dd ?
padwTrustStepErrors	LPDWORD ?
chStores		dd ?
pahStores		HCERTSTORE ?
dwEncoding		dd ?
hMsg			HCRYPTMSG ?
csSigners		dd ?
pasSigners		PCRYPT_PROVIDER_SGNR ?
csProvPrivData		dd ?
pasProvPrivData		PCRYPT_PROVIDER_PRIVDATA ?
dwSubjectChoice		dd ?
UNION
 pPDSip			PPROVDATA_SIP ?
ENDS
pszUsageOID		LPSTR ?
fRecallWithState	BOOL ?
sftSystemTime		FILETIME <>
pszCTLSignerUsageOID	LPSTR ?
dwProvFlags		dd ?
dwFinalError		dd ?
pRequestUsage		PCERT_USAGE_MATCH ?
dwTrustPubSettings	dd ?
dwUIStateFlags		dd ?
CRYPT_PROVIDER_DATA	ENDS
PCRYPT_PROVIDER_DATA	typedef ptr CRYPT_PROVIDER_DATA

CALLBACK(PFN_PROVUI_CALL, :HWND, :ptr CRYPT_PROVIDER_DATA)

CRYPT_PROVIDER_FUNCTIONS STRUC
cbStruct		dd ?
pfnAlloc		PFN_CPD_MEM_ALLOC ?
pfnFree			PFN_CPD_MEM_FREE ?
pfnAddStore2Chain	PFN_CPD_ADD_STORE ?
pfnAddSgnr2Chain	PFN_CPD_ADD_SGNR ?
pfnAddCert2Chain	PFN_CPD_ADD_CERT ?
pfnAddPrivData2Chain	PFN_CPD_ADD_PRIVDATA ?
pfnInitialize		PFN_PROVIDER_INIT_CALL ?
pfnObjectTrust		PFN_PROVIDER_OBJTRUST_CALL ?
pfnSignatureTrust	PFN_PROVIDER_SIGTRUST_CALL ?
pfnCertificateTrust	PFN_PROVIDER_CERTTRUST_CALL ?
pfnFinalPolicy		PFN_PROVIDER_FINALPOLICY_CALL ?
pfnCertCheckPolicy	PFN_PROVIDER_CERTCHKPOLICY_CALL ?
pfnTestFinalPolicy	PFN_PROVIDER_TESTFINALPOLICY_CALL ?
psUIpfns		PCRYPT_PROVUI_FUNCS ?
pfnCleanupPolicy	PFN_PROVIDER_CLEANUP_CALL ?
CRYPT_PROVIDER_FUNCTIONS ENDS

CRYPT_PROVUI_FUNCS	STRUC
cbStruct		dd ?
psUIData		PCRYPT_PROVUI_DATA ?
pfnOnMoreInfoClick	PFN_PROVUI_CALL ?
pfnOnMoreInfoClickDefault PFN_PROVUI_CALL ?
pfnOnAdvancedClick	PFN_PROVUI_CALL ?
pfnOnAdvancedClickDefault PFN_PROVUI_CALL ?
CRYPT_PROVUI_FUNCS	ENDS

CRYPT_PROVUI_DATA	STRUC
cbStruct		dd ?
dwFinalError		dd ?
pYesButtonText		LPWSTR ?
pNoButtonText		LPWSTR ?
pMoreInfoButtonText	LPWSTR ?
pAdvancedLinkText	LPWSTR ?
pCopyActionText		LPWSTR ?
pCopyActionTextNoTS	LPWSTR ?
pCopyActionTextNotSigned LPWSTR ?
CRYPT_PROVUI_DATA	ENDS

SGNR_TYPE_TIMESTAMP	equ 0x00000010

CRYPT_PROVIDER_SGNR	STRUC
cbStruct		dd ?
sftVerifyAsOf		FILETIME <>
csCertChain		dd ?
pasCertChain		PCRYPT_PROVIDER_CERT ?
dwSignerType		dd ?
psSigner		PCMSG_SIGNER_INFO ?
dwError			dd ?
csCounterSigners	dd ?
pasCounterSigners	PCRYPT_PROVIDER_SGNR ?
pChainContext		PCCERT_CHAIN_CONTEXT ?
CRYPT_PROVIDER_SGNR	ENDS

CERT_CONFIDENCE_SIG	equ 0x10000000	; this cert
CERT_CONFIDENCE_TIME	equ 0x01000000	; issuer cert
CERT_CONFIDENCE_TIMENEST equ 0x00100000	 ; this cert
CERT_CONFIDENCE_AUTHIDEXT equ 0x00010000  ; this cert
CERT_CONFIDENCE_HYGIENE equ 0x00001000	; this cert
CERT_CONFIDENCE_HIGHEST equ 0x11111000

CRYPT_PROVIDER_CERT	STRUC
cbStruct		dd ?
pCert			PCCERT_CONTEXT ?
fCommercial		BOOL ?
fTrustedRoot		BOOL ?
fSelfSigned		BOOL ?
fTestCert		BOOL ?
dwRevokedReason		dd ?
dwConfidence		dd ?
dwError			dd ?
pTrustListContext	PCTL_CONTEXT ?
fTrustListSignerCert	BOOL ?
pCtlContext		PCCTL_CONTEXT ?
dwCtlError		dd ?
fIsCyclic		BOOL ?
pChainElement		PCERT_CHAIN_ELEMENT ?
CRYPT_PROVIDER_CERT	ENDS

CRYPT_PROVIDER_PRIVDATA STRUC
cbStruct		dd ?
gProviderID		GUID <>
cbProvData		dd ?
pvProvData		PVOID ?
CRYPT_PROVIDER_PRIVDATA ENDS

PROVDATA_SIP		STRUC
cbStruct		dd ?
gSubject		GUID <>
pSip			PVOID ?;PSIP_DISPATCH_INFO ?
pCATSip			PVOID ?;PSIP_DISPATCH_INFO ?
psSipSubjectInfo	PVOID ?;PSIP_SUBJECTINFO ?
psSipCATSubjectInfo	PVOID ?;PSIP_SUBJECTINFO ?
psIndirectData		PVOID ?;PSIP_INDIRECT_DATA ?
PROVDATA_SIP		ENDS

WT_CURRENT_VERSION	equ 0x00000200

CRYPT_TRUST_REG_ENTRY	STRUC
cbStruct		dd ?
pwszDLLName		LPWSTR ?
pwszFunctionName	LPWSTR ?
CRYPT_TRUST_REG_ENTRY	ENDS
PCRYPT_TRUST_REG_ENTRY	typedef ptr CRYPT_TRUST_REG_ENTRY

CRYPT_REGISTER_ACTIONID STRUC
cbStruct		dd ?
sInitProvider		CRYPT_TRUST_REG_ENTRY <>
sObjectProvider		CRYPT_TRUST_REG_ENTRY <>
sSignatureProvider	CRYPT_TRUST_REG_ENTRY <>
sCertificateProvider	CRYPT_TRUST_REG_ENTRY <>
sCertificatePolicyProvider CRYPT_TRUST_REG_ENTRY <>
sFinalPolicyProvider	CRYPT_TRUST_REG_ENTRY <>
sTestPolicyProvider	CRYPT_TRUST_REG_ENTRY <>
sCleanupProvider	CRYPT_TRUST_REG_ENTRY <>
CRYPT_REGISTER_ACTIONID ENDS
PCRYPT_REGISTER_ACTIONID typedef ptr CRYPT_REGISTER_ACTIONID

;typedef CRYPT_PROVIDER_DEFUSAGE

CALLBACK(PFN_ALLOCANDFILLDEFUSAGE, :LPSTR, :ptr CRYPT_PROVIDER_DEFUSAGE)
CALLBACK(PFN_FREEDEFUSAGE, :LPSTR, :ptr CRYPT_PROVIDER_DEFUSAGE)

CRYPT_PROVIDER_REGDEFUSAGE STRUC
cbStruct		dd ?
pgActionID		LPGUID ?
pwszDllName		LPWSTR ?
pwszLoadCallbackDataFunctionName LPSTR ?
pwszFreeCallbackDataFunctionName LPSTR ?
CRYPT_PROVIDER_REGDEFUSAGE ENDS
PCRYPT_PROVIDER_REGDEFUSAGE typedef ptr CRYPT_PROVIDER_REGDEFUSAGE

CRYPT_PROVIDER_DEFUSAGE STRUC
cbStruct		dd ?
gActionID		GUID <>
pDefPolicyCallbackData	LPVOID ?
pDefSIPClientData	LPVOID ?
CRYPT_PROVIDER_DEFUSAGE ENDS
PCRYPT_PROVIDER_DEFUSAGE typedef ptr CRYPT_PROVIDER_DEFUSAGE

.pragma pack(pop)

WT_PROVIDER_DLL_NAME	equ <L"WINTRUST.DLL">
WT_PROVIDER_CERTTRUST_FUNCTION equ <L"WintrustCertificateTrust">

WintrustAddActionID proto WINAPI :LPGUID, :DWORD, :ptr

WT_ADD_ACTION_ID_RET_RESULT_FLAG equ 0x1

WintrustRemoveActionID proto WINAPI :LPGUID
WintrustLoadFunctionPointers proto WINAPI :LPGUID, :ptr
WintrustAddDefaultForUsage proto WINAPI :LPSTR, :ptr

DWACTION_ALLOCANDFILL	equ 1
DWACTION_FREE		equ 2

WintrustGetDefaultForUsage proto WINAPI :DWORD, :LPSTR, :ptr
WTHelperGetProvSignerFromChain proto WINAPI :ptr, :DWORD, :BOOL, :DWORD
WTHelperGetProvCertFromChain proto WINAPI :ptr, :DWORD
WTHelperProvDataFromStateData proto WINAPI :HANDLE
WTHelperGetProvPrivateDataFromChain proto WINAPI :ptr, :ptr
WTHelperCertIsSelfSigned proto WINAPI :DWORD, :ptr
WTHelperCertCheckValidSignature proto WINAPI :ptr

.pragma pack(push, 8)

szOID_TRUSTED_CODESIGNING_CA_LIST equ <"1.3.6.1.4.1.311.2.2.1">
szOID_TRUSTED_CLIENT_AUTH_CA_LIST equ <"1.3.6.1.4.1.311.2.2.2">
szOID_TRUSTED_SERVER_AUTH_CA_LIST equ <"1.3.6.1.4.1.311.2.2.3">

SPC_COMMON_NAME_OBJID		equ szOID_COMMON_NAME
SPC_TIME_STAMP_REQUEST_OBJID	equ <"1.3.6.1.4.1.311.3.2.1">
SPC_INDIRECT_DATA_OBJID		equ <"1.3.6.1.4.1.311.2.1.4">
SPC_SP_AGENCY_INFO_OBJID	equ <"1.3.6.1.4.1.311.2.1.10">
SPC_STATEMENT_TYPE_OBJID	equ <"1.3.6.1.4.1.311.2.1.11">
SPC_SP_OPUS_INFO_OBJID		equ <"1.3.6.1.4.1.311.2.1.12">
SPC_CERT_EXTENSIONS_OBJID	equ <"1.3.6.1.4.1.311.2.1.14">
SPC_PE_IMAGE_DATA_OBJID		equ <"1.3.6.1.4.1.311.2.1.15">
SPC_RAW_FILE_DATA_OBJID		equ <"1.3.6.1.4.1.311.2.1.18">
SPC_STRUCTURED_STORAGE_DATA_OBJID equ <"1.3.6.1.4.1.311.2.1.19">
SPC_JAVA_CLASS_DATA_OBJID	equ <"1.3.6.1.4.1.311.2.1.20">
SPC_INDIVIDUAL_SP_KEY_PURPOSE_OBJID equ <"1.3.6.1.4.1.311.2.1.21">
SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID equ <"1.3.6.1.4.1.311.2.1.22">
SPC_CAB_DATA_OBJID		equ <"1.3.6.1.4.1.311.2.1.25">
SPC_GLUE_RDN_OBJID		equ <"1.3.6.1.4.1.311.2.1.25">
SPC_MINIMAL_CRITERIA_OBJID	equ <"1.3.6.1.4.1.311.2.1.26">
SPC_FINANCIAL_CRITERIA_OBJID	equ <"1.3.6.1.4.1.311.2.1.27">
SPC_LINK_OBJID			equ <"1.3.6.1.4.1.311.2.1.28">
SPC_SIGINFO_OBJID		equ <"1.3.6.1.4.1.311.2.1.30">

SPC_PE_IMAGE_PAGE_HASHES_V1_OBJID equ <"1.3.6.1.4.1.311.2.3.1">
SPC_PE_IMAGE_PAGE_HASHES_V2_OBJID equ <"1.3.6.1.4.1.311.2.3.2">

CAT_NAMEVALUE_OBJID	equ <"1.3.6.1.4.1.311.12.2.1">
CAT_MEMBERINFO_OBJID	equ <"1.3.6.1.4.1.311.12.2.2">

SPC_SP_AGENCY_INFO_STRUCT	equ 2000
SPC_MINIMAL_CRITERIA_STRUCT	equ 2001
SPC_FINANCIAL_CRITERIA_STRUCT	equ 2002
SPC_INDIRECT_DATA_CONTENT_STRUCT equ 2003
SPC_PE_IMAGE_DATA_STRUCT	equ 2004
SPC_LINK_STRUCT			equ 2005
SPC_STATEMENT_TYPE_STRUCT	equ 2006
SPC_SP_OPUS_INFO_STRUCT		equ 2007
SPC_CAB_DATA_STRUCT		equ 2008
SPC_JAVA_CLASS_DATA_STRUCT	equ 2009
SPC_SIGINFO_STRUCT		equ 2130
CAT_NAMEVALUE_STRUCT		equ 2221
CAT_MEMBERINFO_STRUCT		equ 2222

SPC_UUID_LENGTH			equ 16

;SPC_UUID[SPC_UUID_LENGTH] typedef BYTE

SpcSerializedObjectAttributesClassId equ <{0xA6,0xB5,0x86,0xD5,0xB4,0xA1,0x24,0x66,0xAE,0x05,0xA2,0x17,0xDA,0x8E,0x60,0xD6}>

SPC_SERIALIZED_OBJECT	STRUC
ClassId			db SPC_UUID_LENGTH dup(?) ;SPC_UUID ?
SerializedData		CRYPT_DATA_BLOB <>
SPC_SERIALIZED_OBJECT	ENDS
PSPC_SERIALIZED_OBJECT	typedef ptr SPC_SERIALIZED_OBJECT

SPC_SIGINFO		STRUC
dwSipVersion		dd ?
gSIPGuid		GUID <>
dwReserved1		dd ?
dwReserved2		dd ?
dwReserved3		dd ?
dwReserved4		dd ?
dwReserved5		dd ?
SPC_SIGINFO		ENDS
PSPC_SIGINFO		typedef ptr SPC_SIGINFO

SPC_LINK		STRUC
dwLinkChoice		dd ?
SPC_URL_LINK_CHOICE	equ 1
SPC_MONIKER_LINK_CHOICE equ 2
SPC_FILE_LINK_CHOICE	equ 3
UNION
 pwszUrl		LPWSTR ?
 Moniker		SPC_SERIALIZED_OBJECT <>
 pwszFile		LPWSTR ?
ENDS
SPC_LINK		ENDS
PSPC_LINK		typedef ptr SPC_LINK

SPC_PE_IMAGE_DATA	STRUC
Flags			CRYPT_BIT_BLOB <>
pFile			PSPC_LINK ?
SPC_PE_IMAGE_DATA	ENDS
PSPC_PE_IMAGE_DATA	typedef ptr SPC_PE_IMAGE_DATA

SPC_INDIRECT_DATA_CONTENT STRUC
_Data			CRYPT_ATTRIBUTE_TYPE_VALUE <>
DigestAlgorithm		CRYPT_ALGORITHM_IDENTIFIER <>
Digest			CRYPT_HASH_BLOB <>
SPC_INDIRECT_DATA_CONTENT ENDS
PSPC_INDIRECT_DATA_CONTENT typedef ptr SPC_INDIRECT_DATA_CONTENT

SPC_FINANCIAL_CRITERIA	STRUC
fFinancialInfoAvailable BOOL ?
fMeetsCriteria		BOOL ?
SPC_FINANCIAL_CRITERIA	ENDS
PSPC_FINANCIAL_CRITERIA typedef ptr SPC_FINANCIAL_CRITERIA

SPC_IMAGE		STRUC
pImageLink		PSPC_LINK ?
Bitmap			CRYPT_DATA_BLOB <>
Metafile		CRYPT_DATA_BLOB <>
EnhancedMetafile	CRYPT_DATA_BLOB <>
GifFile			CRYPT_DATA_BLOB <>
SPC_IMAGE		ENDS
PSPC_IMAGE		typedef ptr SPC_IMAGE

SPC_SP_AGENCY_INFO	STRUC
pPolicyInformation	PSPC_LINK ?
pwszPolicyDisplayText	LPWSTR ?
pLogoImage		PSPC_IMAGE ?
pLogoLink		PSPC_LINK ?
SPC_SP_AGENCY_INFO	ENDS
PSPC_SP_AGENCY_INFO	typedef ptr SPC_SP_AGENCY_INFO

SPC_STATEMENT_TYPE	STRUC
cKeyPurposeId		dd ?
rgpszKeyPurposeId	LPSTR ?
SPC_STATEMENT_TYPE	ENDS
PSPC_STATEMENT_TYPE	typedef ptr SPC_STATEMENT_TYPE

SPC_SP_OPUS_INFO	STRUC
pwszProgramName		LPCWSTR ?
pMoreInfo		typedef ptr SPC_LINK_
pPublisherInfo		typedef ptr SPC_LINK_
SPC_SP_OPUS_INFO	ENDS
PSPC_SP_OPUS_INFO	typedef ptr SPC_SP_OPUS_INFO

CAT_NAMEVALUE		STRUC
pwszTag			LPWSTR ?
fdwFlags		dd ?
Value			CRYPT_DATA_BLOB <>
CAT_NAMEVALUE		ENDS
PCAT_NAMEVALUE		typedef ptr CAT_NAMEVALUE

CAT_MEMBERINFO		STRUC
pwszSubjGuid		LPWSTR ?
dwCertVersion		dd ?
CAT_MEMBERINFO		ENDS
PCAT_MEMBERINFO		typedef ptr CAT_MEMBERINFO

.pragma pack(pop)

ifdef WT_DEFINE_ALL_APIS

WIN_CERTIFICATE		STRUC
dwLength		dd ?
wRevision		dw ?
wCertificateType	dw ?
bCertificate		db ANYSIZE_ARRAY dup(?)
WIN_CERTIFICATE		ENDS
LPWIN_CERTIFICATE	typedef ptr WIN_CERTIFICATE

WIN_CERT_REVISION_1_0		equ 0x0100
WIN_CERT_REVISION_2_0		equ 0x0200
WIN_CERT_TYPE_X509		equ 0x0001
WIN_CERT_TYPE_PKCS_SIGNED_DATA	equ 0x0002
WIN_CERT_TYPE_RESERVED_1	equ 0x0003
WIN_CERT_TYPE_TS_STACK_SIGNED	equ 0x0004

WIN_TRUST_SUBJECT	typedef LPVOID

WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT STRUC
hClientToken		HANDLE ?
SubjectType		LPGUID ?
Subject			WIN_TRUST_SUBJECT ?
WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT ENDS
LPWIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT  typedef ptr WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT

WIN_TRUST_ACTDATA_SUBJECT_ONLY STRUC
SubjectType		LPGUID ?
Subject			WIN_TRUST_SUBJECT ?
WIN_TRUST_ACTDATA_SUBJECT_ONLY ENDS
LPWIN_TRUST_ACTDATA_SUBJECT_ONLY typedef ptr WIN_TRUST_ACTDATA_SUBJECT_ONLY

WIN_TRUST_SUBJTYPE_RAW_FILE   equ <{0x959dc450,0x8d9e,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb}}>
WIN_TRUST_SUBJTYPE_PE_IMAGE   equ <{0x43c9a1e0,0x8da0,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb}}>
WIN_TRUST_SUBJTYPE_JAVA_CLASS equ <{0x08ad3990,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb}}>
WIN_TRUST_SUBJTYPE_CABINET    equ <{0xd17c5374,0xa392,0x11cf,{0x9d,0xf5,0x00,0xaa,0x00,0xc1,0x84,0xe0}}>

WIN_TRUST_SUBJECT_FILE	STRUC
hFile			HANDLE ?
lpPath			LPCWSTR ?
WIN_TRUST_SUBJECT_FILE	ENDS
LPWIN_TRUST_SUBJECT_FILE typedef ptr WIN_TRUST_SUBJECT_FILE

WIN_TRUST_SUBJTYPE_RAW_FILEEX	equ <{0x6f458110,0xc2f1,0x11cf,{0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6}}>
WIN_TRUST_SUBJTYPE_PE_IMAGEEX	equ <{0x6f458111,0xc2f1,0x11cf,{0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6}}>
WIN_TRUST_SUBJTYPE_JAVA_CLASSEX equ <{0x6f458113,0xc2f1,0x11cf,{0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6}}>
WIN_TRUST_SUBJTYPE_CABINETEX	equ <{0x6f458114,0xc2f1,0x11cf,{0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6}}>

WIN_TRUST_SUBJECT_FILE_AND_DISPLAY STRUC
hFile			HANDLE ?
lpPath			LPCWSTR ?
lpDisplayName		LPCWSTR ?
WIN_TRUST_SUBJECT_FILE_AND_DISPLAY ENDS
LPWIN_TRUST_SUBJECT_FILE_AND_DISPLAY typedef ptr WIN_TRUST_SUBJECT_FILE_AND_DISPLAY

WIN_TRUST_SUBJTYPE_OLE_STORAGE	   equ <{0xc257e740,0x8da0,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb}}>
WIN_SPUB_ACTION_TRUSTED_PUBLISHER  equ <{0x66426730,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb}}>
WIN_SPUB_ACTION_NT_ACTIVATE_IMAGE  equ <{0x8bc96b00,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb}}>
WIN_SPUB_ACTION_PUBLISHED_SOFTWARE equ <{0x64b9d180,0x8da2,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb}}>

WIN_SPUB_TRUSTED_PUBLISHER_DATA STRUC
hClientToken		HANDLE ?
lpCertificate		LPWIN_CERTIFICATE ?
WIN_SPUB_TRUSTED_PUBLISHER_DATA ENDS
LPWIN_SPUB_TRUSTED_PUBLISHER_DATA typedef ptr WIN_SPUB_TRUSTED_PUBLISHER_DATA

endif

OpenPersonalTrustDBDialogEx proto WINAPI :HWND, :DWORD, :ptr

WT_TRUSTDBDIALOG_NO_UI_FLAG		equ 0x00000001
WT_TRUSTDBDIALOG_ONLY_PUB_TAB_FLAG	equ 0x00000002
WT_TRUSTDBDIALOG_WRITE_LEGACY_REG_FLAG	equ 0x00000100
WT_TRUSTDBDIALOG_WRITE_IEAK_STORE_FLAG	equ 0x00000200

.pragma list(pop)
endif
