Module: wine Branch: master Commit: 49b98b111df40e4bcc7963e9aee6c42e44811eed URL: http://source.winehq.org/git/wine.git/?a=commit;h=49b98b111df40e4bcc7963e9ae...
Author: Vincent Povirk vincent@codeweavers.com Date: Tue Feb 28 16:09:45 2012 -0600
windowscodecs: Implement IWICBitmapCodecInfo::GetContainerFormat.
---
dlls/windowscodecs/info.c | 39 +++++++++++++++++++++++++++++++++++---- dlls/windowscodecs/regsvr.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index 50b520f..86f0adb 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -38,6 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
static const WCHAR mimetypes_valuename[] = {'M','i','m','e','T','y','p','e','s',0}; static const WCHAR pixelformats_keyname[] = {'P','i','x','e','l','F','o','r','m','a','t','s',0}; +static const WCHAR containerformat_valuename[] = {'C','o','n','t','a','i','n','e','r','F','o','r','m','a','t',0};
static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, UINT buffer_size, WCHAR *buffer, UINT *actual_size) @@ -64,6 +65,34 @@ static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, return HRESULT_FROM_WIN32(ret); }
+static HRESULT ComponentInfo_GetGUIDValue(HKEY classkey, LPCWSTR value, + GUID *result) +{ + LONG ret; + WCHAR guid_string[39]; + DWORD cbdata = sizeof(guid_string); + HRESULT hr; + + if (!result) + return E_INVALIDARG; + + ret = RegGetValueW(classkey, NULL, value, RRF_RT_REG_SZ|RRF_NOEXPAND, NULL, + guid_string, &cbdata); + + if (ret != ERROR_SUCCESS) + return HRESULT_FROM_WIN32(ret); + + if (cbdata < sizeof(guid_string)) + { + ERR("incomplete GUID value\n"); + return E_FAIL; + } + + hr = CLSIDFromString(guid_string, result); + + return hr; +} + typedef struct { IWICBitmapDecoderInfo IWICBitmapDecoderInfo_iface; LONG ref; @@ -191,8 +220,9 @@ static HRESULT WINAPI BitmapDecoderInfo_GetFriendlyName(IWICBitmapDecoderInfo *i static HRESULT WINAPI BitmapDecoderInfo_GetContainerFormat(IWICBitmapDecoderInfo *iface, GUID *pguidContainerFormat) { - FIXME("(%p,%p): stub\n", iface, pguidContainerFormat); - return E_NOTIMPL; + BitmapDecoderInfo *This = impl_from_IWICBitmapDecoderInfo(iface); + TRACE("(%p,%p)\n", iface, pguidContainerFormat); + return ComponentInfo_GetGUIDValue(This->classkey, containerformat_valuename, pguidContainerFormat); }
static HRESULT WINAPI BitmapDecoderInfo_GetPixelFormats(IWICBitmapDecoderInfo *iface, @@ -635,8 +665,9 @@ static HRESULT WINAPI BitmapEncoderInfo_GetFriendlyName(IWICBitmapEncoderInfo *i static HRESULT WINAPI BitmapEncoderInfo_GetContainerFormat(IWICBitmapEncoderInfo *iface, GUID *pguidContainerFormat) { - FIXME("(%p,%p): stub\n", iface, pguidContainerFormat); - return E_NOTIMPL; + BitmapEncoderInfo *This = impl_from_IWICBitmapEncoderInfo(iface); + TRACE("(%p,%p)\n", iface, pguidContainerFormat); + return ComponentInfo_GetGUIDValue(This->classkey, containerformat_valuename, pguidContainerFormat); }
static HRESULT WINAPI BitmapEncoderInfo_GetPixelFormats(IWICBitmapEncoderInfo *iface, diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c index e81ae00..b3c1f1b 100644 --- a/dlls/windowscodecs/regsvr.c +++ b/dlls/windowscodecs/regsvr.c @@ -59,6 +59,7 @@ struct regsvr_decoder LPCSTR friendlyname; LPCSTR version; GUID const *vendor; + GUID const *container_format; LPCSTR mimetypes; LPCSTR extensions; GUID const * const *formats; @@ -75,6 +76,7 @@ struct regsvr_encoder LPCSTR friendlyname; LPCSTR version; GUID const *vendor; + GUID const *container_format; LPCSTR mimetypes; LPCSTR extensions; GUID const * const *formats; @@ -119,6 +121,7 @@ static const char tmodel_valuename[] = "ThreadingModel"; static const char author_valuename[] = "Author"; static const char friendlyname_valuename[] = "FriendlyName"; static const WCHAR vendor_valuename[] = {'V','e','n','d','o','r',0}; +static const WCHAR containerformat_valuename[] = {'C','o','n','t','a','i','n','e','r','F','o','r','m','a','t',0}; static const char version_valuename[] = "Version"; static const char mimetypes_valuename[] = "MimeTypes"; static const char extensions_valuename[] = "FileExtensions"; @@ -201,6 +204,13 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) if (res != ERROR_SUCCESS) goto error_close_clsid_key; }
+ if (list->container_format) { + StringFromGUID2(list->container_format, buf, 39); + res = RegSetValueExW(clsid_key, containerformat_valuename, 0, REG_SZ, + (CONST BYTE*)(buf), 78); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, (CONST BYTE*)(list->version), @@ -409,6 +419,13 @@ static HRESULT register_encoders(struct regsvr_encoder const *list) if (res != ERROR_SUCCESS) goto error_close_clsid_key; }
+ if (list->container_format) { + StringFromGUID2(list->container_format, buf, 39); + res = RegSetValueExW(clsid_key, containerformat_valuename, 0, REG_SZ, + (CONST BYTE*)(buf), 78); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, (CONST BYTE*)(list->version), @@ -819,6 +836,7 @@ static struct regsvr_decoder const decoder_list[] = { "BMP Decoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatBmp, "image/bmp", ".bmp,.dib,.rle", bmp_formats, @@ -829,6 +847,7 @@ static struct regsvr_decoder const decoder_list[] = { "GIF Decoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatGif, "image/gif", ".gif", gif_formats, @@ -839,6 +858,7 @@ static struct regsvr_decoder const decoder_list[] = { "ICO Decoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatIco, "image/vnd.microsoft.icon", ".ico", ico_formats, @@ -849,6 +869,7 @@ static struct regsvr_decoder const decoder_list[] = { "JPEG Decoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatJpeg, "image/jpeg", ".jpg;.jpeg;.jfif", jpeg_formats, @@ -859,6 +880,7 @@ static struct regsvr_decoder const decoder_list[] = { "PNG Decoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatPng, "image/png", ".png", png_formats, @@ -869,6 +891,7 @@ static struct regsvr_decoder const decoder_list[] = { "TIFF Decoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatTiff, "image/tiff", ".tif;.tiff", tiff_decode_formats, @@ -879,6 +902,7 @@ static struct regsvr_decoder const decoder_list[] = { "TGA Decoder", "1.0.0.0", &GUID_VendorWine, + &GUID_WineContainerFormatTga, "image/x-targa", ".tga;.tpic", tga_formats, @@ -933,6 +957,7 @@ static struct regsvr_encoder const encoder_list[] = { "BMP Encoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatBmp, "image/bmp", ".bmp,.dib,.rle", bmp_encode_formats @@ -942,6 +967,7 @@ static struct regsvr_encoder const encoder_list[] = { "JPEG Encoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatJpeg, "image/jpeg", ".jpg;.jpeg;.jfif", jpeg_formats @@ -951,6 +977,7 @@ static struct regsvr_encoder const encoder_list[] = { "PNG Encoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatPng, "image/png", ".png", png_encode_formats @@ -960,6 +987,7 @@ static struct regsvr_encoder const encoder_list[] = { "TIFF Encoder", "1.0.0.0", &GUID_VendorMicrosoft, + &GUID_ContainerFormatTiff, "image/tiff", ".tif;.tiff", tiff_encode_formats @@ -969,6 +997,7 @@ static struct regsvr_encoder const encoder_list[] = { "ICNS Encoder", "1.0.0.0", &GUID_VendorWine, + NULL, /* no container format guid */ "image/icns", ".icns", icns_encode_formats