wintrust: Fix the CryptCATAdminReleaseCatalogContext() prototype and better match...
[wine] / dlls / wintrust / crypt.c
1 /*
2  * WinTrust Cryptography functions
3  *
4  * Copyright 2006 James Hawkins
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wintrust.h"
26 #include "mscat.h"
27 #include "mssip.h"
28
29 #include "wine/debug.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
32
33 /***********************************************************************
34  *      CryptCATAdminAcquireContext (WINTRUST.@)
35  *
36  * Get a catalog administrator context handle.
37  *
38  * PARAMS
39  *   catAdmin  [O] Pointer to the context handle.
40  *   sysSystem [I] Pointer to a GUID for the needed subsystem.
41  *   dwFlags   [I] Reserved.
42  *
43  * RETURNS
44  *   Success: TRUE. catAdmin contains the context handle.
45  *   Failure: FALSE.
46  *
47  */
48 BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN* catAdmin,
49                     const GUID *sysSystem, DWORD dwFlags )
50 {
51     FIXME("%p %s %x\n", catAdmin, debugstr_guid(sysSystem), dwFlags);
52
53     if (catAdmin) *catAdmin = (HCATADMIN)0xdeadbeef;
54     return TRUE;
55 }
56
57 /***********************************************************************
58  *             CryptCATAdminAddCatalog (WINTRUST.@)
59  */
60 BOOL WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
61                                     PWSTR selectBaseName, DWORD flags)
62 {
63     FIXME("%p %s %s %d\n", catAdmin, debugstr_w(catalogFile),
64           debugstr_w(selectBaseName), flags);
65     return TRUE;
66 }
67
68 /***********************************************************************
69  *             CryptCATAdminCalcHashFromFileHandle (WINTRUST.@)
70  */
71 BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD* pcbHash,
72                                                 BYTE* pbHash, DWORD dwFlags )
73 {
74     FIXME("%p %p %p %x\n", hFile, pcbHash, pbHash, dwFlags);
75
76     if (pbHash && pcbHash) memset(pbHash, 0, *pcbHash);
77     return TRUE;
78 }
79
80 /***********************************************************************
81  *             CryptCATAdminEnumCatalogFromHash (WINTRUST.@)
82  */
83 HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin,
84                                                  BYTE* pbHash,
85                                                  DWORD cbHash,
86                                                  DWORD dwFlags,
87                                                  HCATINFO* phPrevCatInfo )
88 {
89     FIXME("%p %p %d %d %p\n", hCatAdmin, pbHash, cbHash, dwFlags, phPrevCatInfo);
90     return NULL;
91 }
92
93 /***********************************************************************
94  *      CryptCATAdminReleaseCatalogContext (WINTRUST.@)
95  *
96  * Release a catalog context handle.
97  *
98  * PARAMS
99  *   hCatAdmin [I] Context handle.
100  *   hCatInfo  [I] Catalog handle.
101  *   dwFlags   [I] Reserved.
102  *
103  * RETURNS
104  *   Success: TRUE.
105  *   Failure: FAIL.
106  *
107  */
108 BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin,
109                                                HCATINFO hCatInfo,
110                                                DWORD dwFlags)
111 {
112     FIXME("%p %p %x\n", hCatAdmin, hCatInfo, dwFlags);
113     return TRUE;
114 }
115
116 /***********************************************************************
117  *      CryptCATAdminReleaseContext (WINTRUST.@)
118  *
119  * Release a catalog administrator context handle.
120  *
121  * PARAMS
122  *   catAdmin  [I] Context handle.
123  *   dwFlags   [I] Reserved.
124  *
125  * RETURNS
126  *   Success: TRUE.
127  *   Failure: FAIL.
128  *
129  */
130 BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags )
131 {
132     FIXME("%p %x\n", hCatAdmin, dwFlags);
133     return TRUE;
134 }
135
136 /***********************************************************************
137  *      CryptCATAdminRemoveCatalog (WINTRUST.@)
138  *
139  * Remove a catalog file.
140  *
141  * PARAMS
142  *   catAdmin         [I] Context handle.
143  *   pwszCatalogFile  [I] Catalog file.
144  *   dwFlags          [I] Reserved.
145  *
146  * RETURNS
147  *   Success: TRUE.
148  *   Failure: FALSE.
149  *
150  */
151 BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogFile, DWORD dwFlags)
152 {
153     FIXME("%p %s %x\n", hCatAdmin, debugstr_w(pwszCatalogFile), dwFlags);
154     return DeleteFileW(pwszCatalogFile);
155 }
156
157 /***********************************************************************
158  *      CryptCATClose  (WINTRUST.@)
159  */
160 BOOL WINAPI CryptCATClose(HANDLE hCatalog)
161 {
162     FIXME("(%p) stub\n", hCatalog);
163     return TRUE;
164 }
165
166 /***********************************************************************
167  *      CryptCATEnumerateMember  (WINTRUST.@)
168  */
169 CRYPTCATMEMBER *WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER* pPrevMember)
170 {
171     FIXME("(%p, %p) stub\n", hCatalog, pPrevMember);
172     return NULL;
173 }
174
175 /***********************************************************************
176  *      CryptCATOpen  (WINTRUST.@)
177  */
178 HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV hProv,
179                            DWORD dwPublicVersion, DWORD dwEncodingType)
180 {
181     FIXME("(%s, %d, %ld, %d, %d) stub\n", debugstr_w(pwszFileName), fdwOpenFlags,
182           hProv, dwPublicVersion, dwEncodingType);
183     return 0;
184 }
185
186 /***********************************************************************
187  *      CryptSIPCreateIndirectData  (WINTRUST.@)
188  */
189 BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pcbIndirectData,
190                                        SIP_INDIRECT_DATA* pIndirectData)
191 {
192     FIXME("(%p %p %p) stub\n", pSubjectInfo, pcbIndirectData, pIndirectData);
193  
194     return FALSE;
195 }
196
197 /***********************************************************************
198  *      CryptSIPGetSignedDataMsg  (WINTRUST.@)
199  */
200 BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pdwEncodingType,
201                                        DWORD dwIndex, DWORD* pcbSignedDataMsg, BYTE* pbSignedDataMsg)
202 {
203     FIXME("(%p %p %d %p %p) stub\n", pSubjectInfo, pdwEncodingType, dwIndex,
204           pcbSignedDataMsg, pbSignedDataMsg);
205  
206     return FALSE;
207 }
208
209 /***********************************************************************
210  *      CryptSIPPutSignedDataMsg  (WINTRUST.@)
211  */
212 BOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD pdwEncodingType,
213                                        DWORD* pdwIndex, DWORD cbSignedDataMsg, BYTE* pbSignedDataMsg)
214 {
215     FIXME("(%p %d %p %d %p) stub\n", pSubjectInfo, pdwEncodingType, pdwIndex,
216           cbSignedDataMsg, pbSignedDataMsg);
217  
218     return FALSE;
219 }
220
221 /***********************************************************************
222  *      CryptSIPRemoveSignedDataMsg  (WINTRUST.@)
223  */
224 BOOL WINAPI CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo,
225                                        DWORD dwIndex)
226 {
227     FIXME("(%p %d) stub\n", pSubjectInfo, dwIndex);
228  
229     return FALSE;
230 }
231
232 /***********************************************************************
233  *      CryptSIPVerifyIndirectData  (WINTRUST.@)
234  */
235 BOOL WINAPI CryptSIPVerifyIndirectData(SIP_SUBJECTINFO* pSubjectInfo,
236                                        SIP_INDIRECT_DATA* pIndirectData)
237 {
238     FIXME("(%p %p) stub\n", pSubjectInfo, pIndirectData);
239  
240     return FALSE;
241 }