cryptui: Add purpose selection and column headings to certificate manager dialog.

This commit is contained in:
Juan Lang 2009-01-07 16:16:42 -08:00 committed by Alexandre Julliard
parent 1f183ea289
commit 96d0e63620
3 changed files with 58 additions and 2 deletions

View file

@ -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 "<All>"
IDS_PURPOSE_ADVANCED "<Advanced Purposes>"
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"

View file

@ -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

View file

@ -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];