reactos/sdk/include/psdk/propvarutil.h
Mikhail Tyukin 2d1144a5cd
[PROPSYS] Sync to wine-10.0 (#7677)
[WINESYNC] propsys/tests: Merge test files.
wine commit id d189b55d2ffb038474cb6656dc8743eb34c35a3d by Nikolay Sivov <nsivov@codeweavers.com>

[WINESYNC] propsys: Add a semi-stub for PSCreatePropertyStoreFromObject().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47958
wine commit id acb2e4fc7a4242c74ac91657edb97bf1e402656a by Nikolay Sivov <nsivov@codeweavers.com>

[WINESYNC] propsys: Allow only ASCII digits in PSPropertyKeyFromString.
wine commit id 6e8c2d836e637e1fbd83c231cfd846ecb9333964 by Jacek Caban <jacek@codeweavers.com>

[WINESYNC] propsys/tests: Get rid of strcmp_wa().
wine commit id 2340212ee9c48c731c85bbad8c81ed833458bf15 by Michael Stefaniuc <mstefani@winehq.org>

[WINESYNC] propsys: Use wide-char string literals.
wine commit id b72440fa2e1016681cbfcebcdc4792b6ced3eb53 by Michael Stefaniuc <mstefani@winehq.org>

reduce wine diff and add stuff from previous commit

[WINESYNC] propsys: Use --prefer_native instead of DLL_WINE_PREATTACH.
wine commit id f99113192ffac37506a905827415d3d21d0ebbf8 by Alexandre Julliard <julliard@winehq.org>

[WINESYNC] propsys: Use nameless unions.
wine commit id 1d8e5079f0e53a767a783e5107f57f04c1897951 by Jacek Caban <jacek@codeweavers.com>

[WINESYNC] propsys/tests: Use nameless unions.
wine commit id 497de3cc19f971808ca4105f52038e61dc818db1 by Jacek Caban <jacek@codeweavers.com>

[WINESYNC] winecrt0: Add a default implementation for DllCanUnloadNow().
wine commit id bd6b53740c28c6974300e15f965c12feb0252085 by Alexandre Julliard <julliard@winehq.org>

[WINESYNC] winecrt0: Add a default implementation DllRegisterServer()/DllUnregisterServer().
wine commit id 5d82baf9747b7b133cad3be77c0cc9e24cc09582 by Alexandre Julliard <julliard@winehq.org>

[WINESYNC] propsys: Add support for VT_VECTOR|VT_UI1 type in PropVariantCompareEx().
wine commit id e91b05bb5be6fd70a767bea9991e818a49cc5547 by Nikolay Sivov <nsivov@codeweavers.com>

[WINESYNC] propsys: Fix VT_UI4 comparison, use ulVal instead of uiVal.
wine commit id 58eeb1a86433db1104d3a9ccf9ad7435ec81443a by Rémi Bernon <rbernon@codeweavers.com>

[WINESYNC] propsys/tests: Add a VT_UI4 test for PropVariantCompareEx().
A test for 58eeb1a86433db1104d3a9ccf9ad7435ec81443a.
wine commit id 10359e17ce64f39461a7b7b54f73857e6458d1fb by Nikolay Sivov <nsivov@codeweavers.com>

[WINESYNC] propsys/tests: Avoid "misleading indentation" warnings.
wine commit id 7cd6681b3be35cf6c02f056cb5131c90c0674c16 by Fabian Maurer <dark.shadow4@web.de>

[WINESYNC] propsys: Enable compilation with long types.
wine commit id a9c797e4538a37716e62bb81c3fed3de39561b41 by Eric Pouech <eric.pouech@gmail.com>

[WINESYNC] propsys/tests: Enable compilation with long types.
wine commit id c1c393595d43bd95390d3ddf86dcbc46bc4f52ba by Eric Pouech <eric.pouech@gmail.com>

[WINESYNC] propsys: Implement InitVariantFromFileTime.
wine commit id f2b8ccb7b0b22b7b5d661d908f8f8ee02f22647d by Daniel Lehman <dlehman@esri.com>

[WINESYNC] propsys/tests: Add some InitVariantFromFileTime tests.
wine commit id 083dea7fce4372840ac18176496a7d05dadd5ad8 by Daniel Lehman <dlehman@esri.com>

[WINESYNC] propsys: Implement VariantToStringWithDefault.
wine commit id bf0f1fdcf80657a42116b79a0953181191cf9221 by Mohamad Al-Jaf <mohamadaljaf@gmail.com>

[WINESYNC] propsys/tests: Add VariantToStringWithDefault tests.
wine commit id 89aba13dc381dbbda62d1019e1af2af5a589b0cf by Mohamad Al-Jaf <mohamadaljaf@gmail.com>

[WINESYNC] include: Add Stg functions declaration in propvarutil.h.
wine commit id 0d294ad26544913414277daa164004d731ae6e33 by Biswapriyo Nath <nathbappai@gmail.com>

[WINESYNC] propsys: Add InitPropVariantFromStringVector().
wine commit id 3a1146d8e63d7ceff38441fee08f7f7080527020 by Nikolay Sivov <nsivov@codeweavers.com>

[WINESYNC] Remove unused NONAMELESS defines.
wine commit id 20afe438320f77d103a96d1d8cd562d0899ebac7 by Alexandre Julliard <julliard@winehq.org>

[WINESYNC] propsys: Partially implement VariantToString().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55708
wine commit id f7ef02bd8f74ea052d61e48cd84b226d8a5867a8 by Nikolay Sivov <nsivov@codeweavers.com>

[WINESYNC] propsys: Handle VT_I4 type in VariantToString().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55708
wine commit id 001e0543bfd5aea060053af0c76233bb90fbb43b by Nikolay Sivov <nsivov@codeweavers.com>

[WINESYNC] propsys: Implement PropVariantToUInt32WithDefault.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55713
wine commit id d177709b10ce07ddd234b0e8e00764ae4b1d8488 by Fabian Maurer <dark.shadow4@web.de>

[WINESYNC] include: Use proper dllimports for propsys functions.
wine commit id f0b2e0d00c86fb04d47467f39e49c587250ffec5 by Alexandre Julliard <julliard@winehq.org>

[WINESYNC] propsys: Remove DECLSPEC_HIDDEN usage.
wine commit id e9ff53e098ef3871d692c7b907151cfbb2f0673f by Alistair Leslie-Hughes <leslie_alistair@hotmail.com>

Update propsys_private.h

[WINESYNC] propsys: Force debug info in critical sections.
wine commit id 67bea281cc851eda6a08430c70f6c9e848d3fbe1 by Paul Gofman <pgofman@codeweavers.com>

[WINESYNC] include: Fix typos in IID_IPropertyEnumType2 and CLSID_PropertySystem.
wine commit id 66e6b61705a66459ed3a9e0cf9457d8b180e4564 by Alfred Agrell <floating@muncher.se>

[WINESYNC] propsys: Add stubs for variant conversion functions.
wine commit id c21f04f7adaa4a8d0ca2d2659bf9a6facdc168c3 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys/tests: Add tests for VariantToPropVariant.
wine commit id 8877889f2a8e36d22dcad061e6da84476efb3750 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys: Initially implement VariantToPropVariant.
wine commit id 6985637ed59e81e7d1716095a343cc5681082306 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys/tests: Add tests for PropVariantToVariant.
wine commit id 3277de5572b7f6c41ebeeb89f781e378a6a2c2d3 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys/tests: Test converting clsid to string.
wine commit id 7a4f9f83c51883f41ae1363e27700452472ec18f by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys: Support converting clsid to string for PropVariant.
wine commit id 67b097ff46c65d525de6a7f560f019de6828320c by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys: Initially implement PropVariantToVariant.
wine commit id 808b398549350fffc9fc023d637ef8de9e4bba37 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys: Add PropVariantToBSTR stub.
wine commit id 86558a4b83ebf9a0c6e76888a3d0f3fe3e36bf57 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys/tests: Test PropVariantToBSTR.
wine commit id b4ac03f1f622120906a8b6e691caa05f6539c2dd by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys/tests: Test truncating for PropVariantToString.
wine commit id df16802582a56f8076ebbcf9cb6178f65bb8b9b6 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys: Implement PropVariantToBSTR.
wine commit id 66220be403ce5c3634c13da3546f0c19f04059cc by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys: Use debugstr_variant for the trace in VariantToPropVariant.
wine commit id 3517aded4090229dbb11e413bde8349d1eca0be3 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys: Support converting to BSTR for PropVariantToVariant.
wine commit id c33fdc27650045a754a05a8f25e250e6e72c8072 by Ziqing Hui <zhui@codeweavers.com>

[WINESYNC] propsys/tests: Fix a test that fails on some Windows versions.
wine commit id c09f828f43101cf2dfe11d7e13f1fc6ef4b19853 by Alexandre Julliard <julliard@winehq.org>

[WINESYNC]: propsys is now in sync with wine-staging wine-10.0
Co-authored-by: winesync <ros-dev@reactos.org>

[PROPSYS] Remove duplicate uuid

[PROPSYS] Fix headers/idl file
2025-02-07 22:00:48 +01:00

223 lines
7.6 KiB
C

/*
* Copyright 2008 James Hawkins for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_PROPVARUTIL_H
#define __WINE_PROPVARUTIL_H
#include <shtypes.h>
#include <shlwapi.h>
#ifndef PSSTDAPI
#ifdef _PROPSYS_
#define PSSTDAPI STDAPI
#define PSSTDAPI_(type) STDAPI_(type)
#else
#define PSSTDAPI DECLSPEC_IMPORT STDAPI
#define PSSTDAPI_(type) DECLSPEC_IMPORT STDAPI_(type)
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum tagPROPVAR_CHANGE_FLAGS
{
PVCHF_DEFAULT = 0x00000000,
PVCHF_NOVALUEPROP = 0x00000001,
PVCHF_ALPHABOOL = 0x00000002,
PVCHF_NOUSEROVERRIDE = 0x00000004,
PVCHF_LOCALBOOL = 0x00000008,
PVCHF_NOHEXSTRING = 0x00000010,
};
typedef int PROPVAR_CHANGE_FLAGS;
enum tagPROPVAR_COMPARE_UNIT
{
PVCU_DEFAULT = 0x00000000,
PVCU_SECOND = 0x00000001,
PVCU_MINUTE = 0x00000002,
PVCU_HOUR = 0x00000003,
PVCU_DAY = 0x00000004,
PVCU_MONTH = 0x00000005,
PVCU_YEAR = 0x00000006,
};
typedef int PROPVAR_COMPARE_UNIT;
enum tagPROPVAR_COMPARE_FLAGS
{
PVCF_DEFAULT = 0x00000000,
PVCF_TREATEMPTYASGREATERTHAN = 0x00000001,
PVCF_USESTRCMP = 0x00000002,
PVCF_USESTRCMPC = 0x00000004,
PVCF_USESTRCMPI = 0x00000008,
PVCF_USESTRCMPIC = 0x00000010,
};
typedef int PROPVAR_COMPARE_FLAGS;
PSSTDAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
PROPVAR_CHANGE_FLAGS flags, VARTYPE vt);
PSSTDAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
PSSTDAPI InitVariantFromFileTime(const FILETIME *ft, VARIANT *var);
PSSTDAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
PSSTDAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
PSSTDAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
PSSTDAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
PSSTDAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
PSSTDAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
PSSTDAPI_(INT) PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags);
PSSTDAPI InitPropVariantFromFileTime(const FILETIME *pftIn, PROPVARIANT *ppropvar);
PSSTDAPI InitPropVariantFromStringVector(PCWSTR *strs, ULONG count, PROPVARIANT *ppropvar);
PSSTDAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret);
PSSTDAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
PSSTDAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
PSSTDAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
PSSTDAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
PSSTDAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
PSSTDAPI_(ULONG) PropVariantToUInt32WithDefault(REFPROPVARIANT propvarIn, ULONG uLDefault);
PSSTDAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
PSSTDAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret);
PSSTDAPI PropVariantToBSTR(REFPROPVARIANT propvar, BSTR *bstr);
PSSTDAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb);
PSSTDAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch);
PSSTDAPI_(PCWSTR) PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
PSSTDAPI_(PCWSTR) VariantToStringWithDefault(const VARIANT *pvar, LPCWSTR pszDefault);
PSSTDAPI VariantToString(REFVARIANT var, PWSTR ret, UINT cch);
PSSTDAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
PSSTDAPI PropVariantToVariant(const PROPVARIANT *propvar, VARIANT *var);
PSSTDAPI VariantToPropVariant(const VARIANT* var, PROPVARIANT* propvar);
#ifdef __cplusplus
HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar);
BOOL IsPropVariantVector(REFPROPVARIANT propvar);
BOOL IsPropVariantString(REFPROPVARIANT propvar);
#ifndef NO_PROPVAR_INLINES
inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_BOOL;
ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
inline HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_I2;
ppropvar->iVal = nVal;
return S_OK;
}
inline HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_UI2;
ppropvar->uiVal = uiVal;
return S_OK;
}
inline HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_I4;
ppropvar->lVal = lVal;
return S_OK;
}
inline HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_UI4;
ppropvar->ulVal = ulVal;
return S_OK;
}
inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_I8;
ppropvar->hVal.QuadPart = llVal;
return S_OK;
}
inline HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_UI8;
ppropvar->uhVal.QuadPart = ullVal;
return S_OK;
}
inline HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar)
{
ppropvar->vt = VT_R8;
ppropvar->dblVal = dblVal;
return S_OK;
}
inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
{
HRESULT hres;
hres = SHStrDupW(psz, &ppropvar->pwszVal);
if(SUCCEEDED(hres))
ppropvar->vt = VT_LPWSTR;
else
PropVariantInit(ppropvar);
return hres;
}
inline HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar)
{
return InitPropVariantFromBuffer(&guid, sizeof(GUID), ppropvar);
}
inline BOOL IsPropVariantVector(REFPROPVARIANT propvar)
{
return (propvar.vt & (VT_ARRAY | VT_VECTOR));
}
inline BOOL IsPropVariantString(REFPROPVARIANT propvar)
{
return (PropVariantToStringWithDefault(propvar, NULL) != NULL);
}
#endif /* NO_PROPVAR_INLINES */
#endif /* __cplusplus */
PSSTDAPI StgSerializePropVariant(const PROPVARIANT *ppropvar, SERIALIZEDPROPERTYVALUE **ppprop, ULONG *pcb);
PSSTDAPI StgDeserializePropVariant(const SERIALIZEDPROPERTYVALUE *pprop, ULONG cbmax, PROPVARIANT *ppropvar);
#ifdef __cplusplus
}
#endif
#endif /* __WINE_PROPVARUTIL_H */