[PROPSYS] Sync with Wine 3.0. CORE-14225
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 20 Jan 2018 12:02:49 +0000 (13:02 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 20 Jan 2018 12:02:49 +0000 (13:02 +0100)
dll/win32/propsys/propsys.spec
dll/win32/propsys/propvar.c
media/doc/README.WINE

index 1dee58c..2ee71ba 100644 (file)
 @ stub PropVariantGetUInt32Elem
 @ stub PropVariantGetUInt64Elem
 @ stub PropVariantToBSTR
-@ stub PropVariantToBoolean
+@ stdcall PropVariantToBoolean(ptr ptr)
 @ stub PropVariantToBooleanVector
 @ stub PropVariantToBooleanVectorAlloc
 @ stub PropVariantToBooleanWithDefault
index dab77f8..4b9292e 100644 (file)
@@ -212,6 +212,66 @@ HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
     return hr;
 }
 
+HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
+{
+    static const WCHAR trueW[] = {'t','r','u','e',0};
+    static const WCHAR falseW[] = {'f','a','l','s','e',0};
+    static const WCHAR true2W[] = {'#','T','R','U','E','#',0};
+    static const WCHAR false2W[] = {'#','F','A','L','S','E','#',0};
+    LONGLONG res;
+    HRESULT hr;
+
+    TRACE("%p,%p\n", propvarIn, ret);
+
+    *ret = FALSE;
+
+    switch (propvarIn->vt)
+    {
+        case VT_BOOL:
+            *ret = propvarIn->u.boolVal == VARIANT_TRUE;
+            return S_OK;
+
+        case VT_LPWSTR:
+        case VT_BSTR:
+            if (!propvarIn->u.pwszVal)
+                return DISP_E_TYPEMISMATCH;
+
+            if (!lstrcmpiW(propvarIn->u.pwszVal, trueW) || !lstrcmpW(propvarIn->u.pwszVal, true2W))
+            {
+                *ret = TRUE;
+                return S_OK;
+            }
+
+            if (!lstrcmpiW(propvarIn->u.pwszVal, falseW) || !lstrcmpW(propvarIn->u.pwszVal, false2W))
+            {
+                *ret = FALSE;
+                return S_OK;
+            }
+            break;
+
+         case VT_LPSTR:
+            if (!propvarIn->u.pszVal)
+                return DISP_E_TYPEMISMATCH;
+
+            if (!lstrcmpiA(propvarIn->u.pszVal, "true") || !lstrcmpA(propvarIn->u.pszVal, "#TRUE#"))
+            {
+                *ret = TRUE;
+                return S_OK;
+            }
+
+            if (!lstrcmpiA(propvarIn->u.pszVal, "false") || !lstrcmpA(propvarIn->u.pszVal, "#FALSE#"))
+            {
+                *ret = FALSE;
+                return S_OK;
+            }
+            break;
+    }
+
+    hr = PROPVAR_ConvertNumber(propvarIn, 64, TRUE, &res);
+    *ret = !!res;
+    return hr;
+}
+
 HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
 {
     WCHAR *res = NULL;
index d7b5451..a30fea9 100644 (file)
@@ -151,7 +151,7 @@ reactos/dll/win32/pdh                 # Synced to WineStaging-2.9
 reactos/dll/win32/pidgen              # Synced to WineStaging-2.9
 reactos/dll/win32/powrprof            # Forked at Wine-1.0rc5
 reactos/dll/win32/printui             # Synced to WineStaging-2.9
-reactos/dll/win32/propsys             # Synced to WineStaging-2.16
+reactos/dll/win32/propsys             # Synced to Wine-3.0
 reactos/dll/win32/pstorec             # Synced to WineStaging-2.2
 reactos/dll/win32/qmgr                # Synced to WineStaging-2.9
 reactos/dll/win32/qmgrprxy            # Synced to WineStaging-2.9