Juan Lang : cryptui: Add a non-operational wizard for CryptUIWizImport.

Alexandre Julliard julliard at winehq.org
Tue Dec 23 13:41:19 CST 2008


Module: wine
Branch: master
Commit: b55b4a0cf7e4f139e11e9bb49a4824a56613ef12
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b55b4a0cf7e4f139e11e9bb49a4824a56613ef12

Author: Juan Lang <juan.lang at gmail.com>
Date:   Mon Dec 22 19:07:51 2008 -0800

cryptui: Add a non-operational wizard for CryptUIWizImport.

---

 dlls/cryptui/cryptui_En.rc |   60 +++++++++++++++++
 dlls/cryptui/cryptuires.h  |   17 +++++
 dlls/cryptui/main.c        |  157 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 0 deletions(-)

diff --git a/dlls/cryptui/cryptui_En.rc b/dlls/cryptui/cryptui_En.rc
index 858a8ed..aa86409 100644
--- a/dlls/cryptui/cryptui_En.rc
+++ b/dlls/cryptui/cryptui_En.rc
@@ -65,6 +65,10 @@ STRINGTABLE DISCARDABLE
     IDS_SELECT_STORE "Please select a certificate store."
     IDS_IMPORT_WIZARD "Certificate Import Wizard"
     IDS_IMPORT_TYPE_MISMATCH "The file contains objects that do not match the given criteria.  Please select another file."
+    IDS_IMPORT_FILE_TITLE "File to Import"
+    IDS_IMPORT_FILE_SUBTITLE "Specify the file you want to import."
+    IDS_IMPORT_STORE_TITLE "Certificate Store"
+    IDS_IMPORT_STORE_SUBTITLE "Certificate stores are collections of certificates, certificate revocation lists, and certificate trust lists."
     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"
@@ -200,3 +204,59 @@ BEGIN
   PUSHBUTTON "OK", IDOK, 90,118,50,14, BS_DEFPUSHBUTTON
   PUSHBUTTON "Cancel", IDCANCEL, 144,118,50,14
 END
+
+IDD_IMPORT_WELCOME DIALOG DISCARDABLE 0,0,317,143
+CAPTION "Certificate Import Wizard"
+FONT 8, "MS Shell Dlg"
+BEGIN
+  LTEXT "Welcome to the Certificate Import Wizard", IDC_IMPORT_TITLE, 115,1,195,24
+  LTEXT "This wizard helps you import certificates, certificate revocation lists, and certificate trust lists from a file to a certificate store.",
+    stc1, 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.",
+    stc2, 115,56,195,40
+  LTEXT "To continue, click Next.",
+    stc3, 115,103,195,8
+END
+
+IDD_IMPORT_FILE DIALOG DISCARDABLE 0,0,317,143
+CAPTION "Certificate Import Wizard"
+FONT 8, "MS Shell Dlg"
+BEGIN
+  LTEXT "&File name:", stc1, 21,1,195,10
+  EDITTEXT IDC_IMPORT_FILENAME, 21,11,208,14, ES_AUTOHSCROLL|WS_TABSTOP
+  PUSHBUTTON "B&rowse...", IDC_IMPORT_BROWSE_FILE, 236,11,60,14
+  LTEXT "Note:  The following file formats may contain more than one certificate, certificate revocation list, or certificate trust list:", stc2, 21,26,265,16
+  LTEXT "Cryptographic Message Syntax Standard/PKCS #7 Messages (.p7b)",
+    stc3, 31,49,265,10
+  LTEXT "Personal Information Exchange/PKCS #12 (.pfx, .p12)",
+    stc3, 31,64,265,10
+  LTEXT "Microsoft Serialized Certificate Store (.sst)",
+    stc3, 31,79,265,10
+END
+
+IDD_IMPORT_STORE DIALOG DISCARDABLE 0,0,317,143
+CAPTION "Certificate Import Wizard"
+FONT 8, "MS Shell Dlg"
+BEGIN
+  LTEXT "Wine can automatically select the certificate store, or you can specify a location for the certificates.", stc1, 21,1,195,20
+  AUTORADIOBUTTON "&Automatically select certificate store",
+    IDC_IMPORT_AUTO_STORE, 31,18,180,12, BS_AUTORADIOBUTTON|WS_TABSTOP
+  AUTORADIOBUTTON "&Place all certificates in the following store:",
+    IDC_IMPORT_SPECIFY_STORE, 31,30,180,12, BS_AUTORADIOBUTTON
+  EDITTEXT IDC_IMPORT_STORE, 44,49,185,14, ES_AUTOHSCROLL|WS_TABSTOP
+  PUSHBUTTON "B&rowse...", IDC_IMPORT_BROWSE_STORE, 236,49,60,14
+END
+
+IDD_IMPORT_FINISH DIALOG DISCARDABLE 0,0,317,143
+CAPTION "Certificate Import Wizard"
+FONT 8, "MS Shell Dlg"
+BEGIN
+  LTEXT "Completing the Certificate Import Wizard", IDC_IMPORT_TITLE, 115,1,195,24
+  LTEXT "You have successfully completed the Certificate Import Wizard.",
+    stc1, 115,33,195,24
+  LTEXT "You have specified the following settings:",
+    stc2, 115,57,195,12
+  CONTROL "", IDC_IMPORT_SETTINGS, "SysListView32",
+    LVS_REPORT|LVS_SINGLESEL|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER,
+    115,67,174,100
+END
diff --git a/dlls/cryptui/cryptuires.h b/dlls/cryptui/cryptuires.h
index aaf65bc..0fffb83 100644
--- a/dlls/cryptui/cryptuires.h
+++ b/dlls/cryptui/cryptuires.h
@@ -62,6 +62,10 @@
 #define IDS_SELECT_STORE 1042
 #define IDS_IMPORT_WIZARD 1043
 #define IDS_IMPORT_TYPE_MISMATCH 1044
