From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/info.c | 163 ++++++++++++++++++-------------------- 1 file changed, 79 insertions(+), 84 deletions(-)
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index 2fda5f638bc..dee67a60803 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -38,10 +38,25 @@ typedef struct { IWICComponentInfo IWICComponentInfo_iface; LONG ref; CLSID clsid; + HKEY classkey; struct wine_rb_entry entry; } ComponentInfo;
-static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, +static void component_info_init(ComponentInfo *object, HKEY classkey, + REFGUID clsid, const IWICComponentInfoVtbl *vtbl) +{ + object->IWICComponentInfo_iface.lpVtbl = vtbl; + object->ref = 1; + object->classkey = classkey; + object->clsid = *clsid; +} + +static void component_info_cleanup(ComponentInfo *info) +{ + RegCloseKey(info->classkey); +} + +static HRESULT ComponentInfo_GetStringValue(ComponentInfo *info, LPCWSTR value, UINT buffer_size, WCHAR *buffer, UINT *actual_size) { LONG ret; @@ -50,7 +65,7 @@ static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, if (!actual_size) return E_INVALIDARG;
- ret = RegQueryValueExW(classkey, value, 0, NULL, (void *)buffer, &cbdata); + ret = RegQueryValueExW(info->classkey, value, 0, NULL, (void *)buffer, &cbdata);
if (ret == ERROR_FILE_NOT_FOUND) { @@ -71,7 +86,7 @@ static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, return HRESULT_FROM_WIN32(ret); }
-static HRESULT ComponentInfo_GetGUIDValue(HKEY classkey, LPCWSTR value, +static HRESULT ComponentInfo_GetGUIDValue(ComponentInfo *info, LPCWSTR value, GUID *result) { LONG ret; @@ -82,7 +97,7 @@ static HRESULT ComponentInfo_GetGUIDValue(HKEY classkey, LPCWSTR value, if (!result) return E_INVALIDARG;
- ret = RegGetValueW(classkey, NULL, value, RRF_RT_REG_SZ|RRF_NOEXPAND, NULL, + ret = RegGetValueW(info->classkey, NULL, value, RRF_RT_REG_SZ|RRF_NOEXPAND, NULL, guid_string, &cbdata);
if (ret != ERROR_SUCCESS) @@ -99,7 +114,7 @@ static HRESULT ComponentInfo_GetGUIDValue(HKEY classkey, LPCWSTR value, return hr; }
-static HRESULT ComponentInfo_GetUINTValue(HKEY classkey, LPCWSTR value, +static HRESULT ComponentInfo_GetUINTValue(ComponentInfo *info, LPCWSTR value, void *result) { LONG ret; @@ -108,7 +123,7 @@ static HRESULT ComponentInfo_GetUINTValue(HKEY classkey, LPCWSTR value, if (!result) return E_INVALIDARG;
- ret = RegGetValueW(classkey, NULL, value, RRF_RT_DWORD, NULL, + ret = RegGetValueW(info->classkey, NULL, value, RRF_RT_DWORD, NULL, result, &cbdata);
if (ret == ERROR_FILE_NOT_FOUND) @@ -120,7 +135,7 @@ static HRESULT ComponentInfo_GetUINTValue(HKEY classkey, LPCWSTR value, return HRESULT_FROM_WIN32(ret); }
-static HRESULT ComponentInfo_GetGuidList(HKEY classkey, LPCWSTR subkeyname, +static HRESULT ComponentInfo_GetGuidList(ComponentInfo *info, LPCWSTR subkeyname, UINT buffersize, GUID *buffer, UINT *actual_size) { LONG ret; @@ -133,7 +148,7 @@ static HRESULT ComponentInfo_GetGuidList(HKEY classkey, LPCWSTR subkeyname, if (!actual_size) return E_INVALIDARG;
- ret = RegOpenKeyExW(classkey, subkeyname, 0, KEY_READ, &subkey); + ret = RegOpenKeyExW(info->classkey, subkeyname, 0, KEY_READ, &subkey); if (ret == ERROR_FILE_NOT_FOUND) { *actual_size = 0; @@ -189,7 +204,6 @@ static HRESULT ComponentInfo_GetGuidList(HKEY classkey, LPCWSTR subkeyname,
typedef struct { ComponentInfo base; - HKEY classkey; WICBitmapPattern *patterns; UINT pattern_count; UINT patterns_size; @@ -244,7 +258,7 @@ static ULONG WINAPI BitmapDecoderInfo_Release(IWICBitmapDecoderInfo *iface)
if (ref == 0) { - RegCloseKey(This->classkey); + component_info_cleanup(&This->base); free(This->patterns); free(This); } @@ -286,7 +300,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetAuthor(IWICBitmapDecoderInfo *iface,
TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(&This->base, L"Author", cchAuthor, wzAuthor, pcchActual); }
static HRESULT WINAPI BitmapDecoderInfo_GetVendorGUID(IWICBitmapDecoderInfo *iface, GUID *pguidVendor) @@ -295,7 +309,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetVendorGUID(IWICBitmapDecoderInfo *ifa
TRACE("(%p,%p)\n", iface, pguidVendor);
- return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); + return ComponentInfo_GetGUIDValue(&This->base, L"Vendor", pguidVendor); }
static HRESULT WINAPI BitmapDecoderInfo_GetVersion(IWICBitmapDecoderInfo *iface, UINT cchVersion, @@ -305,7 +319,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetVersion(IWICBitmapDecoderInfo *iface,
TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Version", + return ComponentInfo_GetStringValue(&This->base, L"Version", cchVersion, wzVersion, pcchActual); }
@@ -316,7 +330,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetSpecVersion(IWICBitmapDecoderInfo *if
TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", + return ComponentInfo_GetStringValue(&This->base, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); }
@@ -327,7 +341,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetFriendlyName(IWICBitmapDecoderInfo *i
TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", + return ComponentInfo_GetStringValue(&This->base, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); }
@@ -336,7 +350,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetContainerFormat(IWICBitmapDecoderInfo { BitmapDecoderInfo *This = impl_from_IWICBitmapDecoderInfo(iface); TRACE("(%p,%p)\n", iface, pguidContainerFormat); - return ComponentInfo_GetGUIDValue(This->classkey, L"ContainerFormat", pguidContainerFormat); + return ComponentInfo_GetGUIDValue(&This->base, L"ContainerFormat", pguidContainerFormat); }
static HRESULT WINAPI BitmapDecoderInfo_GetPixelFormats(IWICBitmapDecoderInfo *iface, @@ -344,7 +358,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetPixelFormats(IWICBitmapDecoderInfo *i { BitmapDecoderInfo *This = impl_from_IWICBitmapDecoderInfo(iface); TRACE("(%p,%u,%p,%p)\n", iface, cFormats, pguidPixelFormats, pcActual); - return ComponentInfo_GetGuidList(This->classkey, L"Formats", cFormats, pguidPixelFormats, pcActual); + return ComponentInfo_GetGuidList(&This->base, L"Formats", cFormats, pguidPixelFormats, pcActual); }
static HRESULT WINAPI BitmapDecoderInfo_GetColorManagementVersion(IWICBitmapDecoderInfo *iface, @@ -375,7 +389,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetMimeTypes(IWICBitmapDecoderInfo *ifac
TRACE("(%p,%u,%p,%p)\n", iface, cchMimeTypes, wzMimeTypes, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"MimeTypes", + return ComponentInfo_GetStringValue(&This->base, L"MimeTypes", cchMimeTypes, wzMimeTypes, pcchActual); }
@@ -386,7 +400,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetFileExtensions(IWICBitmapDecoderInfo
TRACE("(%p,%u,%p,%p)\n", iface, cchFileExtensions, wzFileExtensions, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"FileExtensions", + return ComponentInfo_GetStringValue(&This->base, L"FileExtensions", cchFileExtensions, wzFileExtensions, pcchActual); }
@@ -560,7 +574,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) BYTE *patterns_ptr; DWORD length, valuesize;
- res = RegOpenKeyExW(info->classkey, L"Patterns", 0, KEY_READ, &patternskey); + res = RegOpenKeyExW(info->base.classkey, L"Patterns", 0, KEY_READ, &patternskey); if (res != ERROR_SUCCESS) return;
res = RegQueryInfoKeyW(patternskey, NULL, NULL, NULL, &pattern_count, NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -660,10 +674,7 @@ static HRESULT BitmapDecoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp if (!This) return E_OUTOFMEMORY;
- This->base.IWICComponentInfo_iface.lpVtbl = (const IWICComponentInfoVtbl*)&BitmapDecoderInfo_Vtbl; - This->base.ref = 1; - This->classkey = classkey; - This->base.clsid = *clsid; + component_info_init(&This->base, classkey, clsid, (const IWICComponentInfoVtbl *)&BitmapDecoderInfo_Vtbl);
read_bitmap_patterns(This);
@@ -673,7 +684,6 @@ static HRESULT BitmapDecoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp
typedef struct { ComponentInfo base; - HKEY classkey; } BitmapEncoderInfo;
static inline BitmapEncoderInfo *impl_from_IWICBitmapEncoderInfo(IWICBitmapEncoderInfo *iface) @@ -725,7 +735,7 @@ static ULONG WINAPI BitmapEncoderInfo_Release(IWICBitmapEncoderInfo *iface)
if (ref == 0) { - RegCloseKey(This->classkey); + component_info_cleanup(&This->base); free(This); }
@@ -766,7 +776,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetAuthor(IWICBitmapEncoderInfo *iface,
TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(&This->base, L"Author", cchAuthor, wzAuthor, pcchActual); }
static HRESULT WINAPI BitmapEncoderInfo_GetVendorGUID(IWICBitmapEncoderInfo *iface, GUID *pguidVendor) @@ -775,7 +785,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetVendorGUID(IWICBitmapEncoderInfo *ifa
TRACE("(%p,%p)\n", iface, pguidVendor);
- return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); + return ComponentInfo_GetGUIDValue(&This->base, L"Vendor", pguidVendor); }
static HRESULT WINAPI BitmapEncoderInfo_GetVersion(IWICBitmapEncoderInfo *iface, UINT cchVersion, @@ -785,7 +795,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetVersion(IWICBitmapEncoderInfo *iface,
TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Version", + return ComponentInfo_GetStringValue(&This->base, L"Version", cchVersion, wzVersion, pcchActual); }
@@ -796,7 +806,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetSpecVersion(IWICBitmapEncoderInfo *if
TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", + return ComponentInfo_GetStringValue(&This->base, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); }
@@ -807,7 +817,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetFriendlyName(IWICBitmapEncoderInfo *i
TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", + return ComponentInfo_GetStringValue(&This->base, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); }
@@ -816,7 +826,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetContainerFormat(IWICBitmapEncoderInfo { BitmapEncoderInfo *This = impl_from_IWICBitmapEncoderInfo(iface); TRACE("(%p,%p)\n", iface, pguidContainerFormat); - return ComponentInfo_GetGUIDValue(This->classkey, L"ContainerFormat", pguidContainerFormat); + return ComponentInfo_GetGUIDValue(&This->base, L"ContainerFormat", pguidContainerFormat); }
static HRESULT WINAPI BitmapEncoderInfo_GetPixelFormats(IWICBitmapEncoderInfo *iface, @@ -824,7 +834,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetPixelFormats(IWICBitmapEncoderInfo *i { BitmapEncoderInfo *This = impl_from_IWICBitmapEncoderInfo(iface); TRACE("(%p,%u,%p,%p)\n", iface, cFormats, pguidPixelFormats, pcActual); - return ComponentInfo_GetGuidList(This->classkey, L"Formats", cFormats, pguidPixelFormats, pcActual); + return ComponentInfo_GetGuidList(&This->base, L"Formats", cFormats, pguidPixelFormats, pcActual); }
static HRESULT WINAPI BitmapEncoderInfo_GetColorManagementVersion(IWICBitmapEncoderInfo *iface, @@ -855,7 +865,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetMimeTypes(IWICBitmapEncoderInfo *ifac
TRACE("(%p,%u,%p,%p)\n", iface, cchMimeTypes, wzMimeTypes, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"MimeTypes", + return ComponentInfo_GetStringValue(&This->base, L"MimeTypes", cchMimeTypes, wzMimeTypes, pcchActual); }
@@ -866,7 +876,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetFileExtensions(IWICBitmapEncoderInfo
TRACE("(%p,%u,%p,%p)\n", iface, cchFileExtensions, wzFileExtensions, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"FileExtensions", + return ComponentInfo_GetStringValue(&This->base, L"FileExtensions", cchFileExtensions, wzFileExtensions, pcchActual); }
@@ -950,10 +960,7 @@ static HRESULT BitmapEncoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp if (!This) return E_OUTOFMEMORY;
- This->base.IWICComponentInfo_iface.lpVtbl = (const IWICComponentInfoVtbl*)&BitmapEncoderInfo_Vtbl; - This->base.ref = 1; - This->classkey = classkey; - This->base.clsid = *clsid; + component_info_init(&This->base, classkey, clsid, (const IWICComponentInfoVtbl *)&BitmapEncoderInfo_Vtbl);
*ret = &This->base; return S_OK; @@ -961,7 +968,6 @@ static HRESULT BitmapEncoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp
typedef struct { ComponentInfo base; - HKEY classkey; } FormatConverterInfo;
static inline FormatConverterInfo *impl_from_IWICFormatConverterInfo(IWICFormatConverterInfo *iface) @@ -1012,7 +1018,7 @@ static ULONG WINAPI FormatConverterInfo_Release(IWICFormatConverterInfo *iface)
if (ref == 0) { - RegCloseKey(This->classkey); + component_info_cleanup(&This->base); free(This); }
@@ -1053,7 +1059,7 @@ static HRESULT WINAPI FormatConverterInfo_GetAuthor(IWICFormatConverterInfo *ifa
TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(&This->base, L"Author", cchAuthor, wzAuthor, pcchActual); }
static HRESULT WINAPI FormatConverterInfo_GetVendorGUID(IWICFormatConverterInfo *iface, GUID *pguidVendor) @@ -1062,7 +1068,7 @@ static HRESULT WINAPI FormatConverterInfo_GetVendorGUID(IWICFormatConverterInfo
TRACE("(%p,%p)\n", iface, pguidVendor);
- return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); + return ComponentInfo_GetGUIDValue(&This->base, L"Vendor", pguidVendor); }
static HRESULT WINAPI FormatConverterInfo_GetVersion(IWICFormatConverterInfo *iface, UINT cchVersion, @@ -1072,7 +1078,7 @@ static HRESULT WINAPI FormatConverterInfo_GetVersion(IWICFormatConverterInfo *if
TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Version", + return ComponentInfo_GetStringValue(&This->base, L"Version", cchVersion, wzVersion, pcchActual); }
@@ -1083,7 +1089,7 @@ static HRESULT WINAPI FormatConverterInfo_GetSpecVersion(IWICFormatConverterInfo
TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", + return ComponentInfo_GetStringValue(&This->base, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); }
@@ -1094,7 +1100,7 @@ static HRESULT WINAPI FormatConverterInfo_GetFriendlyName(IWICFormatConverterInf
TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", + return ComponentInfo_GetStringValue(&This->base, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); }
@@ -1125,7 +1131,7 @@ static BOOL ConverterSupportsFormat(IWICFormatConverterInfo *iface, const WCHAR /* Avoid testing using IWICFormatConverter_GetPixelFormats because that would be O(n). A registry test should do better. */
- res = RegOpenKeyExW(This->classkey, L"PixelFormats", 0, KEY_READ, &formats_key); + res = RegOpenKeyExW(This->base.classkey, L"PixelFormats", 0, KEY_READ, &formats_key); if (res != ERROR_SUCCESS) return FALSE;
res = RegOpenKeyExW(formats_key, formatguid, 0, KEY_READ, &guid_key); @@ -1160,10 +1166,7 @@ static HRESULT FormatConverterInfo_Constructor(HKEY classkey, REFCLSID clsid, Co if (!This) return E_OUTOFMEMORY;
- This->base.IWICComponentInfo_iface.lpVtbl = (const IWICComponentInfoVtbl*)&FormatConverterInfo_Vtbl; - This->base.ref = 1; - This->classkey = classkey; - This->base.clsid = *clsid; + component_info_init(&This->base, classkey, clsid, (const IWICComponentInfoVtbl *)&FormatConverterInfo_Vtbl);
*ret = &This->base; return S_OK; @@ -1171,7 +1174,6 @@ static HRESULT FormatConverterInfo_Constructor(HKEY classkey, REFCLSID clsid, Co
typedef struct { ComponentInfo base; - HKEY classkey; } PixelFormatInfo;
static inline PixelFormatInfo *impl_from_IWICPixelFormatInfo2(IWICPixelFormatInfo2 *iface) @@ -1223,7 +1225,7 @@ static ULONG WINAPI PixelFormatInfo_Release(IWICPixelFormatInfo2 *iface)
if (ref == 0) { - RegCloseKey(This->classkey); + component_info_cleanup(&This->base); free(This); }
@@ -1271,7 +1273,7 @@ static HRESULT WINAPI PixelFormatInfo_GetAuthor(IWICPixelFormatInfo2 *iface, UIN
TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(&This->base, L"Author", cchAuthor, wzAuthor, pcchActual); }
static HRESULT WINAPI PixelFormatInfo_GetVendorGUID(IWICPixelFormatInfo2 *iface, GUID *pguidVendor) @@ -1280,7 +1282,7 @@ static HRESULT WINAPI PixelFormatInfo_GetVendorGUID(IWICPixelFormatInfo2 *iface,
TRACE("(%p,%p)\n", iface, pguidVendor);
- return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); + return ComponentInfo_GetGUIDValue(&This->base, L"Vendor", pguidVendor); }
static HRESULT WINAPI PixelFormatInfo_GetVersion(IWICPixelFormatInfo2 *iface, UINT cchVersion, @@ -1290,7 +1292,7 @@ static HRESULT WINAPI PixelFormatInfo_GetVersion(IWICPixelFormatInfo2 *iface, UI
TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"Version", + return ComponentInfo_GetStringValue(&This->base, L"Version", cchVersion, wzVersion, pcchActual); }
@@ -1301,7 +1303,7 @@ static HRESULT WINAPI PixelFormatInfo_GetSpecVersion(IWICPixelFormatInfo2 *iface
TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", + return ComponentInfo_GetStringValue(&This->base, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); }
@@ -1312,7 +1314,7 @@ static HRESULT WINAPI PixelFormatInfo_GetFriendlyName(IWICPixelFormatInfo2 *ifac
TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual);
- return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", + return ComponentInfo_GetStringValue(&This->base, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); }
@@ -1343,7 +1345,7 @@ static HRESULT WINAPI PixelFormatInfo_GetBitsPerPixel(IWICPixelFormatInfo2 *ifac
TRACE("(%p,%p)\n", iface, puiBitsPerPixel);
- return ComponentInfo_GetUINTValue(This->classkey, L"BitLength", puiBitsPerPixel); + return ComponentInfo_GetUINTValue(&This->base, L"BitLength", puiBitsPerPixel); }
static HRESULT WINAPI PixelFormatInfo_GetChannelCount(IWICPixelFormatInfo2 *iface, @@ -1353,7 +1355,7 @@ static HRESULT WINAPI PixelFormatInfo_GetChannelCount(IWICPixelFormatInfo2 *ifac
TRACE("(%p,%p)\n", iface, puiChannelCount);
- return ComponentInfo_GetUINTValue(This->classkey, L"ChannelCount", puiChannelCount); + return ComponentInfo_GetUINTValue(&This->base, L"ChannelCount", puiChannelCount); }
static HRESULT WINAPI PixelFormatInfo_GetChannelMask(IWICPixelFormatInfo2 *iface, @@ -1382,7 +1384,7 @@ static HRESULT WINAPI PixelFormatInfo_GetChannelMask(IWICPixelFormatInfo2 *iface
cbData = cbMaskBuffer;
- ret = RegGetValueW(This->classkey, L"ChannelMasks", valuename, RRF_RT_REG_BINARY, NULL, pbMaskBuffer, &cbData); + ret = RegGetValueW(This->base.classkey, L"ChannelMasks", valuename, RRF_RT_REG_BINARY, NULL, pbMaskBuffer, &cbData);
if (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) *pcbActual = cbData; @@ -1403,7 +1405,7 @@ static HRESULT WINAPI PixelFormatInfo_SupportsTransparency(IWICPixelFormatInfo2
TRACE("(%p,%p)\n", iface, pfSupportsTransparency);
- return ComponentInfo_GetUINTValue(This->classkey, L"SupportsTransparency", pfSupportsTransparency); + return ComponentInfo_GetUINTValue(&This->base, L"SupportsTransparency", pfSupportsTransparency); }
static HRESULT WINAPI PixelFormatInfo_GetNumericRepresentation(IWICPixelFormatInfo2 *iface, @@ -1413,7 +1415,7 @@ static HRESULT WINAPI PixelFormatInfo_GetNumericRepresentation(IWICPixelFormatIn
TRACE("(%p,%p)\n", iface, pNumericRepresentation);
- return ComponentInfo_GetUINTValue(This->classkey, L"NumericRepresentation", pNumericRepresentation); + return ComponentInfo_GetUINTValue(&This->base, L"NumericRepresentation", pNumericRepresentation); }
static const IWICPixelFormatInfo2Vtbl PixelFormatInfo_Vtbl = { @@ -1445,10 +1447,7 @@ static HRESULT PixelFormatInfo_Constructor(HKEY classkey, REFCLSID clsid, Compon if (!This) return E_OUTOFMEMORY;
- This->base.IWICComponentInfo_iface.lpVtbl = (const IWICComponentInfoVtbl*)&PixelFormatInfo_Vtbl; - This->base.ref = 1; - This->classkey = classkey; - This->base.clsid = *clsid; + component_info_init(&This->base, classkey, clsid, (const IWICComponentInfoVtbl *)&PixelFormatInfo_Vtbl);
*ret = &This->base; return S_OK; @@ -1464,7 +1463,6 @@ struct metadata_container typedef struct { ComponentInfo base; - HKEY classkey; GUID *container_formats; struct metadata_container *containers; UINT container_count; @@ -1531,7 +1529,7 @@ static ULONG WINAPI MetadataReaderInfo_Release(IWICMetadataReaderInfo *iface) if (!ref) { unsigned i; - RegCloseKey(This->classkey); + component_info_cleanup(&This->base); for (i = 0; i < This->container_count; i++) free(This->containers[i].patterns); free(This->containers); @@ -1577,7 +1575,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetAuthor(IWICMetadataReaderInfo *iface
TRACE("(%p,%u,%p,%p)\n", iface, length, author, actual_length);
- return ComponentInfo_GetStringValue(This->classkey, L"Author", length, author, actual_length); + return ComponentInfo_GetStringValue(&This->base, L"Author", length, author, actual_length); }
static HRESULT WINAPI MetadataReaderInfo_GetVendorGUID(IWICMetadataReaderInfo *iface, @@ -1587,7 +1585,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetVendorGUID(IWICMetadataReaderInfo *i
TRACE("(%p,%p)\n", iface, vendor);
- return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", vendor); + return ComponentInfo_GetGUIDValue(&This->base, L"Vendor", vendor); }
static HRESULT WINAPI MetadataReaderInfo_GetVersion(IWICMetadataReaderInfo *iface, @@ -1597,7 +1595,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetVersion(IWICMetadataReaderInfo *ifac
TRACE("(%p,%u,%p,%p)\n", iface, length, version, actual_length);
- return ComponentInfo_GetStringValue(This->classkey, L"Version", length, version, actual_length); + return ComponentInfo_GetStringValue(&This->base, L"Version", length, version, actual_length); }
static HRESULT WINAPI MetadataReaderInfo_GetSpecVersion(IWICMetadataReaderInfo *iface, @@ -1607,7 +1605,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetSpecVersion(IWICMetadataReaderInfo *
TRACE("(%p,%u,%p,%p)\n", iface, length, version, actual_length);
- return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", + return ComponentInfo_GetStringValue(&This->base, L"SpecVersion", length, version, actual_length); }
@@ -1618,7 +1616,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetFriendlyName(IWICMetadataReaderInfo
TRACE("(%p,%u,%p,%p)\n", iface, length, name, actual_length);
- return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", + return ComponentInfo_GetStringValue(&This->base, L"FriendlyName", length, name, actual_length); }
@@ -1627,7 +1625,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetMetadataFormat(IWICMetadataReaderInf { MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); TRACE("(%p,%p)\n", iface, format); - return ComponentInfo_GetGUIDValue(This->classkey, L"MetadataFormat", format); + return ComponentInfo_GetGUIDValue(&This->base, L"MetadataFormat", format); }
static HRESULT WINAPI MetadataReaderInfo_GetContainerFormats(IWICMetadataReaderInfo *iface, @@ -1669,7 +1667,7 @@ static HRESULT WINAPI MetadataReaderInfo_DoesRequireFullStream(IWICMetadataReade { MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); TRACE("(%p,%p)\n", iface, param); - return ComponentInfo_GetUINTValue(This->classkey, L"RequiresFullStream", param); + return ComponentInfo_GetUINTValue(&This->base, L"RequiresFullStream", param); }
static HRESULT WINAPI MetadataReaderInfo_DoesSupportPadding(IWICMetadataReaderInfo *iface, @@ -1677,7 +1675,7 @@ static HRESULT WINAPI MetadataReaderInfo_DoesSupportPadding(IWICMetadataReaderIn { MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); TRACE("(%p,%p)\n", iface, param); - return ComponentInfo_GetUINTValue(This->classkey, L"SupportsPadding", param); + return ComponentInfo_GetUINTValue(&This->base, L"SupportsPadding", param); }
static HRESULT WINAPI MetadataReaderInfo_DoesRequireFixedSize(IWICMetadataReaderInfo *iface, @@ -1823,7 +1821,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui BYTE *patterns_ptr; DWORD length, valuesize;
- res = RegOpenKeyExW(info->classkey, L"Containers", 0, KEY_READ, &containers_key); + res = RegOpenKeyExW(info->base.classkey, L"Containers", 0, KEY_READ, &containers_key); if (res != ERROR_SUCCESS) return;
StringFromGUID2(container_guid, guidkeyname, 39); @@ -1926,13 +1924,13 @@ static BOOL read_metadata_info(MetadataReaderInfo *info) GUID *formats; HRESULT hr;
- hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", 0, NULL, &format_count); + hr = ComponentInfo_GetGuidList(&info->base, L"Containers", 0, NULL, &format_count); if (FAILED(hr)) return TRUE;
formats = calloc(format_count, sizeof(*formats)); if (!formats) return FALSE;
- hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", format_count, formats, + hr = ComponentInfo_GetGuidList(&info->base, L"Containers", format_count, formats, &format_count); if (FAILED(hr)) { @@ -1965,10 +1963,7 @@ static HRESULT MetadataReaderInfo_Constructor(HKEY classkey, REFCLSID clsid, Com if (!This) return E_OUTOFMEMORY;
- This->base.IWICComponentInfo_iface.lpVtbl = (const IWICComponentInfoVtbl*)&MetadataReaderInfo_Vtbl; - This->base.ref = 1; - This->classkey = classkey; - This->base.clsid = *clsid; + component_info_init(&This->base, classkey, clsid, (const IWICComponentInfoVtbl *)&MetadataReaderInfo_Vtbl);
if (!read_metadata_info(This)) {