From b2fefc0ffd4c8b6c9f64c4aee8a07e2403e1a455 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang@gmail.com>
Date: Sat, 24 Jan 2009 14:13:44 -0800
Subject: [PATCH] cryptui: Move code for enabling the PFX export format to the
 correct dialog proc.

---
 dlls/cryptui/main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index d2c438e63bc..50b5cb553d9 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -5557,9 +5557,13 @@ static LRESULT CALLBACK export_format_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
     {
         PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp;
         int defaultFormatID;
+        BOOL hasPrivateKey;
 
         data = (struct ExportWizData *)page->lParam;
         SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
+        hasPrivateKey = export_info_has_private_key(data->pExportInfo);
+        if (hasPrivateKey)
+            EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_PFX), TRUE);
         switch (data->contextInfo.dwExportFormat)
         {
         case CRYPTUI_WIZ_EXPORT_FORMAT_BASE64:
@@ -5569,7 +5573,7 @@ static LRESULT CALLBACK export_format_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
             defaultFormatID = IDC_EXPORT_FORMAT_CMS;
             break;
         case CRYPTUI_WIZ_EXPORT_FORMAT_PFX:
-            if (export_info_has_private_key(data->pExportInfo))
+            if (hasPrivateKey)
                 defaultFormatID = IDC_EXPORT_FORMAT_PFX;
             else
                 defaultFormatID = IDC_EXPORT_FORMAT_DER;
@@ -5882,8 +5886,6 @@ static LRESULT CALLBACK export_file_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
 
         data = (struct ExportWizData *)page->lParam;
         SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
-        if (export_info_has_private_key(data->pExportInfo))
-            EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_PFX), TRUE);
         break;
     }
     case WM_NOTIFY:
-- 
GitLab