cryptui: Add a do-nothing export wizard.

This commit is contained in:
Juan Lang 2009-01-23 09:00:53 -08:00 committed by Alexandre Julliard
parent 787b4bcd52
commit 0cac6977e6
3 changed files with 349 additions and 2 deletions

View File

@ -141,6 +141,11 @@ STRINGTABLE DISCARDABLE
IDS_PURPOSE_CA_EXCHANGE "Private Key Archival" IDS_PURPOSE_CA_EXCHANGE "Private Key Archival"
IDS_PURPOSE_KEY_RECOVERY_AGENT "Key Recovery Agent" IDS_PURPOSE_KEY_RECOVERY_AGENT "Key Recovery Agent"
IDS_PURPOSE_DS_EMAIL_REPLICATION "Directory Service Email Replication" IDS_PURPOSE_DS_EMAIL_REPLICATION "Directory Service Email Replication"
IDS_EXPORT_WIZARD "Certificate Export Wizard"
IDS_EXPORT_FORMAT_TITLE "Export Format"
IDS_EXPORT_FORMAT_SUBTITLE "Choose the format in which the content will be saved."
IDS_EXPORT_FILE_TITLE "Export Filename"
IDS_EXPORT_FILE_SUBTITLE "Specify the name of the file in which the content will be saved."
} }
IDD_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236 IDD_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236
@ -346,3 +351,66 @@ BEGIN
PUSHBUTTON "OK", IDOK, 132,155,51,14, BS_DEFPUSHBUTTON PUSHBUTTON "OK", IDOK, 132,155,51,14, BS_DEFPUSHBUTTON
PUSHBUTTON "Cancel", IDCANCEL, 190,155,51,14 PUSHBUTTON "Cancel", IDCANCEL, 190,155,51,14
END END
IDD_EXPORT_WELCOME DIALOG DISCARDABLE 0,0,317,143
CAPTION "Certificate Export Wizard"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Welcome to the Certificate Export Wizard", IDC_EXPORT_TITLE,
115,1,195,40
LTEXT "This wizard helps you export certificates, certificate revocation lists, and certificate trust lists from a certificate store to a file.",
-1, 115,33,195,16
LTEXT "A certificate can be used to identify you or the computer with which you are communicating. It can also be used for authentication, and to sign messages. Certificate stores are collections of certificates, certificate revocation lists, and certificate trust lists.",
-1, 115,56,195,40
LTEXT "To continue, click Next.",
-1, 115,103,195,8
END
IDD_EXPORT_FORMAT DIALOG DISCARDABLE 0,0,317,143
CAPTION "Certificate Export Wizard"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Select the format you want to use:", -1, 21,1,195,10
AUTORADIOBUTTON "&DER-encoded X.509 (.cer)",
IDC_EXPORT_FORMAT_DER, 31,18,200,12, BS_AUTORADIOBUTTON|WS_TABSTOP
AUTORADIOBUTTON "Ba&se64-encoded X.509 (.cer):",
IDC_EXPORT_FORMAT_BASE64, 31,30,200,12, BS_AUTORADIOBUTTON
AUTORADIOBUTTON "&Cryptographic Message Syntax Standard/PKCS #7 Message (.p7b)",
IDC_EXPORT_FORMAT_CMS, 31,42,200,12, BS_AUTORADIOBUTTON
CHECKBOX "&Include all certificates in the certification path if possible",
IDC_EXPORT_CMS_INCLUDE_CHAIN, 44,57,200,8, BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED
AUTORADIOBUTTON "&Personal Information Exchange/PKCS #12 (.pfx)",
IDC_EXPORT_FORMAT_PFX, 31,72,200,12, BS_AUTORADIOBUTTON
CHECKBOX "Incl&ude all certificates in the certification path if possible",
IDC_EXPORT_PFX_INCLUDE_CHAIN, 44,87,200,8, BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED
CHECKBOX "&Enable strong encryption",
IDC_EXPORT_PFX_STRONG_ENCRYPTION, 44,102,200,8,
BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED
CHECKBOX "Delete the private &key if the export is successful",
IDC_EXPORT_PFX_DELETE_PRIVATE_KEY, 44,117,200,8,
BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED
END
IDD_EXPORT_FILE DIALOG DISCARDABLE 0,0,317,143
CAPTION "Certificate Export Wizard"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&File name:", -1, 21,1,195,10
EDITTEXT IDC_EXPORT_FILENAME, 21,11,208,14, ES_AUTOHSCROLL|WS_TABSTOP
PUSHBUTTON "B&rowse...", IDC_EXPORT_BROWSE_FILE, 236,11,60,14
END
IDD_EXPORT_FINISH DIALOG DISCARDABLE 0,0,317,143
CAPTION "Certificate Export Wizard"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Completing the Certificate Export Wizard", IDC_EXPORT_TITLE,
115,1,195,40
LTEXT "You have successfully completed the Certificate Export Wizard.",
-1, 115,33,195,24
LTEXT "You have specified the following settings:",
-1, 115,57,195,12
CONTROL "", IDC_EXPORT_SETTINGS, "SysListView32",
LVS_REPORT|LVS_NOCOLUMNHEADER|LVS_SINGLESEL|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER,
115,67,174,100
END

