diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index 11db5cb978b..45ff717d98f 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -1486,6 +1486,78 @@ static void test_metadata_GCE(void) IStream_Release(stream); } +static void test_metadata_APE(void) +{ + static const WCHAR APE_name[] = {'A','p','p','l','i','c','a','t','i','o','n',' ','E','x','t','e','n','s','i','o','n',' ','R','e','a','d','e','r',0}; + static const char APE_data[] = { 0x21,0xff,0x0b,'H','e','l','l','o',' ','W','o','r','l','d', + /*sub-block*/1,0x11, + /*sub-block*/2,0x22,0x33, + /*sub-block*/4,0x44,0x55,0x66,0x77, + /*terminator*/0 }; + static const struct test_data td[2] = + { + { VT_UI1|VT_VECTOR, 0, 11, { 'H','e','l','l','o',' ','W','o','r','l','d' }, NULL, { 'A','p','p','l','i','c','a','t','i','o','n',0 } }, + { VT_UI1|VT_VECTOR, 0, 10, { 1,0x11,2,0x22,0x33,4,0x44,0x55,0x66,0x77 }, NULL, { 'D','a','t','a',0 } } + }; + HRESULT hr; + IStream *stream; + IWICPersistStream *persist; + IWICMetadataReader *reader; + IWICMetadataHandlerInfo *info; + WCHAR name[64]; + UINT count, dummy; + GUID format; + CLSID id; + + hr = CoCreateInstance(&CLSID_WICAPEMetadataReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICMetadataReader, (void **)&reader); +todo_wine + ok(hr == S_OK || broken(hr == E_NOINTERFACE || hr == REGDB_E_CLASSNOTREG) /* before Win7 */, + "CoCreateInstance error %#x\n", hr); + + stream = create_stream(APE_data, sizeof(APE_data)); + + if (SUCCEEDED(hr)) + { + hr = IUnknown_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + hr = IWICPersistStream_Load(persist, stream); + ok(hr == S_OK, "Load error %#x\n", hr); + + IWICPersistStream_Release(persist); + } + + if (SUCCEEDED(hr)) + { + hr = IWICMetadataReader_GetCount(reader, &count); + ok(hr == S_OK, "GetCount error %#x\n", hr); + ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count); + + compare_metadata(reader, td, count); + + hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat error %#x\n", hr); + ok(IsEqualGUID(&format, &GUID_MetadataFormatAPE), "wrong format %s\n", debugstr_guid(&format)); + + hr = IWICMetadataReader_GetMetadataHandlerInfo(reader, &info); + ok(hr == S_OK, "GetMetadataHandlerInfo error %#x\n", hr); + + hr = IWICMetadataHandlerInfo_GetCLSID(info, &id); + ok(hr == S_OK, "GetCLSID error %#x\n", hr); + ok(IsEqualGUID(&id, &CLSID_WICAPEMetadataReader), "wrong CLSID %s\n", debugstr_guid(&id)); + + hr = IWICMetadataHandlerInfo_GetFriendlyName(info, 64, name, &dummy); + ok(hr == S_OK, "GetFriendlyName error %#x\n", hr); + ok(lstrcmpW(name, APE_name) == 0, "wrong APE reader name %s\n", wine_dbgstr_w(name)); + + IWICMetadataHandlerInfo_Release(info); + IWICMetadataReader_Release(reader); + } + + IStream_Release(stream); +} + START_TEST(metadata) { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); @@ -1500,6 +1572,7 @@ START_TEST(metadata) test_metadata_LSD(); test_metadata_IMD(); test_metadata_GCE(); + test_metadata_APE(); CoUninitialize(); } diff --git a/include/wincodecsdk.idl b/include/wincodecsdk.idl index 2a5b389c631..31333c5cc12 100644 --- a/include/wincodecsdk.idl +++ b/include/wincodecsdk.idl @@ -46,6 +46,7 @@ cpp_quote("DEFINE_GUID(GUID_MetadataFormatXMPStruct, 0x22383cf1,0xed17,0x4e2e,0x cpp_quote("DEFINE_GUID(GUID_MetadataFormatIMD, 0xbd2bb086,0x4d52,0x48dd,0x96,0x77,0xdb,0x48,0x3e,0x85,0xae,0x8f);") cpp_quote("DEFINE_GUID(GUID_MetadataFormatLSD, 0xe256031e,0x6299,0x4929,0xb9,0x8d,0x5a,0xc8,0x84,0xaf,0xba,0x92);") 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(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);") @@ -63,6 +64,8 @@ cpp_quote("DEFINE_GUID(CLSID_WICIMDMetadataReader, 0x7447a267,0x0015,0x42c8,0xa8 cpp_quote("DEFINE_GUID(CLSID_WICIMDMetadataWriter, 0x8c89071f,0x452e,0x4e95,0x96,0x82,0x9d,0x10,0x24,0x62,0x71,0x72);") cpp_quote("DEFINE_GUID(CLSID_WICGCEMetadataReader, 0xb92e345d,0xf52d,0x41f3,0xb5,0x62,0x08,0x1b,0xc7,0x72,0xe3,0xb9);") cpp_quote("DEFINE_GUID(CLSID_WICGCEMetadataWriter, 0xaf95dc76,0x16b2,0x47f4,0xb3,0xea,0x3c,0x31,0x79,0x66,0x93,0xe7);") +cpp_quote("DEFINE_GUID(CLSID_WICAPEMetadataReader, 0x1767b93a,0xb021,0x44ea,0x92,0x0f,0x86,0x3c,0x11,0xf4,0xf7,0x68);") +cpp_quote("DEFINE_GUID(CLSID_WICAPEMetadataWriter, 0xbd6edfca,0x2890,0x482f,0xb2,0x33,0x8d,0x73,0x39,0xa1,0xcf,0x8d);") typedef struct WICMetadataPattern { ULARGE_INTEGER Position;