From: Alex Henrie alexhenrie24@gmail.com
Match the behavior on Windows: When the CryptUIWizImport function is called, the "Certificate store" textbox initially says "Determined by the program" instead of having the specific name of the store passed to the function. When the user clicks Browse to select a store, the stores are listed by localized name. After clicking OK, the selected store's localized name is copied into the textbox.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58057 --- dlls/cryptui/main.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c index cbbef5b6905..fcc570048ad 100644 --- a/dlls/cryptui/main.c +++ b/dlls/cryptui/main.c @@ -1449,17 +1449,18 @@ static void free_store_info(HWND tree) } }
+static WCHAR selected_store_title[MAX_STRING_LEN]; + static HCERTSTORE selected_item_to_store(HWND tree, HTREEITEM hItem) { - WCHAR buf[MAX_STRING_LEN]; TVITEMW item; HCERTSTORE store;
memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT; item.hItem = hItem; - item.cchTextMax = ARRAY_SIZE(buf); - item.pszText = buf; + item.cchTextMax = ARRAY_SIZE(selected_store_title); + item.pszText = selected_store_title; SendMessageW(tree, TVM_GETITEMW, 0, (LPARAM)&item); if (item.lParam) { @@ -1473,7 +1474,7 @@ static HCERTSTORE selected_item_to_store(HWND tree, HTREEITEM hItem) else { /* It's implicitly a system store */ - store = CertOpenSystemStoreW(0, buf); + store = CertOpenSystemStoreW(0, selected_store_title); } return store; } @@ -5067,17 +5068,14 @@ static INT_PTR CALLBACK import_store_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, } else { - WCHAR storeTitle[MAX_STRING_LEN]; - SendMessageW(GetDlgItem(hwnd, IDC_IMPORT_SPECIFY_STORE), BM_CLICK, 0, 0); EnableWindow(GetDlgItem(hwnd, IDC_IMPORT_STORE), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_IMPORT_BROWSE_STORE), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_IMPORT_SPECIFY_STORE), !(data->dwFlags & CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE)); - LoadStringW(hInstance, IDS_IMPORT_DEST_DETERMINED, storeTitle, ARRAY_SIZE(storeTitle)); - SendMessageW(GetDlgItem(hwnd, IDC_IMPORT_STORE), WM_SETTEXT, - 0, (LPARAM)storeTitle); + LoadStringW(hInstance, IDS_IMPORT_DEST_DETERMINED, selected_store_title, ARRAY_SIZE(selected_store_title)); + SendMessageW(GetDlgItem(hwnd, IDC_IMPORT_STORE), WM_SETTEXT, 0, (LPARAM)selected_store_title); } break; } @@ -5141,12 +5139,7 @@ static INT_PTR CALLBACK import_store_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, selectInfo.pfnSelectedStoreCallback = NULL; if ((store = CryptUIDlgSelectStoreW(&selectInfo))) { - WCHAR storeTitle[MAX_STRING_LEN]; - - LoadStringW(hInstance, IDS_IMPORT_DEST_DETERMINED, storeTitle, - ARRAY_SIZE(storeTitle)); - SendMessageW(GetDlgItem(hwnd, IDC_IMPORT_STORE), WM_SETTEXT, - 0, (LPARAM)storeTitle); + SendMessageW(GetDlgItem(hwnd, IDC_IMPORT_STORE), WM_SETTEXT, 0, (LPARAM)selected_store_title); data->hDestCertStore = store; data->freeDest = TRUE; } @@ -5174,11 +5167,12 @@ static void show_import_details(HWND lv, struct ImportWizData *data) if (data->autoDest) LoadStringW(hInstance, IDS_IMPORT_DEST_AUTOMATIC, text, ARRAY_SIZE(text)); else - LoadStringW(hInstance, IDS_IMPORT_DEST_DETERMINED, text, ARRAY_SIZE(text)); + item.pszText = selected_store_title; SendMessageW(lv, LVM_SETITEMTEXTW, item.iItem, (LPARAM)&item); item.iItem = SendMessageW(lv, LVM_GETITEMCOUNT, 0, 0); item.iSubItem = 0; LoadStringW(hInstance, IDS_IMPORT_CONTENT, text, ARRAY_SIZE(text)); + item.pszText = text; SendMessageW(lv, LVM_INSERTITEMW, 0, (LPARAM)&item); switch (data->contentType) {