windowscodecs: Add WICImagingCategories registration.

This commit is contained in:
Dmitry Timoshkov 2012-06-22 15:12:54 +09:00 committed by Alexandre Julliard
parent fc413c70a5
commit 40185b6c6e
2 changed files with 103 additions and 0 deletions

View File

@ -1788,6 +1788,104 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
{ NULL } /* list terminator */
};
struct regsvr_category
{
const CLSID *clsid; /* NULL for end of list */
};
static const struct regsvr_category category_list[] = {
{ &CATID_WICBitmapDecoders },
{ &CATID_WICBitmapEncoders },
{ &CATID_WICFormatConverters },
{ &CATID_WICMetadataReader },
{ &CATID_WICPixelFormats },
{ NULL }
};
static HRESULT register_categories(const struct regsvr_category *list)
{
LONG res;
WCHAR buf[39];
HKEY coclass_key, categories_key, instance_key;
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
StringFromGUID2(&CLSID_WICImagingCategories, buf, 39);
res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &categories_key, NULL);
if (res != ERROR_SUCCESS)
{
RegCloseKey(coclass_key);
return HRESULT_FROM_WIN32(res);
}
res = RegCreateKeyExW(categories_key, instance_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &instance_key, NULL);
for (; res == ERROR_SUCCESS && list->clsid; list++)
{
HKEY instance_clsid_key;
StringFromGUID2(list->clsid, buf, 39);
res = RegCreateKeyExW(instance_key, buf, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL);
if (res == ERROR_SUCCESS)
{
res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ,
(const BYTE *)buf, 78);
RegCloseKey(instance_clsid_key);
}
}
RegCloseKey(instance_key);
RegCloseKey(categories_key);
RegCloseKey(coclass_key);
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
static HRESULT unregister_categories(const struct regsvr_category *list)
{
LONG res;
WCHAR buf[39];
HKEY coclass_key, categories_key, instance_key;
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
KEY_READ | KEY_WRITE, &coclass_key);
if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
StringFromGUID2(&CLSID_WICImagingCategories, buf, 39);
res = RegOpenKeyExW(coclass_key, buf, 0,
KEY_READ | KEY_WRITE, &categories_key);
if (res != ERROR_SUCCESS)
{
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
RegCloseKey(coclass_key);
return HRESULT_FROM_WIN32(res);
}
res = RegOpenKeyExW(categories_key, instance_keyname, 0,
KEY_READ | KEY_WRITE, &instance_key);
for (; res == ERROR_SUCCESS && list->clsid; list++)
{
StringFromGUID2(list->clsid, buf, 39);
res = RegDeleteTreeW(instance_key, buf);
}
RegCloseKey(instance_key);
RegCloseKey(categories_key);
StringFromGUID2(&CLSID_WICImagingCategories, buf, 39);
res = RegDeleteTreeW(coclass_key, buf);
RegCloseKey(coclass_key);
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
extern HRESULT WINAPI WIC_DllRegisterServer(void) DECLSPEC_HIDDEN;
extern HRESULT WINAPI WIC_DllUnregisterServer(void) DECLSPEC_HIDDEN;
@ -1798,6 +1896,8 @@ HRESULT WINAPI DllRegisterServer(void)
TRACE("\n");
hr = WIC_DllRegisterServer();
if (SUCCEEDED(hr))
hr = register_categories(category_list);
if (SUCCEEDED(hr))
hr = register_decoders(decoder_list);
if (SUCCEEDED(hr))
@ -1818,6 +1918,8 @@ HRESULT WINAPI DllUnregisterServer(void)
TRACE("\n");
hr = WIC_DllUnregisterServer();
if (SUCCEEDED(hr))
hr = unregister_categories(category_list);
if (SUCCEEDED(hr))
hr = unregister_decoders(decoder_list);
if (SUCCEEDED(hr))

View File

@ -1001,6 +1001,7 @@ cpp_quote("DEFINE_GUID(GUID_ContainerFormatWmp, 0x57a37caa,0x367a,0x4540,0x91,0x
cpp_quote("DEFINE_GUID(GUID_VendorMicrosoft, 0xf0e749ca,0xedef,0x4589,0xa7,0x3a,0xee,0x0e,0x62,0x6a,0x2a,0x2b);")
cpp_quote("DEFINE_GUID(CLSID_WICImagingCategories, 0xfae3d380,0xfea4,0x4623,0x8c,0x75,0xc6,0xb6,0x11,0x10,0xb6,0x81);")
cpp_quote("DEFINE_GUID(CATID_WICBitmapDecoders, 0x7ed96837,0x96f0,0x4812,0xb2,0x11,0xf1,0x3c,0x24,0x11,0x7e,0xd3);")
cpp_quote("DEFINE_GUID(CATID_WICBitmapEncoders, 0xac757296,0x3522,0x4e11,0x98,0x62,0xc1,0x7b,0xe5,0xa1,0x76,0x7e);")
cpp_quote("DEFINE_GUID(CATID_WICFormatConverters, 0x7835eae8,0xbf14,0x49d1,0x93,0xce,0x53,0x3a,0x40,0x7b,0x22,0x48);")