ReactOS  0.4.12-dev-914-g71f84a3
propvar.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "winuser.h"
#include "shlobj.h"
#include "propvarutil.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for propvar.c:

Go to the source code of this file.

Macros

#define NONAMELESSUNION
 
#define CMP_INT_VALUE(var)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (propsys)
 
static HRESULT PROPVAR_ConvertFILETIME (const FILETIME *ft, PROPVARIANT *ppropvarDest, VARTYPE vt)
 
static HRESULT PROPVAR_ConvertNumber (REFPROPVARIANT pv, int dest_bits, BOOL dest_signed, LONGLONG *res)
 
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)
 
HRESULT WINAPI PropVariantToStringAlloc (REFPROPVARIANT propvarIn, WCHAR **ret)
 
PCWSTR WINAPI PropVariantToStringWithDefault (REFPROPVARIANT propvarIn, LPCWSTR pszDefault)
 
HRESULT WINAPI PropVariantChangeType (PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
 
static void PROPVAR_GUIDToWSTR (REFGUID guid, WCHAR *str)
 
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)
 
static DWORD PROPVAR_HexToNum (const WCHAR *hex)
 
static HRESULT PROPVAR_WCHARToGUID (const WCHAR *str, int len, GUID *guid)
 
HRESULT WINAPI PropVariantToGUID (const PROPVARIANT *ppropvar, GUID *guid)
 
HRESULT WINAPI VariantToGUID (const VARIANT *pvar, GUID *guid)
 
static BOOL isemptyornull (const PROPVARIANT *propvar)
 
INT WINAPI PropVariantCompareEx (REFPROPVARIANT propvar1, REFPROPVARIANT propvar2, PROPVAR_COMPARE_UNIT unit, PROPVAR_COMPARE_FLAGS flags)
 

Macro Definition Documentation

◆ CMP_INT_VALUE

#define CMP_INT_VALUE (   var)
Value:
do { \
if (propvar1->u.var > propvar2_converted->u.var) \
res = 1; \
else if (propvar1->u.var < propvar2_converted->u.var) \
res = -1; \
else \
res = 0; \
} while (0)

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 28 of file propvar.c.

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().

◆ isemptyornull()

static BOOL isemptyornull ( const PROPVARIANT *  propvar)
static

Definition at line 723 of file propvar.c.

