ReactOS  0.4.14-dev-358-gbef841c
propsys.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "initguid.h"
#include "propsys.h"
#include "propvarutil.h"
#include "wine/test.h"
Include dependency graph for propsys.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define GUID_MEMBERS(g)   {(g).Data1, (g).Data2, (g).Data3, {(g).Data4[0], (g).Data4[1], (g).Data4[2], (g).Data4[3], (g).Data4[4], (g).Data4[5], (g).Data4[6], (g).Data4[7]}}
 

Functions

 DEFINE_GUID (GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 DEFINE_GUID (dummy_guid, 0xdeadbeef, 0xdead, 0xbeef, 0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0xba, 0xbe)
 
 DEFINE_GUID (expect_guid, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12)
 
static int strcmp_wa (LPCWSTR strw, const char *stra)
 
static void test_PSStringFromPropertyKey (void)
 
static void test_PSPropertyKeyFromString (void)
 
static void test_PSRefreshPropertySchema (void)
 
static void test_InitPropVariantFromGUIDAsString (void)
 
static void test_InitPropVariantFromBuffer (void)
 
static void test_PropVariantToGUID (void)
 
static void test_PropVariantToStringAlloc (void)
 
static void test_PropVariantCompare (void)
 
static void test_intconversions (void)
 
static void test_PropVariantToBoolean (void)
 
static void test_PropVariantToStringWithDefault (void)
 
static void test_PropVariantChangeType_LPWSTR (void)
 
static void test_InitPropVariantFromCLSID (void)
 
 START_TEST (propsys)
 

Variables

static const char topic [] = "wine topic"
 
static const WCHAR topicW [] = {'w','i','n','e',' ','t','o','p','i','c',0}
 
static const WCHAR emptyW [] = {0}
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file propsys.c.

◆ GUID_MEMBERS

#define GUID_MEMBERS (   g)    {(g).Data1, (g).Data2, (g).Data3, {(g).Data4[0], (g).Data4[1], (g).Data4[2], (g).Data4[3], (g).Data4[4], (g).Data4[5], (g).Data4[6], (g).Data4[7]}}

Definition at line 41 of file propsys.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 27 of file propsys.c.

Function Documentation

◆ DEFINE_GUID() [1/3]

DEFINE_GUID ( GUID_NULL  ,
,
,
,
,
,
,
,
,
,
,
 
)

◆ DEFINE_GUID() [2/3]

DEFINE_GUID ( dummy_guid  ,
0xdeadbeef  ,
0xdead  ,
0xbeef  ,
0xde  ,
0xad  ,
0xbe  ,
0xef  ,
0xca  ,
0xfe  ,
0xba  ,
0xbe   
)

◆ DEFINE_GUID() [3/3]

DEFINE_GUID ( expect_guid  ,
0x12345678  ,
0x1234  ,
0x1234  ,
0x12  ,
0x34  ,
0x12  ,
0x34  ,
0x56  ,
0x78  ,
0x90  ,
0x12   
)

◆ START_TEST()

START_TEST ( propsys  )

Definition at line 1251 of file propsys.c.

1252 {
1266 }
static void test_PSRefreshPropertySchema(void)
Definition: propsys.c:438
static void test_PropVariantCompare(void)
Definition: propsys.c:646
static void test_intconversions(void)
Definition: propsys.c:766
static void test_PropVariantToGUID(void)
Definition: propsys.c:558
static void test_PropVariantToStringAlloc(void)
Definition: propsys.c:624
static void test_InitPropVariantFromGUIDAsString(void)
Definition: propsys.c:456
static void test_PropVariantToBoolean(void)
Definition: propsys.c:886
static void test_PSPropertyKeyFromString(void)
Definition: propsys.c:157
static void test_PropVariantChangeType_LPWSTR(void)
Definition: propsys.c:1197
static void test_InitPropVariantFromBuffer(void)
Definition: propsys.c:504
static void test_PSStringFromPropertyKey(void)
Definition: propsys.c:54
static void test_InitPropVariantFromCLSID(void)
Definition: propsys.c:1233
static void test_PropVariantToStringWithDefault(void)
Definition: propsys.c:1097

◆ strcmp_wa()

static int strcmp_wa ( LPCWSTR  strw,
const char stra 
)
static

Definition at line 47 of file propsys.c.

48 {
49  CHAR buf[512];
50  WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
51  return lstrcmpA(stra, buf);
52 }
#define WideCharToMultiByte
Definition: compat.h:101
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
smooth NULL
Definition: ftsmooth.c:416
static const char * strw(LPCWSTR x)
Definition: actctx.c:49

Referenced by test_InitPropVariantFromGUIDAsString().

◆ test_InitPropVariantFromBuffer()

static void test_InitPropVariantFromBuffer ( void  )
static

Definition at line 504 of file propsys.c.

505 {
506  static const char data_in[] = "test";
507  PROPVARIANT propvar;
508  VARIANT var;
509  HRESULT hres;
510  void *data_out;
511  LONG size;
512 
513  hres = InitPropVariantFromBuffer(NULL, 0, &propvar);
514  ok(hres == S_OK, "InitPropVariantFromBuffer returned %x\n", hres);
515  ok(propvar.vt == (VT_VECTOR|VT_UI1), "propvar.vt = %d\n", propvar.vt);
516  ok(propvar.u.caub.cElems == 0, "cElems = %d\n", propvar.u.caub.cElems == 0);
517  PropVariantClear(&propvar);
518 
519  hres = InitPropVariantFromBuffer(data_in, 4, &propvar);
520  ok(hres == S_OK, "InitPropVariantFromBuffer returned %x\n", hres);
521  ok(propvar.vt == (VT_VECTOR|VT_UI1), "propvar.vt = %d\n", propvar.vt);
522  ok(propvar.u.caub.cElems == 4, "cElems = %d\n", propvar.u.caub.cElems == 0);
523  ok(!memcmp(propvar.u.caub.pElems, data_in, 4), "Data inside array is incorrect\n");
524  PropVariantClear(&propvar);
525 
526  hres = InitVariantFromBuffer(NULL, 0, &var);
527  ok(hres == S_OK, "InitVariantFromBuffer returned %x\n", hres);
528  ok(V_VT(&var) == (VT_ARRAY|VT_UI1), "V_VT(&var) = %d\n", V_VT(&var));
529  size = SafeArrayGetDim(V_ARRAY(&var));
530  ok(size == 1, "SafeArrayGetDim returned %d\n", size);
531  hres = SafeArrayGetLBound(V_ARRAY(&var), 1, &size);
532  ok(hres == S_OK, "SafeArrayGetLBound returned %x\n", hres);
533  ok(size == 0, "LBound = %d\n", size);
534  hres = SafeArrayGetUBound(V_ARRAY(&var), 1, &size);
535  ok(hres == S_OK, "SafeArrayGetUBound returned %x\n", hres);
536  ok(size == -1, "UBound = %d\n", size);
537  VariantClear(&var);
538 
539  hres = InitVariantFromBuffer(data_in, 4, &var);
540  ok(hres == S_OK, "InitVariantFromBuffer returned %x\n", hres);
541  ok(V_VT(&var) == (VT_ARRAY|VT_UI1), "V_VT(&var) = %d\n", V_VT(&var));
542  size = SafeArrayGetDim(V_ARRAY(&var));
543  ok(size == 1, "SafeArrayGetDim returned %d\n", size);
544  hres = SafeArrayGetLBound(V_ARRAY(&var), 1, &size);
545  ok(hres == S_OK, "SafeArrayGetLBound returned %x\n", hres);
546  ok(size == 0, "LBound = %d\n", size);
547  hres = SafeArrayGetUBound(V_ARRAY(&var), 1, &size);
548  ok(hres == S_OK, "SafeArrayGetUBound returned %x\n", hres);
549  ok(size == 3, "UBound = %d\n", size);
550  hres = SafeArrayAccessData(V_ARRAY(&var), &data_out);
551  ok(hres == S_OK, "SafeArrayAccessData failed %x\n", hres);
552  ok(!memcmp(data_in, data_out, 4), "Data inside safe array is incorrect\n");
554  ok(hres == S_OK, "SafeArrayUnaccessData failed %x\n", hres);
555  VariantClear(&var);
556 }
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1096
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
#define V_ARRAY(A)
Definition: oleauto.h:222
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1139
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar)
Definition: propvar.c:559
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1068
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1035
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar)
Definition: propvar.c:586
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1170

Referenced by START_TEST().

◆ test_InitPropVariantFromCLSID()

static void test_InitPropVariantFromCLSID ( void  )
static