+#define IDS_IMPORT_FILE_TITLE 1045
+#define IDS_IMPORT_FILE_SUBTITLE 1046
+#define IDS_IMPORT_STORE_TITLE 1047
+#define IDS_IMPORT_STORE_SUBTITLE 1048
 
 #define IDS_PURPOSE_SERVER_AUTH 1100
 #define IDS_PURPOSE_CLIENT_AUTH 1101
@@ -97,6 +101,10 @@
 #define IDD_CERT_PROPERTIES_GENERAL 104
 #define IDD_ADD_CERT_PURPOSE 105
 #define IDD_SELECT_STORE 106
+#define IDD_IMPORT_WELCOME 107
+#define IDD_IMPORT_FILE 108
+#define IDD_IMPORT_STORE 109
+#define IDD_IMPORT_FINISH 110
 
 #define IDB_SMALL_ICONS 200
 #define IDB_CERT 201
@@ -140,4 +148,13 @@
 #define IDC_STORE_LIST 2601
 #define IDC_SHOW_PHYSICAL_STORES 2602
 
+#define IDC_IMPORT_TITLE 2700
+#define IDC_IMPORT_FILENAME 2701
+#define IDC_IMPORT_BROWSE_FILE 2702
+#define IDC_IMPORT_AUTO_STORE 2703
+#define IDC_IMPORT_SPECIFY_STORE 2704
+#define IDC_IMPORT_STORE 2705
+#define IDC_IMPORT_BROWSE_STORE 2706
+#define IDC_IMPORT_SETTINGS 2707
+
 #endif /* ndef __CRYPTUIRES_H_ */
diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index a4232f8..c7f8286 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -3671,6 +3671,159 @@ static BOOL import_file(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle,
     return ret;
 }
 
