ReactOS  0.4.12-dev-934-g9a4676f
propvarutil.h File Reference
#include <shtypes.h>
#include <shlwapi.h>
Include dependency graph for propvarutil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int PROPVAR_CHANGE_FLAGS
 
typedef int PROPVAR_COMPARE_UNIT
 
typedef int PROPVAR_COMPARE_FLAGS
 

Enumerations

enum  tagPROPVAR_CHANGE_FLAGS {
  PVCHF_DEFAULT = 0x00000000, PVCHF_NOVALUEPROP = 0x00000001, PVCHF_ALPHABOOL = 0x00000002, PVCHF_NOUSEROVERRIDE = 0x00000004,
  PVCHF_LOCALBOOL = 0x00000008, PVCHF_NOHEXSTRING = 0x00000010
}
 
enum  tagPROPVAR_COMPARE_UNIT {
  PVCU_DEFAULT = 0x00000000, PVCU_SECOND = 0x00000001, PVCU_MINUTE = 0x00000002, PVCU_HOUR = 0x00000003,
  PVCU_DAY = 0x00000004, PVCU_MONTH = 0x00000005, PVCU_YEAR = 0x00000006
}
 
enum  tagPROPVAR_COMPARE_FLAGS {
  PVCF_DEFAULT = 0x00000000, PVCF_TREATEMPTYASGREATERTHAN = 0x00000001, PVCF_USESTRCMP = 0x00000002, PVCF_USESTRCMPC = 0x00000004,
  PVCF_USESTRCMPI = 0x00000008, PVCF_USESTRCMPIC = 0x00000010
}
 

Functions