Definition at line 1233 of file propsys.c.

1234 {
1235  PROPVARIANT propvar;
1236  GUID clsid;
1237  HRESULT hr;
1238 
1239  memset(&propvar, 0, sizeof(propvar));
1240  propvar.vt = VT_I4;
1241  propvar.u.lVal = 15;
1242 
1243  memset(&clsid, 0xcc, sizeof(clsid));
1244  hr = InitPropVariantFromCLSID(&clsid, &propvar);
1245  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1246  ok(propvar.vt == VT_CLSID, "Unexpected type %d.\n", propvar.vt);
1247  ok(IsEqualGUID(propvar.u.puuid, &clsid), "Unexpected puuid value.\n");
1248  PropVariantClear(&propvar);
1249 }
Definition: compat.h:1947
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:82
HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
Definition: propvar.c:573
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_InitPropVariantFromGUIDAsString()

static void test_InitPropVariantFromGUIDAsString ( void  )
static

Definition at line 456 of file propsys.c.

457 {
458  PROPVARIANT propvar;
459  VARIANT var;
460  HRESULT hres;
461  int i;
462 
463  const struct {
464  REFGUID guid;
465  const char *str;
466  } testcases[] = {
467  {&IID_NULL, "{00000000-0000-0000-0000-000000000000}" },
468  {&dummy_guid, "{DEADBEEF-DEAD-BEEF-DEAD-BEEFCAFEBABE}" },
469  };
470 
472  ok(hres == E_FAIL, "InitPropVariantFromGUIDAsString returned %x\n", hres);
473 
474  if(0) {
475  /* Returns strange data on Win7, crashes on older systems */
477 
478  /* Crashes on windows */
481  }
482 
483  for(i=0; i < ARRAY_SIZE(testcases); i++) {
484  memset(&propvar, 0, sizeof(PROPVARIANT));
485  hres = InitPropVariantFromGUIDAsString(testcases[i].guid, &propvar);
486  ok(hres == S_OK, "%d) InitPropVariantFromGUIDAsString returned %x\n", i, hres);
487  ok(propvar.vt == VT_LPWSTR, "%d) propvar.vt = %d\n", i, propvar.vt);
488  ok(!strcmp_wa(propvar.u.pwszVal, testcases[i].str), "%d) propvar.u.pwszVal = %s\n",
489  i, wine_dbgstr_w(propvar.u.pwszVal));
490  CoTaskMemFree(propvar.u.pwszVal);
491 
492  memset(&var, 0, sizeof(VARIANT));
493  hres = InitVariantFromGUIDAsString(testcases[i].guid, &var);
494  ok(hres == S_OK, "%d) InitVariantFromGUIDAsString returned %x\n", i, hres);
495  ok(V_VT(&var) == VT_BSTR, "%d) V_VT(&var) = %d\n", i, V_VT(&var));
496  ok(SysStringLen(V_BSTR(&var)) == 38, "SysStringLen returned %d\n",
497  SysStringLen(V_BSTR(&var)));
498  ok(!strcmp_wa(V_BSTR(&var), testcases[i].str), "%d) V_BSTR(&var) = %s\n",
499  i, wine_dbgstr_w(V_BSTR(&var)));
500  VariantClear(&var);
501  }
502 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
Definition: scsiwmi.h:51
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define E_FAIL
Definition: ddrawi.h:102
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
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar)
Definition: propvar.c:525
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define IID_NULL
Definition: guiddef.h:98
#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
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: propsys.c:47
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar)
Definition: propvar.c:541
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_intconversions()

static void test_intconversions ( void  )
static

Definition at line 766 of file propsys.c.

767 {
768  PROPVARIANT propvar;
769  SHORT sval;
770  USHORT usval;
771  LONG lval;
772  ULONG ulval;
773  LONGLONG llval;
774  ULONGLONG ullval;
775  HRESULT hr;
776 
777  propvar.vt = 0xdead;
778  hr = PropVariantClear(&propvar);
779  ok (FAILED(hr), "PropVariantClear fails on invalid vt.\n");
780 
781  propvar.vt = VT_I8;
782  PropVariantClear(&propvar);
783 
784  propvar.vt = VT_I8;
785  propvar.u.hVal.QuadPart = (ULONGLONG)1 << 63;
786 
787  hr = PropVariantToInt64(&propvar, &llval);
788  ok(hr == S_OK, "hr=%x\n", hr);
789  ok(llval == (ULONGLONG)1 << 63, "got wrong value %s\n", wine_dbgstr_longlong(llval));
790 
791  hr = PropVariantToUInt64(&propvar, &ullval);
793 
794  hr = PropVariantToInt32(&propvar, &lval);
796 
797  hr = PropVariantToUInt32(&propvar, &ulval);
799 
800  hr = PropVariantToInt16(&propvar, &sval);
802 
803  hr = PropVariantToUInt16(&propvar, &usval);
805 
806  propvar.vt = VT_UI8;
807  propvar.u.uhVal.QuadPart = 5;
808 
809  hr = PropVariantToInt64(&propvar, &llval);
810  ok(hr == S_OK, "hr=%x\n", hr);
811  ok(llval == 5, "got wrong value %s\n", wine_dbgstr_longlong(llval));
812 
813  hr = PropVariantToUInt64(&propvar, &ullval);
814  ok(hr == S_OK, "hr=%x\n", hr);
815  ok(ullval == 5, "got wrong value %s\n", wine_dbgstr_longlong(ullval));
816 
817  hr = PropVariantToInt32(&propvar, &lval);
818  ok(hr == S_OK, "hr=%x\n", hr);
819  ok(lval == 5, "got wrong value %d\n", lval);
820 
821  hr = PropVariantToUInt32(&propvar, &ulval);
822  ok(hr == S_OK, "hr=%x\n", hr);
823  ok(ulval == 5, "got wrong value %d\n", ulval);
824 
825  hr = PropVariantToInt16(&propvar, &sval);
826  ok(hr == S_OK, "hr=%x\n", hr);
827  ok(sval == 5, "got wrong value %d\n", sval);
828 
829  hr = PropVariantToUInt16(&propvar, &usval);
830  ok(hr == S_OK, "hr=%x\n", hr);
831  ok(usval == 5, "got wrong value %d\n", usval);
832 
833  propvar.vt = VT_I8;
834  propvar.u.hVal.QuadPart = -5;
835 
836  hr = PropVariantToInt64(&propvar, &llval);
837  ok(hr == S_OK, "hr=%x\n", hr);
838  ok(llval == -5, "got wrong value %s\n", wine_dbgstr_longlong(llval));
839 
840  hr = PropVariantToUInt64(&propvar, &ullval);
842 
843  hr = PropVariantToInt32(&propvar, &lval);
844  ok(hr == S_OK, "hr=%x\n", hr);
845  ok(lval == -5, "got wrong value %d\n", lval);
846 
847  hr = PropVariantToUInt32(&propvar, &ulval);
849 
850  hr = PropVariantToInt16(&propvar, &sval);
851  ok(hr == S_OK, "hr=%x\n", hr);
852  ok(sval == -5, "got wrong value %d\n", sval);
853 
854  hr = PropVariantToUInt16(&propvar, &usval);
856 
857  propvar.vt = VT_UI4;
858  propvar.u.ulVal = 6;
859 
860  hr = PropVariantToInt64(&propvar, &llval);
861  ok(hr == S_OK, "hr=%x\n", hr);
862  ok(llval == 6, "got wrong value %s\n", wine_dbgstr_longlong(llval));
863 
864  propvar.vt = VT_I4;
865  propvar.u.lVal = -6;
866 
867  hr = PropVariantToInt64(&propvar, &llval);
868  ok(hr == S_OK, "hr=%x\n", hr);
869  ok(llval == -6, "got wrong value %s\n", wine_dbgstr_longlong(llval));
870 
871  propvar.vt = VT_UI2;
872  propvar.u.uiVal = 7;
873 
874  hr = PropVariantToInt64(&propvar, &llval);
875  ok(hr == S_OK, "hr=%x\n", hr);
876  ok(llval == 7, "got wrong value %s\n", wine_dbgstr_longlong(llval));
877 
878  propvar.vt = VT_I2;
879  propvar.u.iVal = -7;
880 
881  hr = PropVariantToInt64(&propvar, &llval);
882  ok(hr == S_OK, "hr=%x\n", hr);
883  ok(llval == -7, "got wrong value %s\n", wine_dbgstr_longlong(llval));
884 }
HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret)
Definition: propvar.c:194
Definition: compat.h:1947
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
Definition: compat.h:1963
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret)
Definition: propvar.c:170
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
#define ERROR_ARITHMETIC_OVERFLOW
Definition: winerror.h:351
int64_t LONGLONG
Definition: typedefs.h:66
Llong llval
Definition: format.c:276
LONG HRESULT
Definition: typedefs.h:77
uint64_t ULONGLONG
Definition: typedefs.h:65
HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
Definition: propvar.c:218
HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret)
Definition: propvar.c:206
#define S_OK
Definition: intsafe.h:59
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret)
Definition: propvar.c:158
HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret)
Definition: propvar.c:182
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
Definition: compat.h:1946

