24#define PID_BEHAVIOR 0x80000003
48 static const WCHAR szDot[] = {
'.',0 };
49 static const WCHAR szPrefix[] = {
's',
't',
'g',0 };
51 'I',
'n',
'f',
'o',
'r',
'm',
'a',
't',
'i',
'o',
'n',0 };
52 static WCHAR propName[] = {
'p',
'r',
'o',
'p',0 };
53 static char val[] =
"l33t auth0r";
62 unsigned char clipcontent[] =
"foobar";
63 GUID anyOldGuid = { 0x12345678,0xdead,0xbeef, {
64 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 } };
67 trace(
"Testing property storage with a set...\n");
69 trace(
"Testing property storage without a set...\n");
78 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
82 if(!pStgCreatePropSetStg)
88 hr = pStgCreatePropSetStg(
storage, 0, propSetStorage);
89 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08x\n",
hr);
91 hr = IPropertySetStorage_Create(*propSetStorage,
95 ok(
hr ==
S_OK,
"IPropertySetStorage_Create failed: 0x%08x\n",
hr);
101 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08x\n",
hr);
103 if(!pStgCreatePropStg)
111 NULL, PROPSETFLAG_ANSI, 0, &propertyStorage);
112 ok(
hr ==
S_OK,
"StgCreatePropStg failed: 0x%08x\n",
hr);
115 hr = IPropertyStorage_WriteMultiple(propertyStorage, 0,
NULL,
NULL, 0);
116 ok(
hr ==
S_OK,
"WriteMultiple with 0 args failed: 0x%08x\n",
hr);
117 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1,
NULL,
NULL, 0);
121 spec.ulKind = PRSPEC_PROPID;
125 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
127 "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n",
hr);
130 spec.ulKind = PRSPEC_LPWSTR;
131 U(spec).lpwstr = propName;
132 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var,
135 "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n",
hr);
138 spec.ulKind = PRSPEC_PROPID;
141 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
143 "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n",
hr);
146 spec.ulKind = PRSPEC_PROPID;
149 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
150 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
153 spec.ulKind = PRSPEC_LPWSTR;
154 U(spec).lpwstr = propName;
156 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var,
158 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
161 spec.ulKind = PRSPEC_PROPID;
162 U(spec).propid = PIDSI_AUTHOR;
165 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
166 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
169 spec.ulKind = PRSPEC_PROPID;
170 U(spec).propid = PIDSI_THUMBNAIL;
172 clipdata.cbSize =
sizeof clipcontent +
sizeof (
ULONG);
174 clipdata.pClipData = clipcontent;
175 U(
var).pclipdata = &clipdata;
176 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
177 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
181 hr = IPropertyStorage_ReadMultiple(propertyStorage, 0,
NULL,
NULL);
182 ok(
hr ==
S_FALSE,
"ReadMultiple with 0 args failed: 0x%08x\n",
hr);
183 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1,
NULL,
NULL);
186 spec.ulKind = PRSPEC_PROPID;
188 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
189 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
191 "Didn't get expected type or value for property (got type %d, value %d)\n",
194 spec.ulKind = PRSPEC_LPWSTR;
195 U(spec).lpwstr = propName;
196 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
197 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
199 "Didn't get expected type or value for property (got type %d, value %d)\n",
202 spec.ulKind = PRSPEC_PROPID;
203 U(spec).propid = PIDSI_AUTHOR;
204 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
205 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
207 "Didn't get expected type or value for property (got type %d, value %s)\n",
212 spec.ulKind = PRSPEC_PROPID;
213 U(spec).propid = PIDSI_THUMBNAIL;
214 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
215 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
218 "clipboard type wrong\n");
220 "clipboard size wrong\n");
221 ok(!
memcmp(
U(
var).pclipdata->pClipData, clipcontent,
sizeof clipcontent),
222 "clipboard contents wrong\n");
226 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 0,
NULL);
227 ok(
hr ==
S_OK,
"DeleteMultiple with 0 args failed: 0x%08x\n",
hr);
228 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1,
NULL);
231 spec.ulKind = PRSPEC_PROPID;
233 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
235 "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n",
hr);
238 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
239 ok(
hr ==
S_OK,
"DeleteMultiple failed: 0x%08x\n",
hr);
241 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
244 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
245 ok(
hr ==
S_OK,
"Commit failed: 0x%08x\n",
hr);
248 spec.ulKind = PRSPEC_PROPID;
250 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
251 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
252 hr = IPropertyStorage_Revert(propertyStorage);
253 ok(
hr ==
S_OK,
"Revert failed: 0x%08x\n",
hr);
255 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
258 spec.ulKind = PRSPEC_PROPID;
262 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
263 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
265 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
266 ok(
hr ==
S_OK,
"Commit failed: 0x%08x\n",
hr);
270 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
271 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
273 hr = IPropertyStorage_Revert(propertyStorage);
274 ok(
hr ==
S_OK,
"Revert failed: 0x%08x\n",
hr);
280 IPropertyStorage_Release(propertyStorage);
281 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
288 ok(
hr ==
S_OK,
"StgOpenStorage failed: 0x%08x\n",
hr);
292 hr = pStgCreatePropSetStg(
storage, 0, propSetStorage);
293 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08x\n",
hr);
297 ok(
hr ==
S_OK,
"IPropertySetStorage_Open failed: 0x%08x\n",
hr);
303 ok(
hr ==
S_OK,
"IStorage_OpenStream failed: 0x%08x\n",
hr);
313 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
314 ok(
hr ==
S_OK,
"StgOpenPropStg failed: 0x%08x\n",
hr);
318 spec.ulKind = PRSPEC_LPWSTR;
319 U(spec).lpwstr = propName;
320 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
321 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
323 "Didn't get expected type or value for property (got type %d, value %d)\n",
325 spec.ulKind = PRSPEC_PROPID;
326 U(spec).propid = PIDSI_AUTHOR;
327 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
328 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
330 "Didn't get expected type or value for property (got type %d, value %s)\n",
334 IPropertyStorage_Release(propertyStorage);
335 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
344 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
348 hr = pStgCreatePropSetStg(
storage, 0, propSetStorage);
349 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08x\n",
hr);
351 hr = IPropertySetStorage_Create(*propSetStorage,
352 &anyOldGuid,
NULL, PROPSETFLAG_ANSI,
355 ok(
hr ==
S_OK,
"IPropertySetStorage_Create failed: 0x%08x\n",
hr);
361 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08x\n",
hr);
364 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
365 ok(
hr ==
S_OK,
"StgCreatePropStg failed: 0x%08x\n",
hr);
368 spec.ulKind = PRSPEC_PROPID;
372 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
373 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
375 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
376 ok(
hr ==
S_OK,
"Commit failed: 0x%08x\n",
hr);
378 IPropertyStorage_Release(propertyStorage);
379 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
386 ok(
hr ==
S_OK,
"StgOpenStorage failed: 0x%08x\n",
hr);
390 hr = pStgCreatePropSetStg(
storage, 0, propSetStorage);
391 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08x\n",
hr);
393 hr = IPropertySetStorage_Open(*propSetStorage, &anyOldGuid,
395 ok(
hr ==
S_OK,
"IPropertySetStorage_Open failed: 0x%08x\n",
hr);
401 ok(
hr ==
S_OK,
"IStorage_OpenStream failed: 0x%08x\n",
hr);
404 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
405 ok(
hr ==
S_OK,
"StgOpenPropStg failed: 0x%08x\n",
hr);
408 spec.ulKind = PRSPEC_PROPID;
410 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
411 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
414 "Didn't get expected type or value for property (got type %d, value %d)\n",
417 IPropertyStorage_Release(propertyStorage);
418 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
435 static const WCHAR szDot[] = {
'.',0 };
436 static const WCHAR szPrefix[] = {
's',
't',
'g',0 };
437 static CHAR aval[] =
"hi";
438 static WCHAR wval[] = {
'h',
'i',0 };
452 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
454 if(!pStgCreatePropSetStg)
460 hr = pStgCreatePropSetStg(
storage, 0, &propSetStorage);
461 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08x\n",
hr);
463 hr = IPropertySetStorage_Create(propSetStorage,
467 ok(
hr ==
S_OK,
"IPropertySetStorage_Create failed: 0x%08x\n",
hr);
469 PropVariantInit(&
var);
470 spec.ulKind = PRSPEC_PROPID;
473 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
474 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
476 "Didn't get expected type or value for property\n");
480 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
481 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
483 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
484 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
486 "Didn't get expected type or value for property\n");
489 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
490 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
492 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
493 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
495 "Didn't get expected type or value for property\n");
497 spec.ulKind = PRSPEC_PROPID;
500 U(
var).pszVal = aval;
501 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
502 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
503 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
504 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
506 "Didn't get expected type or value for property\n");
515 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
516 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
517 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
518 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
520 "Didn't get expected type or value for property\n");
524 spec.ulKind = PRSPEC_PROPID;
528 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
530 "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n",
hr);
532 IPropertyStorage_Release(propertyStorage);
533 IPropertySetStorage_Release(propSetStorage);
541 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
543 hr = pStgCreatePropSetStg(
storage, 0, &propSetStorage);
544 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08x\n",
hr);
546 hr = IPropertySetStorage_Create(propSetStorage,
550 ok(
hr ==
S_OK,
"IPropertySetStorage_Create failed: 0x%08x\n",
hr);
553 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
554 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
555 ok(
var.vt ==
VT_I2,
"Didn't get expected type for property (%u)\n",
var.vt);
558 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
559 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
561 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
562 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
564 "Didn't get expected type or value for property\n");
570 static unsigned char strVal[] = { 0x81, 0xff, 0x04, 0 };
573 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
574 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
578 spec.ulKind = PRSPEC_PROPID;
582 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
583 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08x\n",
hr);
585 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
586 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08x\n",
hr);
588 "Didn't get expected type or value for property\n");
591 IPropertyStorage_Release(propertyStorage);
592 IPropertySetStorage_Release(propSetStorage);
601 'I',
'n',
'f',
'o',
'r',
'm',
'a',
't',
'i',
'o',
'n',0 };
603 'S',
'u',
'm',
'm',
'a',
'r',
'y',
'I',
'n',
'f',
'o',
'r',
'm',
'a',
't',
'i',
'o',
'n',
605 WCHAR szIID_IPropSetStg[] = { 5,
'0',
'j',
'a',
'a',
'a',
'a',
'a',
606 'a',
'A',
'a',
'a',
'a',
'a',
'a',
'd',
'a',
'A',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'G',
612 if (pFmtIdToPropStgName) {
618 ok(
hr ==
S_OK,
"FmtIdToPropStgName failed: 0x%08x\n",
hr);
620 sizeof(
WCHAR)),
"Got wrong name for FMTID_SummaryInformation\n");
622 ok(
hr ==
S_OK,
"FmtIdToPropStgName failed: 0x%08x\n",
hr);
624 sizeof(
WCHAR)),
"Got wrong name for FMTID_DocSummaryInformation\n");
626 ok(
hr ==
S_OK,
"FmtIdToPropStgName failed: 0x%08x\n",
hr);
628 sizeof(
WCHAR)),
"Got wrong name for FMTID_DocSummaryInformation\n");
629 hr = pFmtIdToPropStgName(&IID_IPropertySetStorage,
name);
630 ok(
hr ==
S_OK,
"FmtIdToPropStgName failed: 0x%08x\n",
hr);
632 sizeof(
WCHAR)),
"Got wrong name for IID_IPropertySetStorage\n");
635 if(pPropStgNameToFmtId) {
639 hr = pPropStgNameToFmtId(
NULL, &fmtid);
646 ok(
hr ==
S_OK,
"PropStgNameToFmtId failed: 0x%08x\n",
hr);
648 "Got unexpected FMTID, expected FMTID_SummaryInformation\n");
650 ok(
hr ==
S_OK,
"PropStgNameToFmtId failed: 0x%08x\n",
hr);
652 "Got unexpected FMTID, expected FMTID_DocSummaryInformation\n");
654 hr = pPropStgNameToFmtId(szIID_IPropSetStg, &fmtid);
655 ok(
hr ==
S_OK,
"PropStgNameToFmtId failed: 0x%08x\n",
hr);
656 ok(!
memcmp(&fmtid, &IID_IPropertySetStorage,
sizeof(fmtid)),
657 "Got unexpected FMTID, expected IID_IPropertySetStorage\n");
661 ok(
hr ==
S_OK,
"PropStgNameToFmtId failed: 0x%08x\n",
hr);
663 "Got unexpected FMTID, expected FMTID_DocSummaryInformation\n");
665 hr = pPropStgNameToFmtId(szIID_IPropSetStg, &fmtid);
666 ok(
hr ==
S_OK,
"PropStgNameToFmtId failed: 0x%08x\n",
hr);
667 ok(!
memcmp(&fmtid, &IID_IPropertySetStorage,
sizeof(fmtid)),
668 "Got unexpected FMTID, expected IID_IPropertySetStorage\n");
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define GetProcAddress(x, y)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
static const WCHAR szDocSummaryInfo[]
static const WCHAR szSummaryInfo[]
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
static PEXPLICIT_ACCESSW *static HMODULE hmod
static FMTID *static IPropertySetStorage **static const CLSID IPropertyStorage **static IPropertyStorage **static void init_function_pointers(void)
static void testProps(void)
static void testPropsHelper(IPropertySetStorage **propSetStorage)
static void testFmtId(void)
static void testCodepage(void)
#define STGM_SHARE_EXCLUSIVE
const FMTID FMTID_UserDefinedProperties
const FMTID FMTID_DocSummaryInformation
const FMTID FMTID_SummaryInformation
#define STG_E_INVALIDNAME
#define STG_E_INVALIDPARAMETER
LPWSTR WINAPI CharUpperW(_Inout_ LPWSTR)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList