ReactOS 0.4.16-dev-2357-g35d0dfe
stg_prop.c
Go to the documentation of this file.
1/* IPropertyStorage unit tests
2 * Copyright 2005 Juan Lang
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18#include <stdio.h>
19#define COBJMACROS
20#include "objbase.h"
21#include "wine/test.h"
22
23#ifndef PID_BEHAVIOR
24#define PID_BEHAVIOR 0x80000003
25#endif
26
27/* FIXME: this creates an ANSI storage, try to find conditions under which
28 * Unicode translation fails
29 */
30static void testPropsHelper(IPropertySetStorage **propSetStorage)
31{
32 static const WCHAR szDot[] = { '.',0 };
33 static const WCHAR szPrefix[] = { 's','t','g',0 };
34 static const WCHAR szSummaryInfo[] = { 5,'S','u','m','m','a','r','y',
35 'I','n','f','o','r','m','a','t','i','o','n',0 };
36 static WCHAR propName[] = { 'p','r','o','p',0 };
37 static char val[] = "l33t auth0r";
39 HRESULT hr;
42 IPropertyStorage *propertyStorage = NULL;
43 PROPSPEC spec;
44 PROPVARIANT var;
45 CLIPDATA clipdata;
46 unsigned char clipcontent[] = "foobar";
47 GUID anyOldGuid = { 0x12345678,0xdead,0xbeef, {
48 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 } };
49
50 if(propSetStorage)
51 trace("Testing property storage with a set...\n");
52 else
53 trace("Testing property storage without a set...\n");
54
55 if(!GetTempFileNameW(szDot, szPrefix, 0, filename))
56 return;
57
59
62 ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
63
64 if(propSetStorage)
65 {
66 hr = StgCreatePropSetStg(storage, 0, propSetStorage);
67 ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
68
69 hr = IPropertySetStorage_Create(*propSetStorage,
70 &FMTID_SummaryInformation, NULL, PROPSETFLAG_ANSI,
72 &propertyStorage);
73 ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
74 }
75 else
76 {
77 hr = IStorage_CreateStream(storage, szSummaryInfo,
79 ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08lx\n", hr);
80
82 NULL, PROPSETFLAG_ANSI, 0, &propertyStorage);
83 ok(hr == S_OK, "StgCreatePropStg failed: 0x%08lx\n", hr);
84 }
85
86 hr = IPropertyStorage_WriteMultiple(propertyStorage, 0, NULL, NULL, 0);
87 ok(hr == S_OK, "WriteMultiple with 0 args failed: 0x%08lx\n", hr);
88 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, NULL, NULL, 0);
89 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
90
91 /* test setting one that I can't set */
92 spec.ulKind = PRSPEC_PROPID;
93 spec.propid = PID_DICTIONARY;
94 var.vt = VT_I4;
95 var.lVal = 1;
96 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
98 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
99
100 /* test setting one by name with an invalid propidNameFirst */
101 spec.ulKind = PRSPEC_LPWSTR;
102 spec.lpwstr = propName;
103 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var,
106 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
107
108 /* test setting behavior (case-sensitive) */
109 spec.ulKind = PRSPEC_PROPID;
110 spec.propid = PID_BEHAVIOR;
111 var.lVal = 1;
112 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
114 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
115
116 /* set one by value.. */
117 spec.ulKind = PRSPEC_PROPID;
118 spec.propid = PID_FIRST_USABLE;
119 var.lVal = 1;
120 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
121 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
122
123 /* set one by name */
124 spec.ulKind = PRSPEC_LPWSTR;
125 spec.lpwstr = propName;
126 var.lVal = 2;
127 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var,
129 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
130
131 /* set a string value */
132 spec.ulKind = PRSPEC_PROPID;
133 spec.propid = PIDSI_AUTHOR;
134 var.vt = VT_LPSTR;
135 var.pszVal = val;
136 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
137 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
138
139 /* set a clipboard value */
140 spec.ulKind = PRSPEC_PROPID;
141 spec.propid = PIDSI_THUMBNAIL;
142 var.vt = VT_CF;
143 clipdata.cbSize = sizeof clipcontent + sizeof (ULONG);
144 clipdata.ulClipFmt = CF_ENHMETAFILE;
145 clipdata.pClipData = clipcontent;
146 var.pclipdata = &clipdata;
147 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
148 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
149
150
151 /* check reading */
152 hr = IPropertyStorage_ReadMultiple(propertyStorage, 0, NULL, NULL);
153 ok(hr == S_FALSE, "ReadMultiple with 0 args failed: 0x%08lx\n", hr);
154 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, NULL, NULL);
155 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
156 /* read by propid */
157 spec.ulKind = PRSPEC_PROPID;
158 spec.propid = PID_FIRST_USABLE;
159 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
160 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
161 ok(var.vt == VT_I4 && var.lVal == 1,
162 "Didn't get expected type or value for property (got type %d, value %ld)\n",
163 var.vt, var.lVal);
164 /* read by name */
165 spec.ulKind = PRSPEC_LPWSTR;
166 spec.lpwstr = propName;
167 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
168 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
169 ok(var.vt == VT_I4 && var.lVal == 2,
170 "Didn't get expected type or value for property (got type %d, value %ld)\n",
171 var.vt, var.lVal);
172 /* read string value */
173 spec.ulKind = PRSPEC_PROPID;
174 spec.propid = PIDSI_AUTHOR;
175 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
176 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
177 ok(var.vt == VT_LPSTR && !lstrcmpA(var.pszVal, val),
178 "Didn't get expected type or value for property (got type %d, value %s)\n",
179 var.vt, var.pszVal);
181
182 /* read clipboard format */
183 spec.ulKind = PRSPEC_PROPID;
184 spec.propid = PIDSI_THUMBNAIL;
185 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
186 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
187 ok(var.vt == VT_CF, "variant type wrong\n");
188 ok(var.pclipdata->ulClipFmt == CF_ENHMETAFILE,
189 "clipboard type wrong\n");
190 ok(var.pclipdata->cbSize == sizeof clipcontent + sizeof (ULONG),
191 "clipboard size wrong\n");
192 ok(!memcmp(var.pclipdata->pClipData, clipcontent, sizeof clipcontent),
193 "clipboard contents wrong\n");
194 ok(S_OK == PropVariantClear(&var), "failed to clear variant\n");
195
196 /* check deleting */
197 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 0, NULL);
198 ok(hr == S_OK, "DeleteMultiple with 0 args failed: 0x%08lx\n", hr);
199 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, NULL);
200 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
201 /* contrary to what the docs say, you can't delete the dictionary */
202 spec.ulKind = PRSPEC_PROPID;
203 spec.propid = PID_DICTIONARY;
204 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
206 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
207 /* now delete the first value.. */
208 spec.propid = PID_FIRST_USABLE;
209 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
210 ok(hr == S_OK, "DeleteMultiple failed: 0x%08lx\n", hr);
211 /* and check that it's no longer readable */
212 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
213 ok(hr == S_FALSE, "Expected S_FALSE, got 0x%08lx\n", hr);
214
215 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
216 ok(hr == S_OK, "Commit failed: 0x%08lx\n", hr);
217
218 /* check reverting */
219 spec.ulKind = PRSPEC_PROPID;
220 spec.propid = PID_FIRST_USABLE;
221 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
222 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
223 hr = IPropertyStorage_Revert(propertyStorage);
224 ok(hr == S_OK, "Revert failed: 0x%08lx\n", hr);
225 /* now check that it's still not there */
226 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
227 ok(hr == S_FALSE, "Expected S_FALSE, got 0x%08lx\n", hr);
228 /* set an integer value again */
229 spec.ulKind = PRSPEC_PROPID;
230 spec.propid = PID_FIRST_USABLE;
231 var.vt = VT_I4;
232 var.lVal = 1;
233 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
234 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
235 /* commit it */
236 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
237 ok(hr == S_OK, "Commit failed: 0x%08lx\n", hr);
238 /* set it to a string value */
239 var.vt = VT_LPSTR;
240 var.pszVal = val;
241 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
242 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
243 /* revert it */
244 hr = IPropertyStorage_Revert(propertyStorage);
245 ok(hr == S_OK, "Revert failed: 0x%08lx\n", hr);
246 /* Oddly enough, there's no guarantee that a successful revert actually
247 * implies the value wasn't saved. Maybe transactional mode needs to be
248 * used for that?
249 */
250
251 IPropertyStorage_Release(propertyStorage);
252 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
253 IStorage_Release(storage);
254 if(stream) IUnknown_Release(stream);
255
256 /* now open it again */
258 NULL, 0, &storage);
259 ok(hr == S_OK, "StgOpenStorage failed: 0x%08lx\n", hr);
260
261 if(propSetStorage)
262 {
263 hr = StgCreatePropSetStg(storage, 0, propSetStorage);
264 ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
265
266 hr = IPropertySetStorage_Open(*propSetStorage, &FMTID_SummaryInformation,
267 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &propertyStorage);
268 ok(hr == S_OK, "IPropertySetStorage_Open failed: 0x%08lx\n", hr);
269 }
270 else
271 {
272 hr = IStorage_OpenStream(storage, szSummaryInfo,
274 ok(hr == S_OK, "IStorage_OpenStream failed: 0x%08lx\n", hr);
275
277 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
278 ok(hr == S_OK, "StgOpenPropStg failed: 0x%08lx\n", hr);
279 }
280
281 /* check properties again */
282 spec.ulKind = PRSPEC_LPWSTR;
283 spec.lpwstr = propName;
284 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
285 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
286 ok(var.vt == VT_I4 && var.lVal == 2,
287 "Didn't get expected type or value for property (got type %d, value %ld)\n",
288 var.vt, var.lVal);
289 spec.ulKind = PRSPEC_PROPID;
290 spec.propid = PIDSI_AUTHOR;
291 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
292 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
293 ok(var.vt == VT_LPSTR && !lstrcmpA(var.pszVal, val),
294 "Didn't get expected type or value for property (got type %d, value %s)\n",
295 var.vt, var.pszVal);
297
298 IPropertyStorage_Release(propertyStorage);
299 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
300 IStorage_Release(storage);
301 if(stream) IUnknown_Release(stream);
302
304
305 /* Test creating a property set storage with a random GUID */
308 ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
309
310 if(propSetStorage)
311 {
312 hr = StgCreatePropSetStg(storage, 0, propSetStorage);
313 ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
314
315 hr = IPropertySetStorage_Create(*propSetStorage,
316 &anyOldGuid, NULL, PROPSETFLAG_ANSI,
318 &propertyStorage);
319 ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
320 }
321 else
322 {
323 hr = IStorage_CreateStream(storage, szSummaryInfo,
325 ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08lx\n", hr);
326
327 hr = StgCreatePropStg((IUnknown *)stream, &anyOldGuid, NULL,
328 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
329 ok(hr == S_OK, "StgCreatePropStg failed: 0x%08lx\n", hr);
330 }
331
332 spec.ulKind = PRSPEC_PROPID;
333 spec.propid = PID_FIRST_USABLE;
334 var.vt = VT_I4;
335 var.lVal = 1;
336 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
337 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
338
339 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
340 ok(hr == S_OK, "Commit failed: 0x%08lx\n", hr);
341
342 IPropertyStorage_Release(propertyStorage);
343 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
344 IStorage_Release(storage);
345 if(stream) IUnknown_Release(stream);
346
347 /* now open it again */
349 NULL, 0, &storage);
350 ok(hr == S_OK, "StgOpenStorage failed: 0x%08lx\n", hr);
351
352 if(propSetStorage)
353 {
354 hr = StgCreatePropSetStg(storage, 0, propSetStorage);
355 ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
356
357 hr = IPropertySetStorage_Open(*propSetStorage, &anyOldGuid,
358 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &propertyStorage);
359 ok(hr == S_OK, "IPropertySetStorage_Open failed: 0x%08lx\n", hr);
360 }
361 else
362 {
363 hr = IStorage_OpenStream(storage, szSummaryInfo,
365 ok(hr == S_OK, "IStorage_OpenStream failed: 0x%08lx\n", hr);
366
367 hr = StgOpenPropStg((IUnknown *)stream, &anyOldGuid,
368 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
369 ok(hr == S_OK, "StgOpenPropStg failed: 0x%08lx\n", hr);
370 }
371
372 spec.ulKind = PRSPEC_PROPID;
373 spec.propid = PID_FIRST_USABLE;
374 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
375 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
376
377 ok(var.vt == VT_I4 && var.lVal == 1,
378 "Didn't get expected type or value for property (got type %d, value %ld)\n",
379 var.vt, var.lVal);
380
381 IPropertyStorage_Release(propertyStorage);
382 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
383 IStorage_Release(storage);
384 if(stream) IUnknown_Release(stream);
385
387}
388
389static void testProps(void)
390{
391 IPropertySetStorage *propSetStorage = NULL;
392
393 testPropsHelper(&propSetStorage);
395}
396
397static void testCodepage(void)
398{
399 static const WCHAR szDot[] = { '.',0 };
400 static const WCHAR szPrefix[] = { 's','t','g',0 };
401 static CHAR aval[] = "hi";
402 static WCHAR wval[] = { 'h','i',0 };
403 HRESULT hr;
405 IPropertySetStorage *propSetStorage = NULL;
406 IPropertyStorage *propertyStorage = NULL;
407 PROPSPEC spec;
408 PROPVARIANT var;
409 WCHAR fileName[MAX_PATH];
410
411 if(!GetTempFileNameW(szDot, szPrefix, 0, fileName))
412 return;
413
414 hr = StgCreateDocfile(fileName,
416 ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
417
418 hr = StgCreatePropSetStg(storage, 0, &propSetStorage);
419 ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
420
421 hr = IPropertySetStorage_Create(propSetStorage,
422 &FMTID_SummaryInformation, NULL, PROPSETFLAG_DEFAULT,
424 &propertyStorage);
425 ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
426
427 PropVariantInit(&var);
428 spec.ulKind = PRSPEC_PROPID;
429 spec.propid = PID_CODEPAGE;
430 /* check code page before it's been explicitly set */
431 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
432 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
433 ok(var.vt == VT_I2 && var.iVal == 1200,
434 "Didn't get expected type or value for property\n");
435 /* Set the code page to ascii */
436 var.vt = VT_I2;
437 var.iVal = 1252;
438 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
439 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
440 /* check code page */
441 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
442 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
443 ok(var.vt == VT_I2 && var.iVal == 1252,
444 "Didn't get expected type or value for property\n");
445 /* Set code page to Unicode */
446 var.iVal = 1200;
447 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
448 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
449 /* check code page */
450 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
451 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
452 ok(var.vt == VT_I2 && var.iVal == 1200,
453 "Didn't get expected type or value for property\n");
454 /* Set a string value */
455 spec.ulKind = PRSPEC_PROPID;
456 spec.propid = PID_FIRST_USABLE;
457 var.vt = VT_LPSTR;
458 var.pszVal = aval;
459 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
460 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
461 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
462 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
463 ok(var.vt == VT_LPSTR && !strcmp(var.pszVal, "hi"),
464 "Didn't get expected type or value for property\n");
466 /* This seemingly non-sensical test is to show that the string is indeed
467 * interpreted according to the current system code page, not according to
468 * the property set's code page. (If the latter were true, the whole
469 * string would be maintained. As it is, only the first character is.)
470 */
471 var.vt = VT_LPSTR;
472 var.pszVal = (LPSTR)wval;
473 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
474 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
475 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
476 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
477 ok(var.vt == VT_LPSTR && !strcmp(var.pszVal, "h"),
478 "Didn't get expected type or value for property\n");
480
481 /* now that a property's been set, you can't change the code page */
482 spec.ulKind = PRSPEC_PROPID;
483 spec.propid = PID_CODEPAGE;
484 var.vt = VT_I2;
485 var.iVal = 1200;
486 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
488 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
489
490 IPropertyStorage_Release(propertyStorage);
491 IPropertySetStorage_Release(propSetStorage);
492 IStorage_Release(storage);
493
494 DeleteFileW(fileName);
495
496 /* same tests, but with PROPSETFLAG_ANSI */
497 hr = StgCreateDocfile(fileName,
499 ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
500
501 hr = StgCreatePropSetStg(storage, 0, &propSetStorage);
502 ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
503
504 hr = IPropertySetStorage_Create(propSetStorage,
505 &FMTID_SummaryInformation, NULL, PROPSETFLAG_ANSI,
507 &propertyStorage);
508 ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
509
510 /* check code page before it's been explicitly set */
511 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
512 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
513 ok(var.vt == VT_I2, "Didn't get expected type for property (%u)\n", var.vt);
514 /* Set code page to Unicode */
515 var.iVal = 1200;
516 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
517 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
518 /* check code page */
519 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
520 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
521 ok(var.vt == VT_I2 && var.iVal == 1200,
522 "Didn't get expected type or value for property\n");
523 /* This test is commented out for documentation. It fails under Wine,
524 * and I expect it would under Windows as well, yet it succeeds. There's
525 * obviously something about string conversion I don't understand.
526 */
527 if(0) {
528 static unsigned char strVal[] = { 0x81, 0xff, 0x04, 0 };
529 /* Set code page to 950 (Traditional Chinese) */
530 var.iVal = 950;
531 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
532 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
533 /* Try writing an invalid string: lead byte 0x81 is unused in Traditional
534 * Chinese.
535 */
536 spec.ulKind = PRSPEC_PROPID;
537 spec.propid = PID_FIRST_USABLE;
538 var.vt = VT_LPSTR;
539 var.pszVal = (LPSTR)strVal;
540 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
541 ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
542 /* Check returned string */
543 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
544 ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
545 ok(var.vt == VT_LPSTR && !strcmp(var.pszVal, (LPCSTR)strVal),
546 "Didn't get expected type or value for property\n");
547 }
548
549 IPropertyStorage_Release(propertyStorage);
550 IPropertySetStorage_Release(propSetStorage);
551 IStorage_Release(storage);
552
553 DeleteFileW(fileName);
554}
555
556static void testFmtId(void)
557{
558 WCHAR szSummaryInfo[] = { 5,'S','u','m','m','a','r','y',
559 'I','n','f','o','r','m','a','t','i','o','n',0 };
560 WCHAR szDocSummaryInfo[] = { 5,'D','o','c','u','m','e','n','t',
561 'S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',
562 0 };
563 WCHAR szIID_IPropSetStg[] = { 5,'0','j','a','a','a','a','a',
564 'a','A','a','a','a','a','a','d','a','A','a','a','a','a','a','a','a','G',
565 'c',0 };
566 WCHAR name[32];
567 FMTID fmtid;
568 HRESULT hr;
569
571 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
573 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
575 ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
577 sizeof(WCHAR)), "Got wrong name for FMTID_SummaryInformation\n");
579 ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
581 sizeof(WCHAR)), "Got wrong name for FMTID_DocSummaryInformation\n");
583 ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
585 sizeof(WCHAR)), "Got wrong name for FMTID_DocSummaryInformation\n");
586 hr = FmtIdToPropStgName(&IID_IPropertySetStorage, name);
587 ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
588 ok(!memcmp(name, szIID_IPropSetStg, (lstrlenW(szIID_IPropSetStg) + 1) *
589 sizeof(WCHAR)), "Got wrong name for IID_IPropertySetStorage\n");
590
591 /* test args first */
593 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
594 hr = PropStgNameToFmtId(NULL, &fmtid);
595 ok(hr == STG_E_INVALIDNAME, "Expected STG_E_INVALIDNAME, got 0x%08lx\n",
596 hr);
598 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
599 /* test the known format IDs */
601 ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
602 ok(!memcmp(&fmtid, &FMTID_SummaryInformation, sizeof(fmtid)),
603 "Got unexpected FMTID, expected FMTID_SummaryInformation\n");
605 ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
606 ok(!memcmp(&fmtid, &FMTID_DocSummaryInformation, sizeof(fmtid)),
607 "Got unexpected FMTID, expected FMTID_DocSummaryInformation\n");
608 /* test another GUID */
609 hr = PropStgNameToFmtId(szIID_IPropSetStg, &fmtid);
610 ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
611 ok(!memcmp(&fmtid, &IID_IPropertySetStorage, sizeof(fmtid)),
612 "Got unexpected FMTID, expected IID_IPropertySetStorage\n");
613 /* now check case matching */
616 ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
617 ok(!memcmp(&fmtid, &FMTID_DocSummaryInformation, sizeof(fmtid)),
618 "Got unexpected FMTID, expected FMTID_DocSummaryInformation\n");
619 CharUpperW(szIID_IPropSetStg + 1);
620 hr = PropStgNameToFmtId(szIID_IPropSetStg, &fmtid);
621 ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
622 ok(!memcmp(&fmtid, &IID_IPropertySetStorage, sizeof(fmtid)),
623 "Got unexpected FMTID, expected IID_IPropertySetStorage\n");
624}
625
626typedef struct
627{
634
635typedef struct
636{
640
641typedef struct
642{
646
647typedef struct
648{
652
653typedef struct
654{
658
660{
670} test_prop_data = {
671 {
672 0xfffe, 0, 0x2000a00,
673 /* IID_IUnknown */
674 {0x00000000, 0x0000, 0x0000, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}},
675 2
676 },
677 {
678 /* FMTID_DocSummaryInformation */
679 {0xd5cdd502, 0x2e9c, 0x101b, {0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae}},
680 FIELD_OFFSET(struct test_prop_data, doc_summary_header)
681 },
682 {
683 /* FMTID_UserDefinedProperties */
684 {0xd5cdd505, 0x2e9c, 0x101b, {0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae}},
685 FIELD_OFFSET(struct test_prop_data, user_def_props_header)
686 },
687 {
688 sizeof(PROPERTYSECTIONHEADER) + sizeof(PROPERTYIDOFFSET) + sizeof(PROPVARIANT_DWORD),
689 1
690 },
691 { 0x10, sizeof(PROPERTYSECTIONHEADER) + sizeof(PROPERTYIDOFFSET) },
692 { VT_UI4, 11 },
693 {
694 sizeof(PROPERTYSECTIONHEADER) + sizeof(PROPERTYIDOFFSET) + sizeof(PROPVARIANT_DWORD),
695 1
696 },
697 { 0x10, sizeof(PROPERTYSECTIONHEADER) + sizeof(PROPERTYIDOFFSET) },
698 { VT_I4, 10 }
700
702{
703 IPropertyStorage *prop_storage, *prop_storage2;
704 IPropertySetStorage *ps_storage;
705 IEnumSTATPROPSETSTG *ps_enum;
706 IEnumSTATPROPSTG *prop_enum;
708 STATPROPSETSTG psstg;
709 STATPROPSTG pstg;
710 DWORD ret, fetched;
714 PROPVARIANT pv;
715 PROPSPEC ps;
716 HRESULT hr;
717
718 ret = GetTempFileNameW(L".", L"stg", 0, filename);
719 ok(ret, "Failed to get temporary file name.\n");
720
722 ok(hr == S_OK, "Failed to crate storage, hr %#lx.\n", hr);
723
724 hr = StgCreatePropSetStg(storage, 0, &ps_storage);
725 ok(hr == S_OK, "Failed to create property set storage, hr %#lx.\n", hr);
726
727 hr = IPropertySetStorage_Create(ps_storage, &FMTID_SummaryInformation, &IID_IUnknown, PROPSETFLAG_ANSI,
729 ok(hr == S_OK, "Failed to create property storage, hr %#lx.\n", hr);
730
731 hr = IPropertyStorage_Stat(prop_storage, &psstg);
732 ok(hr == S_OK, "Failed to get prop storage stats, hr %#lx.\n", hr);
734 ok(IsEqualCLSID(&psstg.clsid, &IID_IUnknown), "Unexpected storage clsid %s.\n", wine_dbgstr_guid(&psstg.clsid));
735
736 hr = IPropertySetStorage_Enum(ps_storage, NULL);
737 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
738
739 hr = IPropertySetStorage_Enum(ps_storage, &ps_enum);
740 ok(hr == S_OK, "Failed to get enum object, hr %#lx.\n", hr);
741
742 memset(&psstg, 0, sizeof(psstg));
743 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
744 ok(hr == S_OK, "Failed to get enum item, hr %#lx.\n", hr);
745 ok(fetched == 1, "Unexpected fetched count.\n");
746 ok(IsEqualCLSID(&psstg.fmtid, &FMTID_SummaryInformation), "Unexpected fmtid %s.\n",
747 wine_dbgstr_guid(&psstg.fmtid));
748 ok(psstg.mtime.dwHighDateTime == 0 && psstg.mtime.dwLowDateTime == 0, "Unexpected mtime %#lx / %#lx.\n",
749 psstg.mtime.dwHighDateTime, psstg.mtime.dwLowDateTime);
750
751 memset(&ftime, 0, sizeof(ftime));
752 ftime.dwLowDateTime = 1;
753 hr = IPropertyStorage_SetTimes(prop_storage, NULL, NULL, &ftime);
755 ok(hr == S_OK, "Failed to set storage times, hr %#lx.\n", hr);
756
757 hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
758 ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
759 memset(&psstg, 0, sizeof(psstg));
760 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
761 ok(hr == S_OK, "Failed to get enum item, hr %#lx.\n", hr);
762 ok(fetched == 1, "Unexpected fetched count.\n");
763 ok(IsEqualCLSID(&psstg.fmtid, &FMTID_SummaryInformation), "Unexpected fmtid %s.\n",
764 wine_dbgstr_guid(&psstg.fmtid));
765 ok(psstg.mtime.dwHighDateTime == 0 && psstg.mtime.dwLowDateTime == 0, "Unexpected mtime %#lx / %#lx.\n",
766 psstg.mtime.dwHighDateTime, psstg.mtime.dwLowDateTime);
767 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
768 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
769
770 hr = IPropertySetStorage_Create(ps_storage, &FMTID_SummaryInformation, &IID_IUnknown, PROPSETFLAG_ANSI,
772 ok(hr == S_OK, "Failed to create property storage, hr %#lx.\n", hr);
773
774 hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
775 ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
776 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
777 ok(hr == S_OK, "Failed to get enum item, hr %#lx.\n", hr);
778 ok(fetched == 1, "Unexpected fetched count.\n");
779 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
780 ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
781
782 /* Skipping. */
783 hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
784 ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
785 hr = IEnumSTATPROPSETSTG_Skip(ps_enum, 2);
787 ok(hr == S_FALSE, "Failed to skip, hr %#lx.\n", hr);
788 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
790 ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
791
792 hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
793 ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
794 hr = IEnumSTATPROPSETSTG_Skip(ps_enum, 1);
795 ok(hr == S_OK, "Failed to skip, hr %#lx.\n", hr);
796 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
798 ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
799
800 hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
801 ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
802todo_wine {
803 hr = IEnumSTATPROPSETSTG_Skip(ps_enum, 0);
804 ok(hr == S_FALSE, "Failed to skip, hr %#lx.\n", hr);
805 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
806 ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
807}
808 IEnumSTATPROPSETSTG_Release(ps_enum);
809
810 IPropertyStorage_Release(prop_storage2);
811 IPropertyStorage_Release(prop_storage);
812
813 IPropertySetStorage_Release(ps_storage);
814 IStorage_Release(storage);
815
816 /* test FMTID_UserDefinedProperties */
818 ok(hr == S_OK, "Failed to crate storage, hr %#lx.\n", hr);
819
820 hr = StgCreatePropSetStg(storage, 0, &ps_storage);
821 ok(hr == S_OK, "Failed to create property set storage, hr %#lx.\n", hr);
822
823 hr = IPropertySetStorage_Create(ps_storage, &FMTID_UserDefinedProperties, &IID_IUnknown,
824 PROPSETFLAG_ANSI, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE, &prop_storage);
825 ok(hr == S_OK, "Failed to create property storage, hr %#lx.\n", hr);
826 ps.ulKind = PRSPEC_PROPID;
827 ps.propid = 0x10;
828 pv.vt = VT_I4;
829 pv.lVal = 10;
830 hr = IPropertyStorage_WriteMultiple(prop_storage, 1, &ps, &pv, 0x10);
831 ok(hr == S_OK, "Failed to add property, hr %#lx.\n", hr);
832 IPropertyStorage_Release(prop_storage);
833
834 hr = IPropertySetStorage_Open(ps_storage, &FMTID_DocSummaryInformation,
835 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &prop_storage);
836 ok(hr == S_OK, "Failed to open FMTID_DocSummaryInformation, hr %#lx.\n", hr);
837 pv.vt = VT_UI4;
838 pv.lVal = 11;
839 hr = IPropertyStorage_WriteMultiple(prop_storage, 1, &ps, &pv, 0x10);
840 ok(hr == S_OK, "Failed to add property, hr %#lx.\n", hr);
841 IPropertyStorage_Release(prop_storage);
842
843 hr = IPropertySetStorage_Enum(ps_storage, &ps_enum);
844 ok(hr == S_OK, "Failed to get enum object, hr %#lx.\n", hr);
845 memset(&psstg, 0, sizeof(psstg));
846 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
847 ok(hr == S_OK, "Failed to get enum item, hr %#lx.\n", hr);
848 ok(fetched == 1, "Unexpected fetched count.\n");
849 ok(IsEqualCLSID(&psstg.fmtid, &FMTID_DocSummaryInformation), "Unexpected fmtid %s.\n",
850 wine_dbgstr_guid(&psstg.fmtid));
851 memset(&psstg, 0, sizeof(psstg));
852 hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
853 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
854 IEnumSTATPROPSETSTG_Release(ps_enum);
855
856 hr = IPropertySetStorage_Open(ps_storage, &FMTID_DocSummaryInformation,
857 STGM_READ | STGM_SHARE_EXCLUSIVE, &prop_storage);
858 ok(hr == S_OK, "Failed to open FMTID_DocSummaryInformation, hr %#lx.\n", hr);
859 hr = IPropertyStorage_Enum(prop_storage, &prop_enum);
860 ok(hr == S_OK, "IPropertyStorage_Enum failed, hr %#lx.\n", hr);
861 memset(&pstg, 0, sizeof(pstg));
862 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
863 ok(hr == S_OK, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
864 ok(pstg.propid == 0x10, "pstg.propid = %lx\n", pstg.propid);
865 ok(pstg.vt == VT_UI4, "pstg.vt = %d\n", pstg.vt);
866 memset(&pstg, 0, sizeof(pstg));
867 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
868 ok(hr == S_FALSE, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
869 IEnumSTATPROPSTG_Release(prop_enum);
870 IPropertyStorage_Release(prop_storage);
871
872 hr = IPropertySetStorage_Open(ps_storage, &FMTID_UserDefinedProperties,
873 STGM_READ | STGM_SHARE_EXCLUSIVE, &prop_storage);
874 ok(hr == S_OK, "Failed to open FMTID_DocSummaryInformation, hr %#lx.\n", hr);
875 hr = IPropertyStorage_Enum(prop_storage, &prop_enum);
876 ok(hr == S_OK, "IPropertyStorage_Enum failed, hr %#lx.\n", hr);
877 memset(&pstg, 0, sizeof(pstg));
878 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
879 ok(hr == S_OK, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
880 ok(pstg.propid == 0x10, "pstg.propid = %lx\n", pstg.propid);
881 todo_wine ok(pstg.vt == VT_I4, "pstg.vt = %d\n", pstg.vt);
882 memset(&pstg, 0, sizeof(pstg));
883 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
884 ok(hr == S_FALSE, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
885 IEnumSTATPROPSTG_Release(prop_enum);
886 IPropertyStorage_Release(prop_storage);
887
888 hr = IStorage_OpenStream(storage, L"\5DocumentSummaryInformation", NULL,
890 ok(hr == S_OK, "IStorage_CreateStream failed, hr %#lx.\n", hr);
891 hr = IStream_Write(stream, &test_prop_data, sizeof(test_prop_data), NULL);
892 ok(hr == S_OK, "IStream_Write failed, hr %#lx.\n", hr);
893 IStream_Release(stream);
894
895 hr = IPropertySetStorage_Open(ps_storage, &FMTID_DocSummaryInformation,
896 STGM_READ | STGM_SHARE_EXCLUSIVE, &prop_storage);
897 ok(hr == S_OK, "Failed to open FMTID_DocSummaryInformation, hr %#lx.\n", hr);
898 hr = IPropertyStorage_Enum(prop_storage, &prop_enum);
899 ok(hr == S_OK, "IPropertyStorage_Enum failed, hr %#lx.\n", hr);
900 memset(&pstg, 0, sizeof(pstg));
901 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
902 ok(hr == S_OK, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
903 ok(pstg.propid == 0x10, "pstg.propid = %lx\n", pstg.propid);
904 ok(pstg.vt == VT_UI4, "pstg.vt = %d\n", pstg.vt);
905 memset(&pstg, 0, sizeof(pstg));
906 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
907 ok(hr == S_FALSE, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
908 IEnumSTATPROPSTG_Release(prop_enum);
909 IPropertyStorage_Release(prop_storage);
910
911 hr = IPropertySetStorage_Open(ps_storage, &FMTID_UserDefinedProperties,
912 STGM_READ | STGM_SHARE_EXCLUSIVE, &prop_storage);
913 ok(hr == S_OK, "Failed to open FMTID_DocSummaryInformation, hr %#lx.\n", hr);
914 hr = IPropertyStorage_Enum(prop_storage, &prop_enum);
915 ok(hr == S_OK, "IPropertyStorage_Enum failed, hr %#lx.\n", hr);
916 memset(&pstg, 0, sizeof(pstg));
917 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
918 ok(hr == S_OK, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
919 ok(pstg.propid == 0x10, "pstg.propid = %lx\n", pstg.propid);
920 todo_wine ok(pstg.vt == VT_I4, "pstg.vt = %d\n", pstg.vt);
921 memset(&pstg, 0, sizeof(pstg));
922 hr = IEnumSTATPROPSTG_Next(prop_enum, 1, &pstg, &fetched);
923 ok(hr == S_FALSE, "IEnumSTATPROPSTG_Next failed, hr %#lx.\n", hr);
924 IEnumSTATPROPSTG_Release(prop_enum);
925 IPropertyStorage_Release(prop_storage);
926
927 IPropertySetStorage_Release(ps_storage);
928 IStorage_Release(storage);
929
931 ok(ret, "Failed to delete storage file.\n");
932}
933
934START_TEST(stg_prop)
935{
936 testProps();
937 testCodepage();
938 testFmtId();
940}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define CF_ENHMETAFILE
Definition: constants.h:409
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: combase.c:709
static const WCHAR szDocSummaryInfo[]
Definition: stg_prop.c:62
static const WCHAR szSummaryInfo[]
Definition: stg_prop.c:61
HRESULT WINAPI FmtIdToPropStgName(const FMTID *rfmtid, LPOLESTR str)
Definition: stg_prop.c:72
HRESULT WINAPI PropStgNameToFmtId(const LPOLESTR str, FMTID *rfmtid)
Definition: stg_prop.c:129
HRESULT WINAPI StgCreatePropSetStg(IStorage *pstg, DWORD reserved, IPropertySetStorage **propset)
Definition: storage32.c:233
#define MAX_PATH
Definition: compat.h:34
@ VT_LPSTR
Definition: compat.h:2324
@ VT_I4
Definition: compat.h:2298
@ VT_CF
Definition: compat.h:2336
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1205
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
static void ftime(struct _timeb *ptr)
Definition: timeb.h:72
struct tagPROPERTYIDOFFSET PROPERTYIDOFFSET
struct tagPROPERTYSETHEADER PROPERTYSETHEADER
struct tagFORMATIDOFFSET FORMATIDOFFSET
struct tagPROPERTYSECTIONHEADER PROPERTYSECTIONHEADER
HRESULT WINAPI StgOpenPropStg(IUnknown *unk, REFFMTID fmt, DWORD flags, DWORD reserved, IPropertyStorage **prop_stg)
Definition: stg_prop.c:3104
HRESULT WINAPI StgCreatePropStg(IUnknown *unk, REFFMTID fmt, const CLSID *clsid, DWORD flags, DWORD reserved, IPropertyStorage **prop_stg)
Definition: stg_prop.c:3059
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8701
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8597
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLfloat * val
Definition: glext.h:7180
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
#define todo_wine
Definition: minitest.h:80
const char * var
Definition: shader.c:5666
#define PID_DICTIONARY
Definition: suminfo.c:42
#define PID_CODEPAGE
Definition: suminfo.c:43
#define PID_BEHAVIOR
Definition: stg_prop.c:24
static void testProps(void)
Definition: stg_prop.c:389
static void testPropsHelper(IPropertySetStorage **propSetStorage)
Definition: stg_prop.c:30
static void testFmtId(void)
Definition: stg_prop.c:556
static void testCodepage(void)
Definition: stg_prop.c:397
static void test_propertyset_storage_enum(void)
Definition: stg_prop.c:701
#define STGM_CREATE
Definition: objbase.h:943
#define STGM_READWRITE
Definition: objbase.h:936
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:940
#define STGM_READ
Definition: objbase.h:934
const FMTID FMTID_UserDefinedProperties
const FMTID FMTID_DocSummaryInformation
const FMTID FMTID_SummaryInformation
#define PID_FIRST_USABLE
Definition: propkeydef.h:20
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:206
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
DWORD offset
Definition: stg_prop.c:638
Definition: name.c:39
Definition: parse.h:23
PROPVARIANT_DWORD prop2_val
Definition: stg_prop.c:669
PROPERTYIDOFFSET prop1
Definition: stg_prop.c:665
FORMATIDOFFSET doc_summary
Definition: stg_prop.c:662
PROPERTYIDOFFSET prop2
Definition: stg_prop.c:668
FORMATIDOFFSET user_def_props
Definition: stg_prop.c:663
PROPERTYSECTIONHEADER doc_summary_header
Definition: stg_prop.c:664
PROPVARIANT_DWORD prop1_val
Definition: stg_prop.c:666
PROPERTYSECTIONHEADER user_def_props_header
Definition: stg_prop.c:667
PROPERTYSETHEADER header
Definition: stg_prop.c:661
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint32_t ULONG
Definition: typedefs.h:59
#define S_FALSE
Definition: winerror.h:3451
#define STG_E_INVALIDNAME
Definition: winerror.h:3680
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:3675
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
char * LPSTR
Definition: xmlstorage.h:182
char CHAR
Definition: xmlstorage.h:175