wbemprox: Implement IEnumWbemClassObject::Clone.
[wine] / dlls / windowscodecs / tests / info.c
1 /*
2  * Copyright 2009 Vincent Povirk for CodeWeavers
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
19 #include <stdio.h>
20 #include <stdarg.h>
21 #include <math.h>
22
23 #define COBJMACROS
24
25 #include "windef.h"
26 #include "objbase.h"
27 #include "wincodec.h"
28 #include "wincodecsdk.h"
29 #include "wine/test.h"
30
31 #include "initguid.h"
32 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
33
34 static const char *debugstr_guid(GUID *guid)
35 {
36     static char buf[50];
37
38     if(!guid)
39         return "(null)";
40
41     sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
42             guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
43             guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
44             guid->Data4[5], guid->Data4[6], guid->Data4[7]);
45
46     return buf;
47 }
48
49 static HRESULT get_component_info(const GUID *clsid, IWICComponentInfo **result)
50 {
51     IWICImagingFactory *factory;
52     HRESULT hr;
53
54     hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
55         &IID_IWICImagingFactory, (void**)&factory);
56     ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
57     if (FAILED(hr)) return hr;
58
59     hr = IWICImagingFactory_CreateComponentInfo(factory, clsid, result);
60
61     IWICImagingFactory_Release(factory);
62
63     return hr;
64 }
65
66 static void test_decoder_info(void)
67 {
68     IWICComponentInfo *info;
69     IWICBitmapDecoderInfo *decoder_info;
70     HRESULT hr;
71     ULONG len;
72     WCHAR value[256];
73     const WCHAR expected_mimetype[] = {'i','m','a','g','e','/','b','m','p',0};
74     CLSID clsid;
75
76     hr = get_component_info(&CLSID_WICBmpDecoder, &info);
77
78     hr = IWICComponentInfo_QueryInterface(info, &IID_IWICBitmapDecoderInfo, (void**)&decoder_info);
79     ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
80
81     hr = IWICBitmapDecoderInfo_GetCLSID(decoder_info, NULL);
82     ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
83
84     hr = IWICBitmapDecoderInfo_GetCLSID(decoder_info, &clsid);
85     ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
86     ok(IsEqualGUID(&CLSID_WICBmpDecoder, &clsid), "GetCLSID returned wrong result\n");
87
88     hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, NULL);
89     ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
90
91     hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, NULL, &len);
92     ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
93     ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
94
95     hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, NULL);
96     ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
97
98     hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, &len);
99     ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
100     ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
101
102     value[0] = 0;
103     hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, &len);
104     ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
105     ok(lstrcmpW(value, expected_mimetype) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value));
106     ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
107
108     hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, value, &len);
109     ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetMimeType failed, hr=%x\n", hr);
110     ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
111
112     hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 256, value, &len);
113     ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
114     ok(lstrcmpW(value, expected_mimetype) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value));
115     ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
116
117     IWICBitmapDecoderInfo_Release(decoder_info);
118
119     IWICComponentInfo_Release(info);
120 }
121
122 static void test_pixelformat_info(void)
123 {
124     IWICComponentInfo *info;
125     IWICPixelFormatInfo *pixelformat_info;
126     IWICPixelFormatInfo2 *pixelformat_info2;
127     HRESULT hr;
128     ULONG len, known_len;
129     WCHAR value[256];
130     GUID guid;
131     WICComponentType componenttype;
132     WICPixelFormatNumericRepresentation numericrepresentation;
133     DWORD signing;
134     UINT uiresult;
135     BYTE abbuffer[256];
136     BOOL supportstransparency;
137
138     hr = get_component_info(&GUID_WICPixelFormat32bppBGRA, &info);
139     ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
140
141     if (FAILED(hr))
142         return;
143
144     hr = IWICComponentInfo_GetAuthor(info, 0, NULL, 0);
145     ok(hr == E_INVALIDARG, "GetAuthor failed, hr=%x\n", hr);
146
147     len = 0xdeadbeef;
148     hr = IWICComponentInfo_GetAuthor(info, 0, NULL, &len);
149     ok(hr == S_OK, "GetAuthor failed, hr=%x\n", hr);
150     ok(len < 255 && len > 0, "invalid length 0x%x\n", len);
151     known_len = len;
152
153     memset(value, 0xaa, 256 * sizeof(WCHAR));
154     hr = IWICComponentInfo_GetAuthor(info, len-1, value, NULL);
155     ok(hr == E_INVALIDARG, "GetAuthor failed, hr=%x\n", hr);
156     ok(value[0] = 0xaaaa, "string modified\n");
157
158     len = 0xdeadbeef;
159     memset(value, 0xaa, 256 * sizeof(WCHAR));
160     hr = IWICComponentInfo_GetAuthor(info, known_len-1, value, &len);
161     ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetAuthor failed, hr=%x\n", hr);
162     ok(len == known_len, "got length of 0x%x, expected 0x%x\n", len, known_len);
163     ok(value[known_len-1] == 0xaaaa, "string modified past given length\n");
164     ok(value[0] == 0xaaaa, "string modified\n");
165
166     len = 0xdeadbeef;
167     memset(value, 0xaa, 256 * sizeof(WCHAR));
168     hr = IWICComponentInfo_GetAuthor(info, known_len, value, &len);
169     ok(hr == S_OK, "GetAuthor failed, hr=%x\n", hr);
170     ok(len == known_len, "got length of 0x%x, expected 0x%x\n", len, known_len);
171     ok(value[known_len-1] == 0, "string not terminated at expected length\n");
172     ok(value[known_len-2] != 0xaaaa, "string not modified at given length\n");
173
174     len = 0xdeadbeef;
175     memset(value, 0xaa, 256 * sizeof(WCHAR));
176     hr = IWICComponentInfo_GetAuthor(info, known_len+1, value, &len);
177     ok(hr == S_OK, "GetAuthor failed, hr=%x\n", hr);
178     ok(len == known_len, "got length of 0x%x, expected 0x%x\n", len, known_len);
179     ok(value[known_len] == 0xaaaa, "string modified past end\n");
180     ok(value[known_len-1] == 0, "string not terminated at expected length\n");
181     ok(value[known_len-2] != 0xaaaa, "string not modified at given length\n");
182
183     hr = IWICComponentInfo_GetCLSID(info, NULL);
184     ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
185
186     memset(&guid, 0xaa, sizeof(guid));
187     hr = IWICComponentInfo_GetCLSID(info, &guid);
188     ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
189     ok(IsEqualGUID(&guid, &GUID_WICPixelFormat32bppBGRA), "unexpected CLSID %s\n", debugstr_guid(&guid));
190
191     hr = IWICComponentInfo_GetComponentType(info, NULL);
192     ok(hr == E_INVALIDARG, "GetComponentType failed, hr=%x\n", hr);
193
194     hr = IWICComponentInfo_GetComponentType(info, &componenttype);
195     ok(hr == S_OK, "GetComponentType failed, hr=%x\n", hr);
196     ok(componenttype == WICPixelFormat, "unexpected component type 0x%x\n", componenttype);
197
198     len = 0xdeadbeef;
199     hr = IWICComponentInfo_GetFriendlyName(info, 0, NULL, &len);
200     ok(hr == S_OK, "GetFriendlyName failed, hr=%x\n", hr);
201     ok(len < 255 && len > 0, "invalid length 0x%x\n", len);
202
203     hr = IWICComponentInfo_GetSigningStatus(info, NULL);
204     ok(hr == E_INVALIDARG, "GetSigningStatus failed, hr=%x\n", hr);
205
206     hr = IWICComponentInfo_GetSigningStatus(info, &signing);
207     ok(hr == S_OK, "GetSigningStatus failed, hr=%x\n", hr);
208     ok(signing == WICComponentSigned, "unexpected signing status 0x%x\n", signing);
209
210     len = 0xdeadbeef;
211     hr = IWICComponentInfo_GetSpecVersion(info, 0, NULL, &len);
212     todo_wine ok(hr == S_OK, "GetSpecVersion failed, hr=%x\n", hr);
213     todo_wine ok(len == 0, "invalid length 0x%x\n", len); /* spec version does not apply to pixel formats */
214
215     memset(&guid, 0xaa, sizeof(guid));
216     hr = IWICComponentInfo_GetVendorGUID(info, &guid);
217     ok(hr == S_OK, "GetVendorGUID failed, hr=%x\n", hr);
218     ok(IsEqualGUID(&guid, &GUID_VendorMicrosoft) ||
219        broken(IsEqualGUID(&guid, &GUID_NULL)) /* XP */, "unexpected GUID %s\n", debugstr_guid(&guid));
220
221     len = 0xdeadbeef;
222     hr = IWICComponentInfo_GetVersion(info, 0, NULL, &len);
223     ok(hr == S_OK, "GetVersion failed, hr=%x\n", hr);
224     ok(len == 0, "invalid length 0x%x\n", len); /* version does not apply to pixel formats */
225
226     hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void**)&pixelformat_info);
227     ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
228
229     if (SUCCEEDED(hr))
230     {
231         hr = IWICPixelFormatInfo_GetBitsPerPixel(pixelformat_info, NULL);
232         ok(hr == E_INVALIDARG, "GetBitsPerPixel failed, hr=%x\n", hr);
233
234         hr = IWICPixelFormatInfo_GetBitsPerPixel(pixelformat_info, &uiresult);
235         ok(hr == S_OK, "GetBitsPerPixel failed, hr=%x\n", hr);
236         ok(uiresult == 32, "unexpected bpp %i\n", uiresult);
237
238         hr = IWICPixelFormatInfo_GetChannelCount(pixelformat_info, &uiresult);
239         ok(hr == S_OK, "GetChannelCount failed, hr=%x\n", hr);
240         ok(uiresult == 4, "unexpected channel count %i\n", uiresult);
241
242         hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 0, NULL, NULL);
243         ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr);
244
245         uiresult = 0xdeadbeef;
246         hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 0, NULL, &uiresult);
247         ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr);
248         ok(uiresult == 4, "unexpected length %i\n", uiresult);
249
250         memset(abbuffer, 0xaa, sizeof(abbuffer));
251         hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, known_len, abbuffer, NULL);
252         ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr);
253         ok(abbuffer[0] == 0xaa, "buffer modified\n");
254
255         uiresult = 0xdeadbeef;
256         memset(abbuffer, 0xaa, sizeof(abbuffer));
257         hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 3, abbuffer, &uiresult);
258         ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr);
259         ok(abbuffer[0] == 0xaa, "buffer modified\n");
260         ok(uiresult == 4, "unexpected length %i\n", uiresult);
261
262         memset(abbuffer, 0xaa, sizeof(abbuffer));
263         hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 4, abbuffer, &uiresult);
264         ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr);
265         ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%x\n", *((ULONG*)abbuffer));
266         ok(uiresult == 4, "unexpected length %i\n", uiresult);
267
268         memset(abbuffer, 0xaa, sizeof(abbuffer));
269         hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 5, abbuffer, &uiresult);
270         ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr);
271         ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%x\n", *((ULONG*)abbuffer));
272         ok(abbuffer[4] == 0xaa, "buffer modified past actual length\n");
273         ok(uiresult == 4, "unexpected length %i\n", uiresult);
274
275         memset(&guid, 0xaa, sizeof(guid));
276         hr = IWICPixelFormatInfo_GetFormatGUID(pixelformat_info, &guid);
277         ok(hr == S_OK, "GetFormatGUID failed, hr=%x\n", hr);
278         ok(IsEqualGUID(&guid, &GUID_WICPixelFormat32bppBGRA), "unexpected GUID %s\n", debugstr_guid(&guid));
279
280         IWICPixelFormatInfo_Release(pixelformat_info);
281     }
282
283     hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void**)&pixelformat_info2);
284
285     if (FAILED(hr))
286         win_skip("IWICPixelFormatInfo2 not supported\n");
287     else
288     {
289         hr = IWICPixelFormatInfo2_GetNumericRepresentation(pixelformat_info2, NULL);
290         ok(hr == E_INVALIDARG, "GetNumericRepresentation failed, hr=%x\n", hr);
291
292         numericrepresentation = 0xdeadbeef;
293         hr = IWICPixelFormatInfo2_GetNumericRepresentation(pixelformat_info2, &numericrepresentation);
294         ok(hr == S_OK, "GetNumericRepresentation failed, hr=%x\n", hr);
295         ok(numericrepresentation == WICPixelFormatNumericRepresentationUnsignedInteger, "unexpected numeric representation %i\n", numericrepresentation);
296
297         hr = IWICPixelFormatInfo2_SupportsTransparency(pixelformat_info2, NULL);
298         ok(hr == E_INVALIDARG, "SupportsTransparency failed, hr=%x\n", hr);
299
300         supportstransparency = 0xdeadbeef;
301         hr = IWICPixelFormatInfo2_SupportsTransparency(pixelformat_info2, &supportstransparency);
302         ok(hr == S_OK, "SupportsTransparency failed, hr=%x\n", hr);
303         ok(supportstransparency == 1, "unexpected value %i\n", supportstransparency);
304
305         IWICPixelFormatInfo2_Release(pixelformat_info2);
306     }
307
308     IWICComponentInfo_Release(info);
309 }
310
311 static void test_reader_info(void)
312 {
313     IWICImagingFactory *factory;
314     IWICComponentInfo *info;
315     IWICMetadataReaderInfo *reader_info;
316     HRESULT hr;
317     CLSID clsid;
318     GUID container_formats[10];
319     UINT count, size;
320     WICMetadataPattern *patterns;
321
322     hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
323         &IID_IWICImagingFactory, (void**)&factory);
324     ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
325     if (FAILED(hr)) return;
326
327     hr = IWICImagingFactory_CreateComponentInfo(factory, &CLSID_WICUnknownMetadataReader, &info);
328     ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
329
330     hr = IWICComponentInfo_QueryInterface(info, &IID_IWICMetadataReaderInfo, (void**)&reader_info);
331     ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
332
333     hr = IWICMetadataReaderInfo_GetCLSID(reader_info, NULL);
334     ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
335
336     hr = IWICMetadataReaderInfo_GetCLSID(reader_info, &clsid);
337     ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
338     ok(IsEqualGUID(&CLSID_WICUnknownMetadataReader, &clsid), "GetCLSID returned wrong result\n");
339
340     hr = IWICMetadataReaderInfo_GetMetadataFormat(reader_info, &clsid);
341     ok(hr == S_OK, "GetMetadataFormat failed, hr=%x\n", hr);
342     ok(IsEqualGUID(&GUID_MetadataFormatUnknown, &clsid), "GetMetadataFormat returned wrong result\n");
343
344     hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, NULL);
345     ok(hr == E_INVALIDARG, "GetContainerFormats failed, hr=%x\n", hr);
346
347     count = 0xdeadbeef;
348     hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, &count);
349 todo_wine
350     ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
351 todo_wine
352     ok(count == 0, "unexpected count %d\n", count);
353
354     hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng,
355         0, NULL, NULL, NULL);
356     ok(hr == E_INVALIDARG, "GetPatterns failed, hr=%x\n", hr);
357
358     count = size = 0xdeadbeef;
359     hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng,
360         0, NULL, &count, &size);
361 todo_wine
362     ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND || broken(hr == S_OK) /* Windows XP */,
363         "GetPatterns failed, hr=%x\n", hr);
364     ok(count == 0xdeadbeef, "unexpected count %d\n", count);
365     ok(size == 0xdeadbeef, "unexpected size %d\n", size);
366
367     IWICMetadataReaderInfo_Release(reader_info);
368
369     IWICComponentInfo_Release(info);
370
371     hr = IWICImagingFactory_CreateComponentInfo(factory, &CLSID_WICXMBStructMetadataReader, &info);
372 todo_wine
373     ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
374
375     if (FAILED(hr))
376     {
377         IWICImagingFactory_Release(factory);
378         return;
379     }
380
381     hr = IWICComponentInfo_QueryInterface(info, &IID_IWICMetadataReaderInfo, (void**)&reader_info);
382     ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
383
384     hr = IWICMetadataReaderInfo_GetCLSID(reader_info, NULL);
385     ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
386
387     hr = IWICMetadataReaderInfo_GetCLSID(reader_info, &clsid);
388     ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
389     ok(IsEqualGUID(&CLSID_WICXMBStructMetadataReader, &clsid), "GetCLSID returned wrong result\n");
390
391     hr = IWICMetadataReaderInfo_GetMetadataFormat(reader_info, &clsid);
392     ok(hr == S_OK, "GetMetadataFormat failed, hr=%x\n", hr);
393     ok(IsEqualGUID(&GUID_MetadataFormatXMPStruct, &clsid), "GetMetadataFormat returned wrong result\n");
394
395     hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, NULL);
396     ok(hr == E_INVALIDARG, "GetContainerFormats failed, hr=%x\n", hr);
397
398     count = 0xdeadbeef;
399     hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, &count);
400     ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
401     ok(count >= 2, "unexpected count %d\n", count);
402
403     count = 0xdeadbeef;
404     hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 1, container_formats, &count);
405     ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
406     ok(count == 1, "unexpected count %d\n", count);
407
408     count = 0xdeadbeef;
409     hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 10, container_formats, &count);
410     ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
411     ok(count == min(count, 10), "unexpected count %d\n", count);
412
413     count = size = 0xdeadbeef;
414     hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng,
415         0, NULL, &count, &size);
416     ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND || broken(hr == S_OK) /* Windows XP */,
417         "GetPatterns failed, hr=%x\n", hr);
418     ok(count == 0xdeadbeef, "unexpected count %d\n", count);
419     ok(size == 0xdeadbeef, "unexpected size %d\n", size);
420
421     count = size = 0xdeadbeef;
422     hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_MetadataFormatXMP,
423         0, NULL, &count, &size);
424     ok(hr == S_OK, "GetPatterns failed, hr=%x\n", hr);
425     ok(count == 1, "unexpected count %d\n", count);
426     ok(size > sizeof(WICMetadataPattern), "unexpected size %d\n", size);
427
428     if (hr == S_OK)
429     {
430         patterns = HeapAlloc(GetProcessHeap(), 0, size);
431
432         count = size = 0xdeadbeef;
433         hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_MetadataFormatXMP,
434             size-1, patterns, &count, &size);
435         ok(hr == S_OK, "GetPatterns failed, hr=%x\n", hr);
436         ok(count == 1, "unexpected count %d\n", count);
437         ok(size > sizeof(WICMetadataPattern), "unexpected size %d\n", size);
438
439         count = size = 0xdeadbeef;
440         hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_MetadataFormatXMP,
441             size, patterns, &count, &size);
442         ok(hr == S_OK, "GetPatterns failed, hr=%x\n", hr);
443         ok(count == 1, "unexpected count %d\n", count);
444         ok(size == sizeof(WICMetadataPattern) + patterns->Length * 2, "unexpected size %d\n", size);
445
446         HeapFree(GetProcessHeap(), 0, patterns);
447     }
448
449     IWICMetadataReaderInfo_Release(reader_info);
450
451     IWICComponentInfo_Release(info);
452
453     IWICImagingFactory_Release(factory);
454 }
455
456 START_TEST(info)
457 {
458     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
459
460     test_decoder_info();
461     test_reader_info();
462     test_pixelformat_info();
463
464     CoUninitialize();
465 }