Referenced by START_TEST().

◆ test_PropVariantChangeType_LPWSTR()

static void test_PropVariantChangeType_LPWSTR ( void  )
static

Definition at line 1197 of file propsys.c.

1198 {
1199  PROPVARIANT dest, src;
1200  HRESULT hr;
1201 
1202  PropVariantInit(&dest);
1203 
1204  src.vt = VT_NULL;
1206  ok(hr == S_OK, "hr=%x\n", hr);
1207  ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
1208  ok(!lstrcmpW(dest.u.pwszVal, emptyW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal));
1211 
1212  src.vt = VT_LPSTR;
1213  src.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
1214  strcpy(src.u.pszVal, topic);
1216  ok(hr == S_OK, "hr=%x\n", hr);
1217  ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
1218  ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal));
1221 
1222  src.vt = VT_LPWSTR;
1223  src.u.pwszVal = CoTaskMemAlloc( (lstrlenW(topicW)+1) * sizeof(WCHAR));
1224  lstrcpyW(src.u.pwszVal, topicW);
1226  ok(hr == S_OK, "hr=%x\n", hr);
1227  ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
1228  ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal));
1231 }
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
Definition: propvar.c:361
#define lstrlenW
Definition: compat.h:415
static const WCHAR topicW[]
Definition: propsys.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
#define ok(value,...)
Definition: atltest.h:57
static const char topic[]
Definition: propsys.c:43
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static char * dest
Definition: rtl.c:135
static const WCHAR emptyW[]
Definition: propsys.c:45
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by START_TEST().

◆ test_PropVariantCompare()

static void test_PropVariantCompare ( void  )
static

Definition at line 646 of file propsys.c.

647 {
648  PROPVARIANT empty, null, emptyarray, i2_0, i2_2, i4_large, i4_largeneg, i4_2, str_2, str_02, str_b;
649  INT res;
650  static const WCHAR str_2W[] = {'2', 0};
651  static const WCHAR str_02W[] = {'0', '2', 0};
652  static const WCHAR str_bW[] = {'b', 0};
653  SAFEARRAY emptysafearray;
654 
655  PropVariantInit(&empty);
656  PropVariantInit(&null);
657  PropVariantInit(&emptyarray);
658  PropVariantInit(&i2_0);
659  PropVariantInit(&i2_2);
660  PropVariantInit(&i4_large);
661  PropVariantInit(&i4_largeneg);
662  PropVariantInit(&i4_2);
663  PropVariantInit(&str_2);
664  PropVariantInit(&str_b);
665 
666  empty.vt = VT_EMPTY;
667  null.vt = VT_NULL;
668  emptyarray.vt = VT_ARRAY | VT_I4;
669  emptyarray.u.parray = &emptysafearray;
670  emptysafearray.cDims = 1;
671  emptysafearray.fFeatures = FADF_FIXEDSIZE;
672  emptysafearray.cbElements = 4;
673  emptysafearray.cLocks = 0;
674  emptysafearray.pvData = NULL;
675  emptysafearray.rgsabound[0].cElements = 0;
676  emptysafearray.rgsabound[0].lLbound = 0;
677  i2_0.vt = VT_I2;
678  i2_0.u.iVal = 0;
679  i2_2.vt = VT_I2;
680  i2_2.u.iVal = 2;
681  i4_large.vt = VT_I4;
682  i4_large.u.lVal = 65536;
683  i4_largeneg.vt = VT_I4;
684  i4_largeneg.u.lVal = -65536;
685  i4_2.vt = VT_I4;
686  i4_2.u.lVal = 2;
687  str_2.vt = VT_BSTR;
688  str_2.u.bstrVal = SysAllocString(str_2W);
689  str_02.vt = VT_BSTR;
690  str_02.u.bstrVal = SysAllocString(str_02W);
691  str_b.vt = VT_BSTR;
692  str_b.u.bstrVal = SysAllocString(str_bW);
693 
694  res = PropVariantCompareEx(&empty, &empty, 0, 0);
695  ok(res == 0, "res=%i\n", res);
696 
697  res = PropVariantCompareEx(&empty, &null, 0, 0);
698  ok(res == 0, "res=%i\n", res);
699 
700  res = PropVariantCompareEx(&null, &emptyarray, 0, 0);
701  ok(res == 0, "res=%i\n", res);
702 
703  res = PropVariantCompareEx(&null, &i2_0, 0, 0);
704  ok(res == -1, "res=%i\n", res);
705 
706  res = PropVariantCompareEx(&i2_0, &null, 0, 0);
707  ok(res == 1, "res=%i\n", res);
708 
710  ok(res == 1, "res=%i\n", res);
711 
713  ok(res == -1, "res=%i\n", res);
714 
715  res = PropVariantCompareEx(&i2_2, &i2_0, 0, 0);
716  ok(res == 1, "res=%i\n", res);
717 
718  res = PropVariantCompareEx(&i2_0, &i2_2, 0, 0);
719  ok(res == -1, "res=%i\n", res);
720 
721  /* Always return -1 if second value cannot be converted to first type */
722  res = PropVariantCompareEx(&i2_0, &i4_large, 0, 0);
723  ok(res == -1, "res=%i\n", res);
724 
725  res = PropVariantCompareEx(&i2_0, &i4_largeneg, 0, 0);
726  ok(res == -1, "res=%i\n", res);
727 
728  res = PropVariantCompareEx(&i4_large, &i2_0, 0, 0);
729  ok(res == 1, "res=%i\n", res);
730 
731  res = PropVariantCompareEx(&i4_largeneg, &i2_0, 0, 0);
732  ok(res == -1, "res=%i\n", res);
733 
734  res = PropVariantCompareEx(&i2_2, &i4_2, 0, 0);
735  ok(res == 0, "res=%i\n", res);
736 
737  res = PropVariantCompareEx(&i2_2, &str_2, 0, 0);
738  ok(res == 0, "res=%i\n", res);
739 
740  res = PropVariantCompareEx(&i2_2, &str_02, 0, 0);
741  ok(res == 0, "res=%i\n", res);
742 
743  res = PropVariantCompareEx(&str_2, &i2_2, 0, 0);
744  todo_wine ok(res == 0, "res=%i\n", res);
745 
746  res = PropVariantCompareEx(&str_02, &i2_2, 0, 0);
747  ok(res == -1, "res=%i\n", res);
748 
749  res = PropVariantCompareEx(&str_02, &str_2, 0, 0);
750  ok(res == -1, "res=%i\n", res);
751 
752  res = PropVariantCompareEx(&str_02, &str_b, 0, 0);
753  ok(res == -1, "res=%i\n", res);
754 
755  res = PropVariantCompareEx(&str_2, &str_02, 0, 0);
756  ok(res == 1, "res=%i\n", res);
757 
758  res = PropVariantCompareEx(&i4_large, &str_b, 0, 0);
759  todo_wine ok(res == -5 /* ??? */, "res=%i\n", res);
760 
761  SysFreeString(str_2.u.bstrVal);
762  SysFreeString(str_02.u.bstrVal);
763  SysFreeString(str_b.u.bstrVal);
764 }
ULONG cbElements
Definition: compat.h:2006
Definition: compat.h:1947
SAFEARRAYBOUND rgsabound[1]
Definition: compat.h:2009
USHORT fFeatures
Definition: compat.h:2005
INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2, PROPVAR_COMPARE_UNIT unit, PROPVAR_COMPARE_FLAGS flags)
Definition: propvar.c:741
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
USHORT cDims
Definition: compat.h:2004
__wchar_t WCHAR
Definition: xmlstorage.h:180
PVOID pvData
Definition: compat.h:2008
#define todo_wine
Definition: test.h:154
#define ok(value,...)
Definition: atltest.h:57
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
BOOL empty
Definition: button.c:170
GLuint res
Definition: glext.h:9613
Definition: compat.h:1946
ULONG cLocks
Definition: compat.h:2007

Referenced by START_TEST().

◆ test_PropVariantToBoolean()

