xref: /reactos/sdk/include/psdk/mssip.h (revision c2c66aff)
1 /*
2  * Copyright (C) 2002 Patrik Stridvall
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #ifndef __WINE_MSSIP_H
20 #define __WINE_MSSIP_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* defined(__cplusplus) */
25 
26 /**********************************************************************/
27 
28 typedef CRYPT_HASH_BLOB CRYPT_DIGEST_DATA;
29 
30 /**********************************************************************/
31 
32 #define MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE 0x00010000
33 #define MSSIP_FLAGS_USE_CATALOG               0x00020000
34 
35 #define SPC_INC_PE_RESOURCES_FLAG         0x80
36 #define SPC_INC_PE_DEBUG_INFO_FLAG        0x40
37 #define SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG 0x20
38 
39 #define MSSIP_ADDINFO_NONE      0
40 #define MSSIP_ADDINFO_FLAT      1
41 #define MSSIP_ADDINFO_CATMEMBER 2
42 #define MSSIP_ADDINFO_BLOB      3
43 #define MSSIP_ADDINFO_NONMSSIP  500
44 
45 #define SIP_MAX_MAGIC_NUMBER 4
46 
47 /**********************************************************************/
48 
49 #include <pshpack8.h>
50 typedef struct SIP_SUBJECTINFO_ {
51     DWORD cbSize;
52     GUID *pgSubjectType;
53     HANDLE hFile;
54     LPCWSTR pwsFileName;
55     LPCWSTR pwsDisplayName;
56 
57     DWORD dwReserved1;
58     DWORD dwIntVersion;
59 
60     HCRYPTPROV hProv;
61     CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
62     DWORD dwFlags;
63     DWORD dwEncodingType;
64     DWORD dwReserved2;
65     DWORD fdwCAPISettings;
66     DWORD fdwSecuritySettings;
67     DWORD dwIndex;
68 
69     DWORD dwUnionChoice;
70     union {
71       struct MS_ADDINFO_FLAT_          *psFlat;
72       struct MS_ADDINFO_CATALOGMEMBER_ *psCatMember;
73       struct MS_ADDINFO_BLOB_          *psBlob;
74     } DUMMYUNIONNAME;
75 
76     LPVOID pClientData;
77 } SIP_SUBJECTINFO, *LPSIP_SUBJECTINFO;
78 #include <poppack.h>
79 
80 #include <pshpack8.h>
81 typedef struct MS_ADDINFO_FLAT_ {
82   DWORD cbStruct;
83 
84   struct SIP_INDIRECT_DATA_ *pIndirectData;
85 } MS_ADDINFO_FLAT, *PMS_ADDINFO_FLAT;
86 #include <poppack.h>
87 
88 #include <pshpack8.h>
89 typedef struct MS_ADDINFO_CATALOGMEMBER_ {
90   DWORD cbStruct;
91 
92   struct CRYPTCATSTORE_  *pStore;
93   struct CRYPTCATMEMBER_ *pMember;
94 } MS_ADDINFO_CATALOGMEMBER, *PMS_ADDINFO_CATALOGMEMBER;
95 #include <poppack.h>
96 
97 #include <pshpack8.h>
98 typedef struct MS_ADDINFO_BLOB_ {
99   DWORD cbStruct;
100 
101   DWORD cbMemObject;
102   BYTE *pbMemObject;
103 
104   DWORD cbMemSignedMsg;
105   BYTE *pbMemSignedMsg;
106 } MS_ADDINFO_BLOB, *PMS_ADDINFO_BLOB;
107 #include <poppack.h>
108 
109 #include <pshpack8.h>
110 typedef struct SIP_INDIRECT_DATA_ {
111   CRYPT_ATTRIBUTE_TYPE_VALUE Data;
112   CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
113   CRYPT_HASH_BLOB            Digest;
114 } SIP_INDIRECT_DATA, *PSIP_INDIRECT_DATA;
115 #include <poppack.h>
116 
117 typedef BOOL (WINAPI * pCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *);
118 typedef BOOL (WINAPI * pCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *,DWORD,DWORD *,DWORD,BYTE *);
119 typedef BOOL (WINAPI * pCryptSIPCreateIndirectData)(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *);
120 typedef BOOL (WINAPI * pCryptSIPVerifyIndirectData)(SIP_SUBJECTINFO *,SIP_INDIRECT_DATA *);
121 typedef BOOL (WINAPI * pCryptSIPRemoveSignedDataMsg)(SIP_SUBJECTINFO *,DWORD);
122 
123 #include <pshpack8.h>
124 typedef struct SIP_DISPATCH_INFO_ {
125   DWORD cbSize;
126 
127   HANDLE hSIP;
128 
129   pCryptSIPGetSignedDataMsg    pfGet;
130   pCryptSIPPutSignedDataMsg    pfPut;
131   pCryptSIPCreateIndirectData  pfCreate;
132   pCryptSIPVerifyIndirectData  pfVerify;
133   pCryptSIPRemoveSignedDataMsg pfRemove;
134 } SIP_DISPATCH_INFO, *LPSIP_DISPATCH_INFO;
135 #include <poppack.h>
136 
137 typedef BOOL (WINAPI *pfnIsFileSupported)(HANDLE,GUID *);
138 typedef BOOL (WINAPI *pfnIsFileSupportedName)(WCHAR *,GUID *);
139 
140 #include <pshpack8.h>
141 typedef struct SIP_ADD_NEWPROVIDER_
142 {
143   DWORD cbStruct;
144 
145   GUID  *pgSubject;
146 
147   WCHAR *pwszDLLFileName;
148   WCHAR *pwszMagicNumber;
149 
150   WCHAR *pwszIsFunctionName;
151 
152   WCHAR *pwszGetFuncName;
153   WCHAR *pwszPutFuncName;
154   WCHAR *pwszCreateFuncName;
155   WCHAR *pwszVerifyFuncName;
156   WCHAR *pwszRemoveFuncName;
157 
158   WCHAR *pwszIsFunctionNameFmt2;
159 
160   /* NTDDI_VERSION >= NTDDI_WIN8 */
161   WCHAR *pwszGetCapFuncName;
162 } SIP_ADD_NEWPROVIDER, *PSIP_ADD_NEWPROVIDER;
163 #include <poppack.h>
164 
165 /**********************************************************************/
166 
167 BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *);
168 BOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO *,DWORD,DWORD *,DWORD,BYTE *);
169 BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *);
170 BOOL WINAPI CryptSIPVerifyIndirectData(SIP_SUBJECTINFO *,SIP_INDIRECT_DATA *);
171 BOOL WINAPI CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO *,DWORD);
172 
173 BOOL WINAPI CryptSIPLoad(const GUID *,DWORD,SIP_DISPATCH_INFO *);
174 BOOL WINAPI CryptSIPRetrieveSubjectGuid(LPCWSTR,HANDLE,GUID *);
175 BOOL WINAPI CryptSIPRetrieveSubjectGuidForCatalogFile(LPCWSTR,HANDLE,GUID *);
176 BOOL WINAPI CryptSIPAddProvider(SIP_ADD_NEWPROVIDER *);
177 BOOL WINAPI CryptSIPRemoveProvider(GUID *);
178 
179 #ifdef __cplusplus
180 } /* extern "C" */
181 #endif /* defined(__cplusplus) */
182 
183 #endif  /* __WINE_MSSIP_H */
184