724 {
725  if (propvar->vt == VT_EMPTY || propvar->vt == VT_NULL)
726  return TRUE;
727  if ((propvar->vt & VT_ARRAY) == VT_ARRAY)
728  {
729  int i;
730  for (i=0; i<propvar->u.parray->cDims; i++)
731  {
732  if (propvar->u.parray->rgsabound[i].cElements != 0)
733  break;
734  }
735  return i == propvar->u.parray->cDims;
736  }
737  /* FIXME: vectors, byrefs, errors? */
738  return FALSE;
739 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by PropVariantCompareEx().

◆ PROPVAR_ConvertFILETIME()

static HRESULT PROPVAR_ConvertFILETIME ( const FILETIME ft,
PROPVARIANT *  ppropvarDest,
VARTYPE  vt 
)
static

Definition at line 43 of file propvar.c.

44 {
46 
48 
49  switch (vt)
50  {
51  case VT_LPSTR:
52  ppropvarDest->u.pszVal = HeapAlloc(GetProcessHeap(), 0, 64);
53  if (!ppropvarDest->u.pszVal)
54  return E_OUTOFMEMORY;
55 
56  sprintf( ppropvarDest->u.pszVal, "%04d/%02d/%02d:%02d:%02d:%02d.%03d",
57  time.wYear, time.wMonth, time.wDay,
58  time.wHour, time.wMinute, time.wSecond,
59  time.wMilliseconds );
60 
61  return S_OK;
62 
63  default:
64  FIXME("Unhandled target type: %d\n", vt);
65  }
66 
67  return E_FAIL;
68 }
__u16 time
Definition: mkdosfs.c:366
#define E_FAIL
Definition: ddrawi.h:102
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
#define S_OK
Definition: intsafe.h:59

Referenced by PropVariantChangeType().

◆ PROPVAR_ConvertNumber()

static HRESULT PROPVAR_ConvertNumber ( REFPROPVARIANT  pv,
int  dest_bits,
BOOL  dest_signed,
LONGLONG res 
)
static

Definition at line 70 of file propvar.c.

72 {
73  BOOL src_signed;
74 
75  switch (pv->vt)
76  {
77  case VT_I1:
78  src_signed = TRUE;
79  *res = pv->u.cVal;
80  break;
81  case VT_UI1:
82  src_signed = FALSE;
83  *res = pv->u.bVal;
84  break;
85  case VT_I2:
86  src_signed = TRUE;
87  *res = pv->u.iVal;
88  break;
89  case VT_UI2:
90  src_signed = FALSE;
91  *res = pv->u.uiVal;
92  break;
93  case VT_I4:
94  src_signed = TRUE;
95  *res = pv->u.lVal;
96  break;
97  case VT_UI4:
98  src_signed = FALSE;
99  *res = pv->u.ulVal;
100  break;
101  case VT_I8:
102  src_signed = TRUE;
103  *res = pv->u.hVal.QuadPart;
104  break;
105  case VT_UI8:
106  src_signed = FALSE;
107  *res = pv->u.uhVal.QuadPart;
108  break;
109  case VT_EMPTY:
110  src_signed = FALSE;
111  *res = 0;
112  break;
113  case VT_LPSTR:
114  {
115  char *end;
116  *res = _strtoi64(pv->u.pszVal, &end, 0);
117  if (pv->u.pszVal == end)
118  return DISP_E_TYPEMISMATCH;
119  src_signed = *res < 0;
120  break;
121  }
122  case VT_LPWSTR:
123  case VT_BSTR:
124  {
125  WCHAR *end;
126  *res = strtolW(pv->u.pwszVal, &end, 0);
127  if (pv->u.pwszVal == end)
128  return DISP_E_TYPEMISMATCH;
129  src_signed = *res < 0;
130  break;
131  }
132  default:
133  FIXME("unhandled vt %d\n", pv->vt);
134  return E_NOTIMPL;
135  }
136 
137  if (*res < 0 && src_signed != dest_signed)
139 
140  if (dest_bits < 64)
141  {
142  if (dest_signed)
143  {
144  if (*res >= ((LONGLONG)1 << (dest_bits-1)) ||
145  *res < ((LONGLONG)-1 << (dest_bits-1)))
147  }
148  else
149  {
150  if ((ULONGLONG)(*res) >= ((ULONGLONG)1 << dest_bits))
152  }
153  }
154 
155  return S_OK;
156 }
#define TRUE
Definition: types.h:120
Definition: compat.h:1932
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
Definition: compat.h:1948
Definition: compat.h:1944
_Check_return_ __MINGW_EXTENSION _CRTIMP __int64 __cdecl _strtoi64(_In_z_ const char *_String, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define strtolW(s, e, b)
Definition: unicode.h:33
GLuint GLuint end
Definition: gl.h:1545
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
#define ERROR_ARITHMETIC_OVERFLOW
Definition: winerror.h:351
int64_t LONGLONG
Definition: typedefs.h:66
#define DISP_E_TYPEMISMATCH
Definition: winerror.h:2514
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:65
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613
Definition: compat.h:1931

Referenced by PropVariantChangeType(), PropVariantToBoolean(), PropVariantToInt16(), PropVariantToInt32(), PropVariantToInt64(), PropVariantToUInt16(), PropVariantToUInt32(), and PropVariantToUInt64().

◆ PROPVAR_GUIDToWSTR()

static void PROPVAR_GUIDToWSTR ( REFGUID  guid,
WCHAR str 
)
static

Definition at line 514 of file propvar.c.

515 {
516  static const WCHAR format[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X',
517  '-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X',
518  '%','0','2','X','%','0','2','X','%','0','2','X','}',0};
519 
520  sprintfW(str, format, guid->Data1, guid->Data2, guid->Data3,
521  guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
522  guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
523 }
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
const GUID * guid
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define sprintfW
Definition: unicode.h:58

Referenced by InitPropVariantFromGUIDAsString(), and InitVariantFromGUIDAsString().

◆ PROPVAR_HexToNum()

static DWORD PROPVAR_HexToNum ( const WCHAR hex)
inlinestatic

Definition at line 617 of file propvar.c.

618 {
619  DWORD ret;
620 
621  if(hex[0]>='0' && hex[0]<='9')
622  ret = hex[0]-'0';
623  else if(hex[0]>='a' && hex[0]<='f')
624  ret = hex[0]-'a'+10;
625  else if(hex[0]>='A' && hex[0]<='F')
626  ret = hex[0]-'A'+10;
627  else
628  return -1;
629 
630  ret <<= 4;
631  if(hex[1]>='0' && hex[1]<='9')
632  return ret + hex[1]-'0';
633  else if(hex[1]>='a' && hex[1]<='f')
634  return ret + hex[1]-'a'+10;
635  else if(hex[1]>='A' && hex[1]<='F')
636  return ret + hex[1]-'A'+10;
637  else
638  return -1;
639 }
static const char hex[16]
Definition: profile.c:123
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret

Referenced by PROPVAR_WCHARToGUID().

◆ PROPVAR_WCHARToGUID()

static HRESULT PROPVAR_WCHARToGUID ( const WCHAR str,
int  len,
GUID guid 
)
inlinestatic

Definition at line 641 of file propvar.c.

642 {
643  DWORD i, val=0;
644  const WCHAR *p;
645 
646  memset(guid, 0, sizeof(GUID));
647 
648  if(len!=38 || str[0]!='{' || str[9]!='-' || str[14]!='-'
649  || str[19]!='-' || str[24]!='-' || str[37]!='}') {
650  WARN("Error parsing %s\n", debugstr_w(str));
651  return E_INVALIDARG;
652  }
653 
654  p = str+1;
655  for(i=0; i<4 && val!=-1; i++) {
657  guid->Data1 = (guid->Data1<<8) + val;
658  p += 2;
659  }
660  p++;
661  for(i=0; i<2 && val!=-1; i++) {
663  guid->Data2 = (guid->Data2<<8) + val;
664  p += 2;
665  }
666  p++;
667  for(i=0; i<2 && val!=-1; i++) {
669  guid->Data3 = (guid->Data3<<8) + val;
670  p += 2;
671  }
672  p++;
673  for(i=0; i<8 && val!=-1; i++) {
674  if(i == 2)
675  p++;
676 
677  val = guid->Data4[i] = PROPVAR_HexToNum(p);
678  p += 2;
679  }
680 
681  if(val == -1) {
682  WARN("Error parsing %s\n", debugstr_w(str));
683  memset(guid, 0, sizeof(GUID));
684  return E_INVALIDARG;
685  }
686  return S_OK;
687 }
#define WARN(fmt,...)
Definition: debug.h:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const GUID * guid
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static DWORD PROPVAR_HexToNum(const WCHAR *hex)
Definition: propvar.c:617
#define S_OK
Definition: intsafe.h:59
GLfloat GLfloat p
Definition: glext.h:8902
#define memset(x, y, z)
Definition: compat.h:39

Referenced by PropVariantToGUID(), and VariantToGUID().

◆ 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  unit,
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().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( propsys  )