HRESULT WINAPI PropVariantChangeType (PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
 
HRESULT WINAPI InitPropVariantFromGUIDAsString (REFGUID guid, PROPVARIANT *ppropvar)
 
HRESULT WINAPI InitVariantFromGUIDAsString (REFGUID guid, VARIANT *pvar)
 
HRESULT WINAPI InitPropVariantFromBuffer (const VOID *pv, UINT cb, PROPVARIANT *ppropvar)
 
HRESULT WINAPI InitPropVariantFromCLSID (REFCLSID clsid, PROPVARIANT *ppropvar)
 
HRESULT WINAPI InitVariantFromBuffer (const VOID *pv, UINT cb, VARIANT *pvar)
 
HRESULT WINAPI PropVariantToGUID (const PROPVARIANT *ppropvar, GUID *guid)
 
HRESULT WINAPI VariantToGUID (const VARIANT *pvar, GUID *guid)
 
INT WINAPI PropVariantCompareEx (REFPROPVARIANT propvar1, REFPROPVARIANT propvar2, PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags)
 
HRESULT WINAPI PropVariantToInt16 (REFPROPVARIANT propvarIn, SHORT *ret)
 
HRESULT WINAPI PropVariantToInt32 (REFPROPVARIANT propvarIn, LONG *ret)
 
HRESULT WINAPI PropVariantToInt64 (REFPROPVARIANT propvarIn, LONGLONG *ret)
 
HRESULT WINAPI PropVariantToUInt16 (REFPROPVARIANT propvarIn, USHORT *ret)
 
HRESULT WINAPI PropVariantToUInt32 (REFPROPVARIANT propvarIn, ULONG *ret)
 
HRESULT WINAPI PropVariantToUInt64 (REFPROPVARIANT propvarIn, ULONGLONG *ret)
 
HRESULT WINAPI PropVariantToBoolean (REFPROPVARIANT propvarIn, BOOL *ret)
 
PCWSTR WINAPI PropVariantToStringWithDefault (REFPROPVARIANT propvarIn, LPCWSTR pszDefault)
 
HRESULT WINAPI PropVariantToStringAlloc (REFPROPVARIANT propvarIn, WCHAR **ret)
 

Variables

enum tagPROPVAR_CHANGE_FLAGS uuid
 

Typedef Documentation

◆ PROPVAR_CHANGE_FLAGS

Definition at line 35 of file propvarutil.h.

◆ PROPVAR_COMPARE_FLAGS

Definition at line 60 of file propvarutil.h.

◆ PROPVAR_COMPARE_UNIT

Definition at line 48 of file propvarutil.h.

Enumeration Type Documentation

◆ tagPROPVAR_CHANGE_FLAGS

Enumerator
PVCHF_DEFAULT 
PVCHF_NOVALUEPROP 
PVCHF_ALPHABOOL 
PVCHF_NOUSEROVERRIDE 
PVCHF_LOCALBOOL 
PVCHF_NOHEXSTRING 

Definition at line 25 of file propvarutil.h.

26 {
27  PVCHF_DEFAULT = 0x00000000,
28  PVCHF_NOVALUEPROP = 0x00000001,
29  PVCHF_ALPHABOOL = 0x00000002,
30  PVCHF_NOUSEROVERRIDE = 0x00000004,
31  PVCHF_LOCALBOOL = 0x00000008,
32  PVCHF_NOHEXSTRING = 0x00000010,
33 };

◆ tagPROPVAR_COMPARE_FLAGS

Enumerator
PVCF_DEFAULT 
PVCF_TREATEMPTYASGREATERTHAN 
PVCF_USESTRCMP 
PVCF_USESTRCMPC 
PVCF_USESTRCMPI 
PVCF_USESTRCMPIC 

Definition at line 50 of file propvarutil.h.

51 {
52  PVCF_DEFAULT = 0x00000000,
53  PVCF_TREATEMPTYASGREATERTHAN = 0x00000001,
54  PVCF_USESTRCMP = 0x00000002,
55  PVCF_USESTRCMPC = 0x00000004,
56  PVCF_USESTRCMPI = 0x00000008,
57  PVCF_USESTRCMPIC = 0x00000010,
58 };

◆ tagPROPVAR_COMPARE_UNIT

Enumerator
PVCU_DEFAULT 
PVCU_SECOND 
PVCU_MINUTE 
PVCU_HOUR 
PVCU_DAY 
PVCU_MONTH 
PVCU_YEAR 

Definition at line 37 of file propvarutil.h.

38 {
39  PVCU_DEFAULT = 0x00000000,
40  PVCU_SECOND = 0x00000001,
41  PVCU_MINUTE = 0x00000002,
42  PVCU_HOUR = 0x00000003,
43  PVCU_DAY = 0x00000004,
44  PVCU_MONTH = 0x00000005,
45  PVCU_YEAR = 0x00000006,
46 };

Function Documentation

◆ InitPropVariantFromBuffer()

HRESULT WINAPI InitPropVariantFromBuffer ( const VOID pv,
UINT  cb,
PROPVARIANT *  ppropvar 
)

Definition at line 559 of file propvar.c.

560 {
561  TRACE("(%p %u %p)\n", pv, cb, ppropvar);
562 
563  ppropvar->u.caub.pElems = CoTaskMemAlloc(cb);
564  if(!ppropvar->u.caub.pElems)
565  return E_OUTOFMEMORY;
566 
567  ppropvar->vt = VT_VECTOR|VT_UI1;
568  ppropvar->u.caub.cElems = cb;
569  memcpy(ppropvar->u.caub.pElems, pv, cb);
570  return S_OK;
571 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD cb
Definition: integrity.c:41
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by test_InitPropVariantFromBuffer().

◆ InitPropVariantFromCLSID()

HRESULT WINAPI InitPropVariantFromCLSID ( REFCLSID  clsid,
PROPVARIANT *  ppropvar 
)

Definition at line 573 of file propvar.c.

574 {
575  TRACE("(%s %p)\n", debugstr_guid(clsid), ppropvar);
576 
577  ppropvar->u.puuid = CoTaskMemAlloc(sizeof(*ppropvar->u.puuid));
578  if(!ppropvar->u.puuid)
579  return E_OUTOFMEMORY;
580 
581  ppropvar->vt = VT_CLSID;
582  memcpy(ppropvar->u.puuid, clsid, sizeof(*ppropvar->u.puuid));
583  return S_OK;
584 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
REFCLSID clsid
Definition: msctf.c:84
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by test_InitPropVariantFromCLSID().

◆ InitPropVariantFromGUIDAsString()

HRESULT WINAPI InitPropVariantFromGUIDAsString ( REFGUID  guid,
PROPVARIANT *  ppropvar 
)

Definition at line 525 of file propvar.c.

526 {
527  TRACE("(%p %p)\n", guid, ppropvar);
528 
529  if(!guid)
530  return E_FAIL;
531 
532  ppropvar->vt = VT_LPWSTR;
533  ppropvar->u.pwszVal = CoTaskMemAlloc(39*sizeof(WCHAR));
534  if(!ppropvar->u.pwszVal)
535  return E_OUTOFMEMORY;
536 
537  PROPVAR_GUIDToWSTR(guid, ppropvar->u.pwszVal);
538  return S_OK;
539 }
#define E_FAIL
Definition: ddrawi.h:102
const GUID * guid
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static void PROPVAR_GUIDToWSTR(REFGUID guid, WCHAR *str)
Definition: propvar.c:514
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by test_InitPropVariantFromGUIDAsString(), and test_PropVariantToGUID().

◆ InitVariantFromBuffer()

HRESULT WINAPI InitVariantFromBuffer ( const VOID pv,
UINT  cb,
VARIANT pvar 
)

Definition at line 586 of file propvar.c.

587 {
588  SAFEARRAY *arr;
589  void *data;
590  HRESULT hres;
591 
592  TRACE("(%p %u %p)\n", pv, cb, pvar);
593 
594  arr = SafeArrayCreateVector(VT_UI1, 0, cb);
595  if(!arr)
596  return E_OUTOFMEMORY;
597 
598  hres = SafeArrayAccessData(arr, &data);
599  if(FAILED(hres)) {
600  SafeArrayDestroy(arr);
601  return hres;
602  }
603 
604  memcpy(data, pv, cb);
605 
607  if(FAILED(hres)) {
608  SafeArrayDestroy(arr);
609  return hres;
610  }
611 
612  V_VT(pvar) = VT_ARRAY|VT_UI1;
613  V_ARRAY(pvar) = arr;
614  return S_OK;
615 }
#define V_ARRAY(A)
Definition: oleauto.h:222
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1139
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static DWORD cb
Definition: integrity.c:41
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1349
SAFEARRAY *WINAPI SafeArrayCreateVector(VARTYPE vt, LONG lLbound, ULONG cElements)
Definition: safearray.c:679
#define V_VT(A)
Definition: oleauto.h:211
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1170

Referenced by test_InitPropVariantFromBuffer().

◆ InitVariantFromGUIDAsString()

HRESULT WINAPI InitVariantFromGUIDAsString ( REFGUID  guid,
VARIANT pvar 
)

Definition at line 541 of file propvar.c.

542 {
543  TRACE("(%p %p)\n", guid, pvar);
544 
545  if(!guid) {
546  FIXME("guid == NULL\n");
547  return E_FAIL;
548  }
549 
550  V_VT(pvar) = VT_BSTR;
551  V_BSTR(pvar) = SysAllocStringLen(NULL, 38);
552  if(!V_BSTR(pvar))
553  return E_OUTOFMEMORY;
554 
556  return S_OK;
557 }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
#define E_FAIL
Definition: ddrawi.h:102
const GUID * guid
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static void PROPVAR_GUIDToWSTR(REFGUID guid, WCHAR *str)
Definition: propvar.c:514
#define TRACE(s)
Definition: solgame.cpp:4
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59

Referenced by test_InitPropVariantFromGUIDAsString(), and test_PropVariantToGUID().

◆ PropVariantChangeType()

HRESULT WINAPI PropVariantChangeType ( PROPVARIANT *  ppropvarDest,
REFPROPVARIANT  propvarSrc,
PROPVAR_CHANGE_FLAGS  flags,
VARTYPE  vt 
)

Definition at line 361 of file propvar.c.

363 {
364  HRESULT hr;
365 
366  FIXME("(%p, %p, %d, %d, %d): semi-stub!\n", ppropvarDest, propvarSrc,
367  propvarSrc->vt, flags, vt);
368 
369  if (vt == propvarSrc->vt)
370  return PropVariantCopy(ppropvarDest, propvarSrc);
371 
372  if (propvarSrc->vt == VT_FILETIME)
373  return PROPVAR_ConvertFILETIME(&propvarSrc->u.filetime, ppropvarDest, vt);
374 
375  switch (vt)
376  {
377  case VT_I1:
378  {
379  LONGLONG res;
380 
382  if (SUCCEEDED(hr))
383  {
384  ppropvarDest->vt = VT_I1;
385  ppropvarDest->u.cVal = (char)res;
386  }
387  return hr;
388  }
389 
390  case VT_UI1:
391  {
392  LONGLONG res;
393 
395  if (SUCCEEDED(hr))
396  {
397  ppropvarDest->vt = VT_UI1;
398  ppropvarDest->u.bVal = (UCHAR)res;
399  }
400  return hr;
401  }
402 
403  case VT_I2:
404  {
405  SHORT res;
407  if (SUCCEEDED(hr))
408  {
409  ppropvarDest->vt = VT_I2;
410  ppropvarDest->u.iVal = res;
411  }
412  return hr;
413  }
414  case VT_UI2:
415  {
416  USHORT res;
418  if (SUCCEEDED(hr))
419  {
420  ppropvarDest->vt = VT_UI2;
421  ppropvarDest->u.uiVal = res;
422  }
423  return hr;
424  }
425  case VT_I4:
426  {
427  LONG res;
429  if (SUCCEEDED(hr))
430  {
431  ppropvarDest->vt = VT_I4;
432  ppropvarDest->u.lVal = res;
433  }
434  return hr;
435  }
436  case VT_UI4:
437  {
438  ULONG res;
440  if (SUCCEEDED(hr))
441  {
442  ppropvarDest->vt = VT_UI4;
443  ppropvarDest->u.ulVal = res;
444  }
445  return hr;
446  }
447  case VT_I8:
448  {
449  LONGLONG res;
451  if (SUCCEEDED(hr))
452  {
453  ppropvarDest->vt = VT_I8;
454  ppropvarDest->u.hVal.QuadPart = res;
455  }
456  return hr;
457  }
458  case VT_UI8:
459  {
460  ULONGLONG res;
462  if (SUCCEEDED(hr))
463  {
464  ppropvarDest->vt = VT_UI8;
465  ppropvarDest->u.uhVal.QuadPart = res;
466  }
467  return hr;
468  }
469 
470  case VT_LPWSTR:
471  case VT_BSTR:
472  {
473  WCHAR *res;
475  if (SUCCEEDED(hr))
476  {
477  ppropvarDest->vt = VT_LPWSTR;
478  ppropvarDest->u.pwszVal = res;
479  }
480  return hr;
481  }
482 
483  case VT_LPSTR:
484  {
485  WCHAR *resW;
487  if (SUCCEEDED(hr))
488  {
489  char *res;
490  DWORD len;
491 
492  len = WideCharToMultiByte(CP_ACP, 0, resW, -1, NULL, 0, NULL, NULL);
494  if (res)
495  {
496  WideCharToMultiByte(CP_ACP, 0, resW, -1, res, len, NULL, NULL);
497  ppropvarDest->vt = VT_LPSTR;
498  ppropvarDest->u.pszVal = res;
499  }
500  else
501  hr = E_OUTOFMEMORY;
502 
503  CoTaskMemFree(resW);
504  }
505  return hr;
506  }
507 
508  default:
509  FIXME("Unhandled dest type: %d\n", vt);
510  return E_FAIL;
511  }
512 }
HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret)
Definition: propvar.c:194
#define TRUE
Definition: types.h:120
Definition: compat.h:1932
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define WideCharToMultiByte
Definition: compat.h:101
Definition: compat.h:1948
HRESULT hr
Definition: shlfolder.c:183
Definition: compat.h:1944
#define CP_ACP
Definition: compat.h:99
static HRESULT PROPVAR_ConvertFILETIME(const FILETIME *ft, PROPVARIANT *ppropvarDest, VARTYPE vt)
Definition: propvar.c:43
#define E_FAIL
Definition: ddrawi.h:102
static REFPROPVARIANT propvarSrc
Definition: suminfo.c:85
HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret)
Definition: propvar.c:170
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
Definition: propvar.c:290
HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
Definition: ole2.c:3068
int64_t LONGLONG
Definition: typedefs.h:66
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
uint64_t ULONGLONG
Definition: typedefs.h:65
unsigned long DWORD
Definition: ntddk_ex.h:95
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
GLbitfield flags
Definition: glext.h:7161
unsigned char UCHAR
Definition: xmlstorage.h:181
HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
Definition: propvar.c:218
GLenum GLsizei len
Definition: glext.h:6722
HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret)
Definition: propvar.c:206
unsigned short USHORT
Definition: pedump.c:61
HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret)
Definition: propvar.c:158
HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret)
Definition: propvar.c:182
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
Definition: compat.h:1931
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by get_token(), MimeBody_GetProp(), PropVariantCompareEx(), and test_PropVariantChangeType_LPWSTR().

