push a68a33e62d41ba03b0e27371e671eaa1e09ebd44
[wine/hacks.git] / dlls / crypt32 / tests / sip.c
blobb01229c0ce44d062ef94d187bd2b7e92188987c9
1 /*
2 * Subject Interface Package tests
4 * Copyright 2006 Paul Vriens
5 * Copyright 2008 Juan Lang
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdio.h>
23 #include <stdarg.h>
24 #include <windef.h>
25 #include <winbase.h>
26 #include <winerror.h>
27 #include <winnls.h>
28 #include <wincrypt.h>
29 #include <mssip.h>
31 #include "wine/test.h"
33 static BOOL (WINAPI * funcCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *);
34 static BOOL (WINAPI * funcCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *,DWORD,DWORD *,DWORD,BYTE *);
35 static BOOL (WINAPI * funcCryptSIPCreateIndirectData)(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *);
36 static BOOL (WINAPI * funcCryptSIPVerifyIndirectData)(SIP_SUBJECTINFO *,SIP_INDIRECT_DATA *);
37 static BOOL (WINAPI * funcCryptSIPRemoveSignedDataMsg)(SIP_SUBJECTINFO *,DWORD);
39 static char *show_guid(const GUID *guid, char *buf)
41 sprintf(buf,
42 "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
43 guid->Data1, guid->Data2, guid->Data3,
44 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
45 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
47 return buf;
50 static void test_AddRemoveProvider(void)
52 BOOL ret;
53 SIP_ADD_NEWPROVIDER newprov;
54 GUID actionid = { 0xdeadbe, 0xefde, 0xadbe, { 0xef,0xde,0xad,0xbe,0xef,0xde,0xad,0xbe }};
55 static WCHAR dummydll[] = {'d','e','a','d','b','e','e','f','.','d','l','l',0 };
56 static WCHAR dummyfunction[] = {'d','u','m','m','y','f','u','n','c','t','i','o','n',0 };
58 /* NULL check */
59 SetLastError(0xdeadbeef);
60 ret = CryptSIPRemoveProvider(NULL);
61 ok (!ret, "Expected CryptSIPRemoveProvider to fail.\n");
62 ok (GetLastError() == ERROR_INVALID_PARAMETER,
63 "Expected ERROR_INVALID_PARAMETER, got %d.\n", GetLastError());
65 /* nonexistent provider should result in a registry error */
66 SetLastError(0xdeadbeef);
67 ret = CryptSIPRemoveProvider(&actionid);
68 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
70 /* Apparently the needed rights are checked before the existence of the provider */
71 skip("Need admin rights\n");
73 else
75 ok (!ret, "Expected CryptSIPRemoveProvider to fail.\n");
76 ok (GetLastError() == ERROR_FILE_NOT_FOUND,
77 "Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
80 /* Everything OK, pwszIsFunctionName and pwszIsFunctionNameFmt2 are left NULL
81 * as allowed */
83 memset(&newprov, 0, sizeof(SIP_ADD_NEWPROVIDER));
84 newprov.cbStruct = sizeof(SIP_ADD_NEWPROVIDER);
85 newprov.pgSubject = &actionid;
86 newprov.pwszDLLFileName = dummydll;
87 newprov.pwszGetFuncName = dummyfunction;
88 newprov.pwszPutFuncName = dummyfunction;
89 newprov.pwszCreateFuncName = dummyfunction;
90 newprov.pwszVerifyFuncName = dummyfunction;
91 newprov.pwszRemoveFuncName = dummyfunction;
92 SetLastError(0xdeadbeef);
93 ret = CryptSIPAddProvider(&newprov);
94 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
96 skip("Need admin rights\n");
97 return;
99 ok ( ret, "CryptSIPAddProvider should have succeeded\n");
101 /* Dummy provider will be deleted, but the function still fails because
102 * pwszIsFunctionName and pwszIsFunctionNameFmt2 are not present in the
103 * registry.
105 SetLastError(0xdeadbeef);
106 ret = CryptSIPRemoveProvider(&actionid);
107 ok (!ret, "Expected CryptSIPRemoveProvider to fail.\n");
108 ok (GetLastError() == ERROR_FILE_NOT_FOUND,
109 "Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
111 /* Everything OK */
112 memset(&newprov, 0, sizeof(SIP_ADD_NEWPROVIDER));
113 newprov.cbStruct = sizeof(SIP_ADD_NEWPROVIDER);
114 newprov.pgSubject = &actionid;
115 newprov.pwszDLLFileName = dummydll;
116 newprov.pwszGetFuncName = dummyfunction;
117 newprov.pwszPutFuncName = dummyfunction;
118 newprov.pwszCreateFuncName = dummyfunction;
119 newprov.pwszVerifyFuncName = dummyfunction;
120 newprov.pwszRemoveFuncName = dummyfunction;
121 newprov.pwszIsFunctionNameFmt2 = dummyfunction;
122 newprov.pwszIsFunctionName = dummyfunction;
123 SetLastError(0xdeadbeef);
124 ret = CryptSIPAddProvider(&newprov);
125 ok ( ret, "CryptSIPAddProvider should have succeeded\n");
127 /* Dummy provider should be deleted */
128 SetLastError(0xdeadbeef);
129 ret = CryptSIPRemoveProvider(&actionid);
130 ok ( ret, "CryptSIPRemoveProvider should have succeeded\n");
133 static const BYTE cabFileData[] = {
134 0x4d,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
135 0x2c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x01,0x00,0x00,0x00,
136 0xef,0xbe,0xff,0xff,0x42,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
137 0x00,0x00,0x00,0x00,0x00,0x00,0xf7,0x38,0x4b,0xac,0x00,0x00,0x61,0x2e,0x74,0x78,
138 0x74,0x00,0x6d,0x5a,0x72,0x78,0x06,0x00,0x06,0x00,0x61,0x2e,0x74,0x78,0x74,0x0a,
141 static void test_SIPRetrieveSubjectGUID(void)
143 BOOL ret;
144 GUID subject;
145 HANDLE file;
146 static const CHAR windir[] = "windir";
147 static const CHAR regeditExe[] = "regedit.exe";
148 static const GUID nullSubject = { 0x0, 0x0, 0x0, { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 }};
149 static const WCHAR deadbeef[] = { 'c',':','\\','d','e','a','d','b','e','e','f','.','d','b','f',0 };
150 /* Couldn't find a name for this GUID, it's the one used for 95% of the files */
151 static const GUID unknownGUID = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
152 static const GUID cabGUID = { 0xc689aaba, 0x8e78, 0x11d0, {0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee }};
153 static CHAR regeditPath[MAX_PATH];
154 static WCHAR regeditPathW[MAX_PATH];
155 static CHAR path[MAX_PATH];
156 static CHAR tempfile[MAX_PATH];
157 static WCHAR tempfileW[MAX_PATH];
158 static char guid1[39], guid2[39];
159 DWORD written;
161 /* NULL check */
162 SetLastError(0xdeadbeef);
163 ret = CryptSIPRetrieveSubjectGuid(NULL, NULL, NULL);
164 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
165 ok (GetLastError() == ERROR_INVALID_PARAMETER,
166 "Expected ERROR_INVALID_PARAMETER, got %d.\n", GetLastError());
168 /* Test with a nonexistent file (hopefully) */
169 SetLastError(0xdeadbeef);
170 /* Set subject to something other than zeros */
171 memset(&subject, 1, sizeof(GUID));
172 ret = CryptSIPRetrieveSubjectGuid(deadbeef, NULL, &subject);
173 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
174 ok (GetLastError() == ERROR_FILE_NOT_FOUND,
175 "Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
176 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
177 "Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", show_guid(&subject, guid1));
179 /* Now with an executable that should exist
181 * Use A-functions where possible as that should be available on all platforms
183 ret = GetEnvironmentVariableA(windir, regeditPath, MAX_PATH);
184 ok (ret > 0, "expected GEVA(windir) to succeed, last error %d\n", GetLastError());
185 strcat(regeditPath, "\\");
186 strcat(regeditPath, regeditExe);
187 MultiByteToWideChar( CP_ACP, 0, regeditPath,
188 strlen(regeditPath)+1, regeditPathW,
189 sizeof(regeditPathW)/sizeof(regeditPathW[0]) );
191 SetLastError(0xdeadbeef);
192 memset(&subject, 1, sizeof(GUID));
193 ret = CryptSIPRetrieveSubjectGuid(regeditPathW, NULL, &subject);
194 ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
195 ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
196 "Expected (%s), got (%s).\n", show_guid(&unknownGUID, guid1), show_guid(&subject, guid2));
198 /* The same thing but now with a handle instead of a filename */
199 file = CreateFileA(regeditPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
200 SetLastError(0xdeadbeef);
201 memset(&subject, 1, sizeof(GUID));
202 ret = CryptSIPRetrieveSubjectGuid(NULL, file, &subject);
203 ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
204 ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
205 "Expected (%s), got (%s).\n", show_guid(&unknownGUID, guid1), show_guid(&subject, guid2));
206 CloseHandle(file);
208 /* And both */
209 file = CreateFileA(regeditPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
210 SetLastError(0xdeadbeef);
211 memset(&subject, 1, sizeof(GUID));
212 ret = CryptSIPRetrieveSubjectGuid(regeditPathW, file, &subject);
213 ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
214 ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
215 "Expected (%s), got (%s).\n", show_guid(&unknownGUID, guid1), show_guid(&subject, guid2));
216 CloseHandle(file);
218 /* Now with an empty file */
219 GetTempPathA(sizeof(path), path);
220 GetTempFileNameA(path, "sip", 0 , tempfile);
221 MultiByteToWideChar( CP_ACP, 0, tempfile,
222 strlen(tempfile)+1, tempfileW,
223 sizeof(tempfileW)/sizeof(tempfileW[0]) );
225 SetLastError(0xdeadbeef);
226 memset(&subject, 1, sizeof(GUID));
227 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
228 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
229 ok ( GetLastError() == ERROR_FILE_INVALID ||
230 GetLastError() == ERROR_INVALID_PARAMETER /* Vista */ ||
231 GetLastError() == ERROR_SUCCESS /* Win98 */,
232 "Expected ERROR_FILE_INVALID, ERROR_INVALID_PARAMETER or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
233 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
234 "Expected a NULL GUID for empty file %s, not %s\n", tempfile, show_guid(&subject, guid1));
236 /* Use a file with a size of 3 (at least < 4) */
237 file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
238 WriteFile(file, "123", 3, &written, NULL);
239 CloseHandle(file);
241 SetLastError(0xdeadbeef);
242 memset(&subject, 1, sizeof(GUID));
243 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
244 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
245 ok ( GetLastError() == ERROR_INVALID_PARAMETER ||
246 GetLastError() == ERROR_SUCCESS /* Win98 */,
247 "Expected ERROR_INVALID_PARAMETER or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
248 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
249 "Expected a NULL GUID for empty file %s, not %s\n", tempfile, show_guid(&subject, guid1));
251 /* And now >= 4 */
252 file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
253 WriteFile(file, "1234", 4, &written, NULL);
254 CloseHandle(file);
256 SetLastError(0xdeadbeef);
257 memset(&subject, 1, sizeof(GUID));
258 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
259 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
260 ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN ||
261 GetLastError() == ERROR_SUCCESS /* Win98 */,
262 "Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
263 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
264 "Expected a NULL GUID for empty file %s, not %s\n", tempfile, show_guid(&subject, guid1));
266 /* Clean up */
267 DeleteFileA(tempfile);
269 /* Create a .cab file */
270 file = CreateFileW(tempfileW, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
271 WriteFile(file, cabFileData, sizeof(cabFileData), &written, NULL);
272 CloseHandle(file);
274 SetLastError(0xdeadbeef);
275 memset(&subject, 1, sizeof(GUID));
276 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
277 ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
278 GetLastError(), GetLastError() );
279 ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
280 "Expected GUID %s for cabinet file, not %s\n", show_guid(&cabGUID, guid1), show_guid(&subject, guid2));
281 /* Clean up */
282 DeleteFileW(tempfileW);
285 static void test_SIPLoad(void)
287 BOOL ret;
288 GUID subject;
289 static GUID dummySubject = { 0xdeadbeef, 0xdead, 0xbeef, { 0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef }};
290 static GUID unknown = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */
291 static GUID unknown2 = { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */
292 /* The next SIP is available on Windows (not on a clean Wine install) */
293 static GUID unknown3 = { 0x000C10F1, 0x0000, 0x0000, { 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }}; /* MSISIP.DLL */
294 SIP_DISPATCH_INFO sdi;
295 HMODULE hCrypt;
297 /* All NULL */
298 SetLastError(0xdeadbeef);
299 ret = CryptSIPLoad(NULL, 0, NULL);
300 ok ( !ret, "Expected CryptSIPLoad to fail\n");
301 ok ( GetLastError() == ERROR_INVALID_PARAMETER,
302 "Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
304 /* Only pSipDispatch NULL */
305 SetLastError(0xdeadbeef);
306 ret = CryptSIPLoad(&subject, 0, NULL);
307 ok ( !ret, "Expected CryptSIPLoad to fail\n");
308 ok ( GetLastError() == ERROR_INVALID_PARAMETER,
309 "Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
311 /* No NULLs, but nonexistent pgSubject */
312 SetLastError(0xdeadbeef);
313 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
314 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
315 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
316 ret = CryptSIPLoad(&dummySubject, 0, &sdi);
317 ok ( !ret, "Expected CryptSIPLoad to fail\n");
318 ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN,
319 "Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
320 ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
322 hCrypt = GetModuleHandleA("crypt32.dll");
323 funcCryptSIPGetSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPGetSignedDataMsg");
324 funcCryptSIPPutSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPPutSignedDataMsg");
325 funcCryptSIPCreateIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPCreateIndirectData");
326 funcCryptSIPVerifyIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPVerifyIndirectData");
327 funcCryptSIPRemoveSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPRemoveSignedDataMsg");
329 /* All OK */
330 SetLastError(0xdeadbeef);
331 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
332 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
333 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
334 ret = CryptSIPLoad(&unknown, 0, &sdi);
335 ok ( ret, "Expected CryptSIPLoad to succeed\n");
336 /* On native the last error will always be ERROR_PROC_NOT_FOUND as native searches for the function DllCanUnloadNow
337 * in WINTRUST.DLL (in this case). This function is not available in WINTRUST.DLL.
338 * For now there's no need to implement this is Wine as I doubt any program will rely on
339 * this last error when the call succeeded.
341 ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
343 /* The function addresses returned by CryptSIPLoad are actually the addresses of
344 * crypt32's own functions. A function calling these addresses will end up first
345 * calling crypt32 functions which in its turn call the equivalent in the SIP
346 * as dictated by the given GUID.
348 if (funcCryptSIPGetSignedDataMsg && funcCryptSIPPutSignedDataMsg && funcCryptSIPCreateIndirectData &&
349 funcCryptSIPVerifyIndirectData && funcCryptSIPRemoveSignedDataMsg)
350 ok (sdi.pfGet == funcCryptSIPGetSignedDataMsg &&
351 sdi.pfPut == funcCryptSIPPutSignedDataMsg &&
352 sdi.pfCreate == funcCryptSIPCreateIndirectData &&
353 sdi.pfVerify == funcCryptSIPVerifyIndirectData &&
354 sdi.pfRemove == funcCryptSIPRemoveSignedDataMsg,
355 "Expected function addresses to be from crypt32\n");
356 else
357 trace("Couldn't load function pointers\n");
359 /* All OK, but different GUID (same SIP though) */
360 SetLastError(0xdeadbeef);
361 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
362 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
363 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
364 ret = CryptSIPLoad(&unknown2, 0, &sdi);
365 ok ( ret, "Expected CryptSIPLoad to succeed\n");
366 /* This call on its own would have resulted in an ERROR_PROC_NOT_FOUND, but the previous
367 * call to CryptSIPLoad already loaded wintrust.dll. As this information is cached,
368 * CryptSIPLoad will not try to search for the already mentioned DllCanUnloadNow.
370 ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
372 /* All OK, but other SIP */
373 SetLastError(0xdeadbeef);
374 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
375 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
376 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
377 ret = CryptSIPLoad(&unknown3, 0, &sdi);
378 if (ret)
380 /* The SIP is known so we can safely assume that the next tests can be done */
382 /* As msisip.dll is not checked yet by any of the previous calls, the
383 * function DllCanUnloadNow will be checked again in msisip.dll (it's not present)
385 todo_wine
387 ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
389 /* This is another SIP but this test proves the function addresses are the same as
390 * in the previous test.
392 if (funcCryptSIPGetSignedDataMsg && funcCryptSIPPutSignedDataMsg && funcCryptSIPCreateIndirectData &&
393 funcCryptSIPVerifyIndirectData && funcCryptSIPRemoveSignedDataMsg)
394 ok (sdi.pfGet == funcCryptSIPGetSignedDataMsg &&
395 sdi.pfPut == funcCryptSIPPutSignedDataMsg &&
396 sdi.pfCreate == funcCryptSIPCreateIndirectData &&
397 sdi.pfVerify == funcCryptSIPVerifyIndirectData &&
398 sdi.pfRemove == funcCryptSIPRemoveSignedDataMsg,
399 "Expected function addresses to be from crypt32\n");
400 else
401 trace("Couldn't load function pointers\n");
405 /* Reserved parameter not 0 */
406 SetLastError(0xdeadbeef);
407 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
408 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
409 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
410 ret = CryptSIPLoad(&unknown, 1, &sdi);
411 ok ( !ret, "Expected CryptSIPLoad to fail\n");
412 ok ( GetLastError() == ERROR_INVALID_PARAMETER,
413 "Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
414 ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
417 START_TEST(sip)
419 test_AddRemoveProvider();
420 /* It seems that the caching for loaded dlls is shared between CryptSIPRetrieveSubjectGUID
421 * and CryptSIPLoad. The tests have to be in this order to succeed. This is because in the last
422 * test for CryptSIPRetrieveSubjectGUID, several SIPs will be loaded (on Windows).
424 test_SIPLoad();
425 test_SIPRetrieveSubjectGUID();