Paul Vriens : crypt32/tests: Some tests for CryptSIPLoad.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Sep 14 10:10:08 CDT 2006
Module: wine
Branch: master
Commit: efb65fcac9927f8f9d8a9056792cd9a2ede5c7b3
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=efb65fcac9927f8f9d8a9056792cd9a2ede5c7b3
Author: Paul Vriens <Paul.Vriens at xs4all.nl>
Date: Wed Sep 13 19:17:36 2006 +0200
crypt32/tests: Some tests for CryptSIPLoad.
---
dlls/crypt32/tests/main.c | 76 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/tests/main.c b/dlls/crypt32/tests/main.c
index 76ffab7..1c89f72 100644
--- a/dlls/crypt32/tests/main.c
+++ b/dlls/crypt32/tests/main.c
@@ -420,6 +420,81 @@ static void test_AddRemoveProvider(void)
GetLastError());
}
+static void test_SIPLoad(void)
+{
+ BOOL ret;
+ GUID subject;
+ static GUID dummySubject = { 0xdeadbeef, 0xdead, 0xbeef, { 0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef }};
+ static GUID unknown = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
+ SIP_DISPATCH_INFO sdi;
+
+ /* All NULL */
+ SetLastError(0xdeadbeef);
+ ret = CryptSIPLoad(NULL, 0, NULL);
+ ok ( !ret, "Expected CryptSIPLoad to fail\n");
+ todo_wine
+ ok ( GetLastError() == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
+
+ /* Only pSipDispatch NULL */
+ SetLastError(0xdeadbeef);
+ ret = CryptSIPLoad(&subject, 0, NULL);
+ ok ( !ret, "Expected CryptSIPLoad to fail\n");
+ todo_wine
+ ok ( GetLastError() == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
+
+ /* No NULLs, but nonexistent pgSubject */
+ SetLastError(0xdeadbeef);
+ memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
+ sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
+ ret = CryptSIPLoad(&dummySubject, 0, &sdi);
+ ok ( !ret, "Expected CryptSIPLoad to fail\n");
+ todo_wine
+ ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN,
+ "Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
+
+ /* cbSize not initialized */
+ SetLastError(0xdeadbeef);
+ memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
+ ret = CryptSIPLoad(&dummySubject, 0, &sdi);
+ ok ( !ret, "Expected CryptSIPLoad to fail\n");
+ todo_wine
+ ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN,
+ "Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
+
+ /* cbSize not initialized, but valid subject (named unknown but registered by wintrust) */
+ SetLastError(0xdeadbeef);
+ memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
+ ret = CryptSIPLoad(&unknown, 0, &sdi);
+ todo_wine
+ {
+ ok ( ret, "Expected CryptSIPLoad to succeed\n");
+ ok ( GetLastError() == ERROR_PROC_NOT_FOUND,
+ "Expected ERROR_PROC_NOT_FOUND, got 0x%08lx\n", GetLastError());
+ }
+
+ /* All OK */
+ SetLastError(0xdeadbeef);
+ memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
+ sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
+ ret = CryptSIPLoad(&unknown, 0, &sdi);
+ todo_wine
+ ok ( ret, "Expected CryptSIPLoad to succeed\n");
+ ok ( GetLastError() == 0xdeadbeef,
+ "Expected 0xdeadbeef, got 0x%08lx\n", GetLastError());
+
+ /* Reserved parameter not 0 */
+ SetLastError(0xdeadbeef);
+ memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
+ sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
+ ret = CryptSIPLoad(&unknown, 1, &sdi);
+ ok ( !ret, "Expected CryptSIPLoad to fail\n");
+ todo_wine
+ ok ( GetLastError() == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
+}
+
START_TEST(main)
{
hCrypt = LoadLibraryA("crypt32.dll");
@@ -432,4 +507,5 @@ START_TEST(main)
test_readTrustedPublisherDWORD();
test_getDefaultCryptProv();
test_AddRemoveProvider();
+ test_SIPLoad();
}
More information about the wine-cvs
mailing list