Module: wine Branch: master Commit: 92de4384690fd86f2b7951d5c3e5a9850ac85fca URL: http://source.winehq.org/git/wine.git/?a=commit;h=92de4384690fd86f2b7951d5c3...
Author: Juan Lang juan.lang@gmail.com Date: Mon Aug 27 16:18:50 2007 -0700
wintrust: 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