[crypt32] A small test to verify when to write function pointers
Paul Vriens
Paul.Vriens at xs4all.nl
Thu Sep 28 05:11:04 CDT 2006
Hi,
another test to show when and if we should change function pointers in the
structure.
Changelog
A small test to verify when to write function pointers
Cheers,
Paul.
---
dlls/crypt32/tests/sip.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/tests/sip.c b/dlls/crypt32/tests/sip.c
index 61293aa..6fa6b99 100644
--- a/dlls/crypt32/tests/sip.c
+++ b/dlls/crypt32/tests/sip.c
@@ -283,41 +283,50 @@ static void test_SIPLoad(void)
SetLastError(0xdeadbeef);
memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
+ sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
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());
+ ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
/* cbSize not initialized */
SetLastError(0xdeadbeef);
memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
+ sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
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());
+ ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
/* cbSize not initialized, but valid subject (named unknown but registered by wintrust) */
SetLastError(0xdeadbeef);
memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
+ sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
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());
+ ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
}
/* All OK */
SetLastError(0xdeadbeef);
memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
+ sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
ret = CryptSIPLoad(&unknown, 0, &sdi);
todo_wine
ok ( ret, "Expected CryptSIPLoad to succeed\n");
ok ( GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got 0x%08lx\n", GetLastError());
+ todo_wine
+ ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded.\n");
/* The function addresses returned by CryptSIPLoad are actually the addresses of
* crypt32's own functions. A function calling these addresses will end up first
@@ -351,11 +360,13 @@ static void test_SIPLoad(void)
SetLastError(0xdeadbeef);
memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));
sdi.cbSize = sizeof(SIP_DISPATCH_INFO);
+ sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;
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());
+ ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
}
START_TEST(sip)
--
1.4.2.1
More information about the wine-patches
mailing list