wintrust(2/10): Implement SoftpubLoadSignature (try 2)
Juan Lang
juan.lang at gmail.com
Mon Aug 27 18:34:28 CDT 2007
--Juan
-------------- next part --------------
From 98452b054b6fbf576ef2eee58077b371e0901307 Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Mon, 27 Aug 2007 16:18:50 -0700
Subject: [PATCH] Implement SoftpubLoadSignature
---
dlls/wintrust/softpub.c | 68 +++++++++++++++++++++++++++++++++++++++++++
dlls/wintrust/wintrust.spec | 2 +
2 files changed, 69 insertions(+), 1 deletions(-)
diff --git a/dlls/wintrust/softpub.c b/dlls/wintrust/softpub.c
index f78ed9e..4c8d356 100644
--- a/dlls/wintrust/softpub.c
+++ b/dlls/wintrust/softpub.c
@@ -299,3 +299,71 @@ error:
GetLastError();
return ret ? S_OK : S_FALSE;
}
+
+HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data)
+{
+ BOOL ret;
+ DWORD signerCount, size;
+
+ TRACE("(%p)\n", data);
+
+ if (!data->padwTrustStepErrors)
+ return S_FALSE;
+
+ size = sizeof(signerCount);
+ ret = CryptMsgGetParam(data->hMsg, CMSG_SIGNER_COUNT_PARAM, 0,
+ &signerCount, &size);
+ if (ret)
+ {
+ DWORD i;
+
+ for (i = 0; ret && i < signerCount; i++)
+ {
+ ret = CryptMsgGetParam(data->hMsg, CMSG_SIGNER_CERT_INFO_PARAM,
+ i, NULL, &size);
+ if (ret)
+ {
+ CERT_INFO *certInfo = data->psPfns->pfnAlloc(size);
+
+ if (certInfo)
+ {
+ ret = CryptMsgGetParam(data->hMsg,
+ CMSG_SIGNER_CERT_INFO_PARAM, i, certInfo, &size);
+ if (ret)
+ {
+ CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA para = {
+ sizeof(para), 0, i, CMSG_VERIFY_SIGNER_CERT, NULL };
+
+ para.pvSigner =
+ (LPVOID)CertGetSubjectCertificateFromStore(
+ data->pahStores[0], data->dwEncoding, certInfo);
+ if (para.pvSigner)
+ {
+ ret = CryptMsgControl(data->hMsg, 0,
+ CMSG_CTRL_VERIFY_SIGNATURE_EX, ¶);
+ if (!ret)
+ SetLastError(TRUST_E_CERT_SIGNATURE);
+ }
+ else
+ {
+ SetLastError(TRUST_E_NO_SIGNER_CERT);
+ ret = FALSE;
+ }
+ }
+ data->psPfns->pfnFree(certInfo);
+ }
+ else
+ {
+ SetLastError(ERROR_OUTOFMEMORY);
+ ret = FALSE;
+ }
+ }
+ }
+ }
+ else
+ SetLastError(TRUST_E_NOSIGNATURE);
+ if (!ret)
+ data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] =
+ GetLastError();
+ return ret ? S_OK : S_FALSE;
+}
diff --git a/dlls/wintrust/wintrust.spec b/dlls/wintrust/wintrust.spec
index fe9df8a..ef877b4 100644
--- a/dlls/wintrust/wintrust.spec
+++ b/dlls/wintrust/wintrust.spec
@@ -67,7 +67,7 @@
@ stdcall SoftpubInitialize(ptr)
@ stub SoftpubLoadDefUsageCallData
@ stdcall SoftpubLoadMessage(ptr)
-@ stub SoftpubLoadSignature
+@ stdcall SoftpubLoadSignature(ptr)
@ stub TrustDecode
@ stub TrustFindIssuerCertificate
@ stub TrustFreeDecode
--
1.4.1
More information about the wine-patches
mailing list