diff --git a/dll/win32/propsys/propsys.spec b/dll/win32/propsys/propsys.spec index 1dee58c97e3..2ee71ba370e 100644 --- a/dll/win32/propsys/propsys.spec +++ b/dll/win32/propsys/propsys.spec @@ -108,7 +108,7 @@ @ stub PropVariantGetUInt32Elem @ stub PropVariantGetUInt64Elem @ stub PropVariantToBSTR -@ stub PropVariantToBoolean +@ stdcall PropVariantToBoolean(ptr ptr) @ stub PropVariantToBooleanVector @ stub PropVariantToBooleanVectorAlloc @ stub PropVariantToBooleanWithDefault diff --git a/dll/win32/propsys/propvar.c b/dll/win32/propsys/propvar.c index dab77f8c5af..4b9292eecbe 100644 --- a/dll/win32/propsys/propvar.c +++ b/dll/win32/propsys/propvar.c @@ -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; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index d7b5451b3c8..a30fea9f865 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -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