Commit 49b98b11 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

windowscodecs: Implement IWICBitmapCodecInfo::GetContainerFormat.

parent 8933d91c
...@@ -38,6 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); ...@@ -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 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 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, static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value,
UINT buffer_size, WCHAR *buffer, UINT *actual_size) UINT buffer_size, WCHAR *buffer, UINT *actual_size)
...@@ -64,6 +65,34 @@ static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, ...@@ -64,6 +65,34 @@ static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value,
return HRESULT_FROM_WIN32(ret); 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 { typedef struct {
IWICBitmapDecoderInfo IWICBitmapDecoderInfo_iface; IWICBitmapDecoderInfo IWICBitmapDecoderInfo_iface;
LONG ref; LONG ref;
...@@ -191,8 +220,9 @@ static HRESULT WINAPI BitmapDecoderInfo_GetFriendlyName(IWICBitmapDecoderInfo *i ...@@ -191,8 +220,9 @@ static HRESULT WINAPI BitmapDecoderInfo_GetFriendlyName(IWICBitmapDecoderInfo *i
static HRESULT WINAPI BitmapDecoderInfo_GetContainerFormat(IWICBitmapDecoderInfo *iface, static HRESULT WINAPI BitmapDecoderInfo_GetContainerFormat(IWICBitmapDecoderInfo *iface,
GUID *pguidContainerFormat) GUID *pguidContainerFormat)
{ {
FIXME("(%p,%p): stub\n", iface, pguidContainerFormat); BitmapDecoderInfo *This = impl_from_IWICBitmapDecoderInfo(iface);
return E_NOTIMPL; TRACE("(%p,%p)\n", iface, pguidContainerFormat);
return ComponentInfo_GetGUIDValue(This->classkey, containerformat_valuename, pguidContainerFormat);
} }
static HRESULT WINAPI BitmapDecoderInfo_GetPixelFormats(IWICBitmapDecoderInfo *iface, static HRESULT WINAPI BitmapDecoderInfo_GetPixelFormats(IWICBitmapDecoderInfo *iface,
...@@ -635,8 +665,9 @@ static HRESULT WINAPI BitmapEncoderInfo_GetFriendlyName(IWICBitmapEncoderInfo *i ...@@ -635,8 +665,9 @@ static HRESULT WINAPI BitmapEncoderInfo_GetFriendlyName(IWICBitmapEncoderInfo *i
static HRESULT WINAPI BitmapEncoderInfo_GetContainerFormat(IWICBitmapEncoderInfo *iface, static HRESULT WINAPI BitmapEncoderInfo_GetContainerFormat(IWICBitmapEncoderInfo *iface,
GUID *pguidContainerFormat) GUID *pguidContainerFormat)
{ {
FIXME("(%p,%p): stub\n", iface, pguidContainerFormat); BitmapEncoderInfo *This = impl_from_IWICBitmapEncoderInfo(iface);
return E_NOTIMPL; TRACE("(%p,%p)\n", iface, pguidContainerFormat);
return ComponentInfo_GetGUIDValue(This->classkey, containerformat_valuename, pguidContainerFormat);
} }
static HRESULT WINAPI BitmapEncoderInfo_GetPixelFormats(IWICBitmapEncoderInfo *iface, static HRESULT WINAPI BitmapEncoderInfo_GetPixelFormats(IWICBitmapEncoderInfo *iface,
......
...@@ -59,6 +59,7 @@ struct regsvr_decoder ...@@ -59,6 +59,7 @@ struct regsvr_decoder
LPCSTR friendlyname; LPCSTR friendlyname;
LPCSTR version; LPCSTR version;
GUID const *vendor; GUID const *vendor;
GUID const *container_format;
LPCSTR mimetypes; LPCSTR mimetypes;
LPCSTR extensions; LPCSTR extensions;
GUID const * const *formats; GUID const * const *formats;
...@@ -75,6 +76,7 @@ struct regsvr_encoder ...@@ -75,6 +76,7 @@ struct regsvr_encoder
LPCSTR friendlyname; LPCSTR friendlyname;
LPCSTR version; LPCSTR version;
GUID const *vendor; GUID const *vendor;
GUID const *container_format;
LPCSTR mimetypes; LPCSTR mimetypes;
LPCSTR extensions; LPCSTR extensions;
GUID const * const *formats; GUID const * const *formats;
...@@ -119,6 +121,7 @@ static const char tmodel_valuename[] = "ThreadingModel"; ...@@ -119,6 +121,7 @@ static const char tmodel_valuename[] = "ThreadingModel";
static const char author_valuename[] = "Author"; static const char author_valuename[] = "Author";
static const char friendlyname_valuename[] = "FriendlyName"; static const char friendlyname_valuename[] = "FriendlyName";
static const WCHAR vendor_valuename[] = {'V','e','n','d','o','r',0}; 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 version_valuename[] = "Version";
static const char mimetypes_valuename[] = "MimeTypes"; static const char mimetypes_valuename[] = "MimeTypes";
static const char extensions_valuename[] = "FileExtensions"; static const char extensions_valuename[] = "FileExtensions";
...@@ -201,6 +204,13 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) ...@@ -201,6 +204,13 @@ static HRESULT register_decoders(struct regsvr_decoder const *list)
if (res != ERROR_SUCCESS) goto error_close_clsid_key; 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) { if (list->version) {
res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ,
(CONST BYTE*)(list->version), (CONST BYTE*)(list->version),
...@@ -409,6 +419,13 @@ static HRESULT register_encoders(struct regsvr_encoder const *list) ...@@ -409,6 +419,13 @@ static HRESULT register_encoders(struct regsvr_encoder const *list)
if (res != ERROR_SUCCESS) goto error_close_clsid_key; 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) { if (list->version) {
res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ,
(CONST BYTE*)(list->version), (CONST BYTE*)(list->version),
...@@ -819,6 +836,7 @@ static struct regsvr_decoder const decoder_list[] = { ...@@ -819,6 +836,7 @@ static struct regsvr_decoder const decoder_list[] = {
"BMP Decoder", "BMP Decoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatBmp,
"image/bmp", "image/bmp",
".bmp,.dib,.rle", ".bmp,.dib,.rle",
bmp_formats, bmp_formats,
...@@ -829,6 +847,7 @@ static struct regsvr_decoder const decoder_list[] = { ...@@ -829,6 +847,7 @@ static struct regsvr_decoder const decoder_list[] = {
"GIF Decoder", "GIF Decoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatGif,
"image/gif", "image/gif",
".gif", ".gif",
gif_formats, gif_formats,
...@@ -839,6 +858,7 @@ static struct regsvr_decoder const decoder_list[] = { ...@@ -839,6 +858,7 @@ static struct regsvr_decoder const decoder_list[] = {
"ICO Decoder", "ICO Decoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatIco,
"image/vnd.microsoft.icon", "image/vnd.microsoft.icon",
".ico", ".ico",
ico_formats, ico_formats,
...@@ -849,6 +869,7 @@ static struct regsvr_decoder const decoder_list[] = { ...@@ -849,6 +869,7 @@ static struct regsvr_decoder const decoder_list[] = {
"JPEG Decoder", "JPEG Decoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatJpeg,
"image/jpeg", "image/jpeg",
".jpg;.jpeg;.jfif", ".jpg;.jpeg;.jfif",
jpeg_formats, jpeg_formats,
...@@ -859,6 +880,7 @@ static struct regsvr_decoder const decoder_list[] = { ...@@ -859,6 +880,7 @@ static struct regsvr_decoder const decoder_list[] = {
"PNG Decoder", "PNG Decoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatPng,
"image/png", "image/png",
".png", ".png",
png_formats, png_formats,
...@@ -869,6 +891,7 @@ static struct regsvr_decoder const decoder_list[] = { ...@@ -869,6 +891,7 @@ static struct regsvr_decoder const decoder_list[] = {
"TIFF Decoder", "TIFF Decoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatTiff,
"image/tiff", "image/tiff",
".tif;.tiff", ".tif;.tiff",
tiff_decode_formats, tiff_decode_formats,
...@@ -879,6 +902,7 @@ static struct regsvr_decoder const decoder_list[] = { ...@@ -879,6 +902,7 @@ static struct regsvr_decoder const decoder_list[] = {
"TGA Decoder", "TGA Decoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorWine, &GUID_VendorWine,
&GUID_WineContainerFormatTga,
"image/x-targa", "image/x-targa",
".tga;.tpic", ".tga;.tpic",
tga_formats, tga_formats,
...@@ -933,6 +957,7 @@ static struct regsvr_encoder const encoder_list[] = { ...@@ -933,6 +957,7 @@ static struct regsvr_encoder const encoder_list[] = {
"BMP Encoder", "BMP Encoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatBmp,
"image/bmp", "image/bmp",
".bmp,.dib,.rle", ".bmp,.dib,.rle",
bmp_encode_formats bmp_encode_formats
...@@ -942,6 +967,7 @@ static struct regsvr_encoder const encoder_list[] = { ...@@ -942,6 +967,7 @@ static struct regsvr_encoder const encoder_list[] = {
"JPEG Encoder", "JPEG Encoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatJpeg,
"image/jpeg", "image/jpeg",
".jpg;.jpeg;.jfif", ".jpg;.jpeg;.jfif",
jpeg_formats jpeg_formats
...@@ -951,6 +977,7 @@ static struct regsvr_encoder const encoder_list[] = { ...@@ -951,6 +977,7 @@ static struct regsvr_encoder const encoder_list[] = {
"PNG Encoder", "PNG Encoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatPng,
"image/png", "image/png",
".png", ".png",
png_encode_formats png_encode_formats
...@@ -960,6 +987,7 @@ static struct regsvr_encoder const encoder_list[] = { ...@@ -960,6 +987,7 @@ static struct regsvr_encoder const encoder_list[] = {
"TIFF Encoder", "TIFF Encoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorMicrosoft, &GUID_VendorMicrosoft,
&GUID_ContainerFormatTiff,
"image/tiff", "image/tiff",
".tif;.tiff", ".tif;.tiff",
tiff_encode_formats tiff_encode_formats
...@@ -969,6 +997,7 @@ static struct regsvr_encoder const encoder_list[] = { ...@@ -969,6 +997,7 @@ static struct regsvr_encoder const encoder_list[] = {
"ICNS Encoder", "ICNS Encoder",
"1.0.0.0", "1.0.0.0",
&GUID_VendorWine, &GUID_VendorWine,
NULL, /* no container format guid */
"image/icns", "image/icns",
".icns", ".icns",
icns_encode_formats icns_encode_formats
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment