From 96d0e63620c6f4051e451c994aa65ddf48f4ac82 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Wed, 7 Jan 2009 16:16:42 -0800 Subject: [PATCH] cryptui: Add purpose selection and column headings to certificate manager dialog. --- dlls/cryptui/cryptui_En.rc | 6 +++++ dlls/cryptui/cryptuires.h | 6 +++++ dlls/cryptui/main.c | 48 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/dlls/cryptui/cryptui_En.rc b/dlls/cryptui/cryptui_En.rc index 251bf01deb3..49096abafa1 100644 --- a/dlls/cryptui/cryptui_En.rc +++ b/dlls/cryptui/cryptui_En.rc @@ -94,6 +94,12 @@ STRINGTABLE DISCARDABLE IDS_IMPORT_SUCCEEDED "The import was successful." IDS_IMPORT_FAILED "The import failed." IDS_WIZARD_TITLE_FONT "Arial" + IDS_PURPOSE_ALL "" + IDS_PURPOSE_ADVANCED "" + IDS_SUBJECT_COLUMN "Issued To" + IDS_ISSUER_COLUMN "Issued By" + IDS_EXPIRATION_COLUMN "Expiration Date" + IDS_FRIENDLY_NAME_COLUMN "Friendly Name" IDS_PURPOSE_SERVER_AUTH "Ensures the identify of a remote computer" IDS_PURPOSE_CLIENT_AUTH "Proves your identity to a remote computer" IDS_PURPOSE_CODE_SIGNING "Ensures software came from software publisher\nProtects software from alteration after publication" diff --git a/dlls/cryptui/cryptuires.h b/dlls/cryptui/cryptuires.h index 6799d544795..f6127c278c5 100644 --- a/dlls/cryptui/cryptuires.h +++ b/dlls/cryptui/cryptuires.h @@ -91,6 +91,12 @@ #define IDS_IMPORT_SUCCEEDED 1071 #define IDS_IMPORT_FAILED 1072 #define IDS_WIZARD_TITLE_FONT 1073 +#define IDS_PURPOSE_ALL 1074 +#define IDS_PURPOSE_ADVANCED 1075 +#define IDS_SUBJECT_COLUMN 1076 +#define IDS_ISSUER_COLUMN 1077 +#define IDS_EXPIRATION_COLUMN 1078 +#define IDS_FRIENDLY_NAME_COLUMN 1079 #define IDS_PURPOSE_SERVER_AUTH 1100 #define IDS_PURPOSE_CLIENT_AUTH 1101 diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c index 1a48c6fa9c5..acf438bb2a6 100644 --- a/dlls/cryptui/main.c +++ b/dlls/cryptui/main.c @@ -65,6 +65,50 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } +#define MAX_STRING_LEN 512 + +static void add_cert_columns(HWND hwnd) +{ + HWND lv = GetDlgItem(hwnd, IDC_MGR_CERTS); + RECT rc; + WCHAR buf[MAX_STRING_LEN]; + LVCOLUMNW column; + + SendMessageW(lv, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); + GetWindowRect(lv, &rc); + LoadStringW(hInstance, IDS_SUBJECT_COLUMN, buf, + sizeof(buf) / sizeof(buf[0])); + column.mask = LVCF_WIDTH | LVCF_TEXT; + column.cx = (rc.right - rc.left) * 29 / 100 - 2; + column.pszText = buf; + SendMessageW(lv, LVM_INSERTCOLUMNW, 0, (LPARAM)&column); + LoadStringW(hInstance, IDS_ISSUER_COLUMN, buf, + sizeof(buf) / sizeof(buf[0])); + SendMessageW(lv, LVM_INSERTCOLUMNW, 1, (LPARAM)&column); + column.cx = (rc.right - rc.left) * 16 / 100 - 2; + LoadStringW(hInstance, IDS_EXPIRATION_COLUMN, buf, + sizeof(buf) / sizeof(buf[0])); + SendMessageW(lv, LVM_INSERTCOLUMNW, 2, (LPARAM)&column); + column.cx = (rc.right - rc.left) * 23 / 100 - 1; + LoadStringW(hInstance, IDS_FRIENDLY_NAME_COLUMN, buf, + sizeof(buf) / sizeof(buf[0])); + SendMessageW(lv, LVM_INSERTCOLUMNW, 3, (LPARAM)&column); +} + +static void initialize_purpose_selection(HWND hwnd) +{ + HWND cb = GetDlgItem(hwnd, IDC_MGR_PURPOSE_SELECTION); + WCHAR buf[MAX_STRING_LEN]; + + LoadStringW(hInstance, IDS_PURPOSE_ALL, buf, + sizeof(buf) / sizeof(buf[0])); + SendMessageW(cb, CB_INSERTSTRING, -1, (LPARAM)buf); + LoadStringW(hInstance, IDS_PURPOSE_ADVANCED, buf, + sizeof(buf) / sizeof(buf[0])); + SendMessageW(cb, CB_INSERTSTRING, -1, (LPARAM)buf); + SendMessageW(cb, CB_SETCURSEL, 0, 0); +} + static LRESULT CALLBACK cert_mgr_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { @@ -75,6 +119,8 @@ static LRESULT CALLBACK cert_mgr_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, PCCRYPTUI_CERT_MGR_STRUCT pCryptUICertMgr = (PCCRYPTUI_CERT_MGR_STRUCT)lp; + initialize_purpose_selection(hwnd); + add_cert_columns(hwnd); if (pCryptUICertMgr->pwszTitle) SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)pCryptUICertMgr->pwszTitle); @@ -285,8 +331,6 @@ static void free_store_info(HWND tree) } } -#define MAX_STRING_LEN 512 - static HCERTSTORE selected_item_to_store(HWND tree, HTREEITEM hItem) { WCHAR buf[MAX_STRING_LEN];