cryptui: Make sure a store is selected when the user click OK in the select store dialog.
This commit is contained in:
parent
f3d0739916
commit
8f7e9eee93
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue