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
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)
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] );
50 static void test_AddRemoveProvider(void)
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 };
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");
75 /* On some Win98 systems, CryptSIPRemoveProvider always succeeds if
76 * the arguments are correct, whether or not the registry key is
77 * present, so don't test ret, just check the last error if it does
81 ok (GetLastError() == ERROR_FILE_NOT_FOUND,
82 "Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
85 /* Everything OK, pwszIsFunctionName and pwszIsFunctionNameFmt2 are left NULL
88 memset(&newprov, 0, sizeof(SIP_ADD_NEWPROVIDER));
89 newprov.cbStruct = sizeof(SIP_ADD_NEWPROVIDER);
90 newprov.pgSubject = &actionid;
91 newprov.pwszDLLFileName = dummydll;
92 newprov.pwszGetFuncName = dummyfunction;
93 newprov.pwszPutFuncName = dummyfunction;
94 newprov.pwszCreateFuncName = dummyfunction;
95 newprov.pwszVerifyFuncName = dummyfunction;
96 newprov.pwszRemoveFuncName = dummyfunction;
97 SetLastError(0xdeadbeef);
98 ret = CryptSIPAddProvider(&newprov);
99 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
101 skip("Need admin rights\n");
104 ok ( ret, "CryptSIPAddProvider should have succeeded\n");
106 /* Dummy provider will be deleted, but the function still fails because
107 * pwszIsFunctionName and pwszIsFunctionNameFmt2 are not present in the
110 SetLastError(0xdeadbeef);
111 ret = CryptSIPRemoveProvider(&actionid);
112 /* On some Win98 systems, CryptSIPRemoveProvider always succeeds if
113 * the arguments are correct, whether or not the registry key is
114 * present, so don't test ret, just check the last error if it does
118 ok (GetLastError() == ERROR_FILE_NOT_FOUND,
119 "Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
122 memset(&newprov, 0, sizeof(SIP_ADD_NEWPROVIDER));
123 newprov.cbStruct = sizeof(SIP_ADD_NEWPROVIDER);
124 newprov.pgSubject = &actionid;
125 newprov.pwszDLLFileName = dummydll;
126 newprov.pwszGetFuncName = dummyfunction;
127 newprov.pwszPutFuncName = dummyfunction;
128 newprov.pwszCreateFuncName = dummyfunction;
129 newprov.pwszVerifyFuncName = dummyfunction;
130 newprov.pwszRemoveFuncName = dummyfunction;
131 newprov.pwszIsFunctionNameFmt2 = dummyfunction;
132 newprov.pwszIsFunctionName = dummyfunction;
133 SetLastError(0xdeadbeef);
134 ret = CryptSIPAddProvider(&newprov);
135 ok ( ret, "CryptSIPAddProvider should have succeeded\n");
137 /* Dummy provider should be deleted */
138 SetLastError(0xdeadbeef);
139 ret = CryptSIPRemoveProvider(&actionid);
140 ok ( ret, "CryptSIPRemoveProvider should have succeeded\n");
143 static const BYTE cabFileData[] = {
144 0x4d,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
145 0x2c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x01,0x00,0x00,0x00,
146 0xef,0xbe,0xff,0xff,0x42,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
147 0x00,0x00,0x00,0x00,0x00,0x00,0xf7,0x38,0x4b,0xac,0x00,0x00,0x61,0x2e,0x74,0x78,
148 0x74,0x00,0x6d,0x5a,0x72,0x78,0x06,0x00,0x06,0x00,0x61,0x2e,0x74,0x78,0x74,0x0a,
151 static void test_SIPRetrieveSubjectGUID(void)
156 static const CHAR windir[] = "windir";
157 static const CHAR regeditExe[] = "regedit.exe";
158 static const GUID nullSubject = { 0x0, 0x0, 0x0, { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 }};
159 static const WCHAR deadbeef[] = { 'c',':','\\','d','e','a','d','b','e','e','f','.','d','b','f',0 };
160 /* Couldn't find a name for this GUID, it's the one used for 95% of the files */
161 static const GUID unknownGUID = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
162 static const GUID cabGUID = { 0xc689aaba, 0x8e78, 0x11d0, {0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee }};
163 static CHAR regeditPath[MAX_PATH];
164 static WCHAR regeditPathW[MAX_PATH];
165 static CHAR path[MAX_PATH];
166 static CHAR tempfile[MAX_PATH];
167 static WCHAR tempfileW[MAX_PATH];
168 static char guid1[39], guid2[39];
172 SetLastError(0xdeadbeef);
173 ret = CryptSIPRetrieveSubjectGuid(NULL, NULL, NULL);
174 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
175 ok (GetLastError() == ERROR_INVALID_PARAMETER,
176 "Expected ERROR_INVALID_PARAMETER, got %d.\n", GetLastError());
178 /* Test with a nonexistent file (hopefully) */
179 SetLastError(0xdeadbeef);
180 /* Set subject to something other than zeros */
181 memset(&subject, 1, sizeof(GUID));
182 ret = CryptSIPRetrieveSubjectGuid(deadbeef, NULL, &subject);
183 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
184 ok (GetLastError() == ERROR_FILE_NOT_FOUND,
185 "Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
186 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
187 "Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", show_guid(&subject, guid1));
189 /* Now with an executable that should exist
191 * Use A-functions where possible as that should be available on all platforms
193 ret = GetEnvironmentVariableA(windir, regeditPath, MAX_PATH);
194 ok (ret > 0, "expected GEVA(windir) to succeed, last error %d\n", GetLastError());
195 strcat(regeditPath, "\\");
196 strcat(regeditPath, regeditExe);
197 MultiByteToWideChar( CP_ACP, 0, regeditPath,
198 strlen(regeditPath)+1, regeditPathW,
199 sizeof(regeditPathW)/sizeof(regeditPathW[0]) );
201 SetLastError(0xdeadbeef);
202 memset(&subject, 1, sizeof(GUID));
203 ret = CryptSIPRetrieveSubjectGuid(regeditPathW, NULL, &subject);
204 ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
205 ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
206 "Expected (%s), got (%s).\n", show_guid(&unknownGUID, guid1), show_guid(&subject, guid2));
208 /* The same thing but now with a handle instead of a filename */
209 file = CreateFileA(regeditPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
210 SetLastError(0xdeadbeef);
211 memset(&subject, 1, sizeof(GUID));
212 ret = CryptSIPRetrieveSubjectGuid(NULL, 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));
219 file = CreateFileA(regeditPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
220 SetLastError(0xdeadbeef);
221 memset(&subject, 1, sizeof(GUID));
222 ret = CryptSIPRetrieveSubjectGuid(regeditPathW, file, &subject);
223 ok ( ret, "Expected CryptSIPRetrieveSubjectGuid to succeed\n");
224 ok ( !memcmp(&subject, &unknownGUID, sizeof(GUID)),
225 "Expected (%s), got (%s).\n", show_guid(&unknownGUID, guid1), show_guid(&subject, guid2));
228 /* Now with an empty file */
229 GetTempPathA(sizeof(path), path);
230 GetTempFileNameA(path, "sip", 0 , tempfile);
231 MultiByteToWideChar( CP_ACP, 0, tempfile,
232 strlen(tempfile)+1, tempfileW,
233 sizeof(tempfileW)/sizeof(tempfileW[0]) );
235 SetLastError(0xdeadbeef);
236 memset(&subject, 1, sizeof(GUID));
237 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
238 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
239 ok ( GetLastError() == ERROR_FILE_INVALID ||
240 GetLastError() == ERROR_INVALID_PARAMETER /* Vista */ ||
241 GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
242 GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some Win98 */,
243 "Expected ERROR_FILE_INVALID, ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
244 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
245 "Expected a NULL GUID for empty file %s, not %s\n", tempfile, show_guid(&subject, guid1));
247 /* Use a file with a size of 3 (at least < 4) */
248 file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
249 WriteFile(file, "123", 3, &written, NULL);
252 SetLastError(0xdeadbeef);
253 memset(&subject, 1, sizeof(GUID));
254 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
255 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
256 ok ( GetLastError() == ERROR_INVALID_PARAMETER ||
257 GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
258 GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some Win98 */,
259 "Expected ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
260 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
261 "Expected a NULL GUID for empty file %s, not %s\n", tempfile, show_guid(&subject, guid1));
264 file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
265 WriteFile(file, "1234", 4, &written, NULL);
268 SetLastError(0xdeadbeef);
269 memset(&subject, 1, sizeof(GUID));
270 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
271 ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
272 ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN ||
273 GetLastError() == ERROR_SUCCESS /* Win98 */,
274 "Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
275 ok ( !memcmp(&subject, &nullSubject, sizeof(GUID)),
276 "Expected a NULL GUID for empty file %s, not %s\n", tempfile, show_guid(&subject, guid1));
279 DeleteFileA(tempfile);
281 /* Create a file with just the .cab header 'MSCF' */
282 SetLastError(0xdeadbeef);
283 file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
284 ok(file != INVALID_HANDLE_VALUE, "failed with %u\n", GetLastError());
285 WriteFile(file, cabFileData, 4, &written, NULL);
288 SetLastError(0xdeadbeef);
289 memset(&subject, 1, sizeof(GUID));
290 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
291 ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
292 GetLastError(), GetLastError() );
293 ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
294 "Expected GUID %s for cabinet file, not %s\n", show_guid(&cabGUID, guid1), show_guid(&subject, guid2));
297 DeleteFileA(tempfile);
299 /* Create a .cab file */
300 SetLastError(0xdeadbeef);
301 file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
302 ok(file != INVALID_HANDLE_VALUE, "failed with %u\n", GetLastError());
303 WriteFile(file, cabFileData, sizeof(cabFileData), &written, NULL);
306 SetLastError(0xdeadbeef);
307 memset(&subject, 1, sizeof(GUID));
308 ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
309 ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
310 GetLastError(), GetLastError() );
311 ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
312 "Expected GUID %s for cabinet file, not %s\n", show_guid(&cabGUID, guid1), show_guid(&subject, guid2));
315 DeleteFileA(tempfile);
318 static void test_SIPLoad(void)
322 static GUID dummySubject = { 0xdeadbeef, 0xdead, 0xbeef, { 0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef }};
323 static GUID unknown = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */
324 static GUID unknown2 = { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */
325 /* The next SIP is available on Windows and on Wine */
326 static GUID unknown3 = { 0x000C10F1, 0x0000, 0x0000, { 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }}; /* MSISIP.DLL */
327 SIP_DISPATCH_INFO sdi;
331 SetLastError(0xdeadbeef);
332 ret = CryptSIPLoad(NULL, 0, NULL);
333 ok ( !ret, "Expected CryptSIPLoad to fail\n");
334 ok ( GetLastError() == ERROR_INVALID_PARAMETER,
335 "Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
337 /* Only pSipDispatch NULL */
338 SetLastError(0xdeadbeef);
339 ret = CryptSIPLoad(&subject, 0, NULL);
340 ok ( !ret, "Expected CryptSIPLoad to fail\n");
341 ok ( GetLastError() == ERROR_INVALID_PARAMETER,
342 "Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
344 /* No NULLs, but nonexistent pgSubject */
345 SetLastError(0xdeadbeef);
346 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
347 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
348 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
349 ret = CryptSIPLoad(&dummySubject, 0, &sdi);
350 ok ( !ret, "Expected CryptSIPLoad to fail\n");
351 ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN,
352 "Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
353 ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
355 hCrypt = GetModuleHandleA("crypt32.dll");
356 funcCryptSIPGetSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPGetSignedDataMsg");
357 funcCryptSIPPutSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPPutSignedDataMsg");
358 funcCryptSIPCreateIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPCreateIndirectData");
359 funcCryptSIPVerifyIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPVerifyIndirectData");
360 funcCryptSIPRemoveSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPRemoveSignedDataMsg");
363 SetLastError(0xdeadbeef);
364 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
365 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
366 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
367 ret = CryptSIPLoad(&unknown, 0, &sdi);
368 ok ( ret, "Expected CryptSIPLoad to succeed\n");
369 /* On native the last error will always be ERROR_PROC_NOT_FOUND as native searches for the function DllCanUnloadNow
370 * in WINTRUST.DLL (in this case). This function is not available in WINTRUST.DLL.
371 * For now there's no need to implement this is Wine as I doubt any program will rely on
372 * this last error when the call succeeded.
374 ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
376 /* The function addresses returned by CryptSIPLoad are actually the addresses of
377 * crypt32's own functions. A function calling these addresses will end up first
378 * calling crypt32 functions which in its turn call the equivalent in the SIP
379 * as dictated by the given GUID.
381 if (funcCryptSIPGetSignedDataMsg && funcCryptSIPPutSignedDataMsg && funcCryptSIPCreateIndirectData &&
382 funcCryptSIPVerifyIndirectData && funcCryptSIPRemoveSignedDataMsg)
383 ok (sdi.pfGet == funcCryptSIPGetSignedDataMsg &&
384 sdi.pfPut == funcCryptSIPPutSignedDataMsg &&
385 sdi.pfCreate == funcCryptSIPCreateIndirectData &&
386 sdi.pfVerify == funcCryptSIPVerifyIndirectData &&
387 sdi.pfRemove == funcCryptSIPRemoveSignedDataMsg,
388 "Expected function addresses to be from crypt32\n");
390 trace("Couldn't load function pointers\n");
392 /* All OK, but different GUID (same SIP though) */
393 SetLastError(0xdeadbeef);
394 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
395 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
396 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
397 ret = CryptSIPLoad(&unknown2, 0, &sdi);
398 ok ( ret, "Expected CryptSIPLoad to succeed\n");
399 /* This call on its own would have resulted in an ERROR_PROC_NOT_FOUND, but the previous
400 * call to CryptSIPLoad already loaded wintrust.dll. As this information is cached,
401 * CryptSIPLoad will not try to search for the already mentioned DllCanUnloadNow.
403 ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
405 /* All OK, but other SIP */
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(&unknown3, 0, &sdi);
413 /* The SIP is known so we can safely assume that the next tests can be done */
415 /* As msisip.dll is not checked yet by any of the previous calls, the
416 * function DllCanUnloadNow will be checked again in msisip.dll (it's not present)
418 ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
420 /* This is another SIP but this test proves the function addresses are the same as
421 * in the previous test.
423 if (funcCryptSIPGetSignedDataMsg && funcCryptSIPPutSignedDataMsg && funcCryptSIPCreateIndirectData &&
424 funcCryptSIPVerifyIndirectData && funcCryptSIPRemoveSignedDataMsg)
425 ok (sdi.pfGet == funcCryptSIPGetSignedDataMsg &&
426 sdi.pfPut == funcCryptSIPPutSignedDataMsg &&
427 sdi.pfCreate == funcCryptSIPCreateIndirectData &&
428 sdi.pfVerify == funcCryptSIPVerifyIndirectData &&
429 sdi.pfRemove == funcCryptSIPRemoveSignedDataMsg,
430 "Expected function addresses to be from crypt32\n");
432 trace("Couldn't load function pointers\n");
435 /* Reserved parameter not 0 */
436 SetLastError(0xdeadbeef);
437 memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
438 sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
439 sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
440 ret = CryptSIPLoad(&unknown, 1, &sdi);
441 ok ( !ret, "Expected CryptSIPLoad to fail\n");
442 ok ( GetLastError() == ERROR_INVALID_PARAMETER,
443 "Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
444 ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
449 test_AddRemoveProvider();
450 /* It seems that the caching for loaded dlls is shared between CryptSIPRetrieveSubjectGUID
451 * and CryptSIPLoad. The tests have to be in this order to succeed. This is because in the last
452 * test for CryptSIPRetrieveSubjectGUID, several SIPs will be loaded (on Windows).
455 test_SIPRetrieveSubjectGUID();