Juan Lang : cryptui: Set cert friendly name and description in response to applying the edit cert properties dialog .
Alexandre Julliard
julliard at winehq.org
Fri Dec 19 11:19:26 CST 2008
Module: wine
Branch: master
Commit: 2d2aafbcfa3e1e7b90fc0fd0947b7ee61eb0e942
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d2aafbcfa3e1e7b90fc0fd0947b7ee61eb0e942
Author: Juan Lang <juan.lang at gmail.com>
Date: Thu Dec 18 14:06:53 2008 -0800
cryptui: Set cert friendly name and description in response to applying the edit cert properties dialog.
---
dlls/cryptui/main.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index 275526b..2c0d453 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -1989,9 +1989,43 @@ static void toggle_usage(HWND hwnd, int iItem)
}
}
+static void set_cert_string_property(PCCERT_CONTEXT cert, DWORD prop,
+ LPWSTR str)
+{
+ if (str && strlenW(str))
+ {
+ CRYPT_DATA_BLOB blob;
+
+ blob.pbData = (BYTE *)str;
+ blob.cbData = (strlenW(str) + 1) * sizeof(WCHAR);
+ CertSetCertificateContextProperty(cert, prop, 0, &blob);
+ }
+ else
+ CertSetCertificateContextProperty(cert, prop, 0, NULL);
+}
+
#define MAX_FRIENDLY_NAME 40
#define MAX_DESCRIPTION 255
+static void apply_general_changes(HWND hwnd)
+{
+ WCHAR buf[MAX_DESCRIPTION + 1];
+ struct detail_data *data =
+ (struct detail_data *)GetWindowLongPtrW(hwnd, DWLP_USER);
+
+ SendMessageW(GetDlgItem(hwnd, IDC_FRIENDLY_NAME), WM_GETTEXT,
+ sizeof(buf) / sizeof(buf[0]), (LPARAM)buf);
+ set_cert_string_property(data->pCertViewInfo->pCertContext,
+ CERT_FRIENDLY_NAME_PROP_ID, buf);
+ SendMessageW(GetDlgItem(hwnd, IDC_DESCRIPTION), WM_GETTEXT,
+ sizeof(buf) / sizeof(buf[0]), (LPARAM)buf);
+ set_cert_string_property(data->pCertViewInfo->pCertContext,
+ CERT_DESCRIPTION_PROP_ID, buf);
+ FIXME("apply usage state\n");
+ if (data->pfPropertiesChanged)
+ *data->pfPropertiesChanged = TRUE;
+}
+
static LRESULT CALLBACK cert_properties_general_dlg_proc(HWND hwnd, UINT msg,
WPARAM wp, LPARAM lp)
{
@@ -2028,6 +2062,9 @@ static LRESULT CALLBACK cert_properties_general_dlg_proc(HWND hwnd, UINT msg,
toggle_usage(hwnd, nm->iItem);
SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0);
break;
+ case PSN_APPLY:
+ apply_general_changes(hwnd);
+ break;
}
break;
}
More information about the wine-cvs
mailing list