◆ PropVariantCompareEx()

INT WINAPI PropVariantCompareEx ( REFPROPVARIANT  propvar1,
REFPROPVARIANT  propvar2,
PROPVAR_COMPARE_UNIT  uint,
PROPVAR_COMPARE_FLAGS  flags 
)

Definition at line 741 of file propvar.c.

743 {
744  const PROPVARIANT *propvar2_converted;
745  PROPVARIANT propvar2_static;
746  HRESULT hr;
747  INT res=-1;
748 
749  TRACE("%p,%p,%x,%x\n", propvar1, propvar2, unit, flags);
750 
751  if (isemptyornull(propvar1))
752  {
753  if (isemptyornull(propvar2))
754  return 0;
755  return (flags & PVCF_TREATEMPTYASGREATERTHAN) ? 1 : -1;
756  }
757 
758  if (isemptyornull(propvar2))
759  return (flags & PVCF_TREATEMPTYASGREATERTHAN) ? -1 : 1;
760 
761  if (propvar1->vt != propvar2->vt)
762  {
763  hr = PropVariantChangeType(&propvar2_static, propvar2, 0, propvar1->vt);
764 
765  if (FAILED(hr))
766  return -1;
767 
768  propvar2_converted = &propvar2_static;
769  }
770  else
771  propvar2_converted = propvar2;
772 
773 #define CMP_INT_VALUE(var) do { \
774  if (propvar1->u.var > propvar2_converted->u.var) \
775  res = 1; \
776  else if (propvar1->u.var < propvar2_converted->u.var) \
777  res = -1; \
778  else \
779  res = 0; \
780  } while (0)
781 
782  switch (propvar1->vt)
783  {
784  case VT_I1:
785  CMP_INT_VALUE(cVal);
786  break;
787  case VT_UI1:
788  CMP_INT_VALUE(bVal);
789  break;
790  case VT_I2:
791  CMP_INT_VALUE(iVal);
792  break;
793  case VT_UI2:
794  CMP_INT_VALUE(uiVal);
795  break;
796  case VT_I4:
797  CMP_INT_VALUE(lVal);
798  break;
799  case VT_UI4:
800  CMP_INT_VALUE(uiVal);
801  break;
802  case VT_I8:
803  CMP_INT_VALUE(hVal.QuadPart);
804  break;
805  case VT_UI8:
806  CMP_INT_VALUE(uhVal.QuadPart);
807  break;
808  case VT_BSTR:
809  case VT_LPWSTR:
810  /* FIXME: Use other string flags. */
812  res = lstrcmpiW(propvar1->u.bstrVal, propvar2_converted->u.bstrVal);
813  else
814  res = lstrcmpW(propvar1->u.bstrVal, propvar2_converted->u.bstrVal);
815  break;
816  case VT_LPSTR:
817  /* FIXME: Use other string flags. */
819  res = lstrcmpiA(propvar1->u.pszVal, propvar2_converted->u.pszVal);
820  else
821  res = lstrcmpA(propvar1->u.pszVal, propvar2_converted->u.pszVal);
822  break;
823  default:
824  FIXME("vartype %d not handled\n", propvar1->vt);
825  res = -1;
826  break;
827  }
828 
829  if (propvar2_converted == &propvar2_static)
830  PropVariantClear(&propvar2_static);
831 
832  return res;
833 }
Definition: compat.h:1932
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
Definition: compat.h:1948
HRESULT hr
Definition: shlfolder.c:183
Definition: compat.h:1944
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2952
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
Definition: propvar.c:361
int32_t INT
Definition: typedefs.h:56
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define FIXME(fmt,...)
Definition: debug.h:110
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
#define CMP_INT_VALUE(var)
static BOOL isemptyornull(const PROPVARIANT *propvar)
Definition: propvar.c:723
GLuint res
Definition: glext.h:9613
Definition: compat.h:1931

