windowscodecs: Implement WICMapShortNameToGuid.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2017-06-20 12:37:15 +08:00 committed by Alexandre Julliard
parent 37ae4f24c0
commit e1eed88401
4 changed files with 58 additions and 1 deletions

View File

@ -277,3 +277,23 @@ HRESULT WINAPI WICMapGuidToShortName(REFGUID guid, UINT len, WCHAR *name, UINT *
return WINCODEC_ERR_PROPERTYNOTFOUND;
}
HRESULT WINAPI WICMapShortNameToGuid(PCWSTR 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 (!lstrcmpiW(name, guid2name[i].name))
{
*guid = *guid2name[i].guid;
return S_OK;
}
}
return WINCODEC_ERR_PROPERTYNOTFOUND;
}

View File

@ -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();

View File

@ -111,7 +111,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)

View File

@ -1052,6 +1052,7 @@ interface IWICEnumMetadataItem : IUnknown
cpp_quote("HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst);")
cpp_quote("HRESULT WINAPI WICMapGuidToShortName(REFGUID,UINT,WCHAR *,UINT *);")
cpp_quote("HRESULT WINAPI WICMapShortNameToGuid(PCWSTR,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);")