From a2c6c3133089ae529e23c7f405d295d8b7a27d28 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Tue, 1 Dec 2020 00:58:23 +0100 Subject: [PATCH] windowscodecs: Use wide-char string literals. Signed-off-by: Michael Stefaniuc Signed-off-by: Esme Povirk Signed-off-by: Alexandre Julliard --- dlls/windowscodecs/info.c | 172 ++++++++++++++++------------------------- dlls/windowscodecs/pngformat.c | 21 +++-- 2 files changed, 75 insertions(+), 118 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index 34e14087f94..db6d25b46b3 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -35,26 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); -static const WCHAR mimetypes_valuename[] = {'M','i','m','e','T','y','p','e','s',0}; -static const WCHAR author_valuename[] = {'A','u','t','h','o','r',0}; -static const WCHAR friendlyname_valuename[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0}; -static const WCHAR pixelformats_keyname[] = {'P','i','x','e','l','F','o','r','m','a','t','s',0}; -static const WCHAR formats_keyname[] = {'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 const WCHAR metadataformat_valuename[] = {'M','e','t','a','d','a','t','a','F','o','r','m','a','t',0}; -static const WCHAR vendor_valuename[] = {'V','e','n','d','o','r',0}; -static const WCHAR version_valuename[] = {'V','e','r','s','i','o','n',0}; -static const WCHAR specversion_valuename[] = {'S','p','e','c','V','e','r','s','i','o','n',0}; -static const WCHAR bitsperpixel_valuename[] = {'B','i','t','L','e','n','g','t','h',0}; -static const WCHAR channelcount_valuename[] = {'C','h','a','n','n','e','l','C','o','u','n','t',0}; -static const WCHAR channelmasks_keyname[] = {'C','h','a','n','n','e','l','M','a','s','k','s',0}; -static const WCHAR numericrepresentation_valuename[] = {'N','u','m','e','r','i','c','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0}; -static const WCHAR supportstransparency_valuename[] = {'S','u','p','p','o','r','t','s','T','r','a','n','s','p','a','r','e','n','c','y',0}; -static const WCHAR requiresfullstream_valuename[] = {'R','e','q','u','i','r','e','s','F','u','l','l','S','t','r','e','a','m',0}; -static const WCHAR supportspadding_valuename[] = {'S','u','p','p','o','r','t','s','P','a','d','d','i','n','g',0}; -static const WCHAR fileextensions_valuename[] = {'F','i','l','e','E','x','t','e','n','s','i','o','n','s',0}; -static const WCHAR containers_keyname[] = {'C','o','n','t','a','i','n','e','r','s',0}; - typedef struct { IWICComponentInfo IWICComponentInfo_iface; LONG ref; @@ -308,8 +288,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetAuthor(IWICBitmapDecoderInfo *iface, TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, author_valuename, - cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); } static HRESULT WINAPI BitmapDecoderInfo_GetVendorGUID(IWICBitmapDecoderInfo *iface, GUID *pguidVendor) @@ -318,7 +297,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetVendorGUID(IWICBitmapDecoderInfo *ifa TRACE("(%p,%p)\n", iface, pguidVendor); - return ComponentInfo_GetGUIDValue(This->classkey, vendor_valuename, pguidVendor); + return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); } static HRESULT WINAPI BitmapDecoderInfo_GetVersion(IWICBitmapDecoderInfo *iface, UINT cchVersion, @@ -328,7 +307,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetVersion(IWICBitmapDecoderInfo *iface, TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, version_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"Version", cchVersion, wzVersion, pcchActual); } @@ -339,7 +318,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetSpecVersion(IWICBitmapDecoderInfo *if TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, specversion_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); } @@ -350,7 +329,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetFriendlyName(IWICBitmapDecoderInfo *i TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, friendlyname_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); } @@ -359,7 +338,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetContainerFormat(IWICBitmapDecoderInfo { BitmapDecoderInfo *This = impl_from_IWICBitmapDecoderInfo(iface); TRACE("(%p,%p)\n", iface, pguidContainerFormat); - return ComponentInfo_GetGUIDValue(This->classkey, containerformat_valuename, pguidContainerFormat); + return ComponentInfo_GetGUIDValue(This->classkey, L"ContainerFormat", pguidContainerFormat); } static HRESULT WINAPI BitmapDecoderInfo_GetPixelFormats(IWICBitmapDecoderInfo *iface, @@ -367,7 +346,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, formats_keyname, cFormats, pguidPixelFormats, pcActual); + return ComponentInfo_GetGuidList(This->classkey, L"Formats", cFormats, pguidPixelFormats, pcActual); } static HRESULT WINAPI BitmapDecoderInfo_GetColorManagementVersion(IWICBitmapDecoderInfo *iface, @@ -398,7 +377,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetMimeTypes(IWICBitmapDecoderInfo *ifac TRACE("(%p,%u,%p,%p)\n", iface, cchMimeTypes, wzMimeTypes, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, mimetypes_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"MimeTypes", cchMimeTypes, wzMimeTypes, pcchActual); } @@ -409,7 +388,7 @@ static HRESULT WINAPI BitmapDecoderInfo_GetFileExtensions(IWICBitmapDecoderInfo TRACE("(%p,%u,%p,%p)\n", iface, cchFileExtensions, wzFileExtensions, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, fileextensions_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"FileExtensions", cchFileExtensions, wzFileExtensions, pcchActual); } @@ -577,19 +556,12 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) WCHAR subkeyname[11]; LONG res; HKEY patternskey, patternkey; - static const WCHAR uintformatW[] = {'%','u',0}; - static const WCHAR patternsW[] = {'P','a','t','t','e','r','n','s',0}; - static const WCHAR positionW[] = {'P','o','s','i','t','i','o','n',0}; - static const WCHAR lengthW[] = {'L','e','n','g','t','h',0}; - static const WCHAR patternW[] = {'P','a','t','t','e','r','n',0}; - static const WCHAR maskW[] = {'M','a','s','k',0}; - static const WCHAR endofstreamW[] = {'E','n','d','O','f','S','t','r','e','a','m',0}; UINT i; WICBitmapPattern *patterns; BYTE *patterns_ptr; DWORD length, valuesize; - res = RegOpenKeyExW(info->classkey, patternsW, 0, KEY_READ, &patternskey); + res = RegOpenKeyExW(info->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); @@ -609,25 +581,25 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) for (i=0; res == ERROR_SUCCESS && i < pattern_count; i++) { - swprintf(subkeyname, 11, uintformatW, i); + swprintf(subkeyname, 11, L"%u", i); res = RegOpenKeyExW(patternskey, subkeyname, 0, KEY_READ, &patternkey); if (res != ERROR_SUCCESS) break; valuesize = sizeof(ULONG); - res = RegGetValueW(patternkey, NULL, lengthW, RRF_RT_DWORD, NULL, &length, &valuesize); + res = RegGetValueW(patternkey, NULL, L"Length", RRF_RT_DWORD, NULL, &length, &valuesize); if (res == ERROR_SUCCESS) { patterns_size += length*2; patterns[i].Length = length; valuesize = sizeof(BOOL); - res = RegGetValueW(patternkey, NULL, endofstreamW, RRF_RT_DWORD, NULL, + res = RegGetValueW(patternkey, NULL, L"EndOfStream", RRF_RT_DWORD, NULL, &patterns[i].EndOfStream, &valuesize); if (res) patterns[i].EndOfStream = 0; patterns[i].Position.QuadPart = 0; valuesize = sizeof(ULARGE_INTEGER); - res = RegGetValueW(patternkey, NULL, positionW, RRF_RT_DWORD|RRF_RT_QWORD, NULL, + res = RegGetValueW(patternkey, NULL, L"Position", RRF_RT_DWORD|RRF_RT_QWORD, NULL, &patterns[i].Position, &valuesize); } @@ -645,14 +617,14 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) for (i=0; res == ERROR_SUCCESS && i < pattern_count; i++) { - swprintf(subkeyname, 11, uintformatW, i); + swprintf(subkeyname, 11, L"%u", i); res = RegOpenKeyExW(patternskey, subkeyname, 0, KEY_READ, &patternkey); if (res != ERROR_SUCCESS) break; length = patterns[i].Length; patterns[i].Pattern = patterns_ptr; valuesize = length; - res = RegGetValueW(patternkey, NULL, patternW, RRF_RT_REG_BINARY, NULL, + res = RegGetValueW(patternkey, NULL, L"Pattern", RRF_RT_REG_BINARY, NULL, patterns[i].Pattern, &valuesize); patterns_ptr += length; @@ -660,7 +632,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) { patterns[i].Mask = patterns_ptr; valuesize = length; - res = RegGetValueW(patternkey, NULL, maskW, RRF_RT_REG_BINARY, NULL, + res = RegGetValueW(patternkey, NULL, L"Mask", RRF_RT_REG_BINARY, NULL, patterns[i].Mask, &valuesize); patterns_ptr += length; } @@ -798,8 +770,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetAuthor(IWICBitmapEncoderInfo *iface, TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, author_valuename, - cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); } static HRESULT WINAPI BitmapEncoderInfo_GetVendorGUID(IWICBitmapEncoderInfo *iface, GUID *pguidVendor) @@ -808,7 +779,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetVendorGUID(IWICBitmapEncoderInfo *ifa TRACE("(%p,%p)\n", iface, pguidVendor); - return ComponentInfo_GetGUIDValue(This->classkey, vendor_valuename, pguidVendor); + return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); } static HRESULT WINAPI BitmapEncoderInfo_GetVersion(IWICBitmapEncoderInfo *iface, UINT cchVersion, @@ -818,7 +789,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetVersion(IWICBitmapEncoderInfo *iface, TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, version_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"Version", cchVersion, wzVersion, pcchActual); } @@ -829,7 +800,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetSpecVersion(IWICBitmapEncoderInfo *if TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, specversion_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); } @@ -840,7 +811,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetFriendlyName(IWICBitmapEncoderInfo *i TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, friendlyname_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); } @@ -849,7 +820,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetContainerFormat(IWICBitmapEncoderInfo { BitmapEncoderInfo *This = impl_from_IWICBitmapEncoderInfo(iface); TRACE("(%p,%p)\n", iface, pguidContainerFormat); - return ComponentInfo_GetGUIDValue(This->classkey, containerformat_valuename, pguidContainerFormat); + return ComponentInfo_GetGUIDValue(This->classkey, L"ContainerFormat", pguidContainerFormat); } static HRESULT WINAPI BitmapEncoderInfo_GetPixelFormats(IWICBitmapEncoderInfo *iface, @@ -857,7 +828,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, formats_keyname, cFormats, pguidPixelFormats, pcActual); + return ComponentInfo_GetGuidList(This->classkey, L"Formats", cFormats, pguidPixelFormats, pcActual); } static HRESULT WINAPI BitmapEncoderInfo_GetColorManagementVersion(IWICBitmapEncoderInfo *iface, @@ -888,7 +859,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetMimeTypes(IWICBitmapEncoderInfo *ifac TRACE("(%p,%u,%p,%p)\n", iface, cchMimeTypes, wzMimeTypes, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, mimetypes_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"MimeTypes", cchMimeTypes, wzMimeTypes, pcchActual); } @@ -899,7 +870,7 @@ static HRESULT WINAPI BitmapEncoderInfo_GetFileExtensions(IWICBitmapEncoderInfo TRACE("(%p,%u,%p,%p)\n", iface, cchFileExtensions, wzFileExtensions, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, fileextensions_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"FileExtensions", cchFileExtensions, wzFileExtensions, pcchActual); } @@ -1089,8 +1060,7 @@ static HRESULT WINAPI FormatConverterInfo_GetAuthor(IWICFormatConverterInfo *ifa TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, author_valuename, - cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); } static HRESULT WINAPI FormatConverterInfo_GetVendorGUID(IWICFormatConverterInfo *iface, GUID *pguidVendor) @@ -1099,7 +1069,7 @@ static HRESULT WINAPI FormatConverterInfo_GetVendorGUID(IWICFormatConverterInfo TRACE("(%p,%p)\n", iface, pguidVendor); - return ComponentInfo_GetGUIDValue(This->classkey, vendor_valuename, pguidVendor); + return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); } static HRESULT WINAPI FormatConverterInfo_GetVersion(IWICFormatConverterInfo *iface, UINT cchVersion, @@ -1109,7 +1079,7 @@ static HRESULT WINAPI FormatConverterInfo_GetVersion(IWICFormatConverterInfo *if TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, version_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"Version", cchVersion, wzVersion, pcchActual); } @@ -1120,7 +1090,7 @@ static HRESULT WINAPI FormatConverterInfo_GetSpecVersion(IWICFormatConverterInfo TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, specversion_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); } @@ -1131,7 +1101,7 @@ static HRESULT WINAPI FormatConverterInfo_GetFriendlyName(IWICFormatConverterInf TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, friendlyname_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); } @@ -1162,7 +1132,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, pixelformats_keyname, 0, KEY_READ, &formats_key); + res = RegOpenKeyExW(This->classkey, L"PixelFormats", 0, KEY_READ, &formats_key); if (res != ERROR_SUCCESS) return FALSE; res = RegOpenKeyExW(formats_key, formatguid, 0, KEY_READ, &guid_key); @@ -1311,8 +1281,7 @@ static HRESULT WINAPI PixelFormatInfo_GetAuthor(IWICPixelFormatInfo2 *iface, UIN TRACE("(%p,%u,%p,%p)\n", iface, cchAuthor, wzAuthor, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, author_valuename, - cchAuthor, wzAuthor, pcchActual); + return ComponentInfo_GetStringValue(This->classkey, L"Author", cchAuthor, wzAuthor, pcchActual); } static HRESULT WINAPI PixelFormatInfo_GetVendorGUID(IWICPixelFormatInfo2 *iface, GUID *pguidVendor) @@ -1321,7 +1290,7 @@ static HRESULT WINAPI PixelFormatInfo_GetVendorGUID(IWICPixelFormatInfo2 *iface, TRACE("(%p,%p)\n", iface, pguidVendor); - return ComponentInfo_GetGUIDValue(This->classkey, vendor_valuename, pguidVendor); + return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", pguidVendor); } static HRESULT WINAPI PixelFormatInfo_GetVersion(IWICPixelFormatInfo2 *iface, UINT cchVersion, @@ -1331,7 +1300,7 @@ static HRESULT WINAPI PixelFormatInfo_GetVersion(IWICPixelFormatInfo2 *iface, UI TRACE("(%p,%u,%p,%p)\n", iface, cchVersion, wzVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, version_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"Version", cchVersion, wzVersion, pcchActual); } @@ -1342,7 +1311,7 @@ static HRESULT WINAPI PixelFormatInfo_GetSpecVersion(IWICPixelFormatInfo2 *iface TRACE("(%p,%u,%p,%p)\n", iface, cchSpecVersion, wzSpecVersion, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, specversion_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", cchSpecVersion, wzSpecVersion, pcchActual); } @@ -1353,7 +1322,7 @@ static HRESULT WINAPI PixelFormatInfo_GetFriendlyName(IWICPixelFormatInfo2 *ifac TRACE("(%p,%u,%p,%p)\n", iface, cchFriendlyName, wzFriendlyName, pcchActual); - return ComponentInfo_GetStringValue(This->classkey, friendlyname_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", cchFriendlyName, wzFriendlyName, pcchActual); } @@ -1384,7 +1353,7 @@ static HRESULT WINAPI PixelFormatInfo_GetBitsPerPixel(IWICPixelFormatInfo2 *ifac TRACE("(%p,%p)\n", iface, puiBitsPerPixel); - return ComponentInfo_GetDWORDValue(This->classkey, bitsperpixel_valuename, puiBitsPerPixel); + return ComponentInfo_GetDWORDValue(This->classkey, L"BitLength", puiBitsPerPixel); } static HRESULT WINAPI PixelFormatInfo_GetChannelCount(IWICPixelFormatInfo2 *iface, @@ -1394,13 +1363,12 @@ static HRESULT WINAPI PixelFormatInfo_GetChannelCount(IWICPixelFormatInfo2 *ifac TRACE("(%p,%p)\n", iface, puiChannelCount); - return ComponentInfo_GetDWORDValue(This->classkey, channelcount_valuename, puiChannelCount); + return ComponentInfo_GetDWORDValue(This->classkey, L"ChannelCount", puiChannelCount); } static HRESULT WINAPI PixelFormatInfo_GetChannelMask(IWICPixelFormatInfo2 *iface, UINT uiChannelIndex, UINT cbMaskBuffer, BYTE *pbMaskBuffer, UINT *pcbActual) { - static const WCHAR uintformatW[] = {'%','u',0}; PixelFormatInfo *This = impl_from_IWICPixelFormatInfo2(iface); UINT channel_count; HRESULT hr; @@ -1420,11 +1388,11 @@ static HRESULT WINAPI PixelFormatInfo_GetChannelMask(IWICPixelFormatInfo2 *iface if (SUCCEEDED(hr)) { - swprintf(valuename, 11, uintformatW, uiChannelIndex); + swprintf(valuename, 11, L"%u", uiChannelIndex); cbData = cbMaskBuffer; - ret = RegGetValueW(This->classkey, channelmasks_keyname, valuename, RRF_RT_REG_BINARY, NULL, pbMaskBuffer, &cbData); + ret = RegGetValueW(This->classkey, L"ChannelMasks", valuename, RRF_RT_REG_BINARY, NULL, pbMaskBuffer, &cbData); if (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) *pcbActual = cbData; @@ -1445,7 +1413,7 @@ static HRESULT WINAPI PixelFormatInfo_SupportsTransparency(IWICPixelFormatInfo2 TRACE("(%p,%p)\n", iface, pfSupportsTransparency); - return ComponentInfo_GetDWORDValue(This->classkey, supportstransparency_valuename, (DWORD*)pfSupportsTransparency); + return ComponentInfo_GetDWORDValue(This->classkey, L"SupportsTransparency", (DWORD*)pfSupportsTransparency); } static HRESULT WINAPI PixelFormatInfo_GetNumericRepresentation(IWICPixelFormatInfo2 *iface, @@ -1455,7 +1423,7 @@ static HRESULT WINAPI PixelFormatInfo_GetNumericRepresentation(IWICPixelFormatIn TRACE("(%p,%p)\n", iface, pNumericRepresentation); - return ComponentInfo_GetDWORDValue(This->classkey, numericrepresentation_valuename, pNumericRepresentation); + return ComponentInfo_GetDWORDValue(This->classkey, L"NumericRepresentation", pNumericRepresentation); } static const IWICPixelFormatInfo2Vtbl PixelFormatInfo_Vtbl = { @@ -1622,8 +1590,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetAuthor(IWICMetadataReaderInfo *iface TRACE("(%p,%u,%p,%p)\n", iface, length, author, actual_length); - return ComponentInfo_GetStringValue(This->classkey, author_valuename, - length, author, actual_length); + return ComponentInfo_GetStringValue(This->classkey, L"Author", length, author, actual_length); } static HRESULT WINAPI MetadataReaderInfo_GetVendorGUID(IWICMetadataReaderInfo *iface, @@ -1633,7 +1600,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetVendorGUID(IWICMetadataReaderInfo *i TRACE("(%p,%p)\n", iface, vendor); - return ComponentInfo_GetGUIDValue(This->classkey, vendor_valuename, vendor); + return ComponentInfo_GetGUIDValue(This->classkey, L"Vendor", vendor); } static HRESULT WINAPI MetadataReaderInfo_GetVersion(IWICMetadataReaderInfo *iface, @@ -1643,8 +1610,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetVersion(IWICMetadataReaderInfo *ifac TRACE("(%p,%u,%p,%p)\n", iface, length, version, actual_length); - return ComponentInfo_GetStringValue(This->classkey, version_valuename, - length, version, actual_length); + return ComponentInfo_GetStringValue(This->classkey, L"Version", length, version, actual_length); } static HRESULT WINAPI MetadataReaderInfo_GetSpecVersion(IWICMetadataReaderInfo *iface, @@ -1654,7 +1620,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetSpecVersion(IWICMetadataReaderInfo * TRACE("(%p,%u,%p,%p)\n", iface, length, version, actual_length); - return ComponentInfo_GetStringValue(This->classkey, specversion_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"SpecVersion", length, version, actual_length); } @@ -1665,7 +1631,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetFriendlyName(IWICMetadataReaderInfo TRACE("(%p,%u,%p,%p)\n", iface, length, name, actual_length); - return ComponentInfo_GetStringValue(This->classkey, friendlyname_valuename, + return ComponentInfo_GetStringValue(This->classkey, L"FriendlyName", length, name, actual_length); } @@ -1674,7 +1640,7 @@ static HRESULT WINAPI MetadataReaderInfo_GetMetadataFormat(IWICMetadataReaderInf { MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); TRACE("(%p,%p)\n", iface, format); - return ComponentInfo_GetGUIDValue(This->classkey, metadataformat_valuename, format); + return ComponentInfo_GetGUIDValue(This->classkey, L"MetadataFormat", format); } static HRESULT WINAPI MetadataReaderInfo_GetContainerFormats(IWICMetadataReaderInfo *iface, @@ -1716,7 +1682,7 @@ static HRESULT WINAPI MetadataReaderInfo_DoesRequireFullStream(IWICMetadataReade { MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); TRACE("(%p,%p)\n", iface, param); - return ComponentInfo_GetDWORDValue(This->classkey, requiresfullstream_valuename, (DWORD *)param); + return ComponentInfo_GetDWORDValue(This->classkey, L"RequiresFullStream", (DWORD *)param); } static HRESULT WINAPI MetadataReaderInfo_DoesSupportPadding(IWICMetadataReaderInfo *iface, @@ -1724,7 +1690,7 @@ static HRESULT WINAPI MetadataReaderInfo_DoesSupportPadding(IWICMetadataReaderIn { MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); TRACE("(%p,%p)\n", iface, param); - return ComponentInfo_GetDWORDValue(This->classkey, supportspadding_valuename, (DWORD *)param); + return ComponentInfo_GetDWORDValue(This->classkey, L"SupportsPadding", (DWORD *)param); } static HRESULT WINAPI MetadataReaderInfo_DoesRequireFixedSize(IWICMetadataReaderInfo *iface, @@ -1864,17 +1830,12 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui WCHAR subkeyname[11], guidkeyname[39]; LONG res; HKEY containers_key, guid_key, patternkey; - static const WCHAR uintformatW[] = {'%','u',0}; - static const WCHAR patternW[] = {'P','a','t','t','e','r','n',0}; - static const WCHAR positionW[] = {'P','o','s','i','t','i','o','n',0}; - static const WCHAR maskW[] = {'M','a','s','k',0}; - static const WCHAR dataoffsetW[] = {'D','a','t','a','O','f','f','s','e','t',0}; UINT i; WICMetadataPattern *patterns; BYTE *patterns_ptr; DWORD length, valuesize; - res = RegOpenKeyExW(info->classkey, containers_keyname, 0, KEY_READ, &containers_key); + res = RegOpenKeyExW(info->classkey, L"Containers", 0, KEY_READ, &containers_key); if (res != ERROR_SUCCESS) return; StringFromGUID2(container_guid, guidkeyname, 39); @@ -1900,24 +1861,24 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui for (i=0; res == ERROR_SUCCESS && i < pattern_count; i++) { - swprintf(subkeyname, 11, uintformatW, i); + swprintf(subkeyname, 11, L"%u", i); res = RegOpenKeyExW(guid_key, subkeyname, 0, KEY_READ, &patternkey); if (res != ERROR_SUCCESS) break; - res = RegGetValueW(patternkey, NULL, patternW, RRF_RT_REG_BINARY, NULL, NULL, &length); + res = RegGetValueW(patternkey, NULL, L"Pattern", RRF_RT_REG_BINARY, NULL, NULL, &length); if (res == ERROR_SUCCESS) { patterns_size += length*2; patterns[i].Length = length; valuesize = sizeof(DWORD64); - res = RegGetValueW(patternkey, NULL, dataoffsetW, RRF_RT_DWORD|RRF_RT_QWORD, NULL, + res = RegGetValueW(patternkey, NULL, L"DataOffset", RRF_RT_DWORD|RRF_RT_QWORD, NULL, &patterns[i].DataOffset, &valuesize); if (res) patterns[i].DataOffset.QuadPart = 0; patterns[i].Position.QuadPart = 0; valuesize = sizeof(DWORD64); - res = RegGetValueW(patternkey, NULL, positionW, RRF_RT_DWORD|RRF_RT_QWORD, NULL, + res = RegGetValueW(patternkey, NULL, L"Position", RRF_RT_DWORD|RRF_RT_QWORD, NULL, &patterns[i].Position, &valuesize); } @@ -1935,14 +1896,14 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui for (i=0; res == ERROR_SUCCESS && i < pattern_count; i++) { - swprintf(subkeyname, 11, uintformatW, i); + swprintf(subkeyname, 11, L"%u", i); res = RegOpenKeyExW(guid_key, subkeyname, 0, KEY_READ, &patternkey); if (res != ERROR_SUCCESS) break; length = patterns[i].Length; patterns[i].Pattern = patterns_ptr; valuesize = length; - res = RegGetValueW(patternkey, NULL, patternW, RRF_RT_REG_BINARY, NULL, + res = RegGetValueW(patternkey, NULL, L"Pattern", RRF_RT_REG_BINARY, NULL, patterns[i].Pattern, &valuesize); patterns_ptr += length; @@ -1950,7 +1911,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui { patterns[i].Mask = patterns_ptr; valuesize = length; - res = RegGetValueW(patternkey, NULL, maskW, RRF_RT_REG_BINARY, NULL, + res = RegGetValueW(patternkey, NULL, L"Mask", RRF_RT_REG_BINARY, NULL, patterns[i].Mask, &valuesize); patterns_ptr += length; } @@ -1977,13 +1938,13 @@ static BOOL read_metadata_info(MetadataReaderInfo *info) GUID *formats; HRESULT hr; - hr = ComponentInfo_GetGuidList(info->classkey, containers_keyname, 0, NULL, &format_count); + hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", 0, NULL, &format_count); if (FAILED(hr)) return TRUE; formats = heap_calloc(format_count, sizeof(*formats)); if (!formats) return FALSE; - hr = ComponentInfo_GetGuidList(info->classkey, containers_keyname, format_count, formats, + hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", format_count, formats, &format_count); if (FAILED(hr)) { @@ -2034,9 +1995,6 @@ static HRESULT MetadataReaderInfo_Constructor(HKEY classkey, REFCLSID clsid, Com return S_OK; } -static const WCHAR clsid_keyname[] = {'C','L','S','I','D',0}; -static const WCHAR instance_keyname[] = {'I','n','s','t','a','n','c','e',0}; - struct category { WICComponentType type; const GUID *catid; @@ -2094,7 +2052,7 @@ HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) return S_OK; } - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, KEY_READ, &clsidkey); + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &clsidkey); if (res != ERROR_SUCCESS) { LeaveCriticalSection(&component_info_cache_cs); @@ -2107,7 +2065,7 @@ HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) res = RegOpenKeyExW(clsidkey, guidstring, 0, KEY_READ, &catidkey); if (res == ERROR_SUCCESS) { - res = RegOpenKeyExW(catidkey, instance_keyname, 0, KEY_READ, &instancekey); + res = RegOpenKeyExW(catidkey, L"Instance", 0, KEY_READ, &instancekey); if (res == ERROR_SUCCESS) { StringFromGUID2(clsid, guidstring, 39); @@ -2388,7 +2346,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn if (options) FIXME("ignoring flags %x\n", options); - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, KEY_READ, &clsidkey); + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &clsidkey); if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res); @@ -2412,7 +2370,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn res = RegOpenKeyExW(clsidkey, guidstring, 0, KEY_READ, &catidkey); if (res == ERROR_SUCCESS) { - res = RegOpenKeyExW(catidkey, instance_keyname, 0, KEY_READ, &instancekey); + res = RegOpenKeyExW(catidkey, L"Instance", 0, KEY_READ, &instancekey); if (res == ERROR_SUCCESS) { i=0; diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index d14490560aa..89701bbab77 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -114,7 +114,6 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor, BYTE *data; ULONG data_size; ULONG gamma; - static const WCHAR ImageGamma[] = {'I','m','a','g','e','G','a','m','m','a',0}; LPWSTR name; MetadataItem *result; @@ -132,7 +131,7 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor, HeapFree(GetProcessHeap(), 0, data); result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem)); - name = HeapAlloc(GetProcessHeap(), 0, sizeof(ImageGamma)); + name = HeapAlloc(GetProcessHeap(), 0, sizeof(L"ImageGamma")); if (!result || !name) { HeapFree(GetProcessHeap(), 0, result); @@ -144,7 +143,7 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor, PropVariantInit(&result[0].id); PropVariantInit(&result[0].value); - memcpy(name, ImageGamma, sizeof(ImageGamma)); + memcpy(name, L"ImageGamma", sizeof(L"ImageGamma")); result[0].id.vt = VT_LPWSTR; result[0].id.u.pwszVal = name; @@ -176,14 +175,14 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor, BYTE *data; ULONG data_size; static const WCHAR names[8][12] = { - {'W','h','i','t','e','P','o','i','n','t','X',0}, - {'W','h','i','t','e','P','o','i','n','t','Y',0}, - {'R','e','d','X',0}, - {'R','e','d','Y',0}, - {'G','r','e','e','n','X',0}, - {'G','r','e','e','n','Y',0}, - {'B','l','u','e','X',0}, - {'B','l','u','e','Y',0}, + L"WhitePointX", + L"WhitePointY", + L"RedX", + L"RedY", + L"GreenX", + L"GreenY", + L"BlueX", + L"BlueY", }; LPWSTR dyn_names[8] = {0}; MetadataItem *result; -- 2.11.4.GIT