Referenced by MetadataHandler_GetValue(), and test_PropVariantCompare().

◆ PropVariantToBoolean()

HRESULT WINAPI PropVariantToBoolean ( REFPROPVARIANT  propvarIn,
BOOL ret 
)

Definition at line 230 of file propvar.c.

231 {
232  static const WCHAR trueW[] = {'t','r','u','e',0};
233  static const WCHAR falseW[] = {'f','a','l','s','e',0};
234  static const WCHAR true2W[] = {'#','T','R','U','E','#',0};
235  static const WCHAR false2W[] = {'#','F','A','L','S','E','#',0};
236  LONGLONG res;
237  HRESULT hr;
238 
239  TRACE("%p,%p\n", propvarIn, ret);
240 
241  *ret = FALSE;
242 
243  switch (propvarIn->vt)
244  {
245  case VT_BOOL:
246  *ret = propvarIn->u.boolVal == VARIANT_TRUE;
247  return S_OK;
248 
249  case VT_LPWSTR:
250  case VT_BSTR:
251  if (!propvarIn->u.pwszVal)
252  return DISP_E_TYPEMISMATCH;
253 
254  if (!lstrcmpiW(propvarIn->u.pwszVal, trueW) || !lstrcmpW(propvarIn->u.pwszVal, true2W))
255  {
256  *ret = TRUE;
257  return S_OK;
258  }
259 
260  if (!lstrcmpiW(propvarIn->u.pwszVal, falseW) || !lstrcmpW(propvarIn->u.pwszVal, false2W))
261  {
262  *ret = FALSE;
263  return S_OK;
264  }
265  break;
266 
267  case VT_LPSTR:
268  if (!propvarIn->u.pszVal)
269  return DISP_E_TYPEMISMATCH;
270 
271  if (!lstrcmpiA(propvarIn->u.pszVal, "true") || !lstrcmpA(propvarIn->u.pszVal, "#TRUE#"))
272  {
273  *ret = TRUE;
274  return S_OK;
275  }
276 
277  if (!lstrcmpiA(propvarIn->u.pszVal, "false") || !lstrcmpA(propvarIn->u.pszVal, "#FALSE#"))
278  {
279  *ret = FALSE;
280  return S_OK;
281  }
282  break;
283  }
284 
285  hr = PROPVAR_ConvertNumber(propvarIn, 64, TRUE, &res);
286  *ret = !!res;
287  return hr;
288 }
#define TRUE
Definition: types.h:120
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
HRESULT hr
Definition: shlfolder.c:183
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
int64_t LONGLONG
Definition: typedefs.h:66
#define DISP_E_TYPEMISMATCH
Definition: winerror.h:2514
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR falseW[]
Definition: json.c:35
int ret
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
static const WCHAR trueW[]
Definition: json.c:34

