' ########################################################################################
' Microsoft Windows
' File: propvarutil.inc
' Contents: Variant and PropVariant helpers
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_propvarutil_PBI)
#DEFINE PBX_propvarutil_PBI
%EQUATE `PROPVARUTIL_INC = 1
'#pragma once
' Note: Use the SUCCEEDED function instead.
'typedef __success(return >= 0) LONG NTSTATUS;
'MACRO success_ (nStatus) = (-(BITS(LONG, nStatus) > = 0))
#INCLUDE ONCE "Legacy/System/propapi.inc"
#INCLUDE ONCE "Legacy/System/ShTypes.inc"
#INCLUDE ONCE "Legacy/System/Shlwapi.inc"
' enum PSTIME_FLAGS
%EQUATE `PSTF_UTC = &H00000000&
%EQUATE `PSTF_LOCAL = &H00000001&
'typedef int PSTIME_FLAGS;
'//====================
'//
'// PropVariant Helpers
'//
'//====================
'// Initialize a propvariant
' ========================================================================================
' PSSTDAPI InitPropVariantFromResource(__in HINSTANCE hinst, __in UINT id, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromResource LIB "propsys.dll" ALIAS "InitPropVariantFromResource" ( BYVAL hinst AS QUAD , BYVAL id AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromBuffer(__in_bcount(cb) const void *pv, __in UINT cb, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromBuffer LIB "propsys.dll" ALIAS "InitPropVariantFromBuffer" ( BYREF pv AS ANY , BYVAL cb AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromCLSID(__in REFCLSID clsid, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromCLSID LIB "propsys.dll" ALIAS "InitPropVariantFromCLSID" ( BYREF clsid AS GUID , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromGUIDAsString(__in REFGUID guid, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromGUIDAsString LIB "propsys.dll" ALIAS "InitPropVariantFromGUIDAsString" ( BYREF guid AS GUID , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromFileTime(__in const FILETIME *pftIn, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromFileTime LIB "propsys.dll" ALIAS "InitPropVariantFromFileTime" ( BYREF pft AS FILETIME , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromPropVariantVectorElem(__in REFPROPVARIANT propvarIn, __in ULONG iElem, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromPropVariantVectorElem LIB "propsys.dll" ALIAS "InitPropVariantFromPropVariantVectorElem" ( BYREF propvarIn AS ANY , BYVAL iElem AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantVectorFromPropVariant(__in REFPROPVARIANT propvarSingle, __out PROPVARIANT *ppropvarVector);
' ========================================================================================
DECLARE FUNCTION InitPropVariantVectorFromPropVariant LIB "propsys.dll" ALIAS "InitPropVariantVectorFromPropVariant" ( BYREF propvarSingle AS ANY , BYREF ppropvarVector AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromStrRet(__inout STRRET *pstrret, __in_opt PCUITEMID_CHILD pidl, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromStrRet LIB "propsys.dll" ALIAS "InitPropVariantFromStrRet" ( BYREF pstrret AS STRRET , BYVAL pidl AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromBooleanVector(__in_ecount_opt(cElems) const BOOL *prgf, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromBooleanVector LIB "propsys.dll" ALIAS "InitPropVariantFromBooleanVector" ( BYREF prgf AS LONG , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromInt16Vector(__in_ecount_opt(cElems) const SHORT *prgn, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromInt16Vector LIB "propsys.dll" ALIAS "InitPropVariantFromInt16Vector" ( BYREF prgn AS INTEGER , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromUInt16Vector(__in_ecount_opt(cElems) const USHORT *prgn, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromUInt16Vector LIB "propsys.dll" ALIAS "InitPropVariantFromUInt16Vector" ( BYREF prgn AS WORD , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromInt32Vector(__in_ecount_opt(cElems) const LONG *prgn, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromInt32Vector LIB "propsys.dll" ALIAS "InitPropVariantFromInt32Vector" ( BYREF prgn AS LONG , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromUInt32Vector(__in_ecount_opt(cElems) const ULONG *prgn, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromUInt32Vector LIB "propsys.dll" ALIAS "InitPropVariantFromUInt32Vector" ( BYREF prgn AS QUAD , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromInt64Vector(__in_ecount_opt(cElems) const LONGLONG *prgn, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromInt64Vector LIB "propsys.dll" ALIAS "InitPropVariantFromInt64Vector" ( BYREF prgn AS QUAD , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI InitPropVariantFromUInt64Vector(__in_ecount_opt(cElems) const ULONGLONG *prgn, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
' PSSTDAPI InitPropVariantFromDoubleVector(__in_ecount_opt(cElems) const DOUBLE *prgn, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromDoubleVector LIB "propsys.dll" ALIAS "InitPropVariantFromDoubleVector" ( BYREF prgn AS DOUBLE , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromFileTimeVector(__in_ecount_opt(cElems) const FILETIME *prgft, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromFileTimeVector LIB "propsys.dll" ALIAS "InitPropVariantFromFileTimeVector" ( BYREF prgft AS FILETIME , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromStringVector(__in_ecount_opt(cElems) PCWSTR *prgsz, __in ULONG cElems, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromStringVector LIB "propsys.dll" ALIAS "InitPropVariantFromStringVector" ( BYREF prgsz AS ANY , BYVAL cElems AS QUAD , BYREF ppropvar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI InitPropVariantFromStringAsVector(__in_opt PCWSTR psz, __out PROPVARIANT *ppropvar);
' ========================================================================================
DECLARE FUNCTION InitPropVariantFromStringAsVector LIB "propsys.dll" ALIAS "InitPropVariantFromStringAsVector" ( BYREF psz AS WSTRINGZ , BYREF ppropvar AS ANY ) AS LONG
'#ifdef __cplusplus
'HRESULT InitPropVariantFromBoolean(__in BOOL fVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromInt16(__in SHORT nVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromUInt16(__in USHORT uiVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromInt32(__in LONG lVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromUInt32(__in ULONG ulVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromInt64(__in LONGLONG llVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromUInt64(__in ULONGLONG ullVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromDouble(__in DOUBLE dblVal, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromString(__in PCWSTR psz, __out PROPVARIANT *ppropvar);
'HRESULT InitPropVariantFromGUIDAsBuffer(__in REFGUID guid, __out PROPVARIANT *ppropvar);
'BOOL IsPropVariantVector(__in REFPROPVARIANT propvar);
'BOOL IsPropVariantString(__in REFPROPVARIANT propvar);
'#endif
'// Extract data from a propvariant
' ========================================================================================
' PSSTDAPI_(BOOL) PropVariantToBooleanWithDefault(__in REFPROPVARIANT propvarIn, __in BOOL fDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToBooleanWithDefault LIB "propsys.dll" ALIAS "PropVariantToBooleanWithDefault" ( BYREF propvarIn AS ANY , BYVAL fDefault AS LONG ) AS LONG
' ========================================================================================
' PSSTDAPI_(SHORT) PropVariantToInt16WithDefault(__in REFPROPVARIANT propvarIn, __in SHORT iDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt16WithDefault LIB "propsys.dll" ALIAS "PropVariantToInt16WithDefault" ( BYREF propvarIn AS ANY , BYVAL iDefault AS INTEGER ) AS INTEGER ' SHORT
' ========================================================================================
' PSSTDAPI_(USHORT) PropVariantToUInt16WithDefault(__in REFPROPVARIANT propvarIn, __in USHORT uiDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt16WithDefault LIB "propsys.dll" ALIAS "PropVariantToUInt16WithDefault" ( BYREF propvarIn AS ANY , BYVAL uiDefault AS WORD ) AS WORD ' USHORT
' ========================================================================================
' PSSTDAPI_(LONG) PropVariantToInt32WithDefault(__in REFPROPVARIANT propvarIn, __in LONG lDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt32WithDefault LIB "propsys.dll" ALIAS "PropVariantToInt32WithDefault" ( BYREF propvarIn AS ANY , BYVAL lDefault AS LONG ) AS LONG
' ========================================================================================
' PSSTDAPI_(ULONG) PropVariantToUInt32WithDefault(__in REFPROPVARIANT propvarIn, __in ULONG ulDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt32WithDefault LIB "propsys.dll" ALIAS "PropVariantToUInt32WithDefault" ( BYREF propvarIn AS ANY , BYVAL ulDefault AS QUAD ) AS QUAD ' ULONG
' ========================================================================================
' PSSTDAPI_(LONGLONG) PropVariantToInt64WithDefault(__in REFPROPVARIANT propvarIn, __in LONGLONG llDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt64WithDefault LIB "propsys.dll" ALIAS "PropVariantToInt64WithDefault" ( BYREF propvarIn AS ANY , BYVAL llDefault AS QUAD ) AS QUAD ' LONGLONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI_(ULONGLONG) PropVariantToUInt64WithDefault(__in REFPROPVARIANT propvarIn, __in ULONGLONG ullDefault);
' ========================================================================================
' PSSTDAPI_(DOUBLE) PropVariantToDoubleWithDefault(__in REFPROPVARIANT propvarIn, __in DOUBLE dblDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToDoubleWithDefault LIB "propsys.dll" ALIAS "PropVariantToDoubleWithDefault" ( BYREF propvarIn AS ANY , BYVAL dblDefault AS DOUBLE ) AS DOUBLE ' DOUBLE
' ========================================================================================
' PSSTDAPI_(PCWSTR) PropVariantToStringWithDefault(__in REFPROPVARIANT propvarIn, __in_opt LPCWSTR pszDefault);
' ========================================================================================
DECLARE FUNCTION PropVariantToStringWithDefault LIB "propsys.dll" ALIAS "PropVariantToStringWithDefault" ( BYREF propvarIn AS ANY , OPTIONAL BYREF pszDefault AS WSTRINGZ ) AS QUAD
' ========================================================================================
' PSSTDAPI PropVariantToBoolean(__in REFPROPVARIANT propvarIn, __out BOOL *pfRet);
' ========================================================================================
DECLARE FUNCTION PropVariantToBoolean LIB "propsys.dll" ALIAS "PropVariantToBoolean" ( BYREF propvarIn AS ANY , BYREF pfRet AS LONG ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToInt16(__in REFPROPVARIANT propvarIn, __out SHORT *piRet);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt16 LIB "propsys.dll" ALIAS "PropVariantToInt16" ( BYREF propvarIn AS ANY , BYREF piRet AS INTEGER ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToUInt16(__in REFPROPVARIANT propvarIn, __out USHORT *puiRet);
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt16 LIB "propsys.dll" ALIAS "PropVariantToUInt16" ( BYREF propvarIn AS ANY , BYREF puiRet AS WORD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToInt32(__in REFPROPVARIANT propvarIn, __out LONG *plRet);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt32 LIB "propsys.dll" ALIAS "PropVariantToInt32" ( BYREF propvarIn AS ANY , BYREF plRet AS LONG ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToUInt32(__in REFPROPVARIANT propvarIn, __out ULONG *pulRet);
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt32 LIB "propsys.dll" ALIAS "PropVariantToUInt32" ( BYREF propvarIn AS ANY , BYREF pulRet AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToInt64(__in REFPROPVARIANT propvarIn, __out LONGLONG *pllRet);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt64 LIB "propsys.dll" ALIAS "PropVariantToInt64" ( BYREF propvarIn AS ANY , BYREF pllRet AS QUAD ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI PropVariantToUInt64(__in REFPROPVARIANT propvarIn, __out ULONGLONG *pullRet);
' ========================================================================================
' PSSTDAPI PropVariantToDouble(__in REFPROPVARIANT propvarIn, __out DOUBLE *pdblRet);
' ========================================================================================
DECLARE FUNCTION PropVariantToDouble LIB "propsys.dll" ALIAS "PropVariantToDouble" ( BYREF propvarIn AS ANY , BYREF pdblRet AS DOUBLE ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToBuffer(__in REFPROPVARIANT propvar, __out_bcount(cb) void *pv, __in UINT cb);
' ========================================================================================
DECLARE FUNCTION PropVariantToBuffer LIB "propsys.dll" ALIAS "PropVariantToBuffer" ( BYREF propvar AS ANY , BYREF pv AS ANY , BYVAL cb AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToString(__in REFPROPVARIANT propvar, __out_ecount(cch) PWSTR psz, __in UINT cch);
' ========================================================================================
DECLARE FUNCTION PropVariantToString LIB "propsys.dll" ALIAS "PropVariantToString" ( BYREF propvar AS ANY , BYREF pszBuf AS WSTRINGZ , BYVAL cchBuf AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToGUID(__in REFPROPVARIANT propvar, __out GUID *pguid);
' ========================================================================================
DECLARE FUNCTION PropVariantToGUID LIB "propsys.dll" ALIAS "PropVariantToGUID" ( BYREF propvar AS ANY , BYREF pguid AS GUID ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToStringAlloc LIB "propsys.dll" ALIAS "PropVariantToStringAlloc" ( BYREF propvar AS ANY , BYREF ppszBuf AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToBSTR LIB "propsys.dll" ALIAS "PropVariantToBSTR" ( BYREF propvar AS ANY , BYREF pbstrOut AS WSTRING ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToStrRet LIB "propsys.dll" ALIAS "PropVariantToStrRet" ( BYREF propvar AS ANY , BYREF pstrret AS STRRET ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToFileTime(__in REFPROPVARIANT propvar, __in PSTIME_FLAGS pstfOut, __out FILETIME* pftOut);
' ========================================================================================
DECLARE FUNCTION PropVariantToFileTime LIB "propsys.dll" ALIAS "PropVariantToFileTime" ( BYREF propvar AS ANY , BYVAL pstfOut AS QUAD , BYREF pftOut AS FILETIME ) AS LONG
'#ifdef __cplusplus
'HRESULT PropVariantToCLSID(__in REFPROPVARIANT propvar, __out CLSID *pclsid);
'#endif
' ========================================================================================
' Returns element count of a VT_VECTOR or VT_ARRAY value; or 1 otherwise
' PSSTDAPI_(ULONG) PropVariantGetElementCount(__in REFPROPVARIANT propvar);
' ========================================================================================
DECLARE FUNCTION PropVariantGetElementCount LIB "propsys.dll" ALIAS "PropVariantGetElementCount" ( BYREF propvar AS ANY ) AS QUAD ' ULONG
'// Extract data from a propvariant into a vector
' ========================================================================================
' PSSTDAPI PropVariantToBooleanVector(__in REFPROPVARIANT propvar, __out_ecount_part(crgf, *pcElem) BOOL *prgf, __in ULONG crgf, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToBooleanVector LIB "propsys.dll" ALIAS "PropVariantToBooleanVector" ( BYREF propvar AS ANY , BYREF prgf AS LONG , BYVAL crgf AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToInt16Vector(__in REFPROPVARIANT propvar, __out_ecount_part(crgn, *pcElem) SHORT *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt16Vector LIB "propsys.dll" ALIAS "PropVariantToInt16Vector" ( BYREF propvar AS ANY , BYREF prgn AS INTEGER , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToUInt16Vector(__in REFPROPVARIANT propvar, __out_ecount_part(crgn, *pcElem) USHORT *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt16Vector LIB "propsys.dll" ALIAS "PropVariantToUInt16Vector" ( BYREF propvar AS ANY , BYREF prgn AS WORD , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToInt32Vector(__in REFPROPVARIANT propvar, __out_ecount_part(crgn, *pcElem) LONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt32Vector LIB "propsys.dll" ALIAS "PropVariantToInt32Vector" ( BYREF propvar AS ANY , BYREF prgn AS LONG , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToUInt32Vector(__in REFPROPVARIANT propvar, __out_ecount_part(crgn, *pcElem) ULONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt32Vector LIB "propsys.dll" ALIAS "PropVariantToUInt32Vector" ( BYREF propvar AS ANY , BYREF prgn AS QUAD , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToInt64Vector(__in REFPROPVARIANT propvar, __out_ecount_part(crgn, *pcElem) LONGLONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToInt64Vector LIB "propsys.dll" ALIAS "PropVariantToInt64Vector" ( BYREF propvar AS ANY , BYREF prgn AS QUAD , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI PropVariantToUInt64Vector(__in REFPROPVARIANT propvar, __out_ecount_part(crgn, *pcElem) ULONGLONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
' PSSTDAPI PropVariantToDoubleVector(__in REFPROPVARIANT propvar, __out_ecount_part(crgn, *pcElem) DOUBLE *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToDoubleVector LIB "propsys.dll" ALIAS "PropVariantToDoubleVector" ( BYREF propvar AS ANY , BYREF prgn AS DOUBLE , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantToFileTimeVector(__in REFPROPVARIANT propvar, __out_ecount_part(crgft, *pcElem) FILETIME *prgft, __in ULONG crgft, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION PropVariantToFileTimeVector LIB "propsys.dll" ALIAS "PropVariantToFileTimeVector" ( BYREF propvar AS ANY , BYREF prgn AS FILETIME , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToStringVector LIB "propsys.dll" ALIAS "PropVariantToStringVector" ( BYREF propvar AS ANY , BYREF prgsz AS ANY , BYVAL crgsz AS QUAD , BYREF pcElem AS QUAD ) AS LONG
'// Extract data from a propvariant and return an newly allocated vector (free with CoTaskMemFree)
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToBooleanVectorAlloc LIB "propsys.dll" ALIAS "PropVariantToBooleanVectorAlloc" ( BYREF propvar AS ANY , BYREF pprgf AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToInt16VectorAlloc LIB "propsys.dll" ALIAS "PropVariantToInt16VectorAlloc" ( BYREF propvar AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt16VectorAlloc LIB "propsys.dll" ALIAS "PropVariantToUInt16VectorAlloc" ( BYREF propvar AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToInt32VectorAlloc LIB "propsys.dll" ALIAS "PropVariantToInt32VectorAlloc" ( BYREF propvar AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt32VectorAlloc LIB "propsys.dll" ALIAS "PropVariantToUInt32VectorAlloc" ( BYREF propvar AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToInt64VectorAlloc LIB "propsys.dll" ALIAS "PropVariantToInt64VectorAlloc" ( BYREF propvar AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToUInt64VectorAlloc LIB "propsys.dll" ALIAS "PropVariantToUInt64VectorAlloc" ( BYREF propvar AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToDoubleVectorAlloc LIB "propsys.dll" ALIAS "PropVariantToDoubleVectorAlloc" ( BYREF propvar AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToFileTimeVectorAlloc LIB "propsys.dll" ALIAS "PropVariantToFileTimeVectorAlloc" ( BYREF propvar AS ANY , BYREF pprgft AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantToStringVectorAlloc LIB "propsys.dll" ALIAS "PropVariantToStringVectorAlloc" ( BYREF propvar AS ANY , BYREF pprgsz AS QUAD , BYREF pcElem AS QUAD ) AS LONG
'// Extract a single element from a propvariant. If it is a VT_VECTOR or VT_ARRAY, returns the element you request.
'// Otherwise iElem must equal 0 and the function will return the value.
' ========================================================================================
' PSSTDAPI PropVariantGetBooleanElem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out BOOL *pfVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetBooleanElem LIB "propsys.dll" ALIAS "PropVariantGetBooleanElem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pfVal AS LONG ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantGetInt16Elem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out SHORT *pnVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetInt16Elem LIB "propsys.dll" ALIAS "PropVariantGetInt16Elem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS INTEGER ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantGetUInt16Elem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out USHORT *pnVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetUInt16Elem LIB "propsys.dll" ALIAS "PropVariantGetUInt16Elem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS WORD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantGetInt32Elem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out LONG *pnVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetInt32Elem LIB "propsys.dll" ALIAS "PropVariantGetInt32Elem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS LONG ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantGetUInt32Elem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out ULONG *pnVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetUInt32Elem LIB "propsys.dll" ALIAS "PropVariantGetUInt32Elem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS QUAD ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantGetInt64Elem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out LONGLONG *pnVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetInt64Elem LIB "propsys.dll" ALIAS "PropVariantGetInt64Elem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS QUAD ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI PropVariantGetUInt64Elem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out ULONGLONG *pnVal);
' ========================================================================================
' PSSTDAPI PropVariantGetDoubleElem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out DOUBLE *pnVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetDoubleElem LIB "propsys.dll" ALIAS "PropVariantGetDoubleElem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS DOUBLE ) AS LONG
' ========================================================================================
' PSSTDAPI PropVariantGetFileTimeElem(__in REFPROPVARIANT propvar, __in ULONG iElem, __out FILETIME *pftVal);
' ========================================================================================
DECLARE FUNCTION PropVariantGetFileTimeElem LIB "propsys.dll" ALIAS "PropVariantGetFileTimeElem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF pftVal AS FILETIME ) AS LONG
' ========================================================================================
' ========================================================================================
DECLARE FUNCTION PropVariantGetStringElem LIB "propsys.dll" ALIAS "PropVariantGetStringElem" ( BYREF propvar AS ANY , BYVAL iElem AS QUAD , BYREF ppszVal AS QUAD ) AS LONG
'#ifdef __cplusplus
'HRESULT PropVariantGetElem(__in REFPROPVARIANT propvarIn, __in ULONG iElem, __out PROPVARIANT *ppropvar);
'#endif
'// Helpers
' ========================================================================================
' PSSTDAPI_(void) ClearPropVariantArray(__inout_ecount(cVars) PROPVARIANT *rgPropVar, __in UINT cVars);
' ========================================================================================
DECLARE SUB ClearPropVariantArray LIB "propsys.dll" ALIAS "ClearPropVariantArray" ( BYREF rgPropVar AS ANY , BYVAL cvars AS QUAD ) ' void
' enum PROPVAR_COMPARE_UNIT
%EQUATE `PVCU_DEFAULT = 0
%EQUATE `PVCU_SECOND = 1
%EQUATE `PVCU_MINUTE = 2
%EQUATE `PVCU_HOUR = 3
%EQUATE `PVCU_DAY = 4
%EQUATE `PVCU_MONTH = 5
%EQUATE `PVCU_YEAR = 6
' enum PROPVAR_COMPARE_FLAGS
%EQUATE `PVCF_DEFAULT = &H00000000& ' // When comparing strings, use StrCmpLogical
%EQUATE `PVCF_TREATEMPTYASGREATERTHAN = &H00000001& ' // Empty/null values are greater-than non-empty values
%EQUATE `PVCF_USESTRCMP = &H00000002& ' // When comparing strings, use StrCmp
%EQUATE `PVCF_USESTRCMPC = &H00000004& ' // When comparing strings, use StrCmpC
%EQUATE `PVCF_USESTRCMPI = &H00000008& ' // When comparing strings, use StrCmpI
%EQUATE `PVCF_USESTRCMPIC = &H00000010& ' // When comparing strings, use StrCmpIC
'typedef int PROPVAR_COMPARE_FLAGS;
'// Comparisons
' ========================================================================================
' PSSTDAPI_(int) PropVariantCompareEx(__in REFPROPVARIANT propvar1, __in REFPROPVARIANT propvar2, __in PROPVAR_COMPARE_UNIT unit, __in PROPVAR_COMPARE_FLAGS flags);
' ========================================================================================
DECLARE FUNCTION PropVariantCompareEx LIB "propsys.dll" ALIAS "PropVariantCompareEx" ( BYREF propvar1 AS ANY , BYREF propvar2 AS ANY , BYVAL unit AS LONG , BYVAL flags AS QUAD ) AS LONG ' int
'#ifdef __cplusplus
'int PropVariantCompare(__in REFPROPVARIANT propvar1, __in REFPROPVARIANT propvar2);
'#endif
' enum PROPVAR_CHANGE_FLAGS
%EQUATE `PVCHF_DEFAULT = &H00000000&
%EQUATE `PVCHF_NOVALUEPROP = &H00000001& ' // Maps to VARIANT_NOVALUEPROP for VariantChangeType
%EQUATE `PVCHF_ALPHABOOL = &H00000002& ' // Maps to VARIANT_ALPHABOOL for VariantChangeType
%EQUATE `PVCHF_NOUSEROVERRIDE = &H00000004& ' // Maps to VARIANT_NOUSEROVERRIDE for VariantChangeType
%EQUATE `PVCHF_LOCALBOOL = &H00000008& ' // Maps to VARIANT_LOCALBOOL for VariantChangeType
%EQUATE `PVCHF_NOHEXSTRING = &H00000010& ' // Don't convert a string that looks like hexadecimal (= &HABCD) to the numerical equivalent
'typedef int PROPVAR_CHANGE_FLAGS;
'// Coersions
' ========================================================================================
' PSSTDAPI PropVariantChangeType(__out PROPVARIANT *ppropvarDest, __in REFPROPVARIANT propvarSrc, __in PROPVAR_CHANGE_FLAGS flags, __in VARTYPE vt);
' ========================================================================================
DECLARE FUNCTION PropVariantChangeType LIB "propsys.dll" ALIAS "PropVariantChangeType" ( BYREF ppropvarDest AS ANY , BYREF propvarSrc AS ANY , BYVAL flags AS LONG , BYVAL vt AS WORD ) AS LONG
'// Conversions
' ========================================================================================
' PSSTDAPI PropVariantToVariant(__in const PROPVARIANT *pPropVar, __out VARIANT *pVar);
' ========================================================================================
DECLARE FUNCTION PropVariantToVariant LIB "propsys.dll" ALIAS "PropVariantToVariant" ( BYREF pPropVar AS ANY , BYREF pVar AS ANY ) AS LONG
' ========================================================================================
' PSSTDAPI VariantToPropVariant(__in const VARIANT* pVar, __out PROPVARIANT* pPropVar);
' ========================================================================================
DECLARE FUNCTION VariantToPropVariant LIB "propsys.dll" ALIAS "VariantToPropVariant" ( BYREF pVar AS ANY , BYREF pPropVar AS ANY ) AS LONG
'// Stg functions
' ========================================================================================
' Serializes a specified PROPVARIANT structure, creating a SERIALIZEDPROPERTYVALUE structure.
' ========================================================================================
DECLARE FUNCTION StgSerializePropVariant LIB "propsys.dll" ALIAS "StgSerializePropVariant" ( BYREF ppropvar AS ANY , BYREF ppProp AS ANY , BYREF pcb AS QUAD ) AS LONG
' ========================================================================================
' Deserializes a specified SERIALIZEDPROPERTYVALUE structure, creating a PROPVARIANT structure.
' PSSTDAPI StgDeserializePropVariant(
' ========================================================================================
DECLARE FUNCTION StgDeserializePropVariant LIB "propsys.dll" ALIAS "StgDeserializePropVariant" ( BYREF pprop AS ANY , BYVAL cbMax AS QUAD , BYREF ppropvar AS ANY ) AS LONG
'//================
'//
'// Variant Helpers
'//
'//================
'#ifdef __cplusplus
'BOOL IsVarTypeFloat(__in VARTYPE vt);
'BOOL IsVariantArray(__in REFVARIANT var);
'BOOL IsVariantString(__in REFVARIANT var);
'BOOL IsVarTypeNumber(__in VARTYPE vt);
'BOOL IsVarTypeInteger(__in VARTYPE vt);
'#endif
'// Initialize a VARIANT
' ========================================================================================
' Initializes a VARIANT structure based on a string resource imbedded in an executable file.
' PSSTDAPI InitVariantFromResource(__in HINSTANCE hinst, __in UINT id, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromResource LIB "propsys.dll" ALIAS "InitVariantFromResource" ( BYVAL hinst AS QUAD , BYVAL id AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with the contents of a buffer.
' PSSTDAPI InitVariantFromBuffer(__in_bcount(cb) const void *pv, __in UINT cb, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromBuffer LIB "propsys.dll" ALIAS "InitVariantFromBuffer" ( BYREF pv AS ANY , BYVAL cb AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure based on a GUID. The structure is initialized as VT_BSTR.
' PSSTDAPI InitVariantFromGUIDAsString(__in REFGUID guid, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromGUIDAsString LIB "propsys.dll" ALIAS "InitVariantFromGUIDAsString" ( BYREF guid AS GUID , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with the contents of a FILETIME structure.
' Creates a VT_DATE variant.
' PSSTDAPI InitVariantFromFileTime(__in const FILETIME *pft, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromFileTime LIB "propsys.dll" ALIAS "InitVariantFromFileTime" ( BYREF pft AS FILETIME , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with an array of FILETIME structures.
 'Creates a VT_ARRAY | VT_DATE variant.
