From 0ff7bf13f68a3506c1b4c23ecbca327501b0a88c Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 22 Sep 2008 13:07:38 -0700 Subject: [PATCH] cryptdlg: Implement CertViewPropertiesW on top of CryptUIDlgViewCertificateW. --- dlls/cryptdlg/Makefile.in | 2 +- dlls/cryptdlg/main.c | 58 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/dlls/cryptdlg/Makefile.in b/dlls/cryptdlg/Makefile.in index bb06a0bbe3d..a883c275996 100644 --- a/dlls/cryptdlg/Makefile.in +++ b/dlls/cryptdlg/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = cryptdlg.dll -IMPORTS = crypt32 wintrust kernel32 +IMPORTS = cryptui crypt32 wintrust kernel32 C_SRCS = \ main.c diff --git a/dlls/cryptdlg/main.c b/dlls/cryptdlg/main.c index 943794a30e2..36f2a1b7087 100644 --- a/dlls/cryptdlg/main.c +++ b/dlls/cryptdlg/main.c @@ -27,6 +27,7 @@ #include "wintrust.h" #include "winuser.h" #include "cryptdlg.h" +#include "cryptuiapi.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(cryptdlg); @@ -145,8 +146,61 @@ error: */ BOOL WINAPI CertViewPropertiesW(CERT_VIEWPROPERTIES_STRUCT_W *info) { - FIXME("(%p): stub\n", info); - return FALSE; + static GUID cert_action_verify = CERT_CERTIFICATE_ACTION_VERIFY; + CERT_VERIFY_CERTIFICATE_TRUST trust; + WINTRUST_BLOB_INFO blob; + WINTRUST_DATA wtd; + LONG err; + BOOL ret; + + TRACE("(%p)\n", info); + + memset(&trust, 0, sizeof(trust)); + trust.cbSize = sizeof(trust); + trust.pccert = info->pCertContext; + trust.cRootStores = info->cRootStores; + trust.rghstoreRoots = info->rghstoreRoots; + trust.cStores = info->cStores; + trust.rghstoreCAs = info->rghstoreCAs; + trust.cTrustStores = info->cTrustStores; + trust.rghstoreTrust = info->rghstoreTrust; + memset(&blob, 0, sizeof(blob)); + blob.cbStruct = sizeof(blob); + blob.cbMemObject = sizeof(trust); + blob.pbMemObject = (BYTE *)&trust; + memset(&wtd, 0, sizeof(wtd)); + wtd.cbStruct = sizeof(wtd); + wtd.dwUIChoice = WTD_UI_NONE; + wtd.dwUnionChoice = WTD_CHOICE_BLOB; + wtd.pBlob = &blob; + wtd.dwStateAction = WTD_STATEACTION_VERIFY; + err = WinVerifyTrust(NULL, &cert_action_verify, &wtd); + if (err == ERROR_SUCCESS) + { + CRYPTUI_VIEWCERTIFICATE_STRUCTW uiInfo; + BOOL propsChanged = FALSE; + + memset(&uiInfo, 0, sizeof(uiInfo)); + uiInfo.dwSize = sizeof(uiInfo); + uiInfo.hwndParent = info->hwndParent; + uiInfo.dwFlags = + CRYPTUI_DISABLE_ADDTOSTORE | CRYPTUI_ENABLE_EDITPROPERTIES; + uiInfo.szTitle = info->szTitle; + uiInfo.pCertContext = info->pCertContext; + uiInfo.cPurposes = info->cArrayPurposes; + uiInfo.rgszPurposes = (LPCSTR *)info->arrayPurposes; + uiInfo.hWVTStateData = wtd.hWVTStateData; + uiInfo.fpCryptProviderDataTrustedUsage = TRUE; + uiInfo.cPropSheetPages = info->cArrayPropSheetPages; + uiInfo.rgPropSheetPages = info->arrayPropSheetPages; + uiInfo.nStartPage = info->nStartPage; + ret = CryptUIDlgViewCertificateW(&uiInfo, &propsChanged); + wtd.dwStateAction = WTD_STATEACTION_CLOSE; + WinVerifyTrust(NULL, &cert_action_verify, &wtd); + } + else + ret = FALSE; + return ret; } /***********************************************************************