1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #ifndef MSSIP_H 7 #define MSSIP_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #pragma pack (8) 14 15 typedef CRYPT_HASH_BLOB CRYPT_DIGEST_DATA; 16 17 #define MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE 0x00010000 18 #define MSSIP_FLAGS_USE_CATALOG 0x00020000 19 20 #define SPC_INC_PE_RESOURCES_FLAG 0x80 21 #define SPC_INC_PE_DEBUG_INFO_FLAG 0x40 22 #define SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG 0x20 23 24 typedef struct SIP_SUBJECTINFO_ { 25 DWORD cbSize; 26 GUID *pgSubjectType; 27 HANDLE hFile; 28 LPCWSTR pwsFileName; 29 LPCWSTR pwsDisplayName; 30 DWORD dwReserved1; 31 DWORD dwIntVersion; 32 HCRYPTPROV hProv; 33 CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm; 34 DWORD dwFlags; 35 DWORD dwEncodingType; 36 DWORD dwReserved2; 37 DWORD fdwCAPISettings; 38 DWORD fdwSecuritySettings; 39 DWORD dwIndex; 40 DWORD dwUnionChoice; 41 #define MSSIP_ADDINFO_NONE 0 42 #define MSSIP_ADDINFO_FLAT 1 43 #define MSSIP_ADDINFO_CATMEMBER 2 44 #define MSSIP_ADDINFO_BLOB 3 45 #define MSSIP_ADDINFO_NONMSSIP 500 46 __C89_NAMELESS union { 47 struct MS_ADDINFO_FLAT_ *psFlat; 48 struct MS_ADDINFO_CATALOGMEMBER_ *psCatMember; 49 struct MS_ADDINFO_BLOB_ *psBlob; 50 }; 51 LPVOID pClientData; 52 } SIP_SUBJECTINFO,*LPSIP_SUBJECTINFO; 53 54 typedef struct MS_ADDINFO_FLAT_ { 55 DWORD cbStruct; 56 struct SIP_INDIRECT_DATA_ *pIndirectData; 57 } MS_ADDINFO_FLAT,*PMS_ADDINFO_FLAT; 58 59 typedef struct MS_ADDINFO_CATALOGMEMBER_ { 60 DWORD cbStruct; 61 struct CRYPTCATSTORE_ *pStore; 62 struct CRYPTCATMEMBER_ *pMember; 63 } MS_ADDINFO_CATALOGMEMBER,*PMS_ADDINFO_CATALOGMEMBER; 64 65 typedef struct MS_ADDINFO_BLOB_ { 66 DWORD cbStruct; 67 DWORD cbMemObject; 68 BYTE *pbMemObject; 69 DWORD cbMemSignedMsg; 70 BYTE *pbMemSignedMsg; 71 } MS_ADDINFO_BLOB,*PMS_ADDINFO_BLOB; 72 73 typedef struct SIP_INDIRECT_DATA_ { 74 CRYPT_ATTRIBUTE_TYPE_VALUE Data; 75 CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm; 76 CRYPT_HASH_BLOB Digest; 77 } SIP_INDIRECT_DATA,*PSIP_INDIRECT_DATA; 78 79 #pragma pack() 80 81 extern WINBOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo,DWORD *pdwEncodingType,DWORD dwIndex,DWORD *pcbSignedDataMsg,BYTE *pbSignedDataMsg); 82 typedef WINBOOL (WINAPI *pCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *pSubjectInfo,DWORD *pdwEncodingType,DWORD dwIndex,DWORD *pcbSignedDataMsg,BYTE *pbSignedDataMsg); 83 extern WINBOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo,DWORD dwEncodingType,DWORD *pdwIndex,DWORD cbSignedDataMsg,BYTE *pbSignedDataMsg); 84 typedef WINBOOL (WINAPI *pCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *pSubjectInfo,DWORD dwEncodingType,DWORD *pdwIndex,DWORD cbSignedDataMsg,BYTE *pbSignedDataMsg); 85 extern WINBOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO *pSubjectInfo,DWORD *pcbIndirectData,SIP_INDIRECT_DATA *pIndirectData); 86 typedef WINBOOL (WINAPI *pCryptSIPCreateIndirectData)(SIP_SUBJECTINFO *pSubjectInfo,DWORD *pcbIndirectData,SIP_INDIRECT_DATA *pIndirectData); 87 extern WINBOOL WINAPI CryptSIPVerifyIndirectData(SIP_SUBJECTINFO *pSubjectInfo,SIP_INDIRECT_DATA *pIndirectData); 88 typedef WINBOOL (WINAPI *pCryptSIPVerifyIndirectData)(SIP_SUBJECTINFO *pSubjectInfo,SIP_INDIRECT_DATA *pIndirectData); 89 extern WINBOOL WINAPI CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo,DWORD dwIndex); 90 typedef WINBOOL (WINAPI *pCryptSIPRemoveSignedDataMsg)(SIP_SUBJECTINFO *pSubjectInfo,DWORD dwIndex); 91 92 #pragma pack(8) 93 94 typedef struct SIP_DISPATCH_INFO_ { 95 DWORD cbSize; 96 HANDLE hSIP; 97 pCryptSIPGetSignedDataMsg pfGet; 98 pCryptSIPPutSignedDataMsg pfPut; 99 pCryptSIPCreateIndirectData pfCreate; 100 pCryptSIPVerifyIndirectData pfVerify; 101 pCryptSIPRemoveSignedDataMsg pfRemove; 102 } SIP_DISPATCH_INFO,*LPSIP_DISPATCH_INFO; 103 104 typedef WINBOOL (WINAPI *pfnIsFileSupported)(HANDLE hFile,GUID *pgSubject); 105 typedef WINBOOL (WINAPI *pfnIsFileSupportedName)(WCHAR *pwszFileName,GUID *pgSubject); 106 107 typedef struct SIP_ADD_NEWPROVIDER_ { 108 DWORD cbStruct; 109 GUID *pgSubject; 110 WCHAR *pwszDLLFileName; 111 WCHAR *pwszMagicNumber; 112 WCHAR *pwszIsFunctionName; 113 WCHAR *pwszGetFuncName; 114 WCHAR *pwszPutFuncName; 115 WCHAR *pwszCreateFuncName; 116 WCHAR *pwszVerifyFuncName; 117 WCHAR *pwszRemoveFuncName; 118 WCHAR *pwszIsFunctionNameFmt2; 119 } SIP_ADD_NEWPROVIDER,*PSIP_ADD_NEWPROVIDER; 120 121 #define SIP_MAX_MAGIC_NUMBER 4 122 123 #pragma pack() 124 125 extern WINBOOL WINAPI CryptSIPLoad(const GUID *pgSubject,DWORD dwFlags,SIP_DISPATCH_INFO *pSipDispatch); 126 extern WINBOOL WINAPI CryptSIPRetrieveSubjectGuid(LPCWSTR FileName,HANDLE hFileIn,GUID *pgSubject); 127 extern WINBOOL WINAPI CryptSIPRetrieveSubjectGuidForCatalogFile(LPCWSTR FileName,HANDLE hFileIn,GUID *pgSubject); 128 extern WINBOOL WINAPI CryptSIPAddProvider(SIP_ADD_NEWPROVIDER *psNewProv); 129 extern WINBOOL WINAPI CryptSIPRemoveProvider(GUID *pgProv); 130 131 #ifdef __cplusplus 132 } 133 #endif 134 #endif 135