cryptui: Disable some buttons if a certificate is not selected.

Alexander Morozov amorozov at etersoft.ru
Tue Aug 23 05:36:36 CDT 2011


On Wine if in Certificates dialog unselect certificate with Ctrl + left mouse 
button then Export, Remove and View buttons do nothing but are enabled. On 
Windows buttons become disabled and purposes field becomes cleaned.
-------------- next part --------------
From 92ad3fba821a81624621b12f9a3aa7de7cb92c0b Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at etersoft.ru>
Date: Mon, 8 Aug 2011 19:39:07 +0400
Subject: [PATCH] cryptui: Disable some buttons if a certificate is not
 selected.

---
 dlls/cryptui/main.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index 23f247e..15e71d5 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -1164,20 +1164,19 @@ static LRESULT CALLBACK cert_mgr_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
             break;
         case LVN_ITEMCHANGED:
         {
-            NMITEMACTIVATE *nm;
+            WCHAR empty[] = { 0 };
+            NMITEMACTIVATE *nm = (NMITEMACTIVATE*)lp;
             HWND lv = GetDlgItem(hwnd, IDC_MGR_CERTS);
+            int numSelected = SendMessageW(lv, LVM_GETSELECTEDCOUNT, 0, 0);
 
-            nm = (NMITEMACTIVATE*)lp;
-            if (nm->uNewState & LVN_ITEMACTIVATE)
-            {
-                int numSelected = SendMessageW(lv, LVM_GETSELECTEDCOUNT, 0, 0);
-
-                EnableWindow(GetDlgItem(hwnd, IDC_MGR_EXPORT), numSelected > 0);
-                EnableWindow(GetDlgItem(hwnd, IDC_MGR_REMOVE), numSelected > 0);
-                EnableWindow(GetDlgItem(hwnd, IDC_MGR_VIEW), numSelected == 1);
-                if (numSelected == 1)
-                    cert_mgr_show_cert_usages(hwnd, nm->iItem);
-            }
+            EnableWindow(GetDlgItem(hwnd, IDC_MGR_EXPORT), numSelected > 0);
+            EnableWindow(GetDlgItem(hwnd, IDC_MGR_REMOVE), numSelected > 0);
+            EnableWindow(GetDlgItem(hwnd, IDC_MGR_VIEW), numSelected == 1);
+            if (numSelected == 1)
+                cert_mgr_show_cert_usages(hwnd, nm->iItem);
+            else
+                SendMessageW(GetDlgItem(hwnd, IDC_MGR_PURPOSES), WM_SETTEXT, 0,
+                 (LPARAM)empty);
             break;
         }
         case NM_DBLCLK:
-- 
1.7.5.4



More information about the wine-patches mailing list