31{
32 static const WCHAR szDot[] = {
'.',0 };
33 static const WCHAR szPrefix[] = {
's',
't',
'g',0 };
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";
43 PROPSPEC spec;
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
56 return;
57
59
62 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
63
64 if(propSetStorage)
65 {
67 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08lx\n",
hr);
68
69 hr = IPropertySetStorage_Create(*propSetStorage,
72 &propertyStorage);
73 ok(
hr ==
S_OK,
"IPropertySetStorage_Create failed: 0x%08lx\n",
hr);
74 }
75 else
76 {
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);
90
91
92 spec.ulKind = PRSPEC_PROPID;
96 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
98 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n",
hr);
99
100
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
109 spec.ulKind = PRSPEC_PROPID;
112 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
114 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n",
hr);
115
116
117 spec.ulKind = PRSPEC_PROPID;
120 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
121 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08lx\n",
hr);
122
123
124 spec.ulKind = PRSPEC_LPWSTR;
125 spec.lpwstr = propName;
127 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var,
129 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08lx\n",
hr);
130
131
132 spec.ulKind = PRSPEC_PROPID;
133 spec.propid = PIDSI_AUTHOR;
136 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
137 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08lx\n",
hr);
138
139
140 spec.ulKind = PRSPEC_PROPID;
141 spec.propid = PIDSI_THUMBNAIL;
143 clipdata.cbSize =
sizeof clipcontent +
sizeof (
ULONG);
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
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);
156
157 spec.ulKind = PRSPEC_PROPID;
159 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
160 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08lx\n",
hr);
162 "Didn't get expected type or value for property (got type %d, value %ld)\n",
164
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);
170 "Didn't get expected type or value for property (got type %d, value %ld)\n",
172
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);
178 "Didn't get expected type or value for property (got type %d, value %s)\n",
181
182
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);
189 "clipboard type wrong\n");
191 "clipboard size wrong\n");
192 ok(!
memcmp(
var.pclipdata->pClipData, clipcontent,
sizeof clipcontent),
193 "clipboard contents wrong\n");
195
196
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);
201
202 spec.ulKind = PRSPEC_PROPID;
204 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
206 "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n",
hr);
207
209 hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
210 ok(
hr ==
S_OK,
"DeleteMultiple failed: 0x%08lx\n",
hr);
211
212 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
214
215 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
216 ok(
hr ==
S_OK,
"Commit failed: 0x%08lx\n",
hr);
217
218
219 spec.ulKind = PRSPEC_PROPID;
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
226 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
228
229 spec.ulKind = PRSPEC_PROPID;
233 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
234 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08lx\n",
hr);
235
236 hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
237 ok(
hr ==
S_OK,
"Commit failed: 0x%08lx\n",
hr);
238
241 hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &
var, 0);
242 ok(
hr ==
S_OK,
"WriteMultiple failed: 0x%08lx\n",
hr);
243
244 hr = IPropertyStorage_Revert(propertyStorage);
245 ok(
hr ==
S_OK,
"Revert failed: 0x%08lx\n",
hr);
246
247
248
249
250
251 IPropertyStorage_Release(propertyStorage);
252 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
255
256
259 ok(
hr ==
S_OK,
"StgOpenStorage failed: 0x%08lx\n",
hr);
260
261 if(propSetStorage)
262 {
264 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08lx\n",
hr);
265
268 ok(
hr ==
S_OK,
"IPropertySetStorage_Open failed: 0x%08lx\n",
hr);
269 }
270 else
271 {
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
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);
287 "Didn't get expected type or value for property (got type %d, value %ld)\n",
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);
294 "Didn't get expected type or value for property (got type %d, value %s)\n",
297
298 IPropertyStorage_Release(propertyStorage);
299 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
302
304
305
308 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
309
310 if(propSetStorage)
311 {
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 {
325 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08lx\n",
hr);
326
328 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
329 ok(
hr ==
S_OK,
"StgCreatePropStg failed: 0x%08lx\n",
hr);
330 }
331
332 spec.ulKind = PRSPEC_PROPID;
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);
346
347
350 ok(
hr ==
S_OK,
"StgOpenStorage failed: 0x%08lx\n",
hr);
351
352 if(propSetStorage)
353 {
355 ok(
hr ==
S_OK,
"StgCreatePropSetStg failed: 0x%08lx\n",
hr);
356
357 hr = IPropertySetStorage_Open(*propSetStorage, &anyOldGuid,
359 ok(
hr ==
S_OK,
"IPropertySetStorage_Open failed: 0x%08lx\n",
hr);
360 }
361 else
362 {
365 ok(
hr ==
S_OK,
"IStorage_OpenStream failed: 0x%08lx\n",
hr);
366
368 PROPSETFLAG_DEFAULT, 0, &propertyStorage);
369 ok(
hr ==
S_OK,
"StgOpenPropStg failed: 0x%08lx\n",
hr);
370 }
371
372 spec.ulKind = PRSPEC_PROPID;
374 hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &
var);
375 ok(
hr ==
S_OK,
"ReadMultiple failed: 0x%08lx\n",
hr);
376
378 "Didn't get expected type or value for property (got type %d, value %ld)\n",
380
381 IPropertyStorage_Release(propertyStorage);
382 if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
385
387}
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
HRESULT WINAPI StgOpenPropStg(IUnknown *unk, REFFMTID fmt, DWORD flags, DWORD reserved, IPropertyStorage **prop_stg)
HRESULT WINAPI StgCreatePropStg(IUnknown *unk, REFFMTID fmt, const CLSID *clsid, DWORD flags, DWORD reserved, IPropertyStorage **prop_stg)
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList