Commit 9169e6ed authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

cryptui: Make sure input file is not empty.

parent dbab34e8
......@@ -76,6 +76,7 @@ STRINGTABLE DISCARDABLE
IDS_IMPORT_FILTER_SERIALIZED_STORE "Microsoft Serialized Certificate Store (*.sst)"
IDS_IMPORT_FILTER_CMS "CMS/PKCS #7 Messages (*.spc; *.p7b)"
IDS_IMPORT_FILTER_ALL "All Files (*.*)"
IDS_IMPORT_EMPTY_FILE "Please select a file."
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"
......
......@@ -73,6 +73,7 @@
#define IDS_IMPORT_FILTER_SERIALIZED_STORE 1053
#define IDS_IMPORT_FILTER_CMS 1054
#define IDS_IMPORT_FILTER_ALL 1055
#define IDS_IMPORT_EMPTY_FILE 1056
#define IDS_PURPOSE_SERVER_AUTH 1100
#define IDS_PURPOSE_CLIENT_AUTH 1101
......
......@@ -3529,7 +3529,8 @@ static BOOL check_context_type(DWORD dwFlags, DWORD type)
}
static void import_warn_type_mismatch(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle)
static void import_warning(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle,
int warningID)
{
if (!(dwFlags & CRYPTUI_WIZ_NO_UI))
{
......@@ -3544,12 +3545,17 @@ static void import_warn_type_mismatch(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle)
sizeof(title) / sizeof(title[0]));
pTitle = title;
}
LoadStringW(hInstance, IDS_IMPORT_TYPE_MISMATCH, error,
LoadStringW(hInstance, warningID, error,
sizeof(error) / sizeof(error[0]));
MessageBoxW(hwnd, error, pTitle, MB_ICONERROR | MB_OK);
}
}
static void import_warn_type_mismatch(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle)
{
import_warning(dwFlags, hwnd, szTitle, IDS_IMPORT_TYPE_MISMATCH);
}
static BOOL check_store_context_type(DWORD dwFlags, HCERTSTORE store)
{
BOOL ret;
......@@ -3765,6 +3771,7 @@ static WCHAR *make_import_file_filter(DWORD dwFlags)
struct ImportWizData
{
DWORD dwFlags;
LPCWSTR pwszWizardTitle;
PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc;
HCERTSTORE hDestCertStore;
};
......@@ -3796,6 +3803,30 @@ static LRESULT CALLBACK import_file_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
PSWIZB_BACK | PSWIZB_NEXT);
ret = TRUE;
break;
case PSN_WIZNEXT:
{
HWND fileNameEdit = GetDlgItem(hwnd, IDC_IMPORT_FILENAME);
DWORD len = SendMessageW(fileNameEdit, WM_GETTEXTLENGTH, 0, 0);
data = (struct ImportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER);
if (!len)
{
import_warning(data->dwFlags, hwnd, data->pwszWizardTitle,
IDS_IMPORT_EMPTY_FILE);
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, 1);
ret = 1;
}
else
{
LPWSTR fileName = HeapAlloc(GetProcessHeap(), 0,
(len + 1) * sizeof(WCHAR));
SendMessageW(fileNameEdit, WM_GETTEXT, len + 1,
(LPARAM)fileName);
FIXME("validate %s\n", debugstr_w(fileName));
}
break;
}
}
break;
}
......@@ -3883,7 +3914,8 @@ static BOOL show_import_ui(DWORD dwFlags, HWND hwndParent,
{
PROPSHEETHEADERW hdr;
PROPSHEETPAGEW pages[4];
struct ImportWizData data = { dwFlags, pImportSrc, hDestCertStore };
struct ImportWizData data = { dwFlags, pwszWizardTitle, pImportSrc,
hDestCertStore };
FIXME("\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment