From 8f7e9eee937435fa3f606670dadf1f4853a81bc2 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Sat, 20 Dec 2008 12:43:13 -0800 Subject: [PATCH] cryptui: Make sure a store is selected when the user click OK in the select store dialog. --- dlls/cryptui/cryptui_En.rc | 2 ++ dlls/cryptui/cryptuires.h | 2 ++ dlls/cryptui/main.c | 36 ++++++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/dlls/cryptui/cryptui_En.rc b/dlls/cryptui/cryptui_En.rc index a101ad2d9f0..7ad889e84fc 100644 --- a/dlls/cryptui/cryptui_En.rc +++ b/dlls/cryptui/cryptui_En.rc @@ -61,6 +61,8 @@ STRINGTABLE DISCARDABLE IDS_CERTIFICATE_PROPERTIES "Certificate Properties" IDS_CERTIFICATE_PURPOSE_ERROR "Please enter an OID in the form 1.2.3.4" IDS_CERTIFICATE_PURPOSE_EXISTS "The OID you entered already exists." + IDS_SELECT_STORE_TITLE "Select Certificate Store" + IDS_SELECT_STORE "Please select a certificate store." 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 03765119f63..25dcb8a3caa 100644 --- a/dlls/cryptui/cryptuires.h +++ b/dlls/cryptui/cryptuires.h @@ -58,6 +58,8 @@ #define IDS_CERTIFICATE_PROPERTIES 1038 #define IDS_CERTIFICATE_PURPOSE_ERROR 1039 #define IDS_CERTIFICATE_PURPOSE_EXISTS 1040 +#define IDS_SELECT_STORE_TITLE 1041 +#define IDS_SELECT_STORE 1042 #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 dc2984225e8..8970c7dcb35 100644 --- a/dlls/cryptui/main.c +++ b/dlls/cryptui/main.c @@ -248,6 +248,8 @@ static void free_store_info(HWND tree) } } +#define MAX_STRING_LEN 512 + static LRESULT CALLBACK select_store_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { @@ -274,10 +276,38 @@ static LRESULT CALLBACK select_store_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, switch (wp) { case IDOK: - free_store_info(GetDlgItem(hwnd, IDC_STORE_LIST)); - EndDialog(hwnd, IDOK); + { + HWND tree = GetDlgItem(hwnd, IDC_STORE_LIST); + HTREEITEM selection = (HTREEITEM)SendMessageW(tree, + TVM_GETNEXTITEM, TVGN_CARET, (LPARAM)NULL); + + info = (PCRYPTUI_SELECTSTORE_INFO_W)GetWindowLongPtrW(hwnd, + DWLP_USER); + if (!selection) + { + WCHAR title[MAX_STRING_LEN], error[MAX_STRING_LEN], *pTitle; + + if (info->pwszTitle) + pTitle = info->pwszTitle; + else + { + LoadStringW(hInstance, IDS_SELECT_STORE_TITLE, title, + sizeof(title) / sizeof(title[0])); + pTitle = title; + } + LoadStringW(hInstance, IDS_SELECT_STORE, error, + sizeof(error) / sizeof(error[0])); + MessageBoxW(hwnd, error, pTitle, MB_ICONEXCLAMATION | MB_OK); + } + else + { + /* FIXME: convert selection to store and return it */ + free_store_info(tree); + EndDialog(hwnd, IDOK); + } ret = TRUE; break; + } case IDCANCEL: free_store_info(GetDlgItem(hwnd, IDC_STORE_LIST)); EndDialog(hwnd, IDCANCEL); @@ -580,8 +610,6 @@ static void add_oid_text_to_control(HWND hwnd, char *oid) } } -#define MAX_STRING_LEN 512 - struct OIDToString { LPCSTR oid; -- 2.11.4.GIT