Juan Lang : cryptui: Add support for exporting a serialized store from CryptUIWizExport.

Alexandre Julliard julliard at winehq.org
Tue Jan 27 09:06:53 CST 2009


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Sat Jan 24 12:54:53 2009 -0800

cryptui: Add support for exporting a serialized store from CryptUIWizExport.

---

 dlls/cryptui/cryptui_En.rc |    1 +
 dlls/cryptui/cryptuires.h  |   15 ++++++++-------
 dlls/cryptui/main.c        |   22 ++++++++++++++++++++++
 3 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/dlls/cryptui/cryptui_En.rc b/dlls/cryptui/cryptui_En.rc
index d40d9c1..1e311a1 100644
--- a/dlls/cryptui/cryptui_En.rc
+++ b/dlls/cryptui/cryptui_En.rc
@@ -153,6 +153,7 @@ STRINGTABLE DISCARDABLE
     IDS_EXPORT_FILTER_CTL "Certificate Trust List (*.stl)"
     IDS_EXPORT_FILTER_CMS "CMS/PKCS #7 Messages (*.p7b)"
     IDS_EXPORT_FILTER_PFX "Personal Information Exchange (*.pfx)"
+    IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE "Serialized Certificate Store (*.sst)"
     IDS_EXPORT_FORMAT "File Format"
     IDS_EXPORT_INCLUDE_CHAIN "Include all certificates in certificate path"
     IDS_EXPORT_KEYS "Export keys"
diff --git a/dlls/cryptui/cryptuires.h b/dlls/cryptui/cryptuires.h
index 7b8b4f2..486bae0 100644
--- a/dlls/cryptui/cryptuires.h
+++ b/dlls/cryptui/cryptuires.h
@@ -152,13 +152,14 @@
 #define IDS_EXPORT_FILTER_CTL 1209
 #define IDS_EXPORT_FILTER_CMS 1210
 #define IDS_EXPORT_FILTER_PFX 1211
-#define IDS_EXPORT_FORMAT 1212
-#define IDS_EXPORT_INCLUDE_CHAIN 1213
-#define IDS_EXPORT_KEYS 1214
-#define IDS_YES 1215
-#define IDS_NO 1216
-#define IDS_EXPORT_SUCCEEDED 1217
-#define IDS_EXPORT_FAILED 1218
+#define IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE 1212
+#define IDS_EXPORT_FORMAT 1213
+#define IDS_EXPORT_INCLUDE_CHAIN 1214
+#define IDS_EXPORT_KEYS 1215
+#define IDS_YES 1216
+#define IDS_NO 1217
+#define IDS_EXPORT_SUCCEEDED 1218
+#define IDS_EXPORT_FAILED 1219
 
 #define IDD_GENERAL 100
 #define IDD_DETAIL 101
diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index 9ea7b93..3108c6a 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -5633,6 +5633,7 @@ static LPWSTR export_append_extension(struct ExportWizData *data,
     static const WCHAR ctl[] = { '.','c','t','l',0 };
     static const WCHAR p7b[] = { '.','p','7','b',0 };
     static const WCHAR pfx[] = { '.','p','f','x',0 };
+    static const WCHAR sst[] = { '.','s','s','t',0 };
     LPCWSTR extension;
     LPWSTR dot;
     BOOL appendExtension;
@@ -5654,6 +5655,9 @@ static LPWSTR export_append_extension(struct ExportWizData *data,
         case CRYPTUI_WIZ_EXPORT_CTL_CONTEXT:
             extension = ctl;
             break;
+        case CRYPTUI_WIZ_EXPORT_CERT_STORE:
+            extension = sst;
+            break;
         default:
             extension = cer;
         }
@@ -5760,6 +5764,7 @@ static const WCHAR export_filter_crl[] = { '*','.','c','r','l',0 };
 static const WCHAR export_filter_ctl[] = { '*','.','s','t','l',0 };
 static const WCHAR export_filter_cms[] = { '*','.','p','7','b',0 };
 static const WCHAR export_filter_pfx[] = { '*','.','p','f','x',0 };
+static const WCHAR export_filter_sst[] = { '*','.','s','s','t',0 };
 
 static WCHAR *make_export_file_filter(DWORD exportFormat, DWORD subjectChoice)
 {
@@ -5792,6 +5797,10 @@ static WCHAR *make_export_file_filter(DWORD exportFormat, DWORD subjectChoice)
             baseID = IDS_EXPORT_FILTER_CTL;
             filterStr = export_filter_ctl;
             break;
+        case CRYPTUI_WIZ_EXPORT_CERT_STORE:
+            baseID = IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE;
+            filterStr = export_filter_sst;
+            break;
         default:
             baseID = IDS_EXPORT_FILTER_CERT;
             filterStr = export_filter_cert;
@@ -5968,6 +5977,7 @@ static void show_export_details(HWND lv, struct ExportWizData *data)
     {
     case CRYPTUI_WIZ_EXPORT_CRL_CONTEXT:
     case CRYPTUI_WIZ_EXPORT_CTL_CONTEXT:
+    case CRYPTUI_WIZ_EXPORT_CERT_STORE:
         /* do nothing */
         break;
     default:
@@ -6011,6 +6021,9 @@ static void show_export_details(HWND lv, struct ExportWizData *data)
     case CRYPTUI_WIZ_EXPORT_CTL_CONTEXT:
         contentID = IDS_EXPORT_FILTER_CTL;
         break;
+    case CRYPTUI_WIZ_EXPORT_CERT_STORE:
+        contentID = IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE;
+        break;
     default:
         switch (data->contextInfo.dwExportFormat)
         {
@@ -6132,6 +6145,12 @@ static BOOL save_cms(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,
     return ret;
 }
 
+static BOOL save_serialized_store(HANDLE file, HCERTSTORE store)
+{
+    return CertSaveStore(store, PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
+     CERT_STORE_SAVE_AS_STORE, CERT_STORE_SAVE_TO_FILE, file, 0);
+}
+
 static BOOL do_export(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,
  PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO pContextInfo)
 {
@@ -6154,6 +6173,9 @@ static BOOL do_export(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,
          pExportInfo->u.pCTLContext->pbCtlEncoded,
          pExportInfo->u.pCTLContext->cbCtlEncoded);
         break;
+    case CRYPTUI_WIZ_EXPORT_CERT_STORE:
+        ret = save_serialized_store(file, pExportInfo->u.hCertStore);
+        break;
     default:
         switch (pContextInfo->dwExportFormat)
         {




More information about the wine-cvs mailing list