From e958485fe2ae05c6c5c7867a6e31c5e3578b2136 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Wed, 17 Dec 2008 08:59:06 -0800 Subject: [PATCH] cryptui: Add a (empty) hierarchy page to the cert properties dialog. --- dlls/cryptui/cryptui_En.rc | 14 +++++++ dlls/cryptui/cryptuires.h | 6 +++ dlls/cryptui/main.c | 79 +++++++++++++++++++++++++++++++++++++- 3 files changed, 98 insertions(+), 1 deletion(-) diff --git a/dlls/cryptui/cryptui_En.rc b/dlls/cryptui/cryptui_En.rc index f0462c2d759..af1725eea82 100644 --- a/dlls/cryptui/cryptui_En.rc +++ b/dlls/cryptui/cryptui_En.rc @@ -118,6 +118,20 @@ BEGIN PUSHBUTTON "&Copy to File...", IDC_EXPORT,177,216,70,14 END +IDD_HIERARCHY DIALOG DISCARDABLE 0, 0, 255, 236 +CAPTION "Certification Path" +STYLE WS_VISIBLE +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Certification &path", grp1,6,10,245,165, BS_GROUPBOX + CONTROL "",IDC_CERTPATH, "SysTreeView32", TVS_HASLINES|WS_BORDER, + 13,22,231,130 + PUSHBUTTON "&View Certificate", IDC_VIEWCERTIFICATE,175,156,70,14 + LTEXT "Certificate &status:", IDC_CERTIFICATESTATUS,6,183,70,14 + CONTROL "", IDC_CERTIFICATESTATUSTEXT,"RichEdit20W", + WS_BORDER|ES_READONLY|ES_MULTILINE|WS_DISABLED,6,195,245,36 +END + IDD_USERNOTICE DIALOG DISCARDABLE 0, 0, 255, 256 CAPTION "Disclaimer" STYLE WS_VISIBLE diff --git a/dlls/cryptui/cryptuires.h b/dlls/cryptui/cryptuires.h index 08155106b86..e853141e53f 100644 --- a/dlls/cryptui/cryptuires.h +++ b/dlls/cryptui/cryptuires.h @@ -80,6 +80,7 @@ #define IDD_GENERAL 100 #define IDD_DETAIL 101 +#define IDD_HIERARCHY 102 #define IDD_USERNOTICE 103 #define IDB_CERT 201 @@ -101,6 +102,11 @@ #define IDC_EDITPROPERTIES 2103 #define IDC_EXPORT 2104 +#define IDC_VIEWCERTIFICATE 2200 +#define IDC_CERTPATH 2201 +#define IDC_CERTIFICATESTATUS 2202 +#define IDC_CERTIFICATESTATUSTEXT 2203 + #define IDC_USERNOTICE 2300 #define IDC_CPS 2301 diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c index 4f32726d363..9d44009df67 100644 --- a/dlls/cryptui/main.c +++ b/dlls/cryptui/main.c @@ -1741,6 +1741,78 @@ static BOOL init_detail_page(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, return ret; } +struct hierarchy_data +{ + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo; + DWORD selectedCert; +}; + +static void show_cert_hierarchy(HWND hwnd, struct hierarchy_data *data) +{ + /* Disable view certificate button until a certificate is selected */ + EnableWindow(GetDlgItem(hwnd, IDC_VIEWCERTIFICATE), FALSE); + FIXME("show cert chain\n"); +} + +static LRESULT CALLBACK hierarchy_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, + LPARAM lp) +{ + PROPSHEETPAGEW *page; + struct hierarchy_data *data; + + TRACE("(%p, %08x, %08lx, %08lx)\n", hwnd, msg, wp, lp); + + switch (msg) + { + case WM_INITDIALOG: + page = (PROPSHEETPAGEW *)lp; + data = (struct hierarchy_data *)page->lParam; + show_cert_hierarchy(hwnd, data); + break; + } + return 0; +} + +static UINT CALLBACK hierarchy_callback(HWND hwnd, UINT msg, + PROPSHEETPAGEW *page) +{ + struct hierarchy_data *data; + + switch (msg) + { + case PSPCB_RELEASE: + data = (struct hierarchy_data *)page->lParam; + HeapFree(GetProcessHeap(), 0, data); + break; + } + return 0; +} + +static BOOL init_hierarchy_page(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, + PROPSHEETPAGEW *page) +{ + struct hierarchy_data *data = HeapAlloc(GetProcessHeap(), 0, + sizeof(struct hierarchy_data)); + BOOL ret = FALSE; + + if (data) + { + data->pCertViewInfo = pCertViewInfo; + data->selectedCert = 0xffffffff; + + memset(page, 0, sizeof(PROPSHEETPAGEW)); + page->dwSize = sizeof(PROPSHEETPAGEW); + page->dwFlags = PSP_USECALLBACK; + page->hInstance = hInstance; + page->u.pszTemplate = MAKEINTRESOURCEW(IDD_HIERARCHY); + page->pfnDlgProc = hierarchy_dlg_proc; + page->lParam = (LPARAM)data; + page->pfnCallback = hierarchy_callback; + ret = TRUE; + } + return ret; +} + static int CALLBACK cert_prop_sheet_proc(HWND hwnd, UINT msg, LPARAM lp) { RECT rc; @@ -1782,7 +1854,7 @@ static BOOL show_cert_dialog(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, if (!(pCertViewInfo->dwFlags & CRYPTUI_HIDE_DETAILPAGE)) nPages++; if (!(pCertViewInfo->dwFlags & CRYPTUI_HIDE_HIERARCHYPAGE)) - FIXME("show hierarchy page\n"); + nPages++; pages = HeapAlloc(GetProcessHeap(), 0, nPages * sizeof(PROPSHEETPAGEW)); if (pages) { @@ -1805,6 +1877,11 @@ static BOOL show_cert_dialog(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, &pages[hdr.nPages])) hdr.nPages++; } + if (!(pCertViewInfo->dwFlags & CRYPTUI_HIDE_HIERARCHYPAGE)) + { + if (init_hierarchy_page(pCertViewInfo, &pages[hdr.nPages])) + hdr.nPages++; + } /* Copy each additional page, and create the init dialog struct for it */ if (pCertViewInfo->cPropSheetPages)