From d966bece72d585b36675f5f5bad8d3fe5d69fe4d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 6 May 2017 17:04:02 +0200 Subject: [PATCH] Added patch to implement some additional windowscodecs metadata functions. --- patches/patchinstall.sh | 44 ++ ...decs-Implement-WICMapGuidToShortName.patch | 308 ++++++++++++++ ...decs-Implement-WICMapShortNameToGuid.patch | 120 ++++++ ...scodecs-Implement-WICMapSchemaToName.patch | 388 ++++++++++++++++++ ...plement-IWICMetadataQueryReader-GetC.patch | 34 ++ ...s-in-WICPersistOptions-enumeration-n.patch | 248 +++++++++++ ...mplify-a-bit-comparison-of-two-PROPV.patch | 92 +++++ patches/windowscodecs-Metadata/definition | 3 + 8 files changed, 1237 insertions(+) create mode 100644 patches/windowscodecs-Metadata/0001-windowscodecs-Implement-WICMapGuidToShortName.patch create mode 100644 patches/windowscodecs-Metadata/0002-windowscodecs-Implement-WICMapShortNameToGuid.patch create mode 100644 patches/windowscodecs-Metadata/0003-windowscodecs-Implement-WICMapSchemaToName.patch create mode 100644 patches/windowscodecs-Metadata/0004-windowscodecs-Implement-IWICMetadataQueryReader-GetC.patch create mode 100644 patches/windowscodecs-Metadata/0005-include-Fix-typos-in-WICPersistOptions-enumeration-n.patch create mode 100644 patches/windowscodecs-Metadata/0006-windowscodecs-Simplify-a-bit-comparison-of-two-PROPV.patch create mode 100644 patches/windowscodecs-Metadata/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 846ecfc0..aab0a419 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -399,6 +399,7 @@ patch_enable_all () enable_windowscodecs_GIF_Encoder="$1" enable_windowscodecs_IMILBitmapSource="$1" enable_windowscodecs_IWICPalette_InitializeFromBitmap="$1" + enable_windowscodecs_Metadata="$1" enable_windowscodecs_Palette_Images="$1" enable_windowscodecs_TIFF_Support="$1" enable_windowscodecs_WICCreateBitmapFromSection="$1" @@ -1428,6 +1429,9 @@ patch_enable () windowscodecs-IWICPalette_InitializeFromBitmap) enable_windowscodecs_IWICPalette_InitializeFromBitmap="$2" ;; + windowscodecs-Metadata) + enable_windowscodecs_Metadata="$2" + ;; windowscodecs-Palette_Images) enable_windowscodecs_Palette_Images="$2" ;; @@ -2095,6 +2099,17 @@ if test "$enable_wineboot_ProxySettings" -eq 1; then enable_wineboot_drivers_etc_Stubs=1 fi +if test "$enable_windowscodecs_Metadata" -eq 1; then + if test "$enable_windowscodecs_TIFF_Support" -gt 1; then + abort "Patchset windowscodecs-TIFF_Support disabled, but windowscodecs-Metadata depends on that." + fi + if test "$enable_windowscodecs_WICCreateBitmapFromSection" -gt 1; then + abort "Patchset windowscodecs-WICCreateBitmapFromSection disabled, but windowscodecs-Metadata depends on that." + fi + enable_windowscodecs_TIFF_Support=1 + enable_windowscodecs_WICCreateBitmapFromSection=1 +fi + if test "$enable_windowscodecs_32bppPRGBA" -eq 1; then if test "$enable_windowscodecs_TIFF_Support" -gt 1; then abort "Patchset windowscodecs-TIFF_Support disabled, but windowscodecs-32bppPRGBA depends on that." @@ -8401,6 +8416,35 @@ if test "$enable_windowscodecs_WICCreateBitmapFromSection" -eq 1; then ) >> "$patchlist" fi +# Patchset windowscodecs-Metadata +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * gdiplus-Grayscale_PNG, windowscodecs-32bppGrayFloat, windowscodecs-Palette_Images, windowscodecs-GIF_Encoder, +# | windowscodecs-IWICPalette_InitializeFromBitmap, windowscodecs-TIFF_Support, windowscodecs-WICCreateBitmapFromSection +# | +# | Modified files: +# | * dlls/windowscodecs/Makefile.in, dlls/windowscodecs/gifformat.c, dlls/windowscodecs/imgfactory.c, +# | dlls/windowscodecs/metadatahandler.c, dlls/windowscodecs/metadataquery.c, dlls/windowscodecs/tests/converter.c, +# | dlls/windowscodecs/tests/metadata.c, dlls/windowscodecs/tiffformat.c, dlls/windowscodecs/windowscodecs.spec, +# | include/wincodec.idl, include/wincodecsdk.idl +# | +if test "$enable_windowscodecs_Metadata" -eq 1; then + patch_apply windowscodecs-Metadata/0001-windowscodecs-Implement-WICMapGuidToShortName.patch + patch_apply windowscodecs-Metadata/0002-windowscodecs-Implement-WICMapShortNameToGuid.patch + patch_apply windowscodecs-Metadata/0003-windowscodecs-Implement-WICMapSchemaToName.patch + patch_apply windowscodecs-Metadata/0004-windowscodecs-Implement-IWICMetadataQueryReader-GetC.patch + patch_apply windowscodecs-Metadata/0005-include-Fix-typos-in-WICPersistOptions-enumeration-n.patch + patch_apply windowscodecs-Metadata/0006-windowscodecs-Simplify-a-bit-comparison-of-two-PROPV.patch + ( + printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement WICMapGuidToShortName.", 1 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement WICMapShortNameToGuid.", 1 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement WICMapSchemaToName.", 1 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICMetadataQueryReader::GetContainerFormat.", 1 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "include: Fix typos in WICPersistOptions enumeration names.", 1 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Simplify a bit comparison of two PROPVARIANTs.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wine.inf-Directory_ContextMenuHandlers # | # | This patchset fixes the following Wine bugs: diff --git a/patches/windowscodecs-Metadata/0001-windowscodecs-Implement-WICMapGuidToShortName.patch b/patches/windowscodecs-Metadata/0001-windowscodecs-Implement-WICMapGuidToShortName.patch new file mode 100644 index 00000000..549e5817 --- /dev/null +++ b/patches/windowscodecs-Metadata/0001-windowscodecs-Implement-WICMapGuidToShortName.patch @@ -0,0 +1,308 @@ +From 4c60660a4e6d8545d1fc7101e117320ca0bd827a Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Tue, 28 Mar 2017 12:10:47 +0800 +Subject: windowscodecs: Implement WICMapGuidToShortName. + +--- + dlls/windowscodecs/metadataquery.c | 130 ++++++++++++++++++++++++++++++++++ + dlls/windowscodecs/tests/metadata.c | 60 +++++++++++++++- + dlls/windowscodecs/windowscodecs.spec | 2 +- + include/wincodec.idl | 2 + + include/wincodecsdk.idl | 23 ++++++ + 5 files changed, 215 insertions(+), 2 deletions(-) + +diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c +index 24de2f871c..e3c0d1b096 100644 +--- a/dlls/windowscodecs/metadataquery.c ++++ b/dlls/windowscodecs/metadataquery.c +@@ -1,5 +1,6 @@ + /* + * Copyright 2016 Andrew Eikum for CodeWeavers ++ * Copyright 2017 Dmitry Timoshkov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -29,6 +30,7 @@ + #include "wincodecs_private.h" + + #include "wine/debug.h" ++#include "wine/unicode.h" + + WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); + +@@ -148,3 +150,131 @@ HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMet + + return S_OK; + } ++ ++static const WCHAR bmpW[] = { 'b','m','p',0 }; ++static const WCHAR pngW[] = { 'p','n','g',0 }; ++static const WCHAR icoW[] = { 'i','c','o',0 }; ++static const WCHAR jpgW[] = { 'j','p','g',0 }; ++static const WCHAR tiffW[] = { 't','i','f','f',0 }; ++static const WCHAR gifW[] = { 'g','i','f',0 }; ++static const WCHAR wmphotoW[] = { 'w','m','p','h','o','t','o',0 }; ++static const WCHAR unknownW[] = { 'u','n','k','n','o','w','n',0 }; ++static const WCHAR ifdW[] = { 'i','f','d',0 }; ++static const WCHAR subW[] = { 's','u','b',0 }; ++static const WCHAR exifW[] = { 'e','x','i','f',0 }; ++static const WCHAR gpsW[] = { 'g','p','s',0 }; ++static const WCHAR interopW[] = { 'i','n','t','e','r','o','p',0 }; ++static const WCHAR app0W[] = { 'a','p','p','0',0 }; ++static const WCHAR app1W[] = { 'a','p','p','1',0 }; ++static const WCHAR app13W[] = { 'a','p','p','1','3',0 }; ++static const WCHAR iptcW[] = { 'i','p','t','c',0 }; ++static const WCHAR irbW[] = { 'i','r','b',0 }; ++static const WCHAR _8bimiptcW[] = { '8','b','i','m','i','p','t','c',0 }; ++static const WCHAR _8bimResInfoW[] = { '8','b','i','m','R','e','s','I','n','f','o',0 }; ++static const WCHAR _8bimiptcdigestW[] = { '8','b','i','m','i','p','t','c','d','i','g','e','s','t',0 }; ++static const WCHAR xmpW[] = { 'x','m','p',0 }; ++static const WCHAR thumbW[] = { 't','h','u','m','b',0 }; ++static const WCHAR tEXtW[] = { 't','E','X','t',0 }; ++static const WCHAR xmpstructW[] = { 'x','m','p','s','t','r','u','c','t',0 }; ++static const WCHAR xmpbagW[] = { 'x','m','p','b','a','g',0 }; ++static const WCHAR xmpseqW[] = { 'x','m','p','s','e','q',0 }; ++static const WCHAR xmpaltW[] = { 'x','m','p','a','l','t',0 }; ++static const WCHAR logscrdescW[] = { 'l','o','g','s','c','r','d','e','s','c',0 }; ++static const WCHAR imgdescW[] = { 'i','m','g','d','e','s','c',0 }; ++static const WCHAR grctlextW[] = { 'g','r','c','t','l','e','x','t',0 }; ++static const WCHAR appextW[] = { 'a','p','p','e','x','t',0 }; ++static const WCHAR chrominanceW[] = { 'c','h','r','o','m','i','n','a','n','c','e',0 }; ++static const WCHAR luminanceW[] = { 'l','u','m','i','n','a','n','c','e',0 }; ++static const WCHAR comW[] = { 'c','o','m',0 }; ++static const WCHAR commentextW[] = { 'c','o','m','m','e','n','t','e','x','t',0 }; ++static const WCHAR gAMAW[] = { 'g','A','M','A',0 }; ++static const WCHAR bKGDW[] = { 'b','K','G','D',0 }; ++static const WCHAR iTXtW[] = { 'i','T','X','t',0 }; ++static const WCHAR cHRMW[] = { 'c','H','R','M',0 }; ++static const WCHAR hISTW[] = { 'h','I','S','T',0 }; ++static const WCHAR iCCPW[] = { 'i','C','C','P',0 }; ++static const WCHAR sRGBW[] = { 's','R','G','B',0 }; ++static const WCHAR tIMEW[] = { 't','I','M','E',0 }; ++ ++static const struct ++{ ++ const GUID *guid; ++ const WCHAR *name; ++} guid2name[] = ++{ ++ { &GUID_ContainerFormatBmp, bmpW }, ++ { &GUID_ContainerFormatPng, pngW }, ++ { &GUID_ContainerFormatIco, icoW }, ++ { &GUID_ContainerFormatJpeg, jpgW }, ++ { &GUID_ContainerFormatTiff, tiffW }, ++ { &GUID_ContainerFormatGif, gifW }, ++ { &GUID_ContainerFormatWmp, wmphotoW }, ++ { &GUID_MetadataFormatUnknown, unknownW }, ++ { &GUID_MetadataFormatIfd, ifdW }, ++ { &GUID_MetadataFormatSubIfd, subW }, ++ { &GUID_MetadataFormatExif, exifW }, ++ { &GUID_MetadataFormatGps, gpsW }, ++ { &GUID_MetadataFormatInterop, interopW }, ++ { &GUID_MetadataFormatApp0, app0W }, ++ { &GUID_MetadataFormatApp1, app1W }, ++ { &GUID_MetadataFormatApp13, app13W }, ++ { &GUID_MetadataFormatIPTC, iptcW }, ++ { &GUID_MetadataFormatIRB, irbW }, ++ { &GUID_MetadataFormat8BIMIPTC, _8bimiptcW }, ++ { &GUID_MetadataFormat8BIMResolutionInfo, _8bimResInfoW }, ++ { &GUID_MetadataFormat8BIMIPTCDigest, _8bimiptcdigestW }, ++ { &GUID_MetadataFormatXMP, xmpW }, ++ { &GUID_MetadataFormatThumbnail, thumbW }, ++ { &GUID_MetadataFormatChunktEXt, tEXtW }, ++ { &GUID_MetadataFormatXMPStruct, xmpstructW }, ++ { &GUID_MetadataFormatXMPBag, xmpbagW }, ++ { &GUID_MetadataFormatXMPSeq, xmpseqW }, ++ { &GUID_MetadataFormatXMPAlt, xmpaltW }, ++ { &GUID_MetadataFormatLSD, logscrdescW }, ++ { &GUID_MetadataFormatIMD, imgdescW }, ++ { &GUID_MetadataFormatGCE, grctlextW }, ++ { &GUID_MetadataFormatAPE, appextW }, ++ { &GUID_MetadataFormatJpegChrominance, chrominanceW }, ++ { &GUID_MetadataFormatJpegLuminance, luminanceW }, ++ { &GUID_MetadataFormatJpegComment, comW }, ++ { &GUID_MetadataFormatGifComment, commentextW }, ++ { &GUID_MetadataFormatChunkgAMA, gAMAW }, ++ { &GUID_MetadataFormatChunkbKGD, bKGDW }, ++ { &GUID_MetadataFormatChunkiTXt, iTXtW }, ++ { &GUID_MetadataFormatChunkcHRM, cHRMW }, ++ { &GUID_MetadataFormatChunkhIST, hISTW }, ++ { &GUID_MetadataFormatChunkiCCP, iCCPW }, ++ { &GUID_MetadataFormatChunksRGB, sRGBW }, ++ { &GUID_MetadataFormatChunktIME, tIMEW } ++}; ++ ++HRESULT WINAPI WICMapGuidToShortName(REFGUID guid, UINT len, WCHAR *name, UINT *ret_len) ++{ ++ UINT i; ++ ++ TRACE("%s,%u,%p,%p\n", wine_dbgstr_guid(guid), len, name, ret_len); ++ ++ if (!guid) return E_INVALIDARG; ++ ++ for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++) ++ { ++ if (IsEqualGUID(guid, guid2name[i].guid)) ++ { ++ if (name) ++ { ++ if (!len) return E_INVALIDARG; ++ ++ len = min(len - 1, strlenW(guid2name[i].name)); ++ memcpy(name, guid2name[i].name, len * sizeof(WCHAR)); ++ name[len] = 0; ++ ++ if (len < strlenW(guid2name[i].name)) ++ return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); ++ } ++ if (ret_len) *ret_len = strlenW(guid2name[i].name) + 1; ++ return S_OK; ++ } ++ } ++ ++ return WINCODEC_ERR_PROPERTYNOTFOUND; ++} +diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c +index 39122093a0..db3d995589 100644 +--- a/dlls/windowscodecs/tests/metadata.c ++++ b/dlls/windowscodecs/tests/metadata.c +@@ -1,6 +1,6 @@ + /* + * Copyright 2011 Vincent Povirk for CodeWeavers +- * Copyright 2012 Dmitry Timoshkov ++ * Copyright 2012,2017 Dmitry Timoshkov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -1960,10 +1960,68 @@ static void test_metadata_GIF_comment(void) + IStream_Release(stream); + } + ++static void test_WICMapGuidToShortName(void) ++{ ++ static const WCHAR unkW[] = { 'u','n','k',0 }; ++ static const WCHAR unknownW[] = { 'u','n','k','n','o','w','n',0 }; ++ HRESULT hr; ++ UINT len; ++ WCHAR name[16]; ++ ++ name[0] = 0; ++ len = 0xdeadbeef; ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 8, name, &len); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(len == 8, "got %u\n", len); ++ ok(!lstrcmpW(name, unknownW), "got %s\n", wine_dbgstr_w(name)); ++ ++ name[0] = 0; ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 8, name, NULL); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(!lstrcmpW(name, unknownW), "got %s\n", wine_dbgstr_w(name)); ++ ++ len = 0xdeadbeef; ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 8, NULL, &len); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(len == 8, "got %u\n", len); ++ ++ len = 0xdeadbeef; ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 0, NULL, &len); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(len == 8, "got %u\n", len); ++ ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 0, NULL, NULL); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 8, NULL, NULL); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ++ hr = WICMapGuidToShortName(&GUID_NULL, 0, NULL, NULL); ++ ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "got %#x\n", hr); ++ ++ name[0] = 0; ++ len = 0xdeadbeef; ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 4, name, &len); ++ ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), "got %#x\n", hr); ++ ok(len == 0xdeadbeef, "got %u\n", len); ++ ok(!lstrcmpW(name, unkW), "got %s\n", wine_dbgstr_w(name)); ++ ++ name[0] = 0; ++ len = 0xdeadbeef; ++ hr = WICMapGuidToShortName(&GUID_MetadataFormatUnknown, 0, name, &len); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ok(len == 0xdeadbeef, "got %u\n", len); ++ ok(!name[0], "got %s\n", wine_dbgstr_w(name)); ++ ++ hr = WICMapGuidToShortName(NULL, 8, name, NULL); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++} ++ + START_TEST(metadata) + { + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + ++ test_WICMapGuidToShortName(); + test_metadata_unknown(); + test_metadata_tEXt(); + test_metadata_gAMA(); +diff --git a/dlls/windowscodecs/windowscodecs.spec b/dlls/windowscodecs/windowscodecs.spec +index 2f909aafa9..1765a508a1 100644 +--- a/dlls/windowscodecs/windowscodecs.spec ++++ b/dlls/windowscodecs/windowscodecs.spec +@@ -110,7 +110,7 @@ + @ stdcall WICCreateColorContext_Proxy(ptr ptr) + @ stdcall WICCreateImagingFactory_Proxy(long ptr) + @ stub WICGetMetadataContentSize +-@ stub WICMapGuidToShortName ++@ stdcall WICMapGuidToShortName(ptr long ptr ptr) + @ stub WICMapSchemaToName + @ stub WICMapShortNameToGuid + @ stub WICMatchMetadataContent +diff --git a/include/wincodec.idl b/include/wincodec.idl +index c0248cd495..c8b5b592c0 100644 +--- a/include/wincodec.idl ++++ b/include/wincodec.idl +@@ -1006,6 +1006,8 @@ cpp_quote("HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat + cpp_quote("HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, IWICBitmap **bitmap);") + cpp_quote("HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel access, IWICBitmap **bitmap);") + ++cpp_quote("HRESULT WINAPI WICMapGuidToShortName(REFGUID,UINT,WCHAR *,UINT *);") ++ + cpp_quote("DEFINE_GUID(CLSID_WICBmpDecoder, 0x6b462062,0x7cbf,0x400d,0x9f,0xdb,0x81,0x3d,0xd1,0x0f,0x27,0x78);") + cpp_quote("DEFINE_GUID(CLSID_WICPngDecoder, 0x389ea17b,0x5078,0x4cde,0xb6,0xef,0x25,0xc1,0x51,0x75,0xc7,0x51);") + cpp_quote("DEFINE_GUID(CLSID_WICIcoDecoder, 0xc61bfcdf,0x2e0f,0x4aad,0xa8,0xd7,0xe0,0x6b,0xaf,0xeb,0xcd,0xfe);") +diff --git a/include/wincodecsdk.idl b/include/wincodecsdk.idl +index 9ce3f30ece..7c3c13fbc7 100644 +--- a/include/wincodecsdk.idl ++++ b/include/wincodecsdk.idl +@@ -50,6 +50,29 @@ cpp_quote("DEFINE_GUID(GUID_MetadataFormatLSD, 0xe256031e,0x6299,0x4929,0xb9,0x8 + cpp_quote("DEFINE_GUID(GUID_MetadataFormatGCE, 0x2a25cad8,0xdeeb,0x4c69,0xa7,0x88,0x0e,0xc2,0x26,0x6d,0xca,0xfd);") + cpp_quote("DEFINE_GUID(GUID_MetadataFormatAPE, 0x2e043dc2,0xc967,0x4e05,0x87,0x5e,0x61,0x8b,0xf6,0x7e,0x85,0xc3);") + cpp_quote("DEFINE_GUID(GUID_MetadataFormatGifComment, 0xc4b6e0e0,0xcfb4,0x4ad3,0xab,0x33,0x9a,0xad,0x23,0x55,0xa3,0x4a);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatSubIfd, 0x58a2e128,0x2db9,0x4e57,0xbb,0x14,0x51,0x77,0x89,0x1e,0xd3,0x31);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatGps, 0x7134ab8a,0x9351,0x44ad,0xaf,0x62,0x44,0x8d,0xb6,0xb5,0x02,0xec);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatInterop, 0xed686f8e,0x681f,0x4c8b,0xbd,0x41,0xa8,0xad,0xdb,0xf6,0xb3,0xfc);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatApp0, 0x79007028,0x268d,0x45d6,0xa3,0xc2,0x35,0x4e,0x6a,0x50,0x4b,0xc9);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatApp1, 0x8fd3dfc3,0xf951,0x492b,0x81,0x7f,0x69,0xc2,0xe6,0xd9,0xa5,0xb0);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatApp13, 0x326556a2,0xf502,0x4354,0x9c,0xc0,0x8e,0x3f,0x48,0xea,0xf6,0xb5);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatIPTC, 0x4fab0914,0xe129,0x4087,0xa1,0xd1,0xbc,0x81,0x2d,0x45,0xa7,0xb5);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatIRB, 0x16100d66,0x8570,0x4bb9,0xb9,0x2d,0xfd,0xa4,0xb2,0x3e,0xce,0x67);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormat8BIMIPTC, 0x0010568c,0x0852,0x4e6a,0xb1,0x91,0x5c,0x33,0xac,0x5b,0x04,0x30);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormat8BIMResolutionInfo, 0x739f305d,0x81db,0x43cb,0xac,0x5e,0x55,0x01,0x3e,0xf9,0xf0,0x03);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormat8BIMIPTCDigest, 0x1ca32285,0x9ccd,0x4786,0x8b,0xd8,0x79,0x53,0x9d,0xb6,0xa0,0x06);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatThumbnail, 0x243dcee9,0x8703,0x40ee,0x8e,0xf0,0x22,0xa6,0x0,0xb8,0x5,0x8c);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatXMPBag, 0x833cca5f,0xdcb7,0x4516,0x80,0x6f,0x65,0x96,0xab,0x26,0xdc,0xe4);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatXMPSeq, 0x63e8df02,0xeb6c,0x456c,0xa2,0x24,0xb2,0x5e,0x79,0x4f,0xd6,0x48);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatXMPAlt, 0x7b08a675,0x91aa,0x481b,0xa7,0x98,0x4d,0xa9,0x49,0x08,0x61,0x3b);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatJpegChrominance, 0xf73d0dcf,0xcec6,0x4f85,0x9b,0x0e,0x1c,0x39,0x56,0xb1,0xbe,0xf7);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatJpegLuminance, 0x86908007,0xedfc,0x4860,0x8d,0x4b,0x4e,0xe6,0xe8,0x3e,0x60,0x58);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatJpegComment, 0x220e5f33,0xafd3,0x474e,0x9d,0x31,0x7d,0x4f,0xe7,0x30,0xf5,0x57);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkbKGD, 0xe14d3571,0x6b47,0x4dea,0xb6,0xa,0x87,0xce,0xa,0x78,0xdf,0xb7);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkiTXt, 0xc2bec729,0xb68,0x4b77,0xaa,0xe,0x62,0x95,0xa6,0xac,0x18,0x14);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkhIST, 0xc59a82da,0xdb74,0x48a4,0xbd,0x6a,0xb6,0x9c,0x49,0x31,0xef,0x95);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunkiCCP, 0xeb4349ab,0xb685,0x450f,0x91,0xb5,0xe8,0x2,0xe8,0x92,0x53,0x6c);") ++cpp_quote("DEFINE_GUID(GUID_MetadataFormatChunksRGB, 0xc115fd36,0xcc6f,0x4e3f,0x83,0x63,0x52,0x4b,0x87,0xc6,0xb0,0xd9);") + + cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataReader, 0x699745c2,0x5066,0x4b82,0xa8,0xe3,0xd4,0x04,0x78,0xdb,0xec,0x8c);") + cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataWriter, 0xa09cca86,0x27ba,0x4f39,0x90,0x53,0x12,0x1f,0xa4,0xdc,0x08,0xfc);") +-- +2.12.2 + diff --git a/patches/windowscodecs-Metadata/0002-windowscodecs-Implement-WICMapShortNameToGuid.patch b/patches/windowscodecs-Metadata/0002-windowscodecs-Implement-WICMapShortNameToGuid.patch new file mode 100644 index 00000000..8b6e6f3e --- /dev/null +++ b/patches/windowscodecs-Metadata/0002-windowscodecs-Implement-WICMapShortNameToGuid.patch @@ -0,0 +1,120 @@ +From 1566ba6bda11a9c2d1f1aed638627adb76f84bdf Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Tue, 28 Mar 2017 12:24:54 +0800 +Subject: windowscodecs: Implement WICMapShortNameToGuid. + +--- + dlls/windowscodecs/metadataquery.c | 20 +++++++++++++++++++ + dlls/windowscodecs/tests/metadata.c | 36 +++++++++++++++++++++++++++++++++++ + dlls/windowscodecs/windowscodecs.spec | 2 +- + include/wincodec.idl | 1 + + 4 files changed, 58 insertions(+), 1 deletion(-) + +diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c +index e3c0d1b096..beae81d72f 100644 +--- a/dlls/windowscodecs/metadataquery.c ++++ b/dlls/windowscodecs/metadataquery.c +@@ -278,3 +278,23 @@ HRESULT WINAPI WICMapGuidToShortName(REFGUID guid, UINT len, WCHAR *name, UINT * + + return WINCODEC_ERR_PROPERTYNOTFOUND; + } ++ ++HRESULT WINAPI WICMapShortNameToGuid(const WCHAR *name, GUID *guid) ++{ ++ UINT i; ++ ++ TRACE("%s,%p\n", debugstr_w(name), guid); ++ ++ if (!name || !guid) return E_INVALIDARG; ++ ++ for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++) ++ { ++ if (!strcmpiW(name, guid2name[i].name)) ++ { ++ *guid = *guid2name[i].guid; ++ return S_OK; ++ } ++ } ++ ++ return WINCODEC_ERR_PROPERTYNOTFOUND; ++} +diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c +index db3d995589..c4cecebbb2 100644 +--- a/dlls/windowscodecs/tests/metadata.c ++++ b/dlls/windowscodecs/tests/metadata.c +@@ -2017,11 +2017,47 @@ static void test_WICMapGuidToShortName(void) + ok(hr == E_INVALIDARG, "got %#x\n", hr); + } + ++static void test_WICMapShortNameToGuid(void) ++{ ++ static const WCHAR unkW[] = { 'u','n','k',0 }; ++ static const WCHAR xmpW[] = { 'x','m','p',0 }; ++ static const WCHAR XmPW[] = { 'X','m','P',0 }; ++ static const WCHAR unknownW[] = { 'u','n','k','n','o','w','n',0 }; ++ HRESULT hr; ++ GUID guid; ++ ++ hr = WICMapShortNameToGuid(NULL, NULL); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ hr = WICMapShortNameToGuid(NULL, &guid); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ hr = WICMapShortNameToGuid(unknownW, NULL); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ hr = WICMapShortNameToGuid(unkW, &guid); ++ ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "got %#x\n", hr); ++ ++ hr = WICMapShortNameToGuid(unknownW, &guid); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(IsEqualGUID(&guid, &GUID_MetadataFormatUnknown), "got %s\n", wine_dbgstr_guid(&guid)); ++ ++ hr = WICMapShortNameToGuid(xmpW, &guid); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(IsEqualGUID(&guid, &GUID_MetadataFormatXMP), "got %s\n", wine_dbgstr_guid(&guid)); ++ ++ guid = GUID_NULL; ++ hr = WICMapShortNameToGuid(XmPW, &guid); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(IsEqualGUID(&guid, &GUID_MetadataFormatXMP), "got %s\n", wine_dbgstr_guid(&guid)); ++} ++ + START_TEST(metadata) + { + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + + test_WICMapGuidToShortName(); ++ test_WICMapShortNameToGuid(); + test_metadata_unknown(); + test_metadata_tEXt(); + test_metadata_gAMA(); +diff --git a/dlls/windowscodecs/windowscodecs.spec b/dlls/windowscodecs/windowscodecs.spec +index 1765a508a1..2fc73520d0 100644 +--- a/dlls/windowscodecs/windowscodecs.spec ++++ b/dlls/windowscodecs/windowscodecs.spec +@@ -112,7 +112,7 @@ + @ stub WICGetMetadataContentSize + @ stdcall WICMapGuidToShortName(ptr long ptr ptr) + @ stub WICMapSchemaToName +-@ stub WICMapShortNameToGuid ++@ stdcall WICMapShortNameToGuid(wstr ptr) + @ stub WICMatchMetadataContent + @ stub WICSerializeMetadataContent + @ stdcall WICSetEncoderFormat_Proxy(ptr ptr ptr ptr) +diff --git a/include/wincodec.idl b/include/wincodec.idl +index c8b5b592c0..802644bb55 100644 +--- a/include/wincodec.idl ++++ b/include/wincodec.idl +@@ -1007,6 +1007,7 @@ cpp_quote("HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, RE + cpp_quote("HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel access, IWICBitmap **bitmap);") + + cpp_quote("HRESULT WINAPI WICMapGuidToShortName(REFGUID,UINT,WCHAR *,UINT *);") ++cpp_quote("HRESULT WINAPI WICMapShortNameToGuid(const WCHAR *,GUID *);") + + cpp_quote("DEFINE_GUID(CLSID_WICBmpDecoder, 0x6b462062,0x7cbf,0x400d,0x9f,0xdb,0x81,0x3d,0xd1,0x0f,0x27,0x78);") + cpp_quote("DEFINE_GUID(CLSID_WICPngDecoder, 0x389ea17b,0x5078,0x4cde,0xb6,0xef,0x25,0xc1,0x51,0x75,0xc7,0x51);") +-- +2.12.2 + diff --git a/patches/windowscodecs-Metadata/0003-windowscodecs-Implement-WICMapSchemaToName.patch b/patches/windowscodecs-Metadata/0003-windowscodecs-Implement-WICMapSchemaToName.patch new file mode 100644 index 00000000..37d725c9 --- /dev/null +++ b/patches/windowscodecs-Metadata/0003-windowscodecs-Implement-WICMapSchemaToName.patch @@ -0,0 +1,388 @@ +From e2ec80000e92ce23a18ef0ac0b3774f10b3152e0 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Tue, 28 Mar 2017 12:57:02 +0800 +Subject: windowscodecs: Implement WICMapSchemaToName. + +--- + dlls/windowscodecs/metadataquery.c | 127 ++++++++++++++++++++++ + dlls/windowscodecs/tests/metadata.c | 196 ++++++++++++++++++++++++++++++++++ + dlls/windowscodecs/windowscodecs.spec | 2 +- + include/wincodec.idl | 1 + + 4 files changed, 325 insertions(+), 1 deletion(-) + +diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c +index beae81d72f..bf2668ea4b 100644 +--- a/dlls/windowscodecs/metadataquery.c ++++ b/dlls/windowscodecs/metadataquery.c +@@ -298,3 +298,130 @@ HRESULT WINAPI WICMapShortNameToGuid(const WCHAR *name, GUID *guid) + + return WINCODEC_ERR_PROPERTYNOTFOUND; + } ++ ++static const WCHAR rdf[] = { 'r','d','f',0 }; ++static const WCHAR rdf_scheme[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/','1','9','9','9','/','0','2','/','2','2','-','r','d','f','-','s','y','n','t','a','x','-','n','s','#',0 }; ++static const WCHAR dc[] = { 'd','c',0 }; ++static const WCHAR dc_scheme[] = { 'h','t','t','p',':','/','/','p','u','r','l','.','o','r','g','/','d','c','/','e','l','e','m','e','n','t','s','/','1','.','1','/',0 }; ++static const WCHAR xmp[] = { 'x','m','p',0 }; ++static const WCHAR xmp_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/',0 }; ++static const WCHAR xmpidq[] = { 'x','m','p','i','d','q',0 }; ++static const WCHAR xmpidq_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','I','d','e','n','t','i','f','i','e','r','/','q','u','a','l','/','1','.','0','/',0 }; ++static const WCHAR xmpRights[] = { 'x','m','p','R','i','g','h','t','s',0 }; ++static const WCHAR xmpRights_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','r','i','g','h','t','s','/',0 }; ++static const WCHAR xmpMM[] = { 'x','m','p','M','M',0 }; ++static const WCHAR xmpMM_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','m','m','/',0 }; ++static const WCHAR xmpBJ[] = { 'x','m','p','B','J',0 }; ++static const WCHAR xmpBJ_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','b','j','/',0 }; ++static const WCHAR xmpTPg[] = { 'x','m','p','T','P','g',0 }; ++static const WCHAR xmpTPg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','t','/','p','g','/',0 }; ++static const WCHAR pdf[] = { 'p','d','f',0 }; ++static const WCHAR pdf_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','d','f','/','1','.','3','/',0 }; ++static const WCHAR photoshop[] = { 'p','h','o','t','o','s','h','o','p',0 }; ++static const WCHAR photoshop_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','h','o','t','o','s','h','o','p','/','1','.','0','/',0 }; ++static const WCHAR tiff[] = { 't','i','f','f',0 }; ++static const WCHAR tiff_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','t','i','f','f','/','1','.','0','/',0 }; ++static const WCHAR exif[] = { 'e','x','i','f',0 }; ++static const WCHAR exif_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/',0 }; ++static const WCHAR stDim[] = { 's','t','D','i','m',0 }; ++static const WCHAR stDim_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','D','i','m','e','n','s','i','o','n','s','#',0 }; ++static const WCHAR xapGImg[] = { 'x','a','p','G','I','m','g',0 }; ++static const WCHAR xapGImg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','g','/','i','m','g','/',0 }; ++static const WCHAR stEvt[] = { 's','t','E','v','t',0 }; ++static const WCHAR stEvt_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','E','v','e','n','t','#',0 }; ++static const WCHAR stRef[] = { 's','t','R','e','f',0 }; ++static const WCHAR stRef_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','R','e','f','#',0 }; ++static const WCHAR stVer[] = { 's','t','V','e','r',0 }; ++static const WCHAR stVer_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','V','e','r','s','i','o','n','#',0 }; ++static const WCHAR stJob[] = { 's','t','J','o','b',0 }; ++static const WCHAR stJob_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','J','o','b','#',0 }; ++static const WCHAR aux[] = { 'a','u','x',0 }; ++static const WCHAR aux_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/','a','u','x','/',0 }; ++static const WCHAR crs[] = { 'c','r','s',0 }; ++static const WCHAR crs_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','c','a','m','e','r','a','-','r','a','w','-','s','e','t','t','i','n','g','s','/','1','.','0','/',0 }; ++static const WCHAR xmpDM[] = { 'x','m','p','D','M',0 }; ++static const WCHAR xmpDM_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','1','.','0','/','D','y','n','a','m','i','c','M','e','d','i','a','/',0 }; ++static const WCHAR Iptc4xmpCore[] = { 'I','p','t','c','4','x','m','p','C','o','r','e',0 }; ++static const WCHAR Iptc4xmpCore_scheme[] = { 'h','t','t','p',':','/','/','i','p','t','c','.','o','r','g','/','s','t','d','/','I','p','t','c','4','x','m','p','C','o','r','e','/','1','.','0','/','x','m','l','n','s','/',0 }; ++static const WCHAR MicrosoftPhoto[] = { 'M','i','c','r','o','s','o','f','t','P','h','o','t','o',0 }; ++static const WCHAR MicrosoftPhoto_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','0','/',0 }; ++static const WCHAR MP[] = { 'M','P',0 }; ++static const WCHAR MP_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/',0 }; ++static const WCHAR MPRI[] = { 'M','P','R','I',0 }; ++static const WCHAR MPRI_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','I','n','f','o','#',0 }; ++static const WCHAR MPReg[] = { 'M','P','R','e','g',0 }; ++static const WCHAR MPReg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','#',0 }; ++ ++static const struct ++{ ++ const WCHAR *name; ++ const WCHAR *schema; ++} name2schema[] = ++{ ++ { rdf, rdf_scheme }, ++ { dc, dc_scheme }, ++ { xmp, xmp_scheme }, ++ { xmpidq, xmpidq_scheme }, ++ { xmpRights, xmpRights_scheme }, ++ { xmpMM, xmpMM_scheme }, ++ { xmpBJ, xmpBJ_scheme }, ++ { xmpTPg, xmpTPg_scheme }, ++ { pdf, pdf_scheme }, ++ { photoshop, photoshop_scheme }, ++ { tiff, tiff_scheme }, ++ { exif, exif_scheme }, ++ { stDim, stDim_scheme }, ++ { xapGImg, xapGImg_scheme }, ++ { stEvt, stEvt_scheme }, ++ { stRef, stRef_scheme }, ++ { stVer, stVer_scheme }, ++ { stJob, stJob_scheme }, ++ { aux, aux_scheme }, ++ { crs, crs_scheme }, ++ { xmpDM, xmpDM_scheme }, ++ { Iptc4xmpCore, Iptc4xmpCore_scheme }, ++ { MicrosoftPhoto, MicrosoftPhoto_scheme }, ++ { MP, MP_scheme }, ++ { MPRI, MPRI_scheme }, ++ { MPReg, MPReg_scheme } ++}; ++ ++HRESULT WINAPI WICMapSchemaToName(REFGUID format, const WCHAR *schema, UINT len, WCHAR *name, UINT *ret_len) ++{ ++ UINT i; ++ ++ TRACE("%s,%s,%u,%p,%p\n", wine_dbgstr_guid(format), debugstr_w(schema), len, name, ret_len); ++ ++ if (!format || !schema || !ret_len) ++ return E_INVALIDARG; ++ ++ /* It appears that the only metadata formats ++ * that support schemas are xmp and xmpstruct. ++ */ ++ if (!IsEqualGUID(format, &GUID_MetadataFormatXMP) && ++ !IsEqualGUID(format, &GUID_MetadataFormatXMPStruct)) ++ return WINCODEC_ERR_PROPERTYNOTFOUND; ++ ++ for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++) ++ { ++ if (!strcmpW(name2schema[i].schema, schema)) ++ { ++ if (name) ++ { ++ if (!len) return E_INVALIDARG; ++ ++ len = min(len - 1, strlenW(name2schema[i].name)); ++ memcpy(name, name2schema[i].name, len * sizeof(WCHAR)); ++ name[len] = 0; ++ ++ if (len < lstrlenW(name2schema[i].name)) ++ return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); ++ } ++ ++ if (ret_len) *ret_len = strlenW(name2schema[i].name) + 1; ++ return S_OK; ++ } ++ } ++ ++ return WINCODEC_ERR_PROPERTYNOTFOUND; ++} +diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c +index c4cecebbb2..1123b9f7e3 100644 +--- a/dlls/windowscodecs/tests/metadata.c ++++ b/dlls/windowscodecs/tests/metadata.c +@@ -2052,12 +2052,208 @@ static void test_WICMapShortNameToGuid(void) + ok(IsEqualGUID(&guid, &GUID_MetadataFormatXMP), "got %s\n", wine_dbgstr_guid(&guid)); + } + ++static const GUID *guid_list[] = ++{ ++ &GUID_ContainerFormatBmp, ++ &GUID_ContainerFormatPng, ++ &GUID_ContainerFormatIco, ++ &GUID_ContainerFormatJpeg, ++ &GUID_ContainerFormatTiff, ++ &GUID_ContainerFormatGif, ++ &GUID_ContainerFormatWmp, ++ &GUID_MetadataFormatUnknown, ++ &GUID_MetadataFormatIfd, ++ &GUID_MetadataFormatSubIfd, ++ &GUID_MetadataFormatExif, ++ &GUID_MetadataFormatGps, ++ &GUID_MetadataFormatInterop, ++ &GUID_MetadataFormatApp0, ++ &GUID_MetadataFormatApp1, ++ &GUID_MetadataFormatApp13, ++ &GUID_MetadataFormatIPTC, ++ &GUID_MetadataFormatIRB, ++ &GUID_MetadataFormat8BIMIPTC, ++ &GUID_MetadataFormat8BIMResolutionInfo, ++ &GUID_MetadataFormat8BIMIPTCDigest, ++ &GUID_MetadataFormatXMP, ++ &GUID_MetadataFormatThumbnail, ++ &GUID_MetadataFormatChunktEXt, ++ &GUID_MetadataFormatXMPStruct, ++ &GUID_MetadataFormatXMPBag, ++ &GUID_MetadataFormatXMPSeq, ++ &GUID_MetadataFormatXMPAlt, ++ &GUID_MetadataFormatLSD, ++ &GUID_MetadataFormatIMD, ++ &GUID_MetadataFormatGCE, ++ &GUID_MetadataFormatAPE, ++ &GUID_MetadataFormatJpegChrominance, ++ &GUID_MetadataFormatJpegLuminance, ++ &GUID_MetadataFormatJpegComment, ++ &GUID_MetadataFormatGifComment, ++ &GUID_MetadataFormatChunkgAMA, ++ &GUID_MetadataFormatChunkbKGD, ++ &GUID_MetadataFormatChunkiTXt, ++ &GUID_MetadataFormatChunkcHRM, ++ &GUID_MetadataFormatChunkhIST, ++ &GUID_MetadataFormatChunkiCCP, ++ &GUID_MetadataFormatChunksRGB, ++ &GUID_MetadataFormatChunktIME ++}; ++ ++static WCHAR rdf_scheme[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/','1','9','9','9','/','0','2','/','2','2','-','r','d','f','-','s','y','n','t','a','x','-','n','s','#',0 }; ++static WCHAR dc_scheme[] = { 'h','t','t','p',':','/','/','p','u','r','l','.','o','r','g','/','d','c','/','e','l','e','m','e','n','t','s','/','1','.','1','/',0 }; ++static WCHAR xmp_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/',0 }; ++static WCHAR xmpidq_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','I','d','e','n','t','i','f','i','e','r','/','q','u','a','l','/','1','.','0','/',0 }; ++static WCHAR xmpRights_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','r','i','g','h','t','s','/',0 }; ++static WCHAR xmpMM_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','m','m','/',0 }; ++static WCHAR xmpBJ_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','b','j','/',0 }; ++static WCHAR xmpTPg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','t','/','p','g','/',0 }; ++static WCHAR pdf_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','d','f','/','1','.','3','/',0 }; ++static WCHAR photoshop_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','h','o','t','o','s','h','o','p','/','1','.','0','/',0 }; ++static WCHAR tiff_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','t','i','f','f','/','1','.','0','/',0 }; ++static WCHAR exif_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/',0 }; ++static WCHAR stDim_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','D','i','m','e','n','s','i','o','n','s','#',0 }; ++static WCHAR xapGImg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','g','/','i','m','g','/',0 }; ++static WCHAR stEvt_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','E','v','e','n','t','#',0 }; ++static WCHAR stRef_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','R','e','f','#',0 }; ++static WCHAR stVer_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','V','e','r','s','i','o','n','#',0 }; ++static WCHAR stJob_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','J','o','b','#',0 }; ++static WCHAR aux_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/','a','u','x','/',0 }; ++static WCHAR crs_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','c','a','m','e','r','a','-','r','a','w','-','s','e','t','t','i','n','g','s','/','1','.','0','/',0 }; ++static WCHAR xmpDM_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','1','.','0','/','D','y','n','a','m','i','c','M','e','d','i','a','/',0 }; ++static WCHAR Iptc4xmpCore_scheme[] = { 'h','t','t','p',':','/','/','i','p','t','c','.','o','r','g','/','s','t','d','/','I','p','t','c','4','x','m','p','C','o','r','e','/','1','.','0','/','x','m','l','n','s','/',0 }; ++static WCHAR MicrosoftPhoto_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','0','/',0 }; ++static WCHAR MP_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/',0 }; ++static WCHAR MPRI_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','I','n','f','o','#',0 }; ++static WCHAR MPReg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','#',0 }; ++ ++static WCHAR *schema_list[] = ++{ ++ aux_scheme, ++ rdf_scheme, ++ dc_scheme, ++ xmp_scheme, ++ xmpidq_scheme, ++ xmpRights_scheme, ++ xmpMM_scheme, ++ xmpBJ_scheme, ++ xmpTPg_scheme, ++ pdf_scheme, ++ photoshop_scheme, ++ tiff_scheme, ++ exif_scheme, ++ stDim_scheme, ++ xapGImg_scheme, ++ stEvt_scheme, ++ stRef_scheme, ++ stVer_scheme, ++ stJob_scheme, ++ crs_scheme, ++ xmpDM_scheme, ++ Iptc4xmpCore_scheme, ++ MicrosoftPhoto_scheme, ++ MP_scheme, ++ MPRI_scheme, ++ MPReg_scheme ++}; ++ ++static void test_WICMapSchemaToName(void) ++{ ++ static const WCHAR xmW[] = { 'x','m',0 }; ++ static const WCHAR xmpW[] = { 'x','m','p',0 }; ++ static WCHAR schemaW[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/',0 }; ++ static WCHAR SCHEMAW[] = { 'H','T','T','P',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/',0 }; ++ HRESULT hr; ++ UINT len, i, j; ++ WCHAR name[16]; ++ ++ hr = WICMapSchemaToName(&GUID_MetadataFormatUnknown, NULL, 0, NULL, NULL); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ hr = WICMapSchemaToName(&GUID_MetadataFormatUnknown, schemaW, 0, NULL, NULL); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ hr = WICMapSchemaToName(&GUID_MetadataFormatUnknown, schemaW, 0, NULL, &len); ++ ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "got %#x\n", hr); ++ ++ hr = WICMapSchemaToName(NULL, schemaW, 0, NULL, &len); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schemaW, 0, NULL, NULL); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ len = 0xdeadbeef; ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schemaW, 0, NULL, &len); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(len == 4, "got %u\n", len); ++ ++ len = 0xdeadbeef; ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schemaW, 4, NULL, &len); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(len == 4, "got %u\n", len); ++ ++ len = 0xdeadbeef; ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, SCHEMAW, 0, NULL, &len); ++ ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "got %#x\n", hr); ++ ok(len == 0xdeadbeef, "got %u\n", len); ++ ++ name[0] = 0; ++ len = 0xdeadbeef; ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schemaW, 4, name, &len); ++ ok(hr == S_OK, "got %#x\n", hr); ++ ok(len == 4, "got %u\n", len); ++ ok(!lstrcmpW(name, xmpW), "got %s\n", wine_dbgstr_w(name)); ++ ++ len = 0xdeadbeef; ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schemaW, 0, name, &len); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ok(len == 0xdeadbeef, "got %u\n", len); ++ ++ name[0] = 0; ++ len = 0xdeadbeef; ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schemaW, 3, name, &len); ++ ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), "got %#x\n", hr); ++ ok(len == 0xdeadbeef, "got %u\n", len); ++ ok(!lstrcmpW(name, xmW), "got %s\n", wine_dbgstr_w(name)); ++ ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schemaW, 4, name, NULL); ++ ok(hr == E_INVALIDARG, "got %#x\n", hr); ++ ++ /* Check whether modern schemas are supported */ ++ hr = WICMapSchemaToName(&GUID_MetadataFormatXMP, schema_list[0], 0, NULL, &len); ++ if (hr == WINCODEC_ERR_PROPERTYNOTFOUND) ++ { ++ win_skip("Modern schemas are not supported\n"); ++ return; ++ } ++ ++ for (i = 0; i < sizeof(guid_list)/sizeof(guid_list[0]); i++) ++ { ++ for (j = 0; j < sizeof(schema_list)/sizeof(schema_list[0]); j++) ++ { ++ hr = WICMapSchemaToName(guid_list[i], schema_list[j], 0, NULL, &len); ++ if (IsEqualGUID(guid_list[i], &GUID_MetadataFormatXMP) || ++ IsEqualGUID(guid_list[i], &GUID_MetadataFormatXMPStruct)) ++ { ++ ok(hr == S_OK, "%u: %u: format %s does not support schema %s\n", ++ i, j, wine_dbgstr_guid(guid_list[i]), wine_dbgstr_w(schema_list[j])); ++ } ++ else ++ { ++ ok(hr == WINCODEC_ERR_PROPERTYNOTFOUND, "%u: %u: format %s supports schema %s\n", ++ i, j, wine_dbgstr_guid(guid_list[i]), wine_dbgstr_w(schema_list[j])); ++ } ++ } ++ } ++} ++ + START_TEST(metadata) + { + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + + test_WICMapGuidToShortName(); + test_WICMapShortNameToGuid(); ++ test_WICMapSchemaToName(); + test_metadata_unknown(); + test_metadata_tEXt(); + test_metadata_gAMA(); +diff --git a/dlls/windowscodecs/windowscodecs.spec b/dlls/windowscodecs/windowscodecs.spec +index 2fc73520d0..905ef835af 100644 +--- a/dlls/windowscodecs/windowscodecs.spec ++++ b/dlls/windowscodecs/windowscodecs.spec +@@ -111,7 +111,7 @@ + @ stdcall WICCreateImagingFactory_Proxy(long ptr) + @ stub WICGetMetadataContentSize + @ stdcall WICMapGuidToShortName(ptr long ptr ptr) +-@ stub WICMapSchemaToName ++@ stdcall WICMapSchemaToName(ptr wstr long ptr ptr) + @ stdcall WICMapShortNameToGuid(wstr ptr) + @ stub WICMatchMetadataContent + @ stub WICSerializeMetadataContent +diff --git a/include/wincodec.idl b/include/wincodec.idl +index 802644bb55..671eeafe91 100644 +--- a/include/wincodec.idl ++++ b/include/wincodec.idl +@@ -1008,6 +1008,7 @@ cpp_quote("HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, + + cpp_quote("HRESULT WINAPI WICMapGuidToShortName(REFGUID,UINT,WCHAR *,UINT *);") + cpp_quote("HRESULT WINAPI WICMapShortNameToGuid(const WCHAR *,GUID *);") ++cpp_quote("HRESULT WINAPI WICMapSchemaToName(REFGUID,const WCHAR *,UINT,WCHAR *,UINT *);") + + cpp_quote("DEFINE_GUID(CLSID_WICBmpDecoder, 0x6b462062,0x7cbf,0x400d,0x9f,0xdb,0x81,0x3d,0xd1,0x0f,0x27,0x78);") + cpp_quote("DEFINE_GUID(CLSID_WICPngDecoder, 0x389ea17b,0x5078,0x4cde,0xb6,0xef,0x25,0xc1,0x51,0x75,0xc7,0x51);") +-- +2.12.2 + diff --git a/patches/windowscodecs-Metadata/0004-windowscodecs-Implement-IWICMetadataQueryReader-GetC.patch b/patches/windowscodecs-Metadata/0004-windowscodecs-Implement-IWICMetadataQueryReader-GetC.patch new file mode 100644 index 00000000..aa6337c5 --- /dev/null +++ b/patches/windowscodecs-Metadata/0004-windowscodecs-Implement-IWICMetadataQueryReader-GetC.patch @@ -0,0 +1,34 @@ +From a713a9bc504a7c87cf003caff225fd1dd035e6aa Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Tue, 28 Mar 2017 13:31:34 +0800 +Subject: windowscodecs: Implement IWICMetadataQueryReader::GetContainerFormat. + +--- + dlls/windowscodecs/metadataquery.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c +index bf2668ea4b..f84d595851 100644 +--- a/dlls/windowscodecs/metadataquery.c ++++ b/dlls/windowscodecs/metadataquery.c +@@ -90,12 +90,13 @@ static ULONG WINAPI mqr_Release(IWICMetadataQueryReader *iface) + return ref; + } + +-static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface, +- GUID *pguidContainerFormat) ++static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface, GUID *format) + { + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); +- FIXME("(%p,%p)\n", This, pguidContainerFormat); +- return E_NOTIMPL; ++ ++ TRACE("(%p,%p)\n", This, format); ++ ++ return IWICMetadataBlockReader_GetContainerFormat(This->block, format); + } + + static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface, +-- +2.12.2 + diff --git a/patches/windowscodecs-Metadata/0005-include-Fix-typos-in-WICPersistOptions-enumeration-n.patch b/patches/windowscodecs-Metadata/0005-include-Fix-typos-in-WICPersistOptions-enumeration-n.patch new file mode 100644 index 00000000..be2e3b94 --- /dev/null +++ b/patches/windowscodecs-Metadata/0005-include-Fix-typos-in-WICPersistOptions-enumeration-n.patch @@ -0,0 +1,248 @@ +From e9cd0d95e6c21d304f67035b7aa5113021f2aeb1 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Tue, 28 Mar 2017 14:29:55 +0800 +Subject: include: Fix typos in WICPersistOptions enumeration names. + +--- + dlls/windowscodecs/gifformat.c | 4 ++-- + dlls/windowscodecs/imgfactory.c | 4 ++-- + dlls/windowscodecs/metadatahandler.c | 6 +++--- + dlls/windowscodecs/tests/converter.c | 4 ++-- + dlls/windowscodecs/tests/metadata.c | 28 ++++++++++++++-------------- + dlls/windowscodecs/tiffformat.c | 6 +++--- + include/wincodecsdk.idl | 12 ++++++------ + 7 files changed, 32 insertions(+), 32 deletions(-) + +diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c +index efeddb00bb..7537eaca07 100644 +--- a/dlls/windowscodecs/gifformat.c ++++ b/dlls/windowscodecs/gifformat.c +@@ -566,7 +566,7 @@ static HRESULT create_metadata_reader(const void *data, int data_size, + } + + stream = create_stream(data, data_size); +- IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionsDefault); ++ IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionDefault); + IStream_Release(stream); + + IWICPersistStream_Release(persist); +@@ -936,7 +936,7 @@ static HRESULT create_IMD_metadata_reader(GifFrameDecode *This, IWICMetadataRead + } + + stream = create_stream(&IMD_data, sizeof(IMD_data)); +- IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionsDefault); ++ IWICPersistStream_LoadEx(persist, stream, NULL, WICPersistOptionDefault); + IStream_Release(stream); + + IWICPersistStream_Release(persist); +diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c +index 0ff4c123ee..c28c4a8d28 100644 +--- a/dlls/windowscodecs/imgfactory.c ++++ b/dlls/windowscodecs/imgfactory.c +@@ -1044,7 +1044,7 @@ start: + if (SUCCEEDED(hr)) + { + hr = IWICPersistStream_LoadEx(wicpersiststream, +- stream, vendor, options & WICPersistOptionsMask); ++ stream, vendor, options & WICPersistOptionMask); + + IWICPersistStream_Release(wicpersiststream); + } +@@ -1088,7 +1088,7 @@ start: + + if (SUCCEEDED(hr)) + { +- hr = IWICPersistStream_LoadEx(wicpersiststream, stream, NULL, options & WICPersistOptionsMask); ++ hr = IWICPersistStream_LoadEx(wicpersiststream, stream, NULL, options & WICPersistOptionMask); + + IWICPersistStream_Release(wicpersiststream); + } +diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c +index d0663066c9..e394064f2a 100644 +--- a/dlls/windowscodecs/metadatahandler.c ++++ b/dlls/windowscodecs/metadatahandler.c +@@ -390,7 +390,7 @@ static HRESULT WINAPI MetadataHandler_Load(IWICPersistStream *iface, + { + MetadataHandler *This = impl_from_IWICPersistStream(iface); + TRACE("(%p,%p)\n", iface, pStm); +- return IWICPersistStream_LoadEx(&This->IWICPersistStream_iface, pStm, NULL, WICPersistOptionsDefault); ++ return IWICPersistStream_LoadEx(&This->IWICPersistStream_iface, pStm, NULL, WICPersistOptionDefault); + } + + static HRESULT WINAPI MetadataHandler_Save(IWICPersistStream *iface, +@@ -1059,9 +1059,9 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor, + TRACE("\n"); + + #ifdef WORDS_BIGENDIAN +- if (persist_options & WICPersistOptionsLittleEndian) ++ if (persist_options & WICPersistOptionLittleEndian) + #else +- if (persist_options & WICPersistOptionsBigEndian) ++ if (persist_options & WICPersistOptionBigEndian) + #endif + native_byte_order = FALSE; + +diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c +index 17724d9ed0..357f9ef642 100644 +--- a/dlls/windowscodecs/tests/converter.c ++++ b/dlls/windowscodecs/tests/converter.c +@@ -776,9 +776,9 @@ static void load_stream(IUnknown *reader, IStream *stream) + HRESULT hr; + IWICPersistStream *persist; + #ifdef WORDS_BIGENDIAN +- DWORD persist_options = WICPersistOptionsBigEndian; ++ DWORD persist_options = WICPersistOptionBigEndian; + #else +- DWORD persist_options = WICPersistOptionsLittleEndian; ++ DWORD persist_options = WICPersistOptionLittleEndian; + #endif + + hr = IUnknown_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist); +diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c +index 1123b9f7e3..ad5bcf7b98 100644 +--- a/dlls/windowscodecs/tests/metadata.c ++++ b/dlls/windowscodecs/tests/metadata.c +@@ -262,7 +262,7 @@ static void test_metadata_unknown(void) + ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr); + if (FAILED(hr)) return; + +- load_stream((IUnknown*)reader, metadata_unknown, sizeof(metadata_unknown), WICPersistOptionsDefault); ++ load_stream((IUnknown*)reader, metadata_unknown, sizeof(metadata_unknown), WICPersistOptionDefault); + + hr = IWICMetadataReader_GetEnumerator(reader, &enumerator); + ok(hr == S_OK, "GetEnumerator failed, hr=%x\n", hr); +@@ -329,7 +329,7 @@ static void test_metadata_tEXt(void) + ok(hr == S_OK, "GetCount failed, hr=%x\n", hr); + ok(count == 0, "unexpected count %i\n", count); + +- load_stream((IUnknown*)reader, metadata_tEXt, sizeof(metadata_tEXt), WICPersistOptionsDefault); ++ load_stream((IUnknown*)reader, metadata_tEXt, sizeof(metadata_tEXt), WICPersistOptionDefault); + + hr = IWICMetadataReader_GetCount(reader, &count); + ok(hr == S_OK, "GetCount failed, hr=%x\n", hr); +@@ -440,7 +440,7 @@ static void test_metadata_gAMA(void) + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /*winxp*/, "CoCreateInstance failed, hr=%x\n", hr); + if (FAILED(hr)) return; + +- load_stream((IUnknown*)reader, metadata_gAMA, sizeof(metadata_gAMA), WICPersistOptionsDefault); ++ load_stream((IUnknown*)reader, metadata_gAMA, sizeof(metadata_gAMA), WICPersistOptionDefault); + + hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%x\n", hr); +@@ -498,7 +498,7 @@ static void test_metadata_cHRM(void) + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /*winxp*/, "CoCreateInstance failed, hr=%x\n", hr); + if (FAILED(hr)) return; + +- load_stream((IUnknown*)reader, metadata_cHRM, sizeof(metadata_cHRM), WICPersistOptionsDefault); ++ load_stream((IUnknown*)reader, metadata_cHRM, sizeof(metadata_cHRM), WICPersistOptionDefault); + + hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%x\n", hr); +@@ -792,9 +792,9 @@ static void test_metadata_IFD(void) + GUID format; + char *IFD_data_swapped; + #ifdef WORDS_BIGENDIAN +- DWORD persist_options = WICPersistOptionsBigEndian; ++ DWORD persist_options = WICPersistOptionBigEndian; + #else +- DWORD persist_options = WICPersistOptionsLittleEndian; ++ DWORD persist_options = WICPersistOptionLittleEndian; + #endif + + hr = CoCreateInstance(&CLSID_WICIfdMetadataReader, NULL, CLSCTX_INPROC_SERVER, +@@ -817,10 +817,10 @@ static void test_metadata_IFD(void) + compare_metadata(reader, td, count); + + /* test IFD data with different endianness */ +- if (persist_options == WICPersistOptionsLittleEndian) +- persist_options = WICPersistOptionsBigEndian; ++ if (persist_options == WICPersistOptionLittleEndian) ++ persist_options = WICPersistOptionBigEndian; + else +- persist_options = WICPersistOptionsLittleEndian; ++ persist_options = WICPersistOptionLittleEndian; + + IFD_data_swapped = HeapAlloc(GetProcessHeap(), 0, sizeof(IFD_data)); + memcpy(IFD_data_swapped, &IFD_data, sizeof(IFD_data)); +@@ -964,22 +964,22 @@ static void test_create_reader(void) + stream = create_stream(metadata_tEXt, sizeof(metadata_tEXt)); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, +- NULL, NULL, WICPersistOptionsDefault, ++ NULL, NULL, WICPersistOptionDefault, + stream, &reader); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, +- &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, ++ &GUID_ContainerFormatPng, NULL, WICPersistOptionDefault, + NULL, &reader); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, +- &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, ++ &GUID_ContainerFormatPng, NULL, WICPersistOptionDefault, + stream, NULL); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, +- &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, ++ &GUID_ContainerFormatPng, NULL, WICPersistOptionDefault, + stream, &reader); + ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + +@@ -997,7 +997,7 @@ static void test_create_reader(void) + } + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, +- &GUID_ContainerFormatWmp, NULL, WICPersistOptionsDefault, ++ &GUID_ContainerFormatWmp, NULL, WICPersistOptionDefault, + stream, &reader); + ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + +diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c +index c8f16f2112..5bc08e42e5 100644 +--- a/dlls/windowscodecs/tiffformat.c ++++ b/dlls/windowscodecs/tiffformat.c +@@ -1517,11 +1517,11 @@ static HRESULT create_metadata_reader(TiffFrameDecode *This, IWICMetadataReader + { + BOOL byte_swapped = pTIFFIsByteSwapped(This->parent->tiff); + #ifdef WORDS_BIGENDIAN +- DWORD persist_options = byte_swapped ? WICPersistOptionsLittleEndian : WICPersistOptionsBigEndian; ++ DWORD persist_options = byte_swapped ? WICPersistOptionLittleEndian : WICPersistOptionBigEndian; + #else +- DWORD persist_options = byte_swapped ? WICPersistOptionsBigEndian : WICPersistOptionsLittleEndian; ++ DWORD persist_options = byte_swapped ? WICPersistOptionBigEndian : WICPersistOptionLittleEndian; + #endif +- persist_options |= WICPersistOptionsNoCacheStream; ++ persist_options |= WICPersistOptionNoCacheStream; + hr = IWICPersistStream_LoadEx(persist, This->parent->stream, NULL, persist_options); + if (FAILED(hr)) + ERR("IWICPersistStream_LoadEx error %#x\n", hr); +diff --git a/include/wincodecsdk.idl b/include/wincodecsdk.idl +index 7c3c13fbc7..75492774f3 100644 +--- a/include/wincodecsdk.idl ++++ b/include/wincodecsdk.idl +@@ -20,13 +20,13 @@ import "wtypes.idl"; + import "wincodec.idl"; + + typedef enum WICPersistOptions { +- WICPersistOptionsDefault = 0x00000000, +- WICPersistOptionsLittleEndian = 0x00000000, +- WICPersistOptionsBigEndian = 0x00000001, +- WICPersistOptionsStrictFormat = 0x00000002, +- WICPersistOptionsNoCacheStream = 0x00000004, ++ WICPersistOptionDefault = 0x00000000, ++ WICPersistOptionLittleEndian = 0x00000000, ++ WICPersistOptionBigEndian = 0x00000001, ++ WICPersistOptionStrictFormat = 0x00000002, ++ WICPersistOptionNoCacheStream = 0x00000004, + WICPersistOptionPreferUTF8 = 0x00000008, +- WICPersistOptionsMask = 0x0000FFFF ++ WICPersistOptionMask = 0x0000FFFF + } WICPersistOptions; + + typedef enum WICMetadataCreationOptions { +-- +2.12.2 + diff --git a/patches/windowscodecs-Metadata/0006-windowscodecs-Simplify-a-bit-comparison-of-two-PROPV.patch b/patches/windowscodecs-Metadata/0006-windowscodecs-Simplify-a-bit-comparison-of-two-PROPV.patch new file mode 100644 index 00000000..e7dd9414 --- /dev/null +++ b/patches/windowscodecs-Metadata/0006-windowscodecs-Simplify-a-bit-comparison-of-two-PROPV.patch @@ -0,0 +1,92 @@ +From f0087cfcdb93cfbed95dea8c700726be687a2a8f Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Tue, 28 Mar 2017 14:43:39 +0800 +Subject: windowscodecs: Simplify a bit comparison of two PROPVARIANTs. + +--- + dlls/windowscodecs/Makefile.in | 2 +- + dlls/windowscodecs/metadatahandler.c | 42 +++--------------------------------- + 2 files changed, 4 insertions(+), 40 deletions(-) + +diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in +index 78e2059132..3505e804ca 100644 +--- a/dlls/windowscodecs/Makefile.in ++++ b/dlls/windowscodecs/Makefile.in +@@ -1,6 +1,6 @@ + MODULE = windowscodecs.dll + IMPORTLIB = windowscodecs +-IMPORTS = uuid ole32 oleaut32 rpcrt4 shlwapi user32 gdi32 advapi32 ++IMPORTS = uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32 + EXTRAINCL = $(JPEG_CFLAGS) $(PNG_CFLAGS) $(TIFF_CFLAGS) + EXTRALIBS = $(APPLICATIONSERVICES_LIBS) + +diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c +index e394064f2a..2f67807354 100644 +--- a/dlls/windowscodecs/metadatahandler.c ++++ b/dlls/windowscodecs/metadatahandler.c +@@ -29,6 +29,7 @@ + #include "winbase.h" + #include "winternl.h" + #include "objbase.h" ++#include "propvarutil.h" + + #include "wincodecs_private.h" + +@@ -211,43 +212,6 @@ static HRESULT WINAPI MetadataHandler_GetValueByIndex(IWICMetadataWriter *iface, + return hr; + } + +-static BOOL get_int_value(const PROPVARIANT *pv, LONGLONG *value) +-{ +- switch (pv->vt) +- { +- case VT_NULL: +- case VT_EMPTY: +- *value = 0; +- break; +- case VT_I1: +- *value = pv->u.cVal; +- break; +- case VT_UI1: +- *value = pv->u.bVal; +- break; +- case VT_I2: +- *value = pv->u.iVal; +- break; +- case VT_UI2: +- *value = pv->u.uiVal; +- break; +- case VT_I4: +- *value = pv->u.lVal; +- break; +- case VT_UI4: +- *value = pv->u.ulVal; +- break; +- case VT_I8: +- case VT_UI8: +- *value = pv->u.hVal.QuadPart; +- break; +- default: +- FIXME("not supported variant type %d\n", pv->vt); +- return FALSE; +- } +- return TRUE; +-} +- + /* FiXME: Use propsys.PropVariantCompareEx once it's implemented */ + static int propvar_cmp(const PROPVARIANT *v1, const PROPVARIANT *v2) + { +@@ -263,8 +227,8 @@ static int propvar_cmp(const PROPVARIANT *v1, const PROPVARIANT *v2) + return lstrcmpiW(v1->u.pwszVal, v2->u.pwszVal); + } + +- if (!get_int_value(v1, &value1)) return -1; +- if (!get_int_value(v2, &value2)) return -1; ++ if (PropVariantToInt64(v1, &value1) != S_OK) return -1; ++ if (PropVariantToInt64(v2, &value2) != S_OK) return -1; + + value1 -= value2; + if (value1) return value1 < 0 ? -1 : 1; +-- +2.12.2 + diff --git a/patches/windowscodecs-Metadata/definition b/patches/windowscodecs-Metadata/definition new file mode 100644 index 00000000..d0261fe1 --- /dev/null +++ b/patches/windowscodecs-Metadata/definition @@ -0,0 +1,3 @@ +Fixes: Implement some additional windowscodecs metadata functions +Depends: windowscodecs-TIFF_Support +Depends: windowscodecs-WICCreateBitmapFromSection