' PSSTDAPI InitVariantFromFileTimeArray(__in_ecount_opt(cElems) const FILETIME *prgft, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromFileTimeArray LIB "propsys.dll" ALIAS "InitVariantFromFileTimeArray" ( BYREF prgft AS FILETIME , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with a string stored in a STRRET structure.
' PSSTDAPI InitVariantFromStrRet(__in STRRET *pstrret, __in PCUITEMID_CHILD pidl, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromStrRet LIB "propsys.dll" ALIAS "InitVariantFromStrRet" ( BYREF pstrret AS STRRET , BYVAL pidl AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with a value stored in another VARIANT structure.
' PSSTDAPI InitVariantFromVariantArrayElem(__in REFVARIANT varIn, __in ULONG iElem, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromVariantArrayElem LIB "propsys.dll" ALIAS "InitVariantFromVariantArrayElem" ( BYREF varIn AS ANY , BYVAL iElem AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure from an array of Boolean values.
' PSSTDAPI InitVariantFromBooleanArray(__in_ecount(cElems) const BOOL *prgf, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromBooleanArray LIB "propsys.dll" ALIAS "InitVariantFromBooleanArray" ( BYREF prgf AS LONG , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with an array of 16-bit integer values.
' PSSTDAPI InitVariantFromInt16Array(__in_ecount(cElems) const SHORT *prgn, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromInt16Array LIB "propsys.dll" ALIAS "InitVariantFromInt16Array" ( BYREF prgn AS INTEGER , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with an array of unsigned 16-bit integer values.
' PSSTDAPI InitVariantFromUInt16Array(__in_ecount(cElems) const USHORT *prgn, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromUInt16Array LIB "propsys.dll" ALIAS "InitVariantFromUInt16Array" ( BYREF prgn AS WORD , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with an array of 32-bit integer values.
' PSSTDAPI InitVariantFromInt32Array(__in_ecount(cElems) const LONG *prgn, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromInt32Array LIB "propsys.dll" ALIAS "InitVariantFromInt32Array" ( BYREF prgn AS LONG , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with an array of unsigned 32-bit integer values.
' PSSTDAPI InitVariantFromUInt32Array(__in_ecount(cElems) const ULONG *prgn, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromUInt32Array LIB "propsys.dll" ALIAS "InitVariantFromUInt32Array" ( BYREF prgn AS QUAD , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with an array of 64-bit integer values.
' PSSTDAPI InitVariantFromInt64Array(__in_ecount(cElems) const LONGLONG *prgn, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromInt64Array LIB "propsys.dll" ALIAS "InitVariantFromInt64Array" ( BYREF prgn AS QUAD , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI InitVariantFromUInt64Array(__in_ecount(cElems) const ULONGLONG *prgn, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
' Initializes a VARIANT structure with an array of values of type DOUBLE.
' PSSTDAPI InitVariantFromDoubleArray(__in_ecount(cElems) const DOUBLE *prgn, __in ULONG cElems, __out VARIANT *pvar);
' ========================================================================================
DECLARE FUNCTION InitVariantFromDoubleArray LIB "propsys.dll" ALIAS "InitVariantFromDoubleArray" ( BYREF prgn AS DOUBLE , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
' ========================================================================================
' Initializes a VARIANT structure with an array of strings.
' PSSTDAPI InitVariantFromStringArray(__in_ecount(cElems) PCWSTR *prgsz, __in ULONG cElems, __out VARIANT *pvar);
' Note: prgb must be an array of wide string pointers allocated with CoTaskMemFree.
' ========================================================================================
DECLARE FUNCTION InitVariantFromStringArray LIB "propsys.dll" ALIAS "InitVariantFromStringArray" ( BYREF prgn AS ANY , BYVAL cElems AS QUAD , BYREF pvar AS ANY ) AS LONG
'#ifdef __cplusplus
'HRESULT InitVariantFromBoolean(__in BOOL fVal, __out VARIANT *pvar);
'HRESULT InitVariantFromInt16(__in SHORT iVal, __out VARIANT *pvar);
'HRESULT InitVariantFromUInt16(__in USHORT uiVal, __out VARIANT *pvar);
'HRESULT InitVariantFromInt32(__in LONG lVal, __out VARIANT *pvar);
'HRESULT InitVariantFromUInt32(__in ULONG ulVal, __out VARIANT *pvar);
'HRESULT InitVariantFromInt64(__in LONGLONG llVal, __out VARIANT *pvar);
'HRESULT InitVariantFromUInt64(__in ULONGLONG ullVal, __out VARIANT *pvar);
'HRESULT InitVariantFromDouble(__in DOUBLE dblVal, __out VARIANT *pvar);
'HRESULT InitVariantFromString(__in PCWSTR psz, __out VARIANT *pvar);
'HRESULT InitVariantFromDispatch(__in_opt IDispatch* pdisp, __out VARIANT *pvar);
'HRESULT InitVariantFromDosDateTime(__in WORD wDate, __in WORD wTime, __out VARIANT *pvar);
'HRESULT InitVariantFromGUIDAsBuffer(__in REFGUID guid, __out VARIANT *pvar);
'#endif
'// Extract data from a VARIANT
' ========================================================================================
' Extracts a BOOL value from a VARIANT structure. If no value exists, then the specified
' default value is returned.
' PSSTDAPI_(BOOL) VariantToBooleanWithDefault(__in REFVARIANT varIn, __in BOOL fDefault);
' ========================================================================================
DECLARE FUNCTION VariantToBooleanWithDefault LIB "propsys.dll" ALIAS "VariantToBooleanWithDefault" ( BYREF varIn AS ANY , BYVAL fDefault AS LONG ) AS LONG
' ========================================================================================
' Extracts an Int16 property value of a variant structure. If no value exists, then the
' specified default value is returned.
' PSSTDAPI_(SHORT) VariantToInt16WithDefault(__in REFVARIANT varIn, __in SHORT iDefault);
' ========================================================================================
DECLARE FUNCTION VariantToInt16WithDefault LIB "propsys.dll" ALIAS "VariantToInt16WithDefault" ( BYREF varIn AS ANY , BYVAL iDefault AS INTEGER ) AS INTEGER ' SHORT
' ========================================================================================
' Extracts an unsigned Int16 property value of a variant structure. If no value exists,
' then the specified default value is returned.
' PSSTDAPI_(USHORT) VariantToUInt16WithDefault(__in REFVARIANT varIn, __in USHORT uiDefault);
' ========================================================================================
DECLARE FUNCTION VariantToUInt16WithDefault LIB "propsys.dll" ALIAS "VariantToUInt16WithDefault" ( BYREF varIn AS ANY , BYVAL uiDefault AS WORD ) AS WORD ' USHORT
' ========================================================================================
' Extracts an Int32 property value of a variant structure. If no value exists, then the
' specified default value is returned.
' PSSTDAPI_(LONG) VariantToInt32WithDefault(__in REFVARIANT varIn, __in LONG lDefault);
' ========================================================================================
DECLARE FUNCTION VariantToInt32WithDefault LIB "propsys.dll" ALIAS "VariantToInt32WithDefault" ( BYREF varIn AS ANY , BYVAL lDefault AS LONG ) AS LONG
' ========================================================================================
' Extracts unsigned Int32 property value of a variant structure. If no value can be
' extracted, then a default value is assigned.
' PSSTDAPI_(ULONG) VariantToUInt32WithDefault(__in REFVARIANT varIn, __in ULONG ulDefault);
' ========================================================================================
DECLARE FUNCTION VariantToUInt32WithDefault LIB "propsys.dll" ALIAS "VariantToUInt32WithDefault" ( BYREF varIn AS ANY , BYVAL ulDefault AS QUAD ) AS QUAD ' ULONG
' ========================================================================================
' Extracts an Int64 property value of a variant structure. If no value exists, then the
' specified default value is returned.
' PSSTDAPI_(LONGLONG) VariantToInt64WithDefault(__in REFVARIANT varIn, __in LONGLONG llDefault);
' ========================================================================================
DECLARE FUNCTION VariantToInt64WithDefault LIB "propsys.dll" ALIAS "VariantToInt64WithDefault" ( BYREF varIn AS ANY , BYVAL llDefault AS QUAD ) AS QUAD ' LONGLONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI_(ULONGLONG) VariantToUInt64WithDefault(__in REFVARIANT varIn, __in ULONGLONG ullDefault);
' ========================================================================================
' Extracts a DOUBLE value from a VARIANT structure. If no value exists, then the
' specified default value is returned.
' PSSTDAPI_(DOUBLE) VariantToDoubleWithDefault(__in REFVARIANT varIn, __in DOUBLE dblDefault);
' ========================================================================================
DECLARE FUNCTION VariantToDoubleWithDefault LIB "propsys.dll" ALIAS "VariantToDoubleWithDefault" ( BYREF varIn AS ANY , BYVAL dblDefault AS DOUBLE ) AS DOUBLE ' DOUBLE
' ========================================================================================
' Extracts the string property value of a variant structure. If no value exists, then the
' specified default value is returned.
' PSSTDAPI_(PCWSTR) VariantToStringWithDefault(__in REFVARIANT varIn, __in_opt LPCWSTR pszDefault);
' ========================================================================================
DECLARE FUNCTION VariantToStringWithDefault LIB "propsys.dll" ALIAS "VariantToStringWithDefault" ( BYREF varIn AS ANY , OPTIONAL BYREF pszDefault AS WSTRINGZ ) AS QUAD
' ========================================================================================
' Extracts the value of a Boolean property from a VARIANT structure.
' PSSTDAPI VariantToBoolean(__in REFVARIANT varIn, __out BOOL *pfRet);
' ========================================================================================
DECLARE FUNCTION VariantToBoolean LIB "propsys.dll" ALIAS "VariantToBoolean" ( BYREF varIn AS ANY , BYREF pfRet AS LONG ) AS LONG
' ========================================================================================
' Extracts the Int16 property value of a variant structure.
' PSSTDAPI VariantToInt16(__in REFVARIANT varIn, __out SHORT *piRet);
' ========================================================================================
DECLARE FUNCTION VariantToInt16 LIB "propsys.dll" ALIAS "VariantToInt16" ( BYREF varIn AS ANY , BYREF piRet AS INTEGER ) AS LONG
' ========================================================================================
' Extracts an unsigned Int16 property value of a variant structure.
' PSSTDAPI VariantToUInt16(__in REFVARIANT varIn, __out USHORT *puiRet);
' ========================================================================================
DECLARE FUNCTION VariantToUInt16 LIB "propsys.dll" ALIAS "VariantToUInt16" ( BYREF varIn AS ANY , BYREF puiRet AS WORD ) AS LONG
' ========================================================================================
' Extracts an Int32 property value of a variant structure.
' PSSTDAPI VariantToInt32(__in REFVARIANT varIn, __out LONG *plRet);
' ========================================================================================
DECLARE FUNCTION VariantToInt32 LIB "propsys.dll" ALIAS "VariantToInt32" ( BYREF varIn AS ANY , BYREF plRet AS LONG ) AS LONG
' ========================================================================================
' Extracts unsigned Int32 property value of a variant structure.
' PSSTDAPI VariantToUInt32(__in REFVARIANT varIn, __out ULONG *pulRet);
' ========================================================================================
DECLARE FUNCTION VariantToUInt32 LIB "propsys.dll" ALIAS "VariantToUInt32" ( BYREF varIn AS ANY , BYREF pulRet AS QUAD ) AS LONG
' ========================================================================================
' Extracts an Int64 property value of a variant structure.
' PSSTDAPI VariantToInt64(__in REFVARIANT varIn, __out LONGLONG *pllRet);
' ========================================================================================
DECLARE FUNCTION VariantToInt64 LIB "propsys.dll" ALIAS "VariantToInt64" ( BYREF varIn AS ANY , BYREF pllRet AS QUAD ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI VariantToUInt64(__in REFVARIANT varIn, __out ULONGLONG *pullRet);
' ========================================================================================
' Extracts a DOUBLE value from a VARIANT structure.
' PSSTDAPI VariantToDouble(__in REFVARIANT varIn, __out DOUBLE *pdblRet);
' ========================================================================================
DECLARE FUNCTION VariantToDouble LIB "propsys.dll" ALIAS "VariantToDouble" ( BYREF varIn AS ANY , BYREF pdblRet AS DOUBLE ) AS LONG
' ========================================================================================
' Extracts the contents of a buffer stored in a VARIANT structure of type VT_ARRRAY | VT_UI1.
' PSSTDAPI VariantToBuffer(__in REFVARIANT varIn, __out_bcount(cb) void *pv, __in UINT cb);
' ========================================================================================
DECLARE FUNCTION VariantToBuffer LIB "propsys.dll" ALIAS "VariantToBuffer" ( BYREF varIn AS ANY , BYREF pv AS ANY , BYVAL cb AS QUAD ) AS LONG ' UINT cb
' ========================================================================================
' Extracts a GUID property value of a variant structure.
' PSSTDAPI VariantToGUID(__in REFVARIANT varIn, __out GUID *pguid);
' ========================================================================================
DECLARE FUNCTION VariantToGUID LIB "propsys.dll" ALIAS "VariantToGUID" ( BYREF varIn AS ANY , BYREF pguid AS GUID ) AS LONG
' ========================================================================================
' Extracts the variant value of a variant structure to a string.
' PSSTDAPI VariantToString(__in REFVARIANT varIn, __out_ecount(cchBuf) PWSTR pszBuf, __in UINT cchBuf);
' ========================================================================================
DECLARE FUNCTION VariantToString LIB "propsys.dll" ALIAS "VariantToString" ( BYREF varIn AS ANY , BYREF pszBuf AS WSTRINGZ , BYVAL cchBuf AS QUAD ) AS LONG
' ========================================================================================
' Extracts the variant value of a variant structure to a newly-allocated string.
' ========================================================================================
DECLARE FUNCTION VariantToStringAlloc LIB "propsys.dll" ALIAS "VariantToStringAlloc" ( BYREF varIn AS ANY , BYREF ppszBuf AS QUAD ) AS LONG
' ========================================================================================
' Extracts a date and time value in Microsoft MS-DOS format from a VARIANT structure.
' PSSTDAPI VariantToDosDateTime(__in REFVARIANT varIn, __out WORD *pwDate, __out WORD *pwTime);
' ========================================================================================
DECLARE FUNCTION VariantToDosDateTime LIB "propsys.dll" ALIAS "VariantToDosDateTime" ( BYREF varIn AS ANY , BYREF pwDate AS WORD , BYREF pwTime AS WORD ) AS LONG
' ========================================================================================
' If the source variant is a VT_BSTR, extracts string and places it into a STRRET structure.
' ========================================================================================
DECLARE FUNCTION VariantToStrRet LIB "propsys.dll" ALIAS "VariantToStrRet" ( BYREF varIn AS ANY , BYREF pstrret AS STRRET ) AS LONG
' ========================================================================================
' Extracts a FILETIME structure from a variant structure.
' PSSTDAPI VariantToFileTime(__in REFVARIANT varIn, __in PSTIME_FLAGS stfOut, __out FILETIME* pftOut);
' ========================================================================================
DECLARE FUNCTION VariantToFileTime LIB "propsys.dll" ALIAS "VariantToFileTime" ( BYREF varIn AS ANY , BYVAL stfOut AS QUAD , BYREF pftOut AS FILETIME ) AS LONG
' ========================================================================================
' Get the element count. Returns number of elements for values of type VT_ARRAY; returns 1 otherwise.
' PSSTDAPI_(ULONG) VariantGetElementCount(__in REFVARIANT varIn);
' ========================================================================================
DECLARE FUNCTION VariantGetElementCount LIB "propsys.dll" ALIAS "VariantGetElementCount" ( BYREF varIn AS ANY ) AS QUAD ' ULONG
'// Extract data from a VARIANT into a vector
' ========================================================================================
' Extracts an array of Boolean values from a VARIANT structure.
' PSSTDAPI VariantToBooleanArray(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) BOOL *prgf, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION VariantToBooleanArray LIB "propsys.dll" ALIAS "VariantToBooleanArray" ( BYREF var AS ANY , BYREF prgf AS LONG , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into an Int16 array.
' PSSTDAPI VariantToInt16Array(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) SHORT *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION VariantToInt16Array LIB "propsys.dll" ALIAS "VariantToInt16Array" ( BYREF var AS ANY , BYREF prgn AS INTEGER , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated unsigned Int16 array.
' PSSTDAPI VariantToUInt16Array(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) USHORT *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION VariantToUInt16Array LIB "propsys.dll" ALIAS "VariantToUInt16Array" ( BYREF var AS ANY , BYREF prgn AS WORD , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into an Int32 array.
' PSSTDAPI VariantToInt32Array(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) LONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION VariantToInt32Array LIB "propsys.dll" ALIAS "VariantToInt32Array" ( BYREF var AS ANY , BYREF prgn AS LONG , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into an unsigned Int32 array.
' PSSTDAPI VariantToUInt32Array(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) ULONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION VariantToUInt32Array LIB "propsys.dll" ALIAS "VariantToUInt32Array" ( BYREF var AS ANY , BYREF prgn AS QUAD , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into an unsigned Int64 array.
' PSSTDAPI VariantToInt64Array(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) LONGLONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION VariantToInt64Array LIB "propsys.dll" ALIAS "VariantToInt64Array" ( BYREF var AS ANY , BYREF prgn AS QUAD , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI VariantToUInt64Array(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) ULONGLONG *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
' Extracts an array of DOUBLE values from a VARIANT structure.
' PSSTDAPI VariantToDoubleArray(__in REFVARIANT var, __out_ecount_part(crgn, *pcElem) DOUBLE *prgn, __in ULONG crgn, __out ULONG *pcElem);
' ========================================================================================
DECLARE FUNCTION VariantToDoubleArray LIB "propsys.dll" ALIAS "VariantToDoubleArray" ( BYREF var AS ANY , BYREF prgn AS DOUBLE , BYVAL crgn AS QUAD , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a String array.
' ========================================================================================
DECLARE FUNCTION VariantToStringArray LIB "propsys.dll" ALIAS "VariantToStringArray" ( BYREF var AS ANY , BYREF prgsz AS ANY , BYVAL crgsz AS QUAD , BYREF pcElem AS QUAD ) AS LONG
'// Extract data from a VARIANT into a newly allocated vector (free with CoTaskMemFree)
' ========================================================================================
' Allocates an array of BOOL values then extracts data from a VARIANT structure into that array.
' ========================================================================================
DECLARE FUNCTION VariantToBooleanArrayAlloc LIB "propsys.dll" ALIAS "VariantToBooleanArrayAlloc" ( BYREF var AS ANY , BYREF pprgf AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated Int16 array.
' ========================================================================================
DECLARE FUNCTION VariantToInt16ArrayAlloc LIB "propsys.dll" ALIAS "VariantToInt16ArrayAlloc" ( BYREF var AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated unsigned Int16 array.
' ========================================================================================
DECLARE FUNCTION VariantToUInt16ArrayAlloc LIB "propsys.dll" ALIAS "VariantToUInt16ArrayAlloc" ( BYREF var AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated Int32 array.
' ========================================================================================
DECLARE FUNCTION VariantToInt32ArrayAlloc LIB "propsys.dll" ALIAS "VariantToInt32ArrayAlloc" ( BYREF var AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated unsigned Int32 array.
' ========================================================================================
DECLARE FUNCTION VariantToUInt32ArrayAlloc LIB "propsys.dll" ALIAS "VariantToUInt32ArrayAlloc" ( BYREF var AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated Int64 array.
' ========================================================================================
DECLARE FUNCTION VariantToInt64ArrayAlloc LIB "propsys.dll" ALIAS "VariantToInt64ArrayAlloc" ( BYREF var AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated unsigned Int64 array.
' ========================================================================================
DECLARE FUNCTION VariantToUInt64ArrayAlloc LIB "propsys.dll" ALIAS "VariantToUInt64ArrayAlloc" ( BYREF var AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Allocates an array of DOUBLE values then extracts data from a VARIANT structure into that array.
' ========================================================================================
DECLARE FUNCTION VariantToDoubleArrayAlloc LIB "propsys.dll" ALIAS "VariantToDoubleArrayAlloc" ( BYREF var AS ANY , BYREF pprgn AS ANY , BYREF pcElem AS QUAD ) AS LONG
' ========================================================================================
' Extracts data from a vector structure into a newly-allocated String array.
' ========================================================================================
DECLARE FUNCTION VariantToStringArrayAlloc LIB "propsys.dll" ALIAS "VariantToStringArrayAlloc" ( BYREF var AS ANY , BYREF pprgsz AS ANY , BYREF pcElem AS QUAD ) AS LONG
'// Get a single element of a VARIANT. If it is type VT_ARRAY, returns a the requested element. Otherwise
'// iElem must equal 0 and the function returns the value.
' ========================================================================================
' Extracts a single Boolean element from a variant structure.
' PSSTDAPI VariantGetBooleanElem(__in REFVARIANT var, __in ULONG iElem, __out BOOL *pfVal);
' ========================================================================================
DECLARE FUNCTION VariantGetBooleanElem LIB "propsys.dll" ALIAS "VariantGetBooleanElem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF pfVal AS LONG ) AS LONG
' ========================================================================================
' Extracts a single Int16 element from a variant structure.
' PSSTDAPI VariantGetInt16Elem(__in REFVARIANT var, __in ULONG iElem, __out SHORT *pnVal);
' ========================================================================================
DECLARE FUNCTION VariantGetInt16Elem LIB "propsys.dll" ALIAS "VariantGetInt16Elem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS INTEGER ) AS LONG
' ========================================================================================
' Extracts a single unsigned Int16 element from a variant structure.
' PSSTDAPI VariantGetUInt16Elem(__in REFVARIANT var, __in ULONG iElem, __out USHORT *pnVal);
' ========================================================================================
DECLARE FUNCTION VariantGetUInt16Elem LIB "propsys.dll" ALIAS "VariantGetUInt16Elem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS WORD ) AS LONG
' ========================================================================================
' Extracts a single Int32 element from a variant structure.
' PSSTDAPI VariantGetInt32Elem(__in REFVARIANT var, __in ULONG iElem, __out LONG *pnVal);
' ========================================================================================
DECLARE FUNCTION VariantGetInt32Elem LIB "propsys.dll" ALIAS "VariantGetInt32Elem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS LONG ) AS LONG
' ========================================================================================
' Extracts a single unsigned Int32 element from a variant structure.
' PSSTDAPI VariantGetUInt32Elem(__in REFVARIANT var, __in ULONG iElem, __out ULONG *pnVal);
' ========================================================================================
DECLARE FUNCTION VariantGetUInt32Elem LIB "propsys.dll" ALIAS "VariantGetUInt32Elem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS QUAD ) AS LONG
' ========================================================================================
' Extracts a single Int64 element from a variant structure.
' PSSTDAPI VariantGetInt64Elem(__in REFVARIANT var, __in ULONG iElem, __out LONGLONG *pnVal);
' ========================================================================================
DECLARE FUNCTION VariantGetInt64Elem LIB "propsys.dll" ALIAS "VariantGetInt64Elem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS QUAD ) AS LONG
' PB doesn't currently support unsigned quads.
' PSSTDAPI VariantGetUInt64Elem(__in REFVARIANT var, __in ULONG iElem, __out ULONGLONG *pnVal);
' ========================================================================================
' Extracts one double element from a variant structure.
' PSSTDAPI VariantGetDoubleElem(__in REFVARIANT var, __in ULONG iElem, __out DOUBLE *pnVal);
' ========================================================================================
DECLARE FUNCTION VariantGetDoubleElem LIB "propsys.dll" ALIAS "VariantGetDoubleElem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF pnVal AS DOUBLE ) AS LONG
' ========================================================================================
' Extracts a single wide string element from a variant structure.
' ========================================================================================
DECLARE FUNCTION VariantGetStringElem LIB "propsys.dll" ALIAS "VariantGetStringElem" ( BYREF var AS ANY , BYVAL iElem AS QUAD , BYREF ppszVal AS QUAD ) AS LONG
'#ifdef __cplusplus
'HRESULT VariantGetElem(__in REFVARIANT varIn, __in ULONG iElem, __out VARIANT *pvar);
'#endif
'// Helpers
' ========================================================================================
' Frees the memory and references used by an array of VARIANT structures stored in an array.
' PSSTDAPI_(void) ClearVariantArray(__inout_ecount(cvars) VARIANT *pvars, __in UINT cvars);
' ========================================================================================
DECLARE SUB ClearVariantArray LIB "propsys.dll" ALIAS "ClearVariantArray" ( BYREF pvars AS ANY , BYVAL cvars AS QUAD ) ' void
' ========================================================================================
' Compares two variant structures, based on default comparison rules.
' PSSTDAPI_(int) VariantCompare(__in REFVARIANT var1, __in REFVARIANT var2);
' ========================================================================================
DECLARE FUNCTION VariantCompare LIB "propsys.dll" ALIAS "VariantCompare" ( BYREF var1 AS ANY , BYREF var2 AS ANY ) AS LONG ' int
'//===========================
'//
'// Property-specific notions
'//
'//===========================
'// The progress bar property control uses a specially formatted PROPVARIANT to convey the look of the progress bar
'// propvar.vt = VT_UI4
'// propvar.caul.pElems[0] = current progress
'// propvar.caul.pElems[1] = total progress
'// propvar.caul.pElems[2] = DRAWPROGRESSFLAGS (see below);
' enum DRAWPROGRESSFLAGS
%EQUATE `DPF_NONE = &H0 ' // No progress flags.
%EQUATE `DPF_MARQUEE = &H1 ' // The progress bar should draw in marquee mode.
%EQUATE `DPF_MARQUEE_COMPLETE = &H2 ' // The marquee format progress bar has completed.
%EQUATE `DPF_ERROR = &H4 ' // The progress bar should be drawn in the error state.
%EQUATE `DPF_WARNING = &H8 ' // The progress bar should be drawn in the warning state.
%EQUATE `DPF_STOPPED = &H10 ' // The progress bar is stopped.
'//================
'//
'// Inline Helpers
'//
'//================
'#if defined(__cplusplus) && !defined(NO_PROPVAR_INLINES)
' ========================================================================================
' Initializes a given PROPVARIANT structure as a VT_BOOL using a specified Boolean vlaue.
' ========================================================================================
'inline HRESULT InitPropVariantFromBoolean(__in BOOL fVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_BOOL;
' ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitPropVariantFromBoolean (BYVAL fVal AS LONG, BYREF ppropvar AS PROPVARIANT) AS LONG
 ppropvar.vt = %VT_BOOL
 ppropvar.boolVal = IIF&(fVal <> 0, %VARIANT_TRUE, %VARIANT_FALSE)
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure with a 16-bit integer value.
' ========================================================================================
'inline HRESULT InitPropVariantFromInt16(__in SHORT nVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_I2;
' ppropvar->iVal = nVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitPropVariantFromInt16 (BYVAL nVal AS INTEGER, BYREF ppropvar AS PROPVARIANT) AS LONG
 ppropvar.vt = %VT_I2
 ppropvar.iVal = nVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure with an unsigned 16-bit integer value.
' ========================================================================================
'inline HRESULT InitPropVariantFromUInt16(__in USHORT uiVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_UI2;
' ppropvar->uiVal = uiVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitPropVariantFromUInt16 (BYVAL uiVal AS WORD, BYREF ppropvar AS PROPVARIANT) AS LONG
 ppropvar.vt = %VT_UI2
 ppropvar.uiVal = uiVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure with a 32-bit integer value.
' ========================================================================================
'inline HRESULT InitPropVariantFromInt32(__in LONG lVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_I4;
' ppropvar->lVal = lVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitPropVariantFromInt32 (BYVAL lVal AS LONG, BYREF ppropvar AS PROPVARIANT) AS LONG
 ppropvar.vt = %VT_I4
 ppropvar.lVal = lVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure with a 32-bit integer value.
' ========================================================================================
'inline HRESULT InitPropVariantFromUInt32(__in ULONG ulVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_UI4;
' ppropvar->ulVal = ulVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitPropVariantFromUInt32 (BYVAL ulVal AS DWORD, BYREF ppropvar AS PROPVARIANT) AS LONG
 ppropvar.vt = %VT_UI4
 ppropvar.ulVal = ulVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure with a 64-bit integer value.
' ========================================================================================
'inline HRESULT InitPropVariantFromInt64(__in LONGLONG llVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_I8;
' ppropvar->hVal.QuadPart = llVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitPropVariantFromInt64 (BYVAL llVal AS QUAD, BYREF ppropvar AS PROPVARIANT) AS LONG
 ppropvar.vt = %VT_I8
 ppropvar.hVal = llVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' PB doesn't currently support unsigned quads.
'inline HRESULT InitPropVariantFromUInt64(__in ULONGLONG ullVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_UI8;
' ppropvar->uhVal.QuadPart = ullVal;
' return S_OK;
'}
' ========================================================================================
' Initializes a PROPVARIANT structure with a value of type DOUBLE.
' ========================================================================================
'inline HRESULT InitPropVariantFromDouble(__in DOUBLE dblVal, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_R8;
' ppropvar->dblVal = dblVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitPropVariantFromDouble (BYVAL dblVal AS DOUBLE, BYREF ppropvar AS PROPVARIANT) AS LONG
 ppropvar.vt = %VT_R8
 ppropvar.dblVal = dblVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure based on a specified string.
' ========================================================================================
'inline HRESULT InitPropVariantFromString(__in PCWSTR psz, __out PROPVARIANT *ppropvar)
'{
' ppropvar->vt = VT_LPWSTR;
' HRESULT hr = SHStrDupW(psz, &ppropvar->pwszVal);
' if (FAILED(hr))
' {
' PropVariantInit(ppropvar);
' }
' return hr;
'}
' ========================================================================================
FUNCTION InitPropVariantFromString (BYREF psz AS WSTRINGZ, BYREF ppropvar AS PROPVARIANT) AS LONG
 LOCAL hr AS LONG
 ppropvar.vt = %VT_LPWSTR
 hr = SHStrDupW(psz, ppropvar.pwszVal)
 IF FAILED(hr) THEN PropVariantInit(ppropvar)
 FUNCTION = hr
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure based on a GUID. The structure is initialized as
' VT_ARRAY | VT_UI1.
' ========================================================================================
'inline HRESULT InitPropVariantFromGUIDAsBuffer(__in REFGUID guid, __out PROPVARIANT *ppropvar)
'{
' return InitPropVariantFromBuffer(&guid, sizeof(GUID), ppropvar);
'}
' ========================================================================================
FUNCTION InitPropVariantFromGUIDAsBuffer (BYREF rguid AS GUID, BYREF ppropvar AS PROPVARIANT) AS LONG
 FUNCTION = InitPropVariantFromBuffer(rguid, 16, ppropvar)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Specifies whether a PROPVARIANT structure has a vector type.
' ========================================================================================
'inline BOOL IsPropVariantVector(__in REFPROPVARIANT propvar)
'{
' return (propvar.vt & (VT_ARRAY | VT_VECTOR));
'}
' ========================================================================================
FUNCTION IsPropVariantVector (BYREF propvar AS PROPVARIANT) AS LONG
 FUNCTION = propvar.vt AND (%VT_ARRAY OR %VT_VECTOR)
END FUNCTION
' ========================================================================================
' ========================================================================================
' If TRUE, propvar contains a unicode string.
' Use PropVariantToStringWithDefault(propvar, NULL) to retrieve it.
' ========================================================================================
'inline BOOL IsPropVariantString(__in REFPROPVARIANT propvar)
'{
' return (PropVariantToStringWithDefault(propvar, NULL) != NULL);
'}
' ========================================================================================
FUNCTION IsPropVariantString (BYREF propvar AS PROPVARIANT) AS LONG
 FUNCTION = PropVariantToStringWithDefault(propvar, BYVAL %NULL) <> %NULL
END FUNCTION
' ========================================================================================
'// Handles int instead of LONG
'inline HRESULT PropVariantToInt32(__in REFPROPVARIANT propvarIn, __out int *piRet)
'{
' return PropVariantToInt32(propvarIn, (LONG*)piRet);
'}
'// Handles UINT instead of ULONG
'inline HRESULT PropVariantToUInt32(__in REFPROPVARIANT propvarIn, __out UINT *piRet)
'{
' return PropVariantToUInt32(propvarIn, (ULONG*)piRet);
'}
' ========================================================================================
' Extracts class identifier (CLSID) property value of a PROPVARIANT structure.
' ========================================================================================
'inline HRESULT PropVariantToCLSID(__in REFPROPVARIANT propvarIn, __out CLSID *pclsid)
'{
' return PropVariantToGUID(propvarIn, (GUID*)pclsid);
'}
' ========================================================================================
FUNCTION PropVariantToCLSID (BYREF propvarIn AS PROPVARIANT, BYREF pclsid AS GUID) AS LONG
 FUNCTION = PropVariantToGUID(propvarIn, pclsid)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Compares two PROPVARIANT structures, based on default comparison units and settings.
' ========================================================================================
'inline int PropVariantCompare(__in REFPROPVARIANT propvar1, __in REFPROPVARIANT propvar2)
'{
' return PropVariantCompareEx(propvar1, propvar2, PVCU_DEFAULT, PVCF_DEFAULT);
'}
' ========================================================================================
FUNCTION PropVariantCompare (BYREF propvar1 AS PROPVARIANT, BYREF propvar2 AS PROPVARIANT) AS LONG
 FUNCTION = PropVariantCompareEx(propvar1, propvar2, %PVCU_DEFAULT, %PVCF_DEFAULT)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a PROPVARIANT structure based on a specified element in another PROPVARIANT structure.
' ========================================================================================
'inline HRESULT PropVariantGetElem(__in REFPROPVARIANT propvarIn, __in ULONG iElem, __out PROPVARIANT *ppropvar)
'{
' return InitPropVariantFromPropVariantVectorElem(propvarIn, iElem, ppropvar);
'}
' ========================================================================================
FUNCTION PropVariantGetElem (BYREF propvarIn AS PROPVARIANT, BYVAL iElem AS DWORD, BYREF ppropvar AS PROPVARIANT) AS LONG
 FUNCTION = InitPropVariantFromPropVariantVectorElem(propvarIn, iElem, ppropvar)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with a Boolean value.
' ========================================================================================
'inline HRESULT InitVariantFromBoolean(__in BOOL fVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_BOOL;
' pvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromBoolean (BYVAL fVal AS LONG, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_BOOL
 pvar.boolVal = IIF&(fVal <> 0, %VARIANT_TRUE, %VARIANT_FALSE)
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with a 16-bit integer value.
' ========================================================================================
'inline HRESULT InitVariantFromInt16(__in short iVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_I2;
' pvar->iVal = iVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromInt16 (BYVAL iVal AS INTEGER, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_I2
 pvar.iVal = iVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with an unsigned 16-bit integer value.
' ========================================================================================
'inline HRESULT InitVariantFromUInt16(__in USHORT uiVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_UI2;
' pvar->uiVal = uiVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromUInt16 (BYVAL uiVal AS WORD, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_UI2
 pvar.uiVal = uiVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with a 32-bit integer value.
' ========================================================================================
'inline HRESULT InitVariantFromInt32(__in LONG lVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_I4;
' pvar->lVal = lVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromInt32 (BYVAL lVal AS LONG, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_I4
 pvar.lVal = lVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with an unsigned 32-bit integer value.
' ========================================================================================
'inline HRESULT InitVariantFromUInt32(__in ULONG ulVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_UI4;
' pvar->ulVal = ulVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromUInt32 (BYVAL ulVal AS DWORD, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_UI4
 pvar.ulVal = ulVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with a 64-bit integer value.
' ========================================================================================
'inline HRESULT InitVariantFromInt64(__in LONGLONG llVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_I8;
' pvar->llVal = llVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromInt64 (BYVAL llVal AS QUAD, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_I8
 pvar.llVal = llVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' PB doesn't currently support unsigned quads.
'inline HRESULT InitVariantFromUInt64(__in ULONGLONG ullVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_UI8;
' pvar->ullVal = ullVal;
' return S_OK;
'}
' ========================================================================================
' Initializes a VARIANT structure with a value of type DOUBLE.
' ========================================================================================
'inline HRESULT InitVariantFromDouble(__in DOUBLE dblVal, __out VARIANT *pvar)
'{
' pvar->vt = VT_R8;
' pvar->dblVal = dblVal;
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromDouble (BYVAL dblVal AS DOUBLE, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_R8
 pvar.dblVal = dblVal
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with a string.
' ========================================================================================
'inline HRESULT InitVariantFromString(__in PCWSTR psz, __out VARIANT *pvar)
'{
' pvar->vt = VT_BSTR;
' pvar->bstrVal = SysAllocString(psz);
' HRESULT hr = pvar->bstrVal ? S_OK : (psz ? S_OK : E_OUTOFMEMORY);
' if (FAILED(hr))
' {
' VariantInit(pvar);
' }
' return hr;
'}
' ========================================================================================
FUNCTION InitVariantFromString (BYREF psz AS WSTRINGZ, BYREF pvar AS tagVARIANT) AS LONG
 LOCAL hr AS LONG
 pvar.vt = %VT_BSTR
 pvar.bstrVal = SysAllocString(psz)
 hr = IIF&(pvar.bstrVal <> 0, %S_OK, %E_OUTOFMEMORY)
 IF FAILED(hr) THEN VariantInit(pvar)
 FUNCTION = hr
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure based on an instance of an IDispatch object.
' ========================================================================================
'inline HRESULT InitVariantFromDispatch(__in_opt IDispatch* pdisp, __out VARIANT *pvar)
'{
' pvar->vt = VT_DISPATCH;
' pvar->pdispVal = pdisp;
' if (pvar->pdispVal)
' {
' (pvar->pdispVal)->AddRef();
' }
' return S_OK;
'}
' ========================================================================================
FUNCTION InitVariantFromDispatch (BYVAL pDisp AS IDispatch, BYREF pvar AS tagVARIANT) AS LONG
 LOCAL hr AS LONG
 pvar.vt = %VT_DISPATCH
 pvar.pdispVal = OBJPTR(pDisp)
 IF pvar.pdispVal THEN pDisp.AddRef
 FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure with a date and time given in the format used by
' Microsoft MS-DOS. The date and time values are converted to the format used to store
' date and time in a VARIANT.
' ========================================================================================
'inline HRESULT InitVariantFromDosDateTime(__in WORD wDate, __in WORD wTime, __out VARIANT *pvar)
'{
' pvar->vt = VT_DATE;
' return DosDateTimeToVariantTime(wDate, wTime, &pvar->date) ? S_OK : S_FALSE;
'}
' ========================================================================================
FUNCTION InitVariantFromDosDateTime(BYVAL wDate AS WORD, BYVAL wTime AS WORD, BYREF pvar AS tagVARIANT) AS LONG
 pvar.vt = %VT_DATE
 FUNCTION = IIF&(DosDateTimeToVariantTime(wDate, wTime, pvar.date) = %TRUE, %S_OK, %S_FALSE)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Returns whether a VARTYPE is a float.
' ========================================================================================
'inline BOOL IsVarTypeFloat(__in VARTYPE vt)
'{
' return (vt == VT_R4 || vt == VT_R8);
'}
' ========================================================================================
FUNCTION IsVarTypeFloat (BYVAL vt AS WORD) AS LONG
 FUNCTION = (vt = %VT_R4 OR vt = %VT_R8)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Specifies whether a variant is an array.
' ========================================================================================
'inline BOOL IsVariantArray(__in REFVARIANT var)
'{
' return (var.vt & VT_ARRAY);
'}
' ========================================================================================
FUNCTION IsVariantArray (BYREF var AS tagVARIANT) AS LONG
 FUNCTION = (var.vt AND %VT_ARRAY)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Specifies whether a variant is a string.
' If TRUE, you can use VariantToStringCast to obtain the string pointer
' ========================================================================================
'inline BOOL IsVariantString(__in REFVARIANT var)
'{
' return (VariantToStringWithDefault(var, NULL) != NULL);
'}
' ========================================================================================
FUNCTION IsVariantString (BYREF var AS tagVARIANT) AS LONG
 FUNCTION = VariantToStringWithDefault(var, BYVAL %NULL) <> %NULL
END FUNCTION
' ========================================================================================
' ========================================================================================
' Specifies whether VARTYPE is a number.
' ========================================================================================
'inline BOOL IsVarTypeNumber(__in VARTYPE vt)
'{
' return IsVarTypeInteger(vt) || IsVarTypeFloat(vt);
'}
' ========================================================================================
FUNCTION IsVarTypeNumber (BYVAL vt AS WORD) AS LONG
 FUNCTION = IsVarTypeInteger(vt) OR IsVarTypeFloat(vt)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Returns whether a VARTYPE is a signed integer.
' ========================================================================================
'inline BOOL IsVarTypeSignedInteger(__in VARTYPE vt)
'{
' BOOL fRet = FALSE;
' switch (vt)
' {
' case VT_I1:
' case VT_I2:
' case VT_I4:
' case VT_I8:
' fRet = TRUE;
' }
' return fRet;
'}
' ========================================================================================
FUNCTION IsVarTypeSignedInteger (BYVAL vt AS WORD) AS LONG
 LOCAL fRet AS LONG
 fRet = %FALSE
 SELECT CASE vt
 CASE %VT_I1, %VT_I2, %VT_I4, %VT_I8
 fRet = %TRUE
 END SELECT
 FUNCTION = fRet
END FUNCTION
' ========================================================================================
' ========================================================================================
' Returns whether a VARTYPE is an unsigned integer.
' ========================================================================================
'inline BOOL IsVarTypeUnsignedInteger(__in VARTYPE vt)
'{
' BOOL fRet = FALSE;
' switch (vt)
' {
' case VT_UI1:
' case VT_UI2:
' case VT_UI4:
' case VT_UI8:
' fRet = TRUE;
' }
' return fRet;
'}
' ========================================================================================
FUNCTION IsVarTypeUnsignedInteger (BYVAL vt AS WORD) AS LONG
 LOCAL fRet AS LONG
 fRet = %FALSE
 SELECT CASE vt
 CASE %VT_UI1, %VT_UI2, %VT_UI4, %VT_UI8
 fRet = %TRUE
 END SELECT
 FUNCTION = fRet
END FUNCTION
' ========================================================================================
' ========================================================================================
' Returns whether a VARTYPE is an integer.
' ========================================================================================
'inline BOOL IsVarTypeInteger(__in VARTYPE vt)
'{
' return IsVarTypeSignedInteger(vt) || IsVarTypeUnsignedInteger(vt);
'}
' ========================================================================================
FUNCTION IsVarTypeInteger (BYVAL vt AS WORD) AS LONG
 FUNCTION = IsVarTypeSignedInteger(vt) OR IsVarTypeUnsignedInteger(vt)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Initializes a VARIANT structure based on a GUID. The structure is initialized as
' VT_ARRAY | VT_UI1.
' ========================================================================================
'inline HRESULT InitVariantFromGUIDAsBuffer(__in REFGUID guid, __out VARIANT *pvar)
'{
' return InitVariantFromBuffer(&guid, sizeof(GUID), pvar);
'}
' ========================================================================================
FUNCTION InitVariantFromGUIDAsBuffer (BYREF rguid AS GUID, BYREF pvar AS tagVARIANT) AS LONG
 FUNCTION = InitVariantFromBuffer(rguid, 16, pvar)
END FUNCTION
' ========================================================================================
'// Handles int instead of LONG
'inline HRESULT VariantToInt32(__in REFVARIANT varIn, __out int *piRet)
'{
' return VariantToInt32(varIn, (LONG*)piRet);
'}
'// Handles UINT instead of ULONG
'inline HRESULT VariantToUInt32(__in REFVARIANT varIn, __out UINT *piRet)
'{
' return VariantToUInt32(varIn, (ULONG*)piRet);
'}
' ========================================================================================
' Initializes a VARIANT structure from a specified variant element.
' ========================================================================================
'inline HRESULT VariantGetElem(__in REFVARIANT varIn, __in ULONG iElem, __out VARIANT *pvar)
'{
' return InitVariantFromVariantArrayElem(varIn, iElem, pvar);
'}
' ========================================================================================
FUNCTION VariantGetElem (BYREF varIn AS tagVARIANT, BYVAL iElem AS DWORD, BYREF pvar AS tagVARIANT) AS LONG
 FUNCTION = InitVariantFromVariantArrayElem(varIn, iElem, pvar)
END FUNCTION
' ========================================================================================
'#endif // __cplusplus
#ENDIF