+static LRESULT CALLBACK import_welcome_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
+ LPARAM lp)
+{
+    LRESULT ret = 0;
+
+    switch (msg)
+    {
+    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 import_file_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
+ LPARAM lp)
+{
+    LRESULT ret = 0;
+
+    switch (msg)
+    {
+    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 import_store_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
+ LPARAM lp)
+{
+    LRESULT ret = 0;
+
+    switch (msg)
+    {
+    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 import_finish_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
+ LPARAM lp)
+{
+    LRESULT ret = 0;
+
+    switch (msg)
+    {
+    case WM_NOTIFY:
+    {
+        NMHDR *hdr = (NMHDR *)lp;
+
+        switch (hdr->code)
+        {
+        case PSN_SETACTIVE:
+            PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0,
+             PSWIZB_BACK | PSWIZB_FINISH);
+            ret = TRUE;
+            break;
+        }
+        break;
+    }
+    }
+    return ret;
+}
+
+static BOOL show_import_ui(DWORD dwFlags, HWND hwndParent,
+ LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc,
+ HCERTSTORE hDestCertStore)
+{
+    PROPSHEETHEADERW hdr;
+    PROPSHEETPAGEW pages[4];
+
+    FIXME("\n");
+
+    memset(&pages, 0, sizeof(pages));
+
+    pages[0].dwSize = sizeof(pages[0]);
+    pages[0].hInstance = hInstance;
+    pages[0].u.pszTemplate = MAKEINTRESOURCEW(IDD_IMPORT_WELCOME);
+    pages[0].pfnDlgProc = import_welcome_dlg_proc;
+    pages[0].dwFlags = PSP_HIDEHEADER;
+
+    pages[1].dwSize = sizeof(pages[1]);
+    pages[1].hInstance = hInstance;
+    pages[1].u.pszTemplate = MAKEINTRESOURCEW(IDD_IMPORT_FILE);
+    pages[1].pfnDlgProc = import_file_dlg_proc;
+    pages[1].dwFlags = PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
+    pages[1].pszHeaderTitle = MAKEINTRESOURCEW(IDS_IMPORT_FILE_TITLE);
+    pages[1].pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_IMPORT_FILE_SUBTITLE);
+
+    pages[2].dwSize = sizeof(pages[2]);
+    pages[2].hInstance = hInstance;
+    pages[2].u.pszTemplate = MAKEINTRESOURCEW(IDD_IMPORT_STORE);
+    pages[2].pfnDlgProc = import_store_dlg_proc;
+    pages[2].dwFlags = PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
+    pages[2].pszHeaderTitle = MAKEINTRESOURCEW(IDS_IMPORT_STORE_TITLE);
+    pages[2].pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_IMPORT_STORE_SUBTITLE);
+
+    pages[3].dwSize = sizeof(pages[3]);
+    pages[3].hInstance = hInstance;
+    pages[3].u.pszTemplate = MAKEINTRESOURCEW(IDD_IMPORT_FINISH);
+    pages[3].pfnDlgProc = import_finish_dlg_proc;
+    pages[3].dwFlags = PSP_HIDEHEADER;
+
+    memset(&hdr, 0, sizeof(hdr));
+    hdr.dwSize = sizeof(hdr);
+    hdr.hwndParent = hwndParent;
+    hdr.dwFlags = PSH_PROPSHEETPAGE | PSH_WIZARD97_OLD | PSH_HEADER;
+    hdr.hInstance = hInstance;
+    if (pwszWizardTitle)
+        hdr.pszCaption = pwszWizardTitle;
+    else
+        hdr.pszCaption = MAKEINTRESOURCEW(IDS_IMPORT_WIZARD);
+    hdr.u3.ppsp = pages;
+    hdr.nPages = 4;
+    PropertySheetW(&hdr);
+    return FALSE;
+}
+
 BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardTitle,
                              PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc, HCERTSTORE hDestCertStore)
 {
@@ -3688,6 +3841,10 @@ BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardT
         return FALSE;
     }
 
+    if (!(dwFlags & CRYPTUI_WIZ_NO_UI))
+        ret = show_import_ui(dwFlags, hwndParent, pwszWizardTitle, pImportSrc,
+         hDestCertStore);
+
     switch (pImportSrc->dwSubjectChoice)
     {
     case CRYPTUI_WIZ_IMPORT_SUBJECT_FILE:




More information about the wine-cvs mailing list