static void test_PropVariantToBoolean ( void  )
static

Definition at line 886 of file propsys.c.

887 {
888  static WCHAR str_0[] = {'0',0};
889  static WCHAR str_1[] = {'1',0};
890  static WCHAR str_7[] = {'7',0};
891  static WCHAR str_n7[] = {'-','7',0};
892  static WCHAR str_true[] = {'t','r','u','e',0};
893  static WCHAR str_true2[] = {'#','T','R','U','E','#',0};
894  static WCHAR str_true_case[] = {'t','R','U','e',0};
895  static WCHAR str_false[] = {'f','a','l','s','e',0};
896  static WCHAR str_false2[] = {'#','F','A','L','S','E','#',0};
897  static WCHAR str_true_space[] = {'t','r','u','e',' ',0};
898  static WCHAR str_yes[] = {'y','e','s',0};
899  PROPVARIANT propvar;
900  HRESULT hr;
901  BOOL val;
902 
903  /* VT_BOOL */
904  propvar.vt = VT_BOOL;
905  propvar.u.boolVal = VARIANT_FALSE;
906  val = TRUE;
907  hr = PropVariantToBoolean(&propvar, &val);
908  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
909  ok(val == FALSE, "Unexpected value %d\n", val);
910 
911  propvar.vt = VT_BOOL;
912  propvar.u.boolVal = 1;
913  val = TRUE;
914  hr = PropVariantToBoolean(&propvar, &val);
915  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
916  ok(val == FALSE, "Unexpected value %d\n", val);
917 
918  propvar.vt = VT_BOOL;
919  propvar.u.boolVal = VARIANT_TRUE;
920  val = FALSE;
921  hr = PropVariantToBoolean(&propvar, &val);
922  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
923  ok(val == TRUE, "Unexpected value %d\n", val);
924 
925  /* VT_EMPTY */
926  propvar.vt = VT_EMPTY;
927  propvar.u.boolVal = VARIANT_TRUE;
928  val = TRUE;
929  hr = PropVariantToBoolean(&propvar, &val);
930  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
931  ok(val == FALSE, "Unexpected value %d\n", val);
932 
933  /* test integer conversion */
934  propvar.vt = VT_I4;
935  propvar.u.lVal = 0;
936  val = TRUE;
937  hr = PropVariantToBoolean(&propvar, &val);
938  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
939  ok(val == FALSE, "Unexpected value %d\n", val);
940 
941  propvar.vt = VT_I4;
942  propvar.u.lVal = 1;
943  val = FALSE;
944  hr = PropVariantToBoolean(&propvar, &val);
945  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
946  ok(val == TRUE, "Unexpected value %d\n", val);
947 
948  propvar.vt = VT_I4;
949  propvar.u.lVal = 67;
950  val = FALSE;
951  hr = PropVariantToBoolean(&propvar, &val);
952  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
953  ok(val == TRUE, "Unexpected value %d\n", val);
954 
955  propvar.vt = VT_I4;
956  propvar.u.lVal = -67;
957  val = FALSE;
958  hr = PropVariantToBoolean(&propvar, &val);
959  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
960  ok(val == TRUE, "Unexpected value %d\n", val);
961 
962  /* test string conversion */
963  propvar.vt = VT_LPWSTR;
964  propvar.u.pwszVal = str_0;
965  val = TRUE;
966  hr = PropVariantToBoolean(&propvar, &val);
967  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
968  ok(val == FALSE, "Unexpected value %d\n", val);
969 
970  propvar.vt = VT_LPWSTR;
971  propvar.u.pwszVal = str_1;
972  val = FALSE;
973  hr = PropVariantToBoolean(&propvar, &val);
974  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
975  ok(val == TRUE, "Unexpected value %d\n", val);
976 
977  propvar.vt = VT_LPWSTR;
978  propvar.u.pwszVal = str_7;
979  val = FALSE;
980  hr = PropVariantToBoolean(&propvar, &val);
981  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
982  ok(val == TRUE, "Unexpected value %d\n", val);
983 
984  propvar.vt = VT_LPWSTR;
985  propvar.u.pwszVal = str_n7;
986  val = FALSE;
987  hr = PropVariantToBoolean(&propvar, &val);
988  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
989  ok(val == TRUE, "Unexpected value %d\n", val);
990 
991  propvar.vt = VT_LPWSTR;
992  propvar.u.pwszVal = str_true;
993  val = FALSE;
994  hr = PropVariantToBoolean(&propvar, &val);
995  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
996  ok(val == TRUE, "Unexpected value %d\n", val);
997 
998  propvar.vt = VT_LPWSTR;
999  propvar.u.pwszVal = str_true_case;
1000  val = FALSE;
1001  hr = PropVariantToBoolean(&propvar, &val);
1002  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1003  ok(val == TRUE, "Unexpected value %d\n", val);
1004 
1005  propvar.vt = VT_LPWSTR;
1006  propvar.u.pwszVal = str_true2;
1007  val = FALSE;
1008  hr = PropVariantToBoolean(&propvar, &val);
1009  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1010  ok(val == TRUE, "Unexpected value %d\n", val);
1011 
1012  propvar.vt = VT_LPWSTR;
1013  propvar.u.pwszVal = str_false;
1014  val = TRUE;
1015  hr = PropVariantToBoolean(&propvar, &val);
1016  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1017  ok(val == FALSE, "Unexpected value %d\n", val);
1018 
1019  propvar.vt = VT_LPWSTR;
1020  propvar.u.pwszVal = str_false2;
1021  val = TRUE;
1022  hr = PropVariantToBoolean(&propvar, &val);
1023  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1024  ok(val == FALSE, "Unexpected value %d\n", val);
1025 
1026  propvar.vt = VT_LPWSTR;
1027  propvar.u.pwszVal = str_true_space;
1028  val = TRUE;
1029  hr = PropVariantToBoolean(&propvar, &val);
1030  ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
1031  ok(val == FALSE, "Unexpected value %d\n", val);
1032 
1033  propvar.vt = VT_LPWSTR;
1034  propvar.u.pwszVal = str_yes;
1035  val = TRUE;
1036  hr = PropVariantToBoolean(&propvar, &val);
1037  ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
1038  ok(val == FALSE, "Unexpected value %d\n", val);
1039 
1040  propvar.vt = VT_LPWSTR;
1041  propvar.u.pwszVal = NULL;
1042  val = TRUE;
1043  hr = PropVariantToBoolean(&propvar, &val);
1044  ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
1045  ok(val == FALSE, "Unexpected value %d\n", val);
1046 
1047  /* VT_LPSTR */
1048  propvar.vt = VT_LPSTR;
1049  propvar.u.pszVal = (char *)"#TruE#";
1050  val = TRUE;
1051  hr = PropVariantToBoolean(&propvar, &val);
1052  ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
1053  ok(val == FALSE, "Unexpected value %d\n", val);
1054 
1055  propvar.vt = VT_LPSTR;
1056  propvar.u.pszVal = (char *)"#TRUE#";
1057  val = FALSE;
1058  hr = PropVariantToBoolean(&propvar, &val);
1059  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1060  ok(val == TRUE, "Unexpected value %d\n", val);
1061 
1062  propvar.vt = VT_LPSTR;
1063  propvar.u.pszVal = (char *)"tRUe";
1064  val = FALSE;
1065  hr = PropVariantToBoolean(&propvar, &val);
1066  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1067  ok(val == TRUE, "Unexpected value %d\n", val);
1068 
1069  propvar.vt = VT_LPSTR;
1070  propvar.u.pszVal = (char *)"#FALSE#";
1071  val = TRUE;
1072  hr = PropVariantToBoolean(&propvar, &val);
1073  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1074  ok(val == FALSE, "Unexpected value %d\n", val);
1075 
1076  propvar.vt = VT_LPSTR;
1077  propvar.u.pszVal = (char *)"fALSe";
1078  val = TRUE;
1079  hr = PropVariantToBoolean(&propvar, &val);
1080  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1081  ok(val == FALSE, "Unexpected value %d\n", val);
1082 
1083  propvar.vt = VT_LPSTR;
1084  propvar.u.pszVal = (char *)"1";
1085  val = FALSE;
1086  hr = PropVariantToBoolean(&propvar, &val);
1087  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1088  ok(val == TRUE, "Unexpected value %d\n", val);
1089 
1090  propvar.vt = VT_LPSTR;
1091  propvar.u.pszVal = (char *)"-1";
1092  hr = PropVariantToBoolean(&propvar, &val);
1093  ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
1094  ok(val == TRUE, "Unexpected value %d\n", val);
1095 }
#define TRUE
Definition: types.h:120
Definition: compat.h:1947
HRESULT hr
Definition: shlfolder.c:183
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
#define DISP_E_TYPEMISMATCH
Definition: winerror.h:2514
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
Definition: propvar.c:230

