Paul Vriens : crypt32: Another CryptSIPLoad test.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Sep 27 13:58:37 CDT 2006


Module: wine
Branch: master
Commit: 1a4bd814cafb5d28e741186751c27732d57ab93a
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1a4bd814cafb5d28e741186751c27732d57ab93a

Author: Paul Vriens <Paul.Vriens at xs4all.nl>
Date:   Wed Sep 27 16:10:22 2006 +0200

crypt32: Another CryptSIPLoad test.

---

 dlls/crypt32/tests/sip.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/dlls/crypt32/tests/sip.c b/dlls/crypt32/tests/sip.c
index 04d2990..e213df9 100644
--- a/dlls/crypt32/tests/sip.c
+++ b/dlls/crypt32/tests/sip.c
@@ -29,6 +29,12 @@ #include <mssip.h>
 
 #include "wine/test.h"
 
+static BOOL (WINAPI * funcCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *);
+static BOOL (WINAPI * funcCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *,DWORD,DWORD *,DWORD,BYTE *);
+static BOOL (WINAPI * funcCryptSIPCreateIndirectData)(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *);
+static BOOL (WINAPI * funcCryptSIPVerifyIndirectData)(SIP_SUBJECTINFO *,SIP_INDIRECT_DATA *);
+static BOOL (WINAPI * funcCryptSIPRemoveSignedDataMsg)(SIP_SUBJECTINFO *,DWORD);
+
 static char *show_guid(const GUID *guid)
 {
     static char guidstring[39];
@@ -277,6 +283,7 @@ static void test_SIPLoad(void)
     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;
+    HMODULE hCrypt;
 
     /* All NULL */
     SetLastError(0xdeadbeef);
@@ -334,6 +341,34 @@ static void test_SIPLoad(void)
     ok ( GetLastError() == 0xdeadbeef,
         "Expected 0xdeadbeef, got 0x%08lx\n", GetLastError());
 
+    /* The function addresses returned by CryptSIPLoad are actually the addresses of
+     * crypt32's own functions. A function calling these addresses will end up first
+     * calling crypt32 functions which in it's turn call the equivalent in the SIP
+     * as dictated by the given GUID.
+     */
+    hCrypt = LoadLibrary("crypt32.dll");
+    if (hCrypt)
+    {
+        funcCryptSIPGetSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPGetSignedDataMsg");
+        funcCryptSIPPutSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPPutSignedDataMsg");
+        funcCryptSIPCreateIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPCreateIndirectData");
+        funcCryptSIPVerifyIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPVerifyIndirectData");
+        funcCryptSIPRemoveSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPRemoveSignedDataMsg");
+        if (funcCryptSIPGetSignedDataMsg && funcCryptSIPPutSignedDataMsg && funcCryptSIPCreateIndirectData &&
+            funcCryptSIPVerifyIndirectData && funcCryptSIPRemoveSignedDataMsg)
+            todo_wine
+                ok (sdi.pfGet == funcCryptSIPGetSignedDataMsg &&
+                    sdi.pfPut == funcCryptSIPPutSignedDataMsg &&
+                    sdi.pfCreate == funcCryptSIPCreateIndirectData &&
+                    sdi.pfVerify == funcCryptSIPVerifyIndirectData &&
+                    sdi.pfRemove == funcCryptSIPRemoveSignedDataMsg,
+                    "Expected function addresses to be from crypt32\n");
+        else
+            trace("Couldn't load function pointers\n");
+ 
+        FreeLibrary(hCrypt);
+    }
+
     /* Reserved parameter not 0 */
     SetLastError(0xdeadbeef);
     memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));




More information about the wine-cvs mailing list