View File

@ -140,6 +140,12 @@
#define IDS_PURPOSE_KEY_RECOVERY_AGENT 1124 #define IDS_PURPOSE_KEY_RECOVERY_AGENT 1124
#define IDS_PURPOSE_DS_EMAIL_REPLICATION 1125 #define IDS_PURPOSE_DS_EMAIL_REPLICATION 1125
#define IDS_EXPORT_WIZARD 1200
#define IDS_EXPORT_FORMAT_TITLE 1201
#define IDS_EXPORT_FORMAT_SUBTITLE 1202
#define IDS_EXPORT_FILE_TITLE 1203
#define IDS_EXPORT_FILE_SUBTITLE 1204
#define IDD_GENERAL 100 #define IDD_GENERAL 100
#define IDD_DETAIL 101 #define IDD_DETAIL 101
#define IDD_HIERARCHY 102 #define IDD_HIERARCHY 102
@ -153,6 +159,10 @@
#define IDD_IMPORT_FINISH 110 #define IDD_IMPORT_FINISH 110
#define IDD_CERT_MGR 111 #define IDD_CERT_MGR 111
#define IDD_CERT_MGR_ADVANCED 112 #define IDD_CERT_MGR_ADVANCED 112
#define IDD_EXPORT_WELCOME 113
#define IDD_EXPORT_FORMAT 114
#define IDD_EXPORT_FILE 115
#define IDD_EXPORT_FINISH 116
#define IDB_SMALL_ICONS 200 #define IDB_SMALL_ICONS 200
#define IDB_CERT 201 #define IDB_CERT 201
@ -216,4 +226,17 @@
#define IDC_MGR_PURPOSES 2807 #define IDC_MGR_PURPOSES 2807
#define IDC_MGR_VIEW 2808 #define IDC_MGR_VIEW 2808
#define IDC_EXPORT_TITLE 2900
#define IDC_EXPORT_FORMAT_DER 2901
#define IDC_EXPORT_FORMAT_BASE64 2902
#define IDC_EXPORT_FORMAT_CMS 2903
#define IDC_EXPORT_FORMAT_PFX 2904
#define IDC_EXPORT_CMS_INCLUDE_CHAIN 2905
#define IDC_EXPORT_PFX_INCLUDE_CHAIN 2906
#define IDC_EXPORT_PFX_STRONG_ENCRYPTION 2907
#define IDC_EXPORT_PFX_DELETE_PRIVATE_KEY 2908
#define IDC_EXPORT_FILENAME 2909
#define IDC_EXPORT_BROWSE_FILE 2910
#define IDC_EXPORT_SETTINGS 2911
#endif /* ndef __CRYPTUIRES_H_ */ #endif /* ndef __CRYPTUIRES_H_ */

View File

