Juan Lang : cryptui: Show cert' s friendly name and description in edit properties dialog.

Alexandre Julliard julliard at winehq.org
Fri Dec 19 11:19:21 CST 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Dec 18 13:54:04 2008 -0800

cryptui: Show cert's friendly name and description in edit properties dialog.

---

 dlls/cryptui/main.c |   79 ++++++++++++++++++++++++++++----------------------
 1 files changed, 44 insertions(+), 35 deletions(-)

diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index 2767b5b..c38bf1a 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -1554,6 +1554,49 @@ static void create_cert_details_list(HWND hwnd, struct detail_data *data)
     set_fields_selection(hwnd, data, 0);
 }
 
+static WCHAR *get_cert_property_as_string(PCCERT_CONTEXT cert, DWORD prop)
+{
+    WCHAR *name = NULL;
+    DWORD cb;
+
+    if (CertGetCertificateContextProperty(cert, prop, NULL, &cb))
+    {
+        name = HeapAlloc(GetProcessHeap(), 0, cb);
+        if (name)
+        {
+            if (!CertGetCertificateContextProperty(cert, prop, (LPBYTE)name,
+             &cb))
+            {
+                HeapFree(GetProcessHeap(), 0, name);
+                name = NULL;
+            }
+        }
+    }
+    return name;
+}
+
+static void set_general_cert_properties(HWND hwnd, struct detail_data *data)
+{
+    PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext;
+    WCHAR *str;
+
+    if ((str = get_cert_property_as_string(cert, CERT_FRIENDLY_NAME_PROP_ID)))
+    {
+        SendMessageW(GetDlgItem(hwnd, IDC_FRIENDLY_NAME), WM_SETTEXT, 0,
+         (LPARAM)str);
+        HeapFree(GetProcessHeap(), 0, str);
+    }
+    if ((str = get_cert_property_as_string(cert, CERT_DESCRIPTION_PROP_ID)))
+    {
+        SendMessageW(GetDlgItem(hwnd, IDC_DESCRIPTION), WM_SETTEXT, 0,
+         (LPARAM)str);
+        HeapFree(GetProcessHeap(), 0, str);
+    }
+    FIXME("show cert usages\n");
+    EnableWindow(GetDlgItem(hwnd, IDC_ADD_PURPOSE), FALSE);
+    SendMessageW(GetDlgItem(hwnd, IDC_ENABLE_ALL_PURPOSES), BM_CLICK, 0, 0);
+}
+
 #define MAX_FRIENDLY_NAME 40
 #define MAX_DESCRIPTION 255
 
@@ -1577,23 +1620,10 @@ static LRESULT CALLBACK cert_properties_general_dlg_proc(HWND hwnd, UINT msg,
          MAX_FRIENDLY_NAME, 0);
         SendMessageW(description, EM_SETLIMITTEXT, MAX_DESCRIPTION, 0);
         ShowScrollBar(description, SB_VERT, FALSE);
-        FIXME("set general properties\n");
+        set_general_cert_properties(hwnd, data);
         SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
         break;
     }
-    case WM_COMMAND:
-        switch (HIWORD(wp))
-        {
-        case BN_CLICKED:
-            switch (LOWORD(wp))
-            {
-            case IDC_ADD_PURPOSE:
-                FIXME("show add purpose dialog\n");
-                break;
-            }
-            break;
-        }
-        break;
     }
     return 0;
 }
@@ -1827,27 +1857,6 @@ static struct hierarchy_data *get_hierarchy_data_from_tree_item(HWND tree,
     return data;
 }
 
-static WCHAR *get_cert_property_as_string(PCCERT_CONTEXT cert, DWORD prop)
-{
-    WCHAR *name = NULL;
-    DWORD cb;
-
-    if (CertGetCertificateContextProperty(cert, prop, NULL, &cb))
-    {
-        name = HeapAlloc(GetProcessHeap(), 0, cb);
-        if (name)
-        {
-            if (!CertGetCertificateContextProperty(cert, prop, (LPBYTE)name,
-             &cb))
-            {
-                HeapFree(GetProcessHeap(), 0, name);
-                name = NULL;
-            }
-        }
-    }
-    return name;
-}
-
 static WCHAR *get_cert_display_name(PCCERT_CONTEXT cert)
 {
     WCHAR *name = get_cert_property_as_string(cert, CERT_FRIENDLY_NAME_PROP_ID);




More information about the wine-cvs mailing list