quartz: Convert media type registration to IRegistrar mechanism.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6e3f39a4c5
commit
b743cfe4fb
|
@ -24,7 +24,7 @@ C_SRCS = \
|
|||
vmr9.c \
|
||||
waveparser.c
|
||||
|
||||
RC_SRCS = version.rc
|
||||
RC_SRCS = quartz.rc
|
||||
|
||||
IDL_SRCS = \
|
||||
control_tlb.idl \
|
||||
|
|
|
@ -25,3 +25,6 @@
|
|||
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
|
||||
|
||||
#include "wine/wine_common_ver.rc"
|
||||
|
||||
/* @makedep: quartz.rgs */
|
||||
1 WINE_REGISTRY quartz.rgs
|
|
@ -0,0 +1,82 @@
|
|||
HKCR
|
||||
{
|
||||
NoRemove 'Media Type'
|
||||
{
|
||||
'{e436eb83-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
'{7364696d-0000-0010-8000-00aa00389b71}'
|
||||
{
|
||||
val '0' = s '0,4,,52494646,8,4,,524d4944'
|
||||
val '1' = s '0,4,,4d546864'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{73747874-0000-0010-8000-00aa00389b71}'
|
||||
{
|
||||
val '0' = s '0,4,,4c595249'
|
||||
val '1' = s '0,4,,6c797269'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e06d8022-db46-11cf-b4d1-00805f6cbbea}'
|
||||
{
|
||||
val '0' = s '0,5,ffffffffc0,000001ba40'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb84-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,16,fffffffff100010001800001ffffffff,000001ba2100010001800001000001bb'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb85-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,4,,52494646,8,8,,43445841666D7420,36,20,FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFF,646174610000000000FFFFFFFFFFFFFFFFFFFF00'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb86-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,4,,000001b3'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb87-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,2,ffe0,ffe0'
|
||||
val '1' = s '0,10,ffffff00000080808080,494433000000000000'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb88-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,4,,52494646,8,4,,41564920'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb89-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '4,4,,6d646174'
|
||||
val '1' = s '4,4,,6d6f6f76'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb8b-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,4,,52494646,8,4,,57415645'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb8c-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,4,,2e736e64'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
'{e436eb8d-524f-11ce-9f53-0020af0ba770}'
|
||||
{
|
||||
val '0' = s '0,4,,464f524d,8,4,,41494646'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
}
|
||||
NoRemove Extensions
|
||||
{
|
||||
'.mp3'
|
||||
{
|
||||
val 'Media Type' = s '{e436eb83-524f-11ce-9f53-0020af0ba770}'
|
||||
val 'Subtype' = s '{e436eb87-524f-11ce-9f53-0020af0ba770}'
|
||||
val 'Source Filter' = s '{e436ebb5-524f-11ce-9f53-0020af0ba770}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,23 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|||
* DllUnregisterServer, which make all this worthwhile.
|
||||
*/
|
||||
|
||||
struct regsvr_mediatype_parsing
|
||||
{
|
||||
CLSID const *majortype; /* NULL for end of list */
|
||||
CLSID const *subtype;
|
||||
LPCSTR line[11]; /* NULL for end of list */
|
||||
};
|
||||
|
||||
static HRESULT register_mediatypes_parsing(struct regsvr_mediatype_parsing const *list);
|
||||
static HRESULT unregister_mediatypes_parsing(struct regsvr_mediatype_parsing const *list);
|
||||
|
||||
struct regsvr_mediatype_extension
|
||||
{
|
||||
CLSID const *majortype; /* NULL for end of list */
|
||||
CLSID const *subtype;
|
||||
LPCSTR extension;
|
||||
};
|
||||
|
||||
struct mediatype
|
||||
{
|
||||
CLSID const *majortype; /* NULL for end of list */
|
||||
|
@ -84,201 +67,6 @@ struct regsvr_filter
|
|||
struct pin pins[11];
|
||||
};
|
||||
|
||||
static HRESULT register_mediatypes_extension(struct regsvr_mediatype_extension const *list);
|
||||
static HRESULT unregister_mediatypes_extension(struct regsvr_mediatype_extension const *list);
|
||||
|
||||
static HRESULT register_filters(struct regsvr_filter const *list);
|
||||
static HRESULT unregister_filters(struct regsvr_filter const *list);
|
||||
|
||||
/***********************************************************************
|
||||
* static string constants
|
||||
*/
|
||||
static const WCHAR mediatype_name[] = {
|
||||
'M', 'e', 'd', 'i', 'a', ' ', 'T', 'y', 'p', 'e', 0 };
|
||||
static const WCHAR subtype_valuename[] = {
|
||||
'S', 'u', 'b', 't', 'y', 'p', 'e', 0 };
|
||||
static const WCHAR sourcefilter_valuename[] = {
|
||||
'S', 'o', 'u', 'r', 'c', 'e', ' ', 'F', 'i', 'l', 't', 'e', 'r', 0 };
|
||||
static const WCHAR extensions_keyname[] = {
|
||||
'E', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', 0 };
|
||||
|
||||
/***********************************************************************
|
||||
* register_mediatypes_parsing
|
||||
*/
|
||||
static HRESULT register_mediatypes_parsing(struct regsvr_mediatype_parsing const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY mediatype_key;
|
||||
WCHAR buf[39];
|
||||
int i;
|
||||
|
||||
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &mediatype_key, NULL);
|
||||
if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->majortype; ++list) {
|
||||
HKEY majortype_key = NULL;
|
||||
HKEY subtype_key = NULL;
|
||||
|
||||
StringFromGUID2(list->majortype, buf, 39);
|
||||
res = RegCreateKeyExW(mediatype_key, buf, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &majortype_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_keys;
|
||||
|
||||
StringFromGUID2(list->subtype, buf, 39);
|
||||
res = RegCreateKeyExW(majortype_key, buf, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &subtype_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_keys;
|
||||
|
||||
StringFromGUID2(&CLSID_AsyncReader, buf, 39);
|
||||
res = RegSetValueExW(subtype_key, sourcefilter_valuename, 0, REG_SZ, (const BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
if (res != ERROR_SUCCESS) goto error_close_keys;
|
||||
|
||||
for(i = 0; list->line[i]; i++) {
|
||||
char buffer[3];
|
||||
wsprintfA(buffer, "%d", i);
|
||||
res = RegSetValueExA(subtype_key, buffer, 0, REG_SZ, (const BYTE*)list->line[i],
|
||||
lstrlenA(list->line[i]));
|
||||
if (res != ERROR_SUCCESS) goto error_close_keys;
|
||||
}
|
||||
|
||||
error_close_keys:
|
||||
if (majortype_key)
|
||||
RegCloseKey(majortype_key);
|
||||
if (subtype_key)
|
||||
RegCloseKey(subtype_key);
|
||||
}
|
||||
|
||||
RegCloseKey(mediatype_key);
|
||||
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* register_mediatypes_extension
|
||||
*/
|
||||
static HRESULT register_mediatypes_extension(struct regsvr_mediatype_extension const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY mediatype_key;
|
||||
HKEY extensions_root_key = NULL;
|
||||
WCHAR buf[39];
|
||||
|
||||
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &mediatype_key, NULL);
|
||||
if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
|
||||
|
||||
res = RegCreateKeyExW(mediatype_key, extensions_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &extensions_root_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->majortype; ++list) {
|
||||
HKEY extension_key;
|
||||
|
||||
res = RegCreateKeyExA(extensions_root_key, list->extension, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &extension_key, NULL);
|
||||
if (res != ERROR_SUCCESS) break;
|
||||
|
||||
StringFromGUID2(list->majortype, buf, 39);
|
||||
res = RegSetValueExW(extension_key, mediatype_name, 0, REG_SZ, (const BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
if (res != ERROR_SUCCESS) goto error_close_key;
|
||||
|
||||
StringFromGUID2(list->subtype, buf, 39);
|
||||
res = RegSetValueExW(extension_key, subtype_valuename, 0, REG_SZ, (const BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
if (res != ERROR_SUCCESS) goto error_close_key;
|
||||
|
||||
StringFromGUID2(&CLSID_AsyncReader, buf, 39);
|
||||
res = RegSetValueExW(extension_key, sourcefilter_valuename, 0, REG_SZ, (const BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
if (res != ERROR_SUCCESS) goto error_close_key;
|
||||
|
||||
error_close_key:
|
||||
RegCloseKey(extension_key);
|
||||
}
|
||||
|
||||
error_return:
|
||||
RegCloseKey(mediatype_key);
|
||||
if (extensions_root_key)
|
||||
RegCloseKey(extensions_root_key);
|
||||
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* unregister_mediatypes_parsing
|
||||
*/
|
||||
static HRESULT unregister_mediatypes_parsing(struct regsvr_mediatype_parsing const *list)
|
||||
{
|
||||
LONG res;
|
||||
HKEY mediatype_key;
|
||||
HKEY majortype_key;
|
||||
WCHAR buf[39];
|
||||
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0,
|
||||
KEY_READ | KEY_WRITE, &mediatype_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
|
||||
if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->majortype; ++list) {
|
||||
StringFromGUID2(list->majortype, buf, 39);
|
||||
res = RegOpenKeyExW(mediatype_key, buf, 0,
|
||||
KEY_READ | KEY_WRITE, &majortype_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) {
|
||||
res = ERROR_SUCCESS;
|
||||
continue;
|
||||
}
|
||||
if (res != ERROR_SUCCESS) break;
|
||||
|
||||
StringFromGUID2(list->subtype, buf, 39);
|
||||
res = RegDeleteTreeW(majortype_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
|
||||
/* Removed majortype key if there is no more subtype key */
|
||||
res = RegDeleteKeyW(majortype_key, 0);
|
||||
if (res == ERROR_ACCESS_DENIED) res = ERROR_SUCCESS;
|
||||
|
||||
RegCloseKey(majortype_key);
|
||||
}
|
||||
|
||||
RegCloseKey(mediatype_key);
|
||||
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* unregister_mediatypes_extension
|
||||
*/
|
||||
static HRESULT unregister_mediatypes_extension(struct regsvr_mediatype_extension const *list)
|
||||
{
|
||||
LONG res;
|
||||
HKEY mediatype_key;
|
||||
HKEY extensions_root_key = NULL;
|
||||
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0,
|
||||
KEY_READ | KEY_WRITE, &mediatype_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
|
||||
if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
|
||||
|
||||
res = RegOpenKeyExW(mediatype_key, extensions_keyname, 0,
|
||||
KEY_READ | KEY_WRITE, &extensions_root_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND)
|
||||
res = ERROR_SUCCESS;
|
||||
else if (res == ERROR_SUCCESS)
|
||||
for (; res == ERROR_SUCCESS && list->majortype; ++list) {
|
||||
res = RegDeleteTreeA(extensions_root_key, list->extension);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegCloseKey(mediatype_key);
|
||||
if (extensions_root_key)
|
||||
RegCloseKey(extensions_root_key);
|
||||
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* register_filters
|
||||
*/
|
||||
|
@ -386,91 +174,6 @@ static HRESULT unregister_filters(struct regsvr_filter const *list)
|
|||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* mediatype list
|
||||
*/
|
||||
|
||||
static struct regsvr_mediatype_parsing const mediatype_parsing_list[] = {
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_Avi,
|
||||
{ "0,4,,52494646,8,4,,41564920",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_MPEG1System,
|
||||
{ "0, 16, FFFFFFFFF100010001800001FFFFFFFF, 000001BA2100010001800001000001BB",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_MPEG1VideoCD,
|
||||
{ "0, 4, , 52494646, 8, 8, , 43445841666D7420, 36, 20, FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFF, 646174610000000000FFFFFFFFFFFFFFFFFFFF00",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_MPEG1Video,
|
||||
{ "0, 4, , 000001B3",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_MPEG1Audio,
|
||||
{ "0, 2, FFE0, FFE0",
|
||||
"0, 10, FFFFFF00000080808080, 494433000000000000",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_MPEG2_PROGRAM,
|
||||
{ "0, 5, FFFFFFFFC0, 000001BA40",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_QTMovie,
|
||||
{ "4, 4, , 6d646174",
|
||||
"4, 4, , 6d6f6f76",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_WAVE,
|
||||
{ "0,4,,52494646,8,4,,57415645",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_AU,
|
||||
{ "0,4,,2e736e64",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_AIFF,
|
||||
{ "0,4,,464f524d,8,4,,41494646",
|
||||
"0,4,,464f524d,8,4,,41494643",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIATYPE_Text,
|
||||
{ "0,4,,4C595249",
|
||||
"0,4,,6C797269",
|
||||
NULL }
|
||||
},
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIATYPE_Midi,
|
||||
{ "0,4,,52494646,8,4,,524D4944",
|
||||
"0,4,,4D546864",
|
||||
NULL }
|
||||
},
|
||||
{ NULL } /* list terminator */
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* mediatype list
|
||||
*/
|
||||
|
||||
static struct regsvr_mediatype_extension const mediatype_extension_list[] = {
|
||||
{ &MEDIATYPE_Stream,
|
||||
&MEDIASUBTYPE_MPEG1Audio,
|
||||
".mp3"
|
||||
},
|
||||
{ NULL } /* list terminator */
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* filter list
|
||||
*/
|
||||
|
@ -687,10 +390,6 @@ HRESULT WINAPI DllRegisterServer(void)
|
|||
TRACE("\n");
|
||||
|
||||
hr = QUARTZ_DllRegisterServer();
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_mediatypes_parsing(mediatype_parsing_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_mediatypes_extension(mediatype_extension_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_filters(filter_list);
|
||||
return hr;
|
||||
|
@ -706,10 +405,6 @@ HRESULT WINAPI DllUnregisterServer(void)
|
|||
TRACE("\n");
|
||||
|
||||
hr = unregister_filters(filter_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = unregister_mediatypes_parsing(mediatype_parsing_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = unregister_mediatypes_extension(mediatype_extension_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = QUARTZ_DllUnregisterServer();
|
||||
return hr;
|
||||
|
|
Loading…
Reference in New Issue