Dmitry Timoshkov : propsys: Add support for VT_LPSTR to PropVariantChangeType.

Alexandre Julliard julliard at winehq.org
Tue Jun 20 15:34:55 CDT 2017


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue Jun 20 12:37:00 2017 +0800

propsys: Add support for VT_LPSTR to PropVariantChangeType.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/propsys/propvar.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c
index fc6cf58..8a8698f 100644
--- a/dlls/propsys/propvar.c
+++ b/dlls/propsys/propvar.c
@@ -385,6 +385,31 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
         return hr;
     }
 
+    case VT_LPSTR:
+    {
+        WCHAR *resW;
+        hr = PropVariantToStringAlloc(propvarSrc, &resW);
+        if (SUCCEEDED(hr))
+        {
+            char *res;
+            DWORD len;
+
+            len = WideCharToMultiByte(CP_ACP, 0, resW, -1, NULL, 0, NULL, NULL);
+            res = CoTaskMemAlloc(len);
+            if (res)
+            {
+                WideCharToMultiByte(CP_ACP, 0, resW, -1, res, len, NULL, NULL);
+                ppropvarDest->vt = VT_LPSTR;
+                ppropvarDest->u.pszVal = res;
+            }
+            else
+                hr = E_OUTOFMEMORY;
+
+            CoTaskMemFree(resW);
+        }
+        return hr;
+    }
+
     default:
         FIXME("Unhandled dest type: %d\n", vt);
         return E_FAIL;




More information about the wine-cvs mailing list