2 * Copyright 2009 Vincent Povirk for CodeWeavers
3 * Copyright 2012 Dmitry Timoshkov
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wincodecsdk.h"
34 #include "wincodecs_private.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
41 IWICComponentFactory IWICComponentFactory_iface;
45 static inline ComponentFactory *impl_from_IWICComponentFactory(IWICComponentFactory *iface)
47 return CONTAINING_RECORD(iface, ComponentFactory, IWICComponentFactory_iface);
50 static HRESULT WINAPI ComponentFactory_QueryInterface(IWICComponentFactory *iface, REFIID iid,
53 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
54 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
56 if (!ppv) return E_INVALIDARG;
58 if (IsEqualIID(&IID_IUnknown, iid) ||
59 IsEqualIID(&IID_IWICImagingFactory, iid) ||
60 IsEqualIID(&IID_IWICComponentFactory, iid))
62 *ppv = &This->IWICComponentFactory_iface;
70 IUnknown_AddRef((IUnknown*)*ppv);
74 static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory *iface)
76 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
77 ULONG ref = InterlockedIncrement(&This->ref);
79 TRACE("(%p) refcount=%u\n", iface, ref);
84 static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory *iface)
86 ComponentFactory *This = impl_from_IWICComponentFactory(iface);
87 ULONG ref = InterlockedDecrement(&This->ref);
89 TRACE("(%p) refcount=%u\n", iface, ref);
92 HeapFree(GetProcessHeap(), 0, This);
97 static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename(
98 IWICComponentFactory *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
99 DWORD dwDesiredAccess, WICDecodeOptions metadataOptions,
100 IWICBitmapDecoder **ppIDecoder)
105 TRACE("(%p,%s,%s,%u,%u,%p)\n", iface, debugstr_w(wzFilename),
106 debugstr_guid(pguidVendor), dwDesiredAccess, metadataOptions, ppIDecoder);
108 hr = StreamImpl_Create(&stream);
111 hr = IWICStream_InitializeFromFilename(stream, wzFilename, dwDesiredAccess);
115 hr = IWICComponentFactory_CreateDecoderFromStream(iface, (IStream*)stream,
116 pguidVendor, metadataOptions, ppIDecoder);
119 IWICStream_Release(stream);
125 static IWICBitmapDecoder *find_decoder(IStream *pIStream, const GUID *pguidVendor,
126 WICDecodeOptions metadataOptions)
128 IEnumUnknown *enumdecoders;
129 IUnknown *unkdecoderinfo;
130 IWICBitmapDecoderInfo *decoderinfo;
131 IWICBitmapDecoder *decoder = NULL;
137 res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
138 if (FAILED(res)) return NULL;
142 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
146 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void**)&decoderinfo);
152 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
153 if (FAILED(res) || !IsEqualIID(&vendor, pguidVendor))
155 IWICBitmapDecoderInfo_Release(decoderinfo);
156 IUnknown_Release(unkdecoderinfo);
161 res = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, pIStream, &matches);
163 if (SUCCEEDED(res) && matches)
165 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &decoder);
167 /* FIXME: should use QueryCapability to choose a decoder */
171 res = IWICBitmapDecoder_Initialize(decoder, pIStream, metadataOptions);
175 IWICBitmapDecoder_Release(decoder);
181 IWICBitmapDecoderInfo_Release(decoderinfo);
184 IUnknown_Release(unkdecoderinfo);
190 IEnumUnknown_Release(enumdecoders);
195 static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(
196 IWICComponentFactory *iface, IStream *pIStream, const GUID *pguidVendor,
197 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
200 IWICBitmapDecoder *decoder = NULL;
202 TRACE("(%p,%p,%s,%u,%p)\n", iface, pIStream, debugstr_guid(pguidVendor),
203 metadataOptions, ppIDecoder);
206 decoder = find_decoder(pIStream, pguidVendor, metadataOptions);
208 decoder = find_decoder(pIStream, NULL, metadataOptions);
212 *ppIDecoder = decoder;
217 if (WARN_ON(wincodecs))
223 WARN("failed to load from a stream\n");
226 res = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
228 res = IStream_Read(pIStream, data, 4, &bytesread);
230 WARN("first %i bytes of stream=%x %x %x %x\n", bytesread, data[0], data[1], data[2], data[3]);
233 return WINCODEC_ERR_COMPONENTNOTFOUND;
237 static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle(
238 IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *pguidVendor,
239 WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
241 FIXME("(%p,%lx,%s,%u,%p): stub\n", iface, hFile, debugstr_guid(pguidVendor),
242 metadataOptions, ppIDecoder);
246 static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory *iface,
247 REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
249 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
250 return CreateComponentInfo(clsidComponent, ppIInfo);
253 static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface,
254 REFGUID guidContainerFormat, const GUID *pguidVendor,
255 IWICBitmapDecoder **ppIDecoder)
257 IEnumUnknown *enumdecoders;
258 IUnknown *unkdecoderinfo;
259 IWICBitmapDecoderInfo *decoderinfo;
260 IWICBitmapDecoder *decoder = NULL, *preferred_decoder = NULL;
265 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
266 debugstr_guid(pguidVendor), ppIDecoder);
268 if (!guidContainerFormat || !ppIDecoder) return E_INVALIDARG;
270 res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
271 if (FAILED(res)) return res;
273 while (!preferred_decoder)
275 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
276 if (res != S_OK) break;
278 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void **)&decoderinfo);
283 res = IWICBitmapDecoderInfo_GetContainerFormat(decoderinfo, &container_guid);
284 if (SUCCEEDED(res) && IsEqualIID(&container_guid, guidContainerFormat))
286 IWICBitmapDecoder *new_decoder;
288 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &new_decoder);
293 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
294 if (SUCCEEDED(res) && IsEqualIID(&vendor, pguidVendor))
296 preferred_decoder = new_decoder;
301 if (new_decoder && !decoder)
303 decoder = new_decoder;
307 if (new_decoder) IWICBitmapDecoder_Release(new_decoder);
311 IWICBitmapDecoderInfo_Release(decoderinfo);
314 IUnknown_Release(unkdecoderinfo);
317 IEnumUnknown_Release(enumdecoders);
319 if (preferred_decoder)
321 *ppIDecoder = preferred_decoder;
322 if (decoder) IWICBitmapDecoder_Release(decoder);
328 *ppIDecoder = decoder;
333 return WINCODEC_ERR_COMPONENTNOTFOUND;
336 static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface,
337 REFGUID guidContainerFormat, const GUID *pguidVendor,
338 IWICBitmapEncoder **ppIEncoder)
341 IEnumUnknown *enumencoders;
342 IUnknown *unkencoderinfo;
343 IWICBitmapEncoderInfo *encoderinfo;
344 IWICBitmapEncoder *encoder=NULL;
347 GUID actual_containerformat;
349 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
350 debugstr_guid(pguidVendor), ppIEncoder);
352 if (pguidVendor && !fixme++)
353 FIXME("ignoring vendor GUID\n");
355 res = CreateComponentEnumerator(WICEncoder, WICComponentEnumerateDefault, &enumencoders);
356 if (FAILED(res)) return res;
360 res = IEnumUnknown_Next(enumencoders, 1, &unkencoderinfo, &num_fetched);
364 res = IUnknown_QueryInterface(unkencoderinfo, &IID_IWICBitmapEncoderInfo, (void**)&encoderinfo);
368 res = IWICBitmapEncoderInfo_GetContainerFormat(encoderinfo, &actual_containerformat);
370 if (SUCCEEDED(res) && IsEqualGUID(guidContainerFormat, &actual_containerformat))
372 res = IWICBitmapEncoderInfo_CreateInstance(encoderinfo, &encoder);
377 IWICBitmapEncoderInfo_Release(encoderinfo);
380 IUnknown_Release(unkencoderinfo);
386 IEnumUnknown_Release(enumencoders);
390 *ppIEncoder = encoder;
395 WARN("failed to create encoder\n");
397 return WINCODEC_ERR_COMPONENTNOTFOUND;
401 static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface,
402 IWICPalette **ppIPalette)
404 TRACE("(%p,%p)\n", iface, ppIPalette);
405 return PaletteImpl_Create(ppIPalette);
408 static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface,
409 IWICFormatConverter **ppIFormatConverter)
411 return FormatConverter_CreateInstance(NULL, &IID_IWICFormatConverter, (void**)ppIFormatConverter);
414 static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface,
415 IWICBitmapScaler **ppIBitmapScaler)
417 TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
419 return BitmapScaler_Create(ppIBitmapScaler);
422 static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory *iface,
423 IWICBitmapClipper **ppIBitmapClipper)
425 FIXME("(%p,%p): stub\n", iface, ppIBitmapClipper);
429 static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory *iface,
430 IWICBitmapFlipRotator **ppIBitmapFlipRotator)
432 TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
433 return FlipRotator_Create(ppIBitmapFlipRotator);
436 static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface,
437 IWICStream **ppIWICStream)
439 TRACE("(%p,%p)\n", iface, ppIWICStream);
440 return StreamImpl_Create(ppIWICStream);
443 static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory *iface,
444 IWICColorContext **ppIColorContext)
446 TRACE("(%p,%p)\n", iface, ppIColorContext);
447 return ColorContext_Create(ppIColorContext);
450 static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory *iface,
451 IWICColorTransform **ppIColorTransform)
453 FIXME("(%p,%p): stub\n", iface, ppIColorTransform);
457 static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
458 UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat,
459 WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
461 TRACE("(%p,%u,%u,%s,%u,%p)\n", iface, uiWidth, uiHeight,
462 debugstr_guid(pixelFormat), option, ppIBitmap);
463 return BitmapImpl_Create(uiWidth, uiHeight, 0, 0, NULL, pixelFormat, option, ppIBitmap);
466 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory *iface,
467 IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option,
468 IWICBitmap **ppIBitmap)
471 IWICBitmapLock *lock;
472 IWICPalette *palette;
474 WICPixelFormatGUID pixelformat = {0};
478 IWICComponentInfo *info;
479 IWICPixelFormatInfo2 *formatinfo;
480 WICPixelFormatNumericRepresentation format_type;
482 TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
484 if (!piBitmapSource || !ppIBitmap)
487 hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height);
490 hr = IWICBitmapSource_GetPixelFormat(piBitmapSource, &pixelformat);
493 hr = CreateComponentInfo(&pixelformat, &info);
497 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void**)&formatinfo);
501 hr = IWICPixelFormatInfo2_GetNumericRepresentation(formatinfo, &format_type);
503 IWICPixelFormatInfo2_Release(formatinfo);
506 IWICComponentInfo_Release(info);
510 hr = BitmapImpl_Create(width, height, 0, 0, NULL, &pixelformat, option, &result);
514 hr = IWICBitmap_Lock(result, NULL, WICBitmapLockWrite, &lock);
517 UINT stride, buffersize;
523 hr = IWICBitmapLock_GetStride(lock, &stride);
526 hr = IWICBitmapLock_GetDataPointer(lock, &buffersize, &buffer);
529 hr = IWICBitmapSource_CopyPixels(piBitmapSource, &rc, stride,
532 IWICBitmapLock_Release(lock);
536 hr = PaletteImpl_Create(&palette);
538 if (SUCCEEDED(hr) && (format_type == WICPixelFormatNumericRepresentationUnspecified ||
539 format_type == WICPixelFormatNumericRepresentationIndexed))
541 hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
544 hr = IWICBitmap_SetPalette(result, palette);
548 IWICPalette_Release(palette);
553 hr = IWICBitmapSource_GetResolution(piBitmapSource, &dpix, &dpiy);
556 hr = IWICBitmap_SetResolution(result, dpix, dpiy);
564 IWICBitmap_Release(result);
570 static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface,
571 IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height,
572 IWICBitmap **ppIBitmap)
574 FIXME("(%p,%p,%u,%u,%u,%u,%p): stub\n", iface, piBitmapSource, x, y, width,
579 static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory *iface,
580 UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride,
581 UINT size, BYTE *buffer, IWICBitmap **bitmap)
583 TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height,
584 debugstr_guid(format), stride, size, buffer, bitmap);
586 if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG;
588 return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap);
591 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface,
592 HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options,
593 IWICBitmap **ppIBitmap)
595 FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap);
599 static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface,
600 HICON hIcon, IWICBitmap **ppIBitmap)
602 FIXME("(%p,%p,%p): stub\n", iface, hIcon, ppIBitmap);
606 static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface,
607 DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
609 TRACE("(%p,%u,%u,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
610 return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
613 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder(
614 IWICComponentFactory *iface, IWICBitmapDecoder *pIDecoder,
615 IWICFastMetadataEncoder **ppIFastEncoder)
617 FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
621 static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(
622 IWICComponentFactory *iface, IWICBitmapFrameDecode *pIFrameDecoder,
623 IWICFastMetadataEncoder **ppIFastEncoder)
625 FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
629 static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory *iface,
630 REFGUID guidMetadataFormat, const GUID *pguidVendor,
631 IWICMetadataQueryWriter **ppIQueryWriter)
633 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidMetadataFormat),
634 debugstr_guid(pguidVendor), ppIQueryWriter);
638 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface,
639 IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor,
640 IWICMetadataQueryWriter **ppIQueryWriter)
642 FIXME("(%p,%p,%s,%p): stub\n", iface, pIQueryReader, debugstr_guid(pguidVendor),
647 static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory *iface,
648 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
650 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
651 options, stream, reader);
655 static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer(IWICComponentFactory *iface,
656 REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
658 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
659 options, stream, reader);
663 static HRESULT WINAPI ComponentFactory_CreateMetadataWriter(IWICComponentFactory *iface,
664 REFGUID format, const GUID *vendor, DWORD options, IWICMetadataWriter **writer)
666 FIXME("%p,%s,%s,%x,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, writer);
670 static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader(IWICComponentFactory *iface,
671 IWICMetadataReader *reader, const GUID *vendor, IWICMetadataWriter **writer)
673 FIXME("%p,%p,%s,%p: stub\n", iface, reader, debugstr_guid(vendor), writer);
677 static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComponentFactory *iface,
678 IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
680 FIXME("%p,%p,%p: stub\n", iface, block_reader, query_reader);
684 static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,
685 IWICMetadataBlockWriter *block_writer, IWICMetadataQueryWriter **query_writer)
687 FIXME("%p,%p,%p: stub\n", iface, block_writer, query_writer);
691 static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag(IWICComponentFactory *iface,
692 PROPBAG2 *options, UINT count, IPropertyBag2 **property)
694 FIXME("%p,%p,%u,%p: stub\n", iface, options, count, property);
698 static const IWICComponentFactoryVtbl ComponentFactory_Vtbl = {
699 ComponentFactory_QueryInterface,
700 ComponentFactory_AddRef,
701 ComponentFactory_Release,
702 ComponentFactory_CreateDecoderFromFilename,
703 ComponentFactory_CreateDecoderFromStream,
704 ComponentFactory_CreateDecoderFromFileHandle,
705 ComponentFactory_CreateComponentInfo,
706 ComponentFactory_CreateDecoder,
707 ComponentFactory_CreateEncoder,
708 ComponentFactory_CreatePalette,
709 ComponentFactory_CreateFormatConverter,
710 ComponentFactory_CreateBitmapScaler,
711 ComponentFactory_CreateBitmapClipper,
712 ComponentFactory_CreateBitmapFlipRotator,
713 ComponentFactory_CreateStream,
714 ComponentFactory_CreateColorContext,
715 ComponentFactory_CreateColorTransformer,
716 ComponentFactory_CreateBitmap,
717 ComponentFactory_CreateBitmapFromSource,
718 ComponentFactory_CreateBitmapFromSourceRect,
719 ComponentFactory_CreateBitmapFromMemory,
720 ComponentFactory_CreateBitmapFromHBITMAP,
721 ComponentFactory_CreateBitmapFromHICON,
722 ComponentFactory_CreateComponentEnumerator,
723 ComponentFactory_CreateFastMetadataEncoderFromDecoder,
724 ComponentFactory_CreateFastMetadataEncoderFromFrameDecode,
725 ComponentFactory_CreateQueryWriter,
726 ComponentFactory_CreateQueryWriterFromReader,
727 ComponentFactory_CreateMetadataReader,
728 ComponentFactory_CreateMetadataReaderFromContainer,
729 ComponentFactory_CreateMetadataWriter,
730 ComponentFactory_CreateMetadataWriterFromReader,
731 ComponentFactory_CreateQueryReaderFromBlockReader,
732 ComponentFactory_CreateQueryWriterFromBlockWriter,
733 ComponentFactory_CreateEncoderPropertyBag
736 HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
738 ComponentFactory *This;
741 TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
745 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
747 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory));
748 if (!This) return E_OUTOFMEMORY;
750 This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
753 ret = IWICComponentFactory_QueryInterface(&This->IWICComponentFactory_iface, iid, ppv);
754 IWICComponentFactory_Release(&This->IWICComponentFactory_iface);