Juan Lang : cryptui: Implement CryptUIDlgSelectStoreA on top of CryptUIDlgSelectStoreW.

Alexandre Julliard julliard at winehq.org
Mon Dec 22 10:19:43 CST 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Sat Dec 20 10:10:24 2008 -0800

cryptui: Implement CryptUIDlgSelectStoreA on top of CryptUIDlgSelectStoreW.

---

 dlls/cryptui/main.c |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index d6d4718..7ae27d2 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -119,21 +119,49 @@ typedef struct _CRYPTUI_SELECTSTORE_INFO_W
 } CRYPTUI_SELECTSTORE_INFO_W, *PCRYPTUI_SELECTSTORE_INFO_W;
 
 /***********************************************************************
- *		CryptUIDlgSelectStoreA (CRYPTUI.@)
+ *		CryptUIDlgSelectStoreW (CRYPTUI.@)
  */
-HCERTSTORE WINAPI CryptUIDlgSelectStoreA(PCRYPTUI_SELECTSTORE_INFO_A info)
+HCERTSTORE WINAPI CryptUIDlgSelectStoreW(PCRYPTUI_SELECTSTORE_INFO_W info)
 {
     FIXME("(%p): stub\n", info);
     return NULL;
 }
 
 /***********************************************************************
- *		CryptUIDlgSelectStoreW (CRYPTUI.@)
+ *		CryptUIDlgSelectStoreA (CRYPTUI.@)
  */
-HCERTSTORE WINAPI CryptUIDlgSelectStoreW(PCRYPTUI_SELECTSTORE_INFO_W info)
+HCERTSTORE WINAPI CryptUIDlgSelectStoreA(PCRYPTUI_SELECTSTORE_INFO_A info)
 {
-    FIXME("(%p): stub\n", info);
-    return NULL;
+    CRYPTUI_SELECTSTORE_INFO_W infoW;
+    HCERTSTORE ret;
+    int len;
+
+    TRACE("(%p)\n", info);
+
+    if (info->dwSize != sizeof(CRYPTUI_SELECTSTORE_INFO_A))
+    {
+        WARN("unexpected size %d\n", info->dwSize);
+        SetLastError(E_INVALIDARG);
+        return NULL;
+    }
+    memcpy(&infoW, &info, sizeof(info));
+    if (info->pszTitle)
+    {
+        len = MultiByteToWideChar(CP_ACP, 0, info->pszTitle, -1, NULL, 0);
+        infoW.pwszTitle = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        MultiByteToWideChar(CP_ACP, 0, info->pszTitle, -1, infoW.pwszTitle,
+         len);
+    }
+    if (info->pszText)
+    {
+        len = MultiByteToWideChar(CP_ACP, 0, info->pszText, -1, NULL, 0);
+        infoW.pwszText = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        MultiByteToWideChar(CP_ACP, 0, info->pszText, -1, infoW.pwszText, len);
+    }
+    ret = CryptUIDlgSelectStoreW(&infoW);
+    HeapFree(GetProcessHeap(), 0, infoW.pwszText);
+    HeapFree(GetProcessHeap(), 0, infoW.pwszTitle);
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list