[05/17] propsys: Add support for VT_LPSTR to PropVariantChangeType. (v2)

Dmitry Timoshkov dmitry at baikal.ru
Mon Jun 19 23:37:00 CDT 2017


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/propsys/propvar.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c
index fc6cf58e70..8a8698fcbb 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;
-- 
2.13.1




More information about the wine-patches mailing list