Referenced by START_TEST().

◆ test_PropVariantToGUID()

static void test_PropVariantToGUID ( void  )
static

Definition at line 558 of file propsys.c.

559 {
560  PROPVARIANT propvar;
561  VARIANT var;
562  GUID guid;
563  HRESULT hres;
564 
566  ok(hres == S_OK, "InitPropVariantFromGUIDAsString failed %x\n", hres);
567 
568  hres = PropVariantToGUID(&propvar, &guid);
569  ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
570  ok(!memcmp(&IID_NULL, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
571  PropVariantClear(&propvar);
572 
573  hres = InitPropVariantFromGUIDAsString(&dummy_guid, &propvar);
574  ok(hres == S_OK, "InitPropVariantFromGUIDAsString failed %x\n", hres);
575 
576  hres = PropVariantToGUID(&propvar, &guid);
577  ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
578  ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
579 
580  ok(propvar.vt == VT_LPWSTR, "incorrect PROPVARIANT type: %d\n", propvar.vt);
581  propvar.u.pwszVal[1] = 'd';
582  propvar.u.pwszVal[2] = 'E';
583  propvar.u.pwszVal[3] = 'a';
584  hres = PropVariantToGUID(&propvar, &guid);
585  ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
586  ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
587 
588  propvar.u.pwszVal[1] = 'z';
589  hres = PropVariantToGUID(&propvar, &guid);
590  ok(hres == E_INVALIDARG, "PropVariantToGUID returned %x\n", hres);
591  PropVariantClear(&propvar);
592 
593 
595  ok(hres == S_OK, "InitVariantFromGUIDAsString failed %x\n", hres);
596 
597  hres = VariantToGUID(&var, &guid);
598  ok(hres == S_OK, "VariantToGUID failed %x\n", hres);
599  ok(!memcmp(&IID_NULL, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
600  VariantClear(&var);
601 
602  hres = InitVariantFromGUIDAsString(&dummy_guid, &var);
603  ok(hres == S_OK, "InitVariantFromGUIDAsString failed %x\n", hres);
604 
605  hres = VariantToGUID(&var, &guid);
606  ok(hres == S_OK, "VariantToGUID failed %x\n", hres);
607  ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
608 
609  ok(V_VT(&var) == VT_BSTR, "incorrect VARIANT type: %d\n", V_VT(&var));
610  V_BSTR(&var)[1] = 'z';
611  hres = VariantToGUID(&var, &guid);
612  ok(hres == E_FAIL, "VariantToGUID returned %x\n", hres);
613 
614  V_BSTR(&var)[1] = 'd';
615  propvar.vt = V_VT(&var);
616  propvar.u.bstrVal = V_BSTR(&var);
617  V_VT(&var) = VT_EMPTY;
618  hres = PropVariantToGUID(&propvar, &guid);
619  ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
620  ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
621  PropVariantClear(&propvar);
622 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid)
Definition: propvar.c:705
#define E_FAIL
Definition: ddrawi.h:102
const GUID * guid
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar)
Definition: propvar.c:525
HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid)
Definition: propvar.c:689
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define IID_NULL
Definition: guiddef.h:98
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar)
Definition: propvar.c:541
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_PropVariantToStringAlloc()

static void test_PropVariantToStringAlloc ( void  )
static

Definition at line 624 of file propsys.c.

625 {
626  PROPVARIANT prop;
627  WCHAR *str;
628  HRESULT hres;
629 
630  prop.vt = VT_NULL;
631  hres = PropVariantToStringAlloc(&prop, &str);
632  ok(hres == S_OK, "returned %x\n", hres);
633  ok(!lstrcmpW(str, emptyW), "got %s\n", wine_dbgstr_w(str));
635 
636  prop.vt = VT_LPSTR;
637  prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
638  strcpy(prop.u.pszVal, topic);
639  hres = PropVariantToStringAlloc(&prop, &str);
640  ok(hres == S_OK, "returned %x\n", hres);
641  ok(!lstrcmpW(str, topicW), "got %s\n", wine_dbgstr_w(str));
643  PropVariantClear(&prop);
644 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const WCHAR topicW[]
Definition: propsys.c:44
const WCHAR * str
HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
Definition: propvar.c:290
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static const char topic[]
Definition: propsys.c:43
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static const WCHAR emptyW[]
Definition: propsys.c:45
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by START_TEST().

◆ test_PropVariantToStringWithDefault()

static void test_PropVariantToStringWithDefault ( void  )
static

Definition at line 1097 of file propsys.c.

1098 {
1099  PROPVARIANT propvar;
1100  static WCHAR default_value[] = {'t', 'e', 's', 't', 0};
1101  static WCHAR wstr_test2[] = {'t', 'e', 's', 't', '2', 0};
1102  static WCHAR wstr_empty[] = {0};
1103  static WCHAR wstr_space[] = {' ', 0};
1104  static CHAR str_test2[] = "test2";
1105  static CHAR str_empty[] = "";
1106  static CHAR str_space[] = " ";
1107  LPCWSTR result;
1108 
1109  propvar.vt = VT_EMPTY;
1110  result = PropVariantToStringWithDefault(&propvar, default_value);
1111  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1112 
1113  propvar.vt = VT_NULL;
1114  result = PropVariantToStringWithDefault(&propvar, default_value);
1115  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1116 
1117  propvar.vt = VT_BOOL;
1118  propvar.u.boolVal = VARIANT_TRUE;
1119  result = PropVariantToStringWithDefault(&propvar, default_value);
1120  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1121 
1122  propvar.vt = VT_I4;
1123  propvar.u.lVal = 15;
1124  result = PropVariantToStringWithDefault(&propvar, default_value);
1125  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1126 
1127  /* VT_LPWSTR */
1128 
1129  propvar.vt = VT_LPWSTR;
1130  propvar.u.pwszVal = NULL;
1131  result = PropVariantToStringWithDefault(&propvar, default_value);
1132  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1133 
1134  propvar.vt = VT_LPWSTR;
1135  propvar.u.pwszVal = wstr_empty;
1136  result = PropVariantToStringWithDefault(&propvar, default_value);
1137  ok(result == wstr_empty, "Unexpected value %s\n", wine_dbgstr_w(result));
1138 
1139  propvar.vt = VT_LPWSTR;
1140  propvar.u.pwszVal = wstr_space;
1141  result = PropVariantToStringWithDefault(&propvar, default_value);
1142  ok(result == wstr_space, "Unexpected value %s\n", wine_dbgstr_w(result));
1143 
1144  propvar.vt = VT_LPWSTR;
1145  propvar.u.pwszVal = wstr_test2;
1146  result = PropVariantToStringWithDefault(&propvar, default_value);
1147  ok(result == wstr_test2, "Unexpected value %s\n", wine_dbgstr_w(result));
1148 
1149  /* VT_LPSTR */
1150 
1151  propvar.vt = VT_LPSTR;
1152  propvar.u.pszVal = NULL;
1153  result = PropVariantToStringWithDefault(&propvar, default_value);
1154  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1155 
1156  propvar.vt = VT_LPSTR;
1157  propvar.u.pszVal = str_empty;
1158  result = PropVariantToStringWithDefault(&propvar, default_value);
1159  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1160 
1161  propvar.vt = VT_LPSTR;
1162  propvar.u.pszVal = str_space;
1163  result = PropVariantToStringWithDefault(&propvar, default_value);
1164  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1165 
1166  propvar.vt = VT_LPSTR;
1167  propvar.u.pszVal = str_test2;
1168  result = PropVariantToStringWithDefault(&propvar, default_value);
1169  ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
1170 
1171  /* VT_BSTR */
1172 
1173  propvar.vt = VT_BSTR;
1174  propvar.u.bstrVal = NULL;
1175  result = PropVariantToStringWithDefault(&propvar, default_value);
1176  ok(!lstrcmpW(result, wstr_empty), "Unexpected value %s\n", wine_dbgstr_w(result));
1177 
1178  propvar.vt = VT_BSTR;
1179  propvar.u.bstrVal = SysAllocString(wstr_empty);
1180  result = PropVariantToStringWithDefault(&propvar, default_value);
1181  ok(!lstrcmpW(result, wstr_empty), "Unexpected value %s\n", wine_dbgstr_w(result));
1182  SysFreeString(propvar.u.bstrVal);
1183 
1184  propvar.vt = VT_BSTR;
1185  propvar.u.bstrVal = SysAllocString(wstr_space);
1186  result = PropVariantToStringWithDefault(&propvar, default_value);
1187  ok(!lstrcmpW(result, wstr_space), "Unexpected value %s\n", wine_dbgstr_w(result));
1188  SysFreeString(propvar.u.bstrVal);
1189 
1190  propvar.vt = VT_BSTR;
1191  propvar.u.bstrVal = SysAllocString(wstr_test2);
1192  result = PropVariantToStringWithDefault(&propvar, default_value);
1193  ok(!lstrcmpW(result, wstr_test2), "Unexpected value %s\n", wine_dbgstr_w(result));
1194  SysFreeString(propvar.u.bstrVal);
1195 }
Definition: compat.h:1947
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
char CHAR
Definition: xmlstorage.h:175
PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault)
Definition: propvar.c:340
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ok(value,...)
Definition: atltest.h:57
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
GLuint64EXT * result
Definition: glext.h:11304

Referenced by START_TEST().

◆ test_PSPropertyKeyFromString()

static void test_PSPropertyKeyFromString ( void  )
static

Definition at line 157 of file propsys.c.

158 {
159  static const WCHAR fmtid_clsidW[] = {'S','t','d','F','o','n','t',' ','1',0};
160  static const WCHAR fmtid_truncatedW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
161  '1','2','3','4','-',0};
162  static const WCHAR fmtid_nobracketsW[] = {'1','2','3','4','5','6','7','8','-','1','2','3','4','-',
163  '1','2','3','4','-','1','2','3','4','-',
164  '1','2','3','4','5','6','7','8','9','0','1','2',0};
165  static const WCHAR fmtid_badbracketW[] = {'X','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
166  '1','2','3','4','-','1','2','3','4','-',
167  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
168  static const WCHAR fmtid_badcharW[] = {'{','X','2','3','4','5','6','7','8','-','1','2','3','4','-',
169  '1','2','3','4','-','1','2','3','4','-',
170  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
171  static const WCHAR fmtid_badchar2W[] = {'{','1','2','3','4','5','6','7','X','-','1','2','3','4','-',
172  '1','2','3','4','-','1','2','3','4','-',
173  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
174  static const WCHAR fmtid_baddashW[] = {'{','1','2','3','4','5','6','7','8','X','1','2','3','4','-',
175  '1','2','3','4','-','1','2','3','4','-',
176  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
177  static const WCHAR fmtid_badchar3W[] = {'{','1','2','3','4','5','6','7','8','-','X','2','3','4','-',
178  '1','2','3','4','-','1','2','3','4','-',
179  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
180  static const WCHAR fmtid_badchar4W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','X','-',
181  '1','2','3','4','-','1','2','3','4','-',
182  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
183  static const WCHAR fmtid_baddash2W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','X',
184  '1','2','3','4','-','1','2','3','4','-',
185  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
186  static const WCHAR fmtid_badchar5W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
187  'X','2','3','4','-','1','2','3','4','-',
188  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
189  static const WCHAR fmtid_badchar6W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
190  '1','2','3','X','-','1','2','3','4','-',
191  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
192  static const WCHAR fmtid_baddash3W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
193  '1','2','3','4','X','1','2','3','4','-',
194  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
195  static const WCHAR fmtid_badchar7W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
196  '1','2','3','4','-','X','2','3','4','-',
197  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
198  static const WCHAR fmtid_badchar8W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
199  '1','2','3','4','-','1','2','3','X','-',
200  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
201  static const WCHAR fmtid_baddash4W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
202  '1','2','3','4','-','1','2','3','4','X',
203  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
204  static const WCHAR fmtid_badchar9W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
205  '1','2','3','4','-','1','2','3','4','-',
206  'X','2','3','4','5','6','7','8','9','0','1','2','}',0};
207  static const WCHAR fmtid_badchar9_adjW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
208  '1','2','3','4','-','1','2','3','4','-',
209  '1','X','3','4','5','6','7','8','9','0','1','2','}',0};
210  static const WCHAR fmtid_badchar10W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
211  '1','2','3','4','-','1','2','3','4','-',
212  '1','2','X','4','5','6','7','8','9','0','1','2','}',0};
213  static const WCHAR fmtid_badchar11W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
214  '1','2','3','4','-','1','2','3','4','-',
215  '1','2','3','4','X','6','7','8','9','0','1','2','}',0};
216  static const WCHAR fmtid_badchar12W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
217  '1','2','3','4','-','1','2','3','4','-',
218  '1','2','3','4','5','6','X','8','9','0','1','2','}',0};
219  static const WCHAR fmtid_badchar13W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
220  '1','2','3','4','-','1','2','3','4','-',
221  '1','2','3','4','5','6','7','8','X','0','1','2','}',0};
222  static const WCHAR fmtid_badchar14W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
223  '1','2','3','4','-','1','2','3','4','-',
224  '1','2','3','4','5','6','7','8','9','0','X','2','}',0};
225  static const WCHAR fmtid_badbracket2W[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
226  '1','2','3','4','-','1','2','3','4','-',
227  '1','2','3','4','5','6','7','8','9','0','1','2','X',0};
228  static const WCHAR fmtid_spaceW[] = {' ','{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
229  '1','2','3','4','-','1','2','3','4','-',
230  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
231  static const WCHAR fmtid_spaceendW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
232  '1','2','3','4','-','1','2','3','4','-',
233  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',0};
234  static const WCHAR fmtid_spacesendW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
235  '1','2','3','4','-','1','2','3','4','-',
236  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',' ',' ',0};
237  static const WCHAR fmtid_nopidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
238  '1','2','3','4','-','1','2','3','4','-',
239  '1','2','3','4','5','6','7','8','9','0','1','2','}',0};
240  static const WCHAR fmtid_badpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
241  '1','2','3','4','-','1','2','3','4','-',
242  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','D','E','A','D',0};
243  static const WCHAR fmtid_adjpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
244  '1','2','3','4','-','1','2','3','4','-',
245  '1','2','3','4','5','6','7','8','9','0','1','2','}','1','3','5','7','9',0};
246  static const WCHAR fmtid_spacespidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
247  '1','2','3','4','-','1','2','3','4','-',
248  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',' ',' ','1','3','5','7','9',0};
249  static const WCHAR fmtid_negpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
250  '1','2','3','4','-','1','2','3','4','-',
251  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','-','1','3','5','7','9',0};
252  static const WCHAR fmtid_negnegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
253  '1','2','3','4','-','1','2','3','4','-',
254  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','-','-','1','3','5','7','9',0};
255  static const WCHAR fmtid_negnegnegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
256  '1','2','3','4','-','1','2','3','4','-',
257  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','-','-','-','1','3','5','7','9',0};
258  static const WCHAR fmtid_negspacepidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
259  '1','2','3','4','-','1','2','3','4','-',
260  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','-',' ','1','3','5','7','9',0};
261  static const WCHAR fmtid_negspacenegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
262  '1','2','3','4','-','1','2','3','4','-',
263  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','-',' ','-','1','3','5','7','9',0};
264  static const WCHAR fmtid_negspacespidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
265  '1','2','3','4','-','1','2','3','4','-',
266  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','-',' ','-',' ','-','1','3','5','7','9',0};
267  static const WCHAR fmtid_pospidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
268  '1','2','3','4','-','1','2','3','4','-',
269  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','+','1','3','5','7','9',0};
270  static const WCHAR fmtid_posnegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
271  '1','2','3','4','-','1','2','3','4','-',
272  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','+','-','+','-','1','3','5','7','9',0};
273  static const WCHAR fmtid_symbolpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
274  '1','2','3','4','-','1','2','3','4','-',
275  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','+','/','$','-','1','3','5','7','9',0};
276  static const WCHAR fmtid_letterpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
277  '1','2','3','4','-','1','2','3','4','-',
278  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','A','B','C','D','1','3','5','7','9',0};
279  static const WCHAR fmtid_spacepadpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
280  '1','2','3','4','-','1','2','3','4','-',
281  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','1','3','5','7','9',' ',' ',' ',0};
282  static const WCHAR fmtid_spacemixpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
283  '1','2','3','4','-','1','2','3','4','-',
284  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','1',' ','3',' ','5','7','9',' ',' ',' ',0};
285  static const WCHAR fmtid_tabpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
286  '1','2','3','4','-','1','2','3','4','-',
287  '1','2','3','4','5','6','7','8','9','0','1','2','}','\t','1','3','5','7','9',0};
288  static const WCHAR fmtid_hexpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
289  '1','2','3','4','-','1','2','3','4','-',
290  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','0','x','D','E','A','D',0};
291  static const WCHAR fmtid_mixedpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
292  '1','2','3','4','-','1','2','3','4','-',
293  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','A','9','B','5','C','3','D','1',0};
294  static const WCHAR fmtid_overflowpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
295  '1','2','3','4','-','1','2','3','4','-',
296  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','1','2','3','4','5','6','7','8','9','0','1',0};
297  static const WCHAR fmtid_commapidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
298  '1','2','3','4','-','1','2','3','4','-',
299  '1','2','3','4','5','6','7','8','9','0','1','2','}',',','1','3','5','7','9',0};
300  static const WCHAR fmtid_commaspidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
301  '1','2','3','4','-','1','2','3','4','-',
302  '1','2','3','4','5','6','7','8','9','0','1','2','}',',',',',',','1','3','5','7','9',0};
303  static const WCHAR fmtid_commaspacepidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
304  '1','2','3','4','-','1','2','3','4','-',
305  '1','2','3','4','5','6','7','8','9','0','1','2','}',',',' ','1','3','5','7','9',0};
306  static const WCHAR fmtid_spacecommapidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
307  '1','2','3','4','-','1','2','3','4','-',
308  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',',','1','3','5','7','9',0};
309  static const WCHAR fmtid_spccommaspcpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
310  '1','2','3','4','-','1','2','3','4','-',
311  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',',',' ','1','3','5','7','9',0};
312  static const WCHAR fmtid_spacescommaspidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
313  '1','2','3','4','-','1','2','3','4','-',
314  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',',',' ',',','1','3','5','7','9',0};
315  static const WCHAR fmtid_commanegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
316  '1','2','3','4','-','1','2','3','4','-',
317  '1','2','3','4','5','6','7','8','9','0','1','2','}',',','-','1','3','5','7','9',0};
318  static const WCHAR fmtid_spccommanegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
319  '1','2','3','4','-','1','2','3','4','-',
320  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',',','-','1','3','5','7','9',0};
321  static const WCHAR fmtid_commaspcnegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
322  '1','2','3','4','-','1','2','3','4','-',
323  '1','2','3','4','5','6','7','8','9','0','1','2','}',',',' ','-','1','3','5','7','9',0};
324  static const WCHAR fmtid_spccommaspcnegpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
325  '1','2','3','4','-','1','2','3','4','-',
326  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ',',',' ','-','1','3','5','7','9',0};
327  static const WCHAR fmtid_commanegspcpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
328  '1','2','3','4','-','1','2','3','4','-',
329  '1','2','3','4','5','6','7','8','9','0','1','2','}',',','-',' ','1','3','5','7','9',0};
330  static const WCHAR fmtid_negcommapidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
331  '1','2','3','4','-','1','2','3','4','-',
332  '1','2','3','4','5','6','7','8','9','0','1','2','}','-',',','1','3','5','7','9',0};
333  static const WCHAR fmtid_normalpidW[] = {'{','1','2','3','4','5','6','7','8','-','1','2','3','4','-',
334  '1','2','3','4','-','1','2','3','4','-',
335  '1','2','3','4','5','6','7','8','9','0','1','2','}',' ','1','3','5','7','9',0};
336  PROPERTYKEY out_init = {GUID_MEMBERS(dummy_guid), 0xdeadbeef};
337  PROPERTYKEY out;
338  HRESULT ret;
339 
340  const struct
341  {
342  LPCWSTR pwzString;
343  PROPERTYKEY *pkey;
344  HRESULT hr_expect;
345  PROPERTYKEY pkey_expect;
346  } testcases[] =
347  {
348  {NULL, NULL, E_POINTER},
349  {NULL, &out, E_POINTER, {GUID_MEMBERS(out_init.fmtid), out_init.pid}},
350  {emptyW, NULL, E_POINTER},
352  {fmtid_clsidW, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0}},
353  {fmtid_truncatedW, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0,0,0,0,0,0,0,0}}, 0}},
354  {fmtid_nobracketsW, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0}},
355  {fmtid_badbracketW, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0}},
356  {fmtid_badcharW, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0}},
357  {fmtid_badchar2W, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0}},
358  {fmtid_baddashW, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}},
359  {fmtid_badchar3W, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}},
360  {fmtid_badchar4W, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}},
361  {fmtid_baddash2W, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}},
362  {fmtid_badchar5W, &out, E_INVALIDARG, { {0x12345678,0x1234,0,{0,0,0,0,0,0,0,0}}, 0}},
363  {fmtid_badchar6W, &out, E_INVALIDARG, { {0x12345678,0x1234,0,{0,0,0,0,0,0,0,0}}, 0}},
364  {fmtid_baddash3W, &out, E_INVALIDARG, { {0x12345678,0x1234,0,{0,0,0,0,0,0,0,0}}, 0}},
365  {fmtid_badchar7W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0,0,0,0,0,0,0,0}}, 0}},
366  {fmtid_badchar8W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0,0,0,0,0,0,0}}, 0}},
367  {fmtid_baddash4W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0,0,0,0,0,0,0}}, 0}},
368  {fmtid_badchar9W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0,0,0,0,0,0}}, 0}},
369  {fmtid_badchar9_adjW, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0,0,0,0,0,0}}, 0}},
370  {fmtid_badchar10W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0,0,0,0,0}}, 0}},
371  {fmtid_badchar11W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0,0,0,0}}, 0}},
372  {fmtid_badchar12W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0,0,0}}, 0}},
373  {fmtid_badchar13W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0x78,0,0}}, 0}},
374  {fmtid_badchar14W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0x78,0x90,0}}, 0}},
375  {fmtid_badbracket2W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0x78,0x90,0x00}}, 0 }},
376  {fmtid_spaceW, &out, E_INVALIDARG, {GUID_MEMBERS(GUID_NULL), 0 }},
377  {fmtid_spaceendW, &out, E_INVALIDARG, {GUID_MEMBERS(expect_guid), 0}},
378  {fmtid_spacesendW, &out, E_INVALIDARG, {GUID_MEMBERS(expect_guid), 0}},
379  {fmtid_nopidW, &out, E_INVALIDARG, {GUID_MEMBERS(expect_guid), 0}},
380  {fmtid_badpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
381  {fmtid_adjpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
382  {fmtid_spacespidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
383  {fmtid_negpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
384  {fmtid_negnegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 4294953717U}},
385  {fmtid_negnegnegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
386  {fmtid_negspacepidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
387  {fmtid_negspacenegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 4294953717U}},
388  {fmtid_negspacespidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
389  {fmtid_pospidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
390  {fmtid_posnegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
391  {fmtid_symbolpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
392  {fmtid_letterpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
393  {fmtid_spacepadpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
394  {fmtid_spacemixpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 1}},
395  {fmtid_tabpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
396  {fmtid_hexpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
397  {fmtid_mixedpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
398  {fmtid_overflowpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 3755744309U}},
399  {fmtid_commapidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
400  {fmtid_commaspidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
401  {fmtid_commaspacepidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
402  {fmtid_spacecommapidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
403  {fmtid_spccommaspcpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
404  {fmtid_spacescommaspidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
405  {fmtid_commanegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 4294953717U}},
406  {fmtid_spccommanegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 4294953717U}},
407  {fmtid_commaspcnegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 4294953717U}},
408  {fmtid_spccommaspcnegpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 4294953717U}},
409  {fmtid_commanegspcpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0U}},
410  {fmtid_negcommapidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 0}},
411  {fmtid_normalpidW, &out, S_OK, {GUID_MEMBERS(expect_guid), 13579}},
412  };
413 
414  int i;
415 
416  for (i = 0; i < ARRAY_SIZE(testcases); i++)
417  {
418  if (testcases[i].pkey)
419  *testcases[i].pkey = out_init;
420 
421  ret = PSPropertyKeyFromString(testcases[i].pwzString, testcases[i].pkey);
422  ok(ret == testcases[i].hr_expect,
423  "[%d] Expected PSPropertyKeyFromString to return 0x%08x, got 0x%08x\n",
424  i, testcases[i].hr_expect, ret);
425 
426  if (testcases[i].pkey)
427  {
428  ok(IsEqualGUID(&testcases[i].pkey->fmtid, &testcases[i].pkey_expect.fmtid),
429  "[%d] Expected GUID %s, got %s\n",
430  i, wine_dbgstr_guid(&testcases[i].pkey_expect.fmtid), wine_dbgstr_guid(&testcases[i].pkey->fmtid));
431  ok(testcases[i].pkey->pid == testcases[i].pkey_expect.pid,
432  "[%d] Expected property ID %u, got %u\n",
433  i, testcases[i].pkey_expect.pid, testcases[i].pkey->pid);
434  }
435  }
436 }
#define expect_guid(expected, guid)
Definition: typelib.c:49
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define GUID_MEMBERS(g)
Definition: propsys.c:41
#define U(x)
Definition: wordpad.c:44
const char * wine_dbgstr_guid(const GUID *guid)
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
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static FILE * out
Definition: regtests2xml.c:44
int ret
HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR pszString, PROPERTYKEY *pkey)
Definition: propsys_main.c:431
#define GUID_NULL
Definition: ks.h:106
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define E_POINTER
Definition: winerror.h:2365
static const WCHAR emptyW[]
Definition: propsys.c:45

Referenced by START_TEST().

◆ test_PSRefreshPropertySchema()

static void test_PSRefreshPropertySchema ( void  )
static

Definition at line 438 of file propsys.c.

439 {
440  HRESULT ret;
441 
443  todo_wine
445  "Expected PSRefreshPropertySchema to return CO_E_NOTINITIALIZED, got 0x%08x\n", ret);
446 
448 
450  ok(ret == S_OK,
451  "Expected PSRefreshPropertySchema to return S_OK, got 0x%08x\n", ret);
452 
453  CoUninitialize();
454 }
#define CO_E_NOTINITIALIZED
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI PSRefreshPropertySchema(void)
Definition: propsys_main.c:277
LONG HRESULT
Definition: typedefs.h:77
int ret
#define todo_wine
Definition: test.h:154
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964

Referenced by START_TEST().

◆ test_PSStringFromPropertyKey()

static void test_PSStringFromPropertyKey ( void  )
static

Definition at line 54 of file propsys.c.

55 {
56  static const WCHAR fillerW[] = {'X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X',
57  'X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X',
58  'X','X','X','X','X','X','X','X','X','X'};
59  static const WCHAR zero_fillerW[] = {'\0','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X',
60  'X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X',
61  'X','X','X','X','X','X','X','X','X','X','X','X','X','X'};
62  static const WCHAR zero_truncatedW[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0',
63  '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0',
64  '0','0','0','}',' ','\0','9','X','X','X','X','X','X','X','X','X'};
65  static const WCHAR zero_truncated2W[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0',
66  '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0',
67  '0','0','0','}',' ','\0','9','2','7','6','9','4','9','2','X','X'};
68  static const WCHAR zero_truncated3W[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0',
69  '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0',
70  '0','0','0','}',' ','\0','9','2','7','6','9','4','9','2','4','X'};
71  static const WCHAR zero_truncated4W[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0',
72  '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0',
73  '0','0','0','}',' ','\0','7','X','X','X','X','X','X','X','X','X'};
74  static const WCHAR truncatedW[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0',
75  '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0',
76  '0','}',' ','\0','9','X','X','X','X','X','X','X','X','X'};
77  static const WCHAR truncated2W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0',
78  '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0',
79  '0','}',' ','\0','9','2','7','6','9','4','9','2','X','X'};
80  static const WCHAR truncated3W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0',
81  '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0',
82  '0','}',' ','\0','9','2','7','6','9','4','9','2','4','X'};
83  static const WCHAR truncated4W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0',
84  '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0',
85  '0','}',' ','\0','7','X','X','X','X','X','X','X','X','X'};
86  static const WCHAR expectedW[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0',
87  '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0',
88  '0','}',' ','4','2','9','4','9','6','7','2','9','5',0};
89  static const WCHAR expected2W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0',
90  '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0',
91  '0','}',' ','1','3','5','7','9','\0','X','X','X','X','X'};
92  static const WCHAR expected3W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0',
93  '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0',
94  '0','}',' ','0','\0','X','X','X','X','X','X','X','X','X'};
95  PROPERTYKEY prop = {GUID_MEMBERS(GUID_NULL), ~0U};
96  PROPERTYKEY prop2 = {GUID_MEMBERS(GUID_NULL), 13579};
97  PROPERTYKEY prop3 = {GUID_MEMBERS(GUID_NULL), 0};
98  WCHAR out[PKEYSTR_MAX];
99  HRESULT ret;
100 
101  const struct
102  {
103  REFPROPERTYKEY pkey;
104  LPWSTR psz;
105  UINT cch;
106  HRESULT hr_expect;
107  const WCHAR *buf_expect;
108  BOOL hr_broken;
109  HRESULT hr2;
110  BOOL buf_broken;
111  const WCHAR *buf2;
112  } testcases[] =
113  {
114  {NULL, NULL, 0, E_POINTER},
115  {&prop, NULL, 0, E_POINTER},
116  {&prop, NULL, PKEYSTR_MAX, E_POINTER},
117  {NULL, out, 0, E_NOT_SUFFICIENT_BUFFER, fillerW},
118  {NULL, out, PKEYSTR_MAX, E_NOT_SUFFICIENT_BUFFER, zero_fillerW, FALSE, 0, TRUE, fillerW},
119  {&prop, out, 0, E_NOT_SUFFICIENT_BUFFER, fillerW},
120  {&prop, out, GUIDSTRING_MAX, E_NOT_SUFFICIENT_BUFFER, fillerW},
121  {&prop, out, GUIDSTRING_MAX + 1, E_NOT_SUFFICIENT_BUFFER, fillerW},
122  {&prop, out, GUIDSTRING_MAX + 2, E_NOT_SUFFICIENT_BUFFER, zero_truncatedW, TRUE, S_OK, TRUE, truncatedW},
123  {&prop, out, PKEYSTR_MAX - 2, E_NOT_SUFFICIENT_BUFFER, zero_truncated2W, TRUE, S_OK, TRUE, truncated2W},
124  {&prop, out, PKEYSTR_MAX - 1, E_NOT_SUFFICIENT_BUFFER, zero_truncated3W, TRUE, S_OK, TRUE, truncated3W},
125  {&prop, out, PKEYSTR_MAX, S_OK, expectedW},
126  {&prop2, out, GUIDSTRING_MAX + 2, E_NOT_SUFFICIENT_BUFFER, zero_truncated4W, TRUE, S_OK, TRUE, truncated4W},
127  {&prop2, out, GUIDSTRING_MAX + 6, S_OK, expected2W},
128  {&prop2, out, PKEYSTR_MAX, S_OK, expected2W},
129  {&prop3, out, GUIDSTRING_MAX + 1, E_NOT_SUFFICIENT_BUFFER, fillerW},
130  {&prop3, out, GUIDSTRING_MAX + 2, S_OK, expected3W},
131  {&prop3, out, PKEYSTR_MAX, S_OK, expected3W},
132  };
133 
134  int i;
135 
136  for (i = 0; i < ARRAY_SIZE(testcases); i++)
137  {
138  if (testcases[i].psz)
139  memcpy(testcases[i].psz, fillerW, PKEYSTR_MAX * sizeof(WCHAR));
140 
141  ret = PSStringFromPropertyKey(testcases[i].pkey,
142  testcases[i].psz,
143  testcases[i].cch);
144  ok(ret == testcases[i].hr_expect ||
145  broken(testcases[i].hr_broken && ret == testcases[i].hr2), /* Vista/Win2k8 */
146  "[%d] Expected PSStringFromPropertyKey to return 0x%08x, got 0x%08x\n",
147  i, testcases[i].hr_expect, ret);
148 
149  if (testcases[i].psz)
150  ok(!memcmp(testcases[i].psz, testcases[i].buf_expect, PKEYSTR_MAX * sizeof(WCHAR)) ||
151  broken(testcases[i].buf_broken &&
152  !memcmp(testcases[i].psz, testcases[i].buf2, PKEYSTR_MAX * sizeof(WCHAR))), /* Vista/Win2k8 */
153  "[%d] Unexpected output contents\n", i);
154  }
155 }
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define GUID_MEMBERS(g)
Definition: propsys.c:41
HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch)
Definition: propsys_main.c:283
#define U(x)
Definition: wordpad.c:44
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
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static FILE * out
Definition: regtests2xml.c:44
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GUID_NULL
Definition: ks.h:106
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define broken(x)
Definition: _sntprintf.h:21
PSSTDAPI typedef PROPERTYKEY * REFPROPERTYKEY
Definition: propsys.idl:30
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define E_POINTER
Definition: winerror.h:2365

Referenced by START_TEST().

Variable Documentation

◆ emptyW

const WCHAR emptyW[] = {0}
static

◆ topic

◆ topicW

const WCHAR topicW[] = {'w','i','n','e',' ','t','o','p','i','c',0}
static