Referenced by test_PropVariantToBoolean().

◆ PropVariantToGUID()

HRESULT WINAPI PropVariantToGUID ( const PROPVARIANT *  ppropvar,
GUID guid 
)

Definition at line 689 of file propvar.c.

690 {
691  TRACE("%p %p)\n", ppropvar, guid);
692 
693  switch(ppropvar->vt) {
694  case VT_BSTR:
695  return PROPVAR_WCHARToGUID(ppropvar->u.bstrVal, SysStringLen(ppropvar->u.bstrVal), guid);
696  case VT_LPWSTR:
697  return PROPVAR_WCHARToGUID(ppropvar->u.pwszVal, strlenW(ppropvar->u.pwszVal), guid);
698 
699  default:
700  FIXME("unsupported vt: %d\n", ppropvar->vt);
701  return E_NOTIMPL;
702  }
703 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const GUID * guid
static HRESULT PROPVAR_WCHARToGUID(const WCHAR *str, int len, GUID *guid)
Definition: propvar.c:641
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:199
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by test_PropVariantToGUID().

◆ PropVariantToInt16()

HRESULT WINAPI PropVariantToInt16 ( REFPROPVARIANT  propvarIn,
SHORT ret 
)

Definition at line 158 of file propvar.c.

159 {
160  LONGLONG res;
161  HRESULT hr;
162 
163  TRACE("%p,%p\n", propvarIn, ret);
164 
165  hr = PROPVAR_ConvertNumber(propvarIn, 16, TRUE, &res);
166  if (SUCCEEDED(hr)) *ret = (SHORT)res;
167  return hr;
168 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
short SHORT
Definition: pedump.c:59
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
int ret
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropVariantChangeType(), and test_intconversions().

◆ PropVariantToInt32()

HRESULT WINAPI PropVariantToInt32 ( REFPROPVARIANT  propvarIn,
LONG ret 
)

Definition at line 170 of file propvar.c.

171 {
172  LONGLONG res;
173  HRESULT hr;
174 
175  TRACE("%p,%p\n", propvarIn, ret);
176 
177  hr = PROPVAR_ConvertNumber(propvarIn, 32, TRUE, &res);
178  if (SUCCEEDED(hr)) *ret = (LONG)res;
179  return hr;
180 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
long LONG
Definition: pedump.c:60
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
int ret
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropVariantChangeType(), and test_intconversions().

◆ PropVariantToInt64()

HRESULT WINAPI PropVariantToInt64 ( REFPROPVARIANT  propvarIn,
LONGLONG ret 
)

Definition at line 182 of file propvar.c.

183 {
184  LONGLONG res;
185  HRESULT hr;
186 
187  TRACE("%p,%p\n", propvarIn, ret);
188 
189  hr = PROPVAR_ConvertNumber(propvarIn, 64, TRUE, &res);
190  if (SUCCEEDED(hr)) *ret = (LONGLONG)res;
191  return hr;
192 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
int ret
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by propvar_cmp(), PropVariantChangeType(), and test_intconversions().

◆ PropVariantToStringAlloc()

HRESULT WINAPI PropVariantToStringAlloc ( REFPROPVARIANT  propvarIn,
WCHAR **  ret 
)

Definition at line 290 of file propvar.c.

291 {
292  WCHAR *res = NULL;
293  HRESULT hr = S_OK;
294 
295  TRACE("%p,%p semi-stub\n", propvarIn, ret);
296 
297  switch(propvarIn->vt)
298  {
299  case VT_NULL:
300  res = CoTaskMemAlloc(1*sizeof(WCHAR));
301  res[0] = '\0';
302  break;
303 
304  case VT_LPSTR:
305  if(propvarIn->u.pszVal)
306  {
307  DWORD len;
308 
309  len = MultiByteToWideChar(CP_ACP, 0, propvarIn->u.pszVal, -1, NULL, 0);
310  res = CoTaskMemAlloc(len*sizeof(WCHAR));
311  if(!res)
312  return E_OUTOFMEMORY;
313 
314  MultiByteToWideChar(CP_ACP, 0, propvarIn->u.pszVal, -1, res, len);
315  }
316  break;
317 
318  case VT_LPWSTR:
319  case VT_BSTR:
320  if (propvarIn->u.pwszVal)
321  {
322  DWORD size = (lstrlenW(propvarIn->u.pwszVal) + 1) * sizeof(WCHAR);
324  if(!res) return E_OUTOFMEMORY;
325  memcpy(res, propvarIn->u.pwszVal, size);
326  }
327  break;
328 
329  default:
330  FIXME("Unsupported conversion (%d)\n", propvarIn->vt);
331  hr = E_FAIL;
332  break;
333  }
334 
335  *ret = res;
336 
337  return hr;
338 }
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
#define lstrlenW
Definition: compat.h:407
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by PropVariantChangeType(), and test_PropVariantToStringAlloc().

◆ PropVariantToStringWithDefault()

PCWSTR WINAPI PropVariantToStringWithDefault ( REFPROPVARIANT  propvarIn,
LPCWSTR  pszDefault 
)

Definition at line 340 of file propvar.c.

341 {
342  static const WCHAR str_empty[] = {0};
343  if (propvarIn->vt == VT_BSTR)
344  {
345  if (propvarIn->u.bstrVal == NULL)
346  return str_empty;
347 
348  return propvarIn->u.bstrVal;
349  }
350 
351  if (propvarIn->vt == VT_LPWSTR && propvarIn->u.pwszVal != NULL)
352  return propvarIn->u.pwszVal;
353 
354  return pszDefault;
355 }
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_PropVariantToStringWithDefault().

◆ PropVariantToUInt16()

HRESULT WINAPI PropVariantToUInt16 ( REFPROPVARIANT  propvarIn,
USHORT ret 
)

Definition at line 194 of file propvar.c.

195 {
196  LONGLONG res;
197  HRESULT hr;
198 
199  TRACE("%p,%p\n", propvarIn, ret);
200 
201  hr = PROPVAR_ConvertNumber(propvarIn, 16, FALSE, &res);
202  if (SUCCEEDED(hr)) *ret = (USHORT)res;
203  return hr;
204 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
int ret
unsigned short USHORT
Definition: pedump.c:61
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropVariantChangeType(), and test_intconversions().

◆ PropVariantToUInt32()

HRESULT WINAPI PropVariantToUInt32 ( REFPROPVARIANT  propvarIn,
ULONG ret 
)

Definition at line 206 of file propvar.c.

207 {
208  LONGLONG res;
209  HRESULT hr;
210 
211  TRACE("%p,%p\n", propvarIn, ret);
212 
213  hr = PROPVAR_ConvertNumber(propvarIn, 32, FALSE, &res);
214  if (SUCCEEDED(hr)) *ret = (ULONG)res;
215  return hr;
216 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
int ret
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropVariantChangeType(), and test_intconversions().

◆ PropVariantToUInt64()

HRESULT WINAPI PropVariantToUInt64 ( REFPROPVARIANT  propvarIn,
ULONGLONG ret 
)

Definition at line 218 of file propvar.c.

219 {
220  LONGLONG res;
221  HRESULT hr;
222 
223  TRACE("%p,%p\n", propvarIn, ret);
224 
225  hr = PROPVAR_ConvertNumber(propvarIn, 64, FALSE, &res);
226  if (SUCCEEDED(hr)) *ret = (ULONGLONG)res;
227  return hr;
228 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
Definition: propvar.c:70
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
uint64_t ULONGLONG
Definition: typedefs.h:65
int ret
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PropVariantChangeType(), and test_intconversions().

◆ VariantToGUID()

HRESULT WINAPI VariantToGUID ( const VARIANT pvar,
GUID guid 
)

Definition at line 705 of file propvar.c.

706 {
707  TRACE("(%p %p)\n", pvar, guid);
708 
709  switch(V_VT(pvar)) {
710  case VT_BSTR: {
712  if(hres == E_INVALIDARG)
713  return E_FAIL;
714  return hres;
715  }
716 
717  default:
718  FIXME("unsupported vt: %d\n", V_VT(pvar));
719  return E_NOTIMPL;
720  }
721 }
#define E_FAIL
Definition: ddrawi.h:102
const GUID * guid
static HRESULT PROPVAR_WCHARToGUID(const WCHAR *str, int len, GUID *guid)
Definition: propvar.c:641
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define V_VT(A)
Definition: oleauto.h:211
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:199
#define V_BSTR(A)
Definition: oleauto.h:226
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by test_PropVariantToGUID().

Variable Documentation

◆ uuid