@ -5436,10 +5436,266 @@ BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardT
return ret; return ret;
} }
struct ExportWizData
{
HFONT titleFont;
DWORD dwFlags;
LPCWSTR pwszWizardTitle;
PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo;
void *pvoid;
};
static LRESULT CALLBACK export_welcome_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
LPARAM lp)
{
LRESULT ret = 0;
switch (msg)
{
case WM_INITDIALOG:
{
struct ExportWizData *data;
PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp;
WCHAR fontFace[MAX_STRING_LEN];
HDC hDC = GetDC(hwnd);
int height;
data = (struct ExportWizData *)page->lParam;
LoadStringW(hInstance, IDS_WIZARD_TITLE_FONT, fontFace,
sizeof(fontFace) / sizeof(fontFace[0]));
height = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);
data->titleFont = CreateFontW(height, 0, 0, 0, FW_BOLD, 0, 0, 0,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontFace);
SendMessageW(GetDlgItem(hwnd, IDC_EXPORT_TITLE), WM_SETFONT,
(WPARAM)data->titleFont, TRUE);
ReleaseDC(hwnd, hDC);
break;
}
case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lp;
switch (hdr->code)
{
case PSN_SETACTIVE:
PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0, PSWIZB_NEXT);
ret = TRUE;
break;
}
break;
}
}
return ret;
}
static LRESULT CALLBACK export_format_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
LPARAM lp)
{
LRESULT ret = 0;
struct ExportWizData *data;
switch (msg)
{
case WM_INITDIALOG:
{
PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp;
data = (struct ExportWizData *)page->lParam;
SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
SendMessageW(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_DER), BM_CLICK, 0, 0);
break;
}
case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lp;
switch (hdr->code)
{
case PSN_SETACTIVE:
PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0,
PSWIZB_BACK | PSWIZB_NEXT);
ret = TRUE;
break;
}
break;
}
}
return ret;
}
static LRESULT CALLBACK export_file_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
LPARAM lp)
{
LRESULT ret = 0;
struct ExportWizData *data;
switch (msg)
{
case WM_INITDIALOG:
{
PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp;
data = (struct ExportWizData *)page->lParam;
SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
break;
}
case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lp;
switch (hdr->code)
{
case PSN_SETACTIVE:
PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0,
PSWIZB_BACK | PSWIZB_NEXT);
ret = TRUE;
break;
}
break;
}
}
return ret;
}
static LRESULT CALLBACK export_finish_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
LPARAM lp)
{
LRESULT ret = 0;
struct ExportWizData *data;
switch (msg)
{
case WM_INITDIALOG:
{
PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp;
HWND lv = GetDlgItem(hwnd, IDC_EXPORT_SETTINGS);
RECT rc;
LVCOLUMNW column;
data = (struct ExportWizData *)page->lParam;
SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
SendMessageW(GetDlgItem(hwnd, IDC_EXPORT_TITLE), WM_SETFONT,
(WPARAM)data->titleFont, TRUE);
GetWindowRect(lv, &rc);
column.mask = LVCF_WIDTH;
column.cx = (rc.right - rc.left) / 2 - 2;
SendMessageW(lv, LVM_INSERTCOLUMNW, 0, (LPARAM)&column);
SendMessageW(lv, LVM_INSERTCOLUMNW, 1, (LPARAM)&column);
break;
}
case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lp;
switch (hdr->code)
{
case PSN_SETACTIVE:
{
HWND lv = GetDlgItem(hwnd, IDC_EXPORT_SETTINGS);
data = (struct ExportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER);
SendMessageW(lv, LVM_DELETEALLITEMS, 0, 0);
PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0,
PSWIZB_BACK | PSWIZB_FINISH);
ret = TRUE;
break;
}
}
break;
}
}
return ret;
}
static BOOL show_export_ui(DWORD dwFlags, HWND hwndParent,
LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, void *pvoid)
{
PROPSHEETHEADERW hdr;
PROPSHEETPAGEW pages[4];
struct ExportWizData data;
int nPages = 0;
data.dwFlags = dwFlags;
data.pwszWizardTitle = pwszWizardTitle;
data.pExportInfo = pExportInfo;
data.pvoid = pvoid;
memset(&pages, 0, sizeof(pages));
pages[nPages].dwSize = sizeof(pages[0]);
pages[nPages].hInstance = hInstance;
pages[nPages].u.pszTemplate = MAKEINTRESOURCEW(IDD_EXPORT_WELCOME);
pages[nPages].pfnDlgProc = export_welcome_dlg_proc;
pages[nPages].dwFlags = PSP_HIDEHEADER;
pages[nPages].lParam = (LPARAM)&data;
nPages++;
pages[nPages].dwSize = sizeof(pages[0]);
pages[nPages].hInstance = hInstance;
pages[nPages].u.pszTemplate = MAKEINTRESOURCEW(IDD_EXPORT_FORMAT);
pages[nPages].pfnDlgProc = export_format_dlg_proc;
pages[nPages].dwFlags = PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
pages[nPages].pszHeaderTitle =
MAKEINTRESOURCEW(IDS_EXPORT_FORMAT_TITLE);
pages[nPages].pszHeaderSubTitle =
MAKEINTRESOURCEW(IDS_EXPORT_FORMAT_SUBTITLE);
pages[nPages].lParam = (LPARAM)&data;
nPages++;
pages[nPages].dwSize = sizeof(pages[0]);
pages[nPages].hInstance = hInstance;
pages[nPages].u.pszTemplate = MAKEINTRESOURCEW(IDD_EXPORT_FILE);
pages[nPages].pfnDlgProc = export_file_dlg_proc;
pages[nPages].dwFlags = PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
pages[nPages].pszHeaderTitle = MAKEINTRESOURCEW(IDS_EXPORT_FILE_TITLE);
pages[nPages].pszHeaderSubTitle =
MAKEINTRESOURCEW(IDS_EXPORT_FILE_SUBTITLE);
pages[nPages].lParam = (LPARAM)&data;
nPages++;
pages[nPages].dwSize = sizeof(pages[0]);
pages[nPages].hInstance = hInstance;
pages[nPages].u.pszTemplate = MAKEINTRESOURCEW(IDD_EXPORT_FINISH);
pages[nPages].pfnDlgProc = export_finish_dlg_proc;
pages[nPages].dwFlags = PSP_HIDEHEADER;
pages[nPages].lParam = (LPARAM)&data;
nPages++;
memset(&hdr, 0, sizeof(hdr));
hdr.dwSize = sizeof(hdr);
hdr.hwndParent = hwndParent;
hdr.dwFlags = PSH_PROPSHEETPAGE | PSH_WIZARD97_NEW | PSH_HEADER |
PSH_WATERMARK;
hdr.hInstance = hInstance;
if (pwszWizardTitle)
hdr.pszCaption = pwszWizardTitle;
else
hdr.pszCaption = MAKEINTRESOURCEW(IDS_EXPORT_WIZARD);
hdr.u3.ppsp = pages;
hdr.nPages = nPages;
hdr.u4.pszbmWatermark = MAKEINTRESOURCEW(IDB_CERT_WATERMARK);
hdr.u5.pszbmHeader = MAKEINTRESOURCEW(IDB_CERT_HEADER);
PropertySheetW(&hdr);
DeleteObject(data.titleFont);
return FALSE;
}
BOOL WINAPI CryptUIWizExport(DWORD dwFlags, HWND hwndParent, BOOL WINAPI CryptUIWizExport(DWORD dwFlags, HWND hwndParent,
LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, void *pvoid) LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, void *pvoid)
{ {
FIXME("(%08x, %p, %s, %p, %p): stub\n", dwFlags, hwndParent, BOOL ret;
TRACE("(%08x, %p, %s, %p, %p)\n", dwFlags, hwndParent,
debugstr_w(pwszWizardTitle), pExportInfo, pvoid); debugstr_w(pwszWizardTitle), pExportInfo, pvoid);
return FALSE;
if (!(dwFlags & CRYPTUI_WIZ_NO_UI))
ret = show_export_ui(dwFlags, hwndParent, pwszWizardTitle, pExportInfo,
pvoid);
else
{
FIXME("stub\n");
ret = FALSE;
}
return ret;
} }