Commit e1eed884 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

windowscodecs: Implement WICMapShortNameToGuid.

parent 37ae4f24
......@@ -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;
}
......@@ -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();
......
......@@ -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)
......@@ -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);")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment