devenum: Don't bother creating the category key for codecs if there are no codecs to register.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-04-11 10:49:39 -05:00 committed by Alexandre Julliard
parent 341fe50c28
commit cbfd33300a
1 changed files with 0 additions and 56 deletions

View File

@ -52,7 +52,6 @@ static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a',
static const WCHAR wszFilterData[] = {'F','i','l','t','e','r','D','a','t','a',0}; static const WCHAR wszFilterData[] = {'F','i','l','t','e','r','D','a','t','a',0};
static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface); static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface);
static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory);
/********************************************************************** /**********************************************************************
* DEVENUM_ICreateDevEnum_QueryInterface (also IUnknown) * DEVENUM_ICreateDevEnum_QueryInterface (also IUnknown)
@ -429,9 +428,6 @@ static void register_legacy_filters(void)
hr = HRESULT_FROM_WIN32(lRet); hr = HRESULT_FROM_WIN32(lRet);
} }
if (SUCCEEDED(hr))
hr = DEVENUM_CreateAMCategoryKey(&CLSID_LegacyAmFilterCategory);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
for (i = 0; i < dwFilterSubkeys; i++) for (i = 0; i < dwFilterSubkeys; i++)
@ -517,10 +513,6 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons
VARIANT var; VARIANT var;
HRESULT hr; HRESULT hr;
hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory);
if (FAILED(hr))
return FALSE;
if (guid) if (guid)
{ {
WCHAR *name = heap_alloc(sizeof(defaultW) + lstrlenW(desc) * sizeof(WCHAR)); WCHAR *name = heap_alloc(sizeof(defaultW) + lstrlenW(desc) * sizeof(WCHAR));
@ -578,9 +570,6 @@ static void register_waveout_devices(void)
VARIANT var; VARIANT var;
HRESULT hr; HRESULT hr;
hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory);
if (FAILED(hr)) return;
count = waveOutGetNumDevs(); count = waveOutGetNumDevs();
for (i = -1; i < count; i++) for (i = -1; i < count; i++)
@ -627,9 +616,6 @@ static void register_wavein_devices(void)
VARIANT var; VARIANT var;
HRESULT hr; HRESULT hr;
hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory);
if (FAILED(hr)) return;
count = waveInGetNumDevs(); count = waveInGetNumDevs();
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -671,9 +657,6 @@ static void register_midiout_devices(void)
VARIANT var; VARIANT var;
HRESULT hr; HRESULT hr;
hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory);
if (FAILED(hr)) return;
count = midiOutGetNumDevs(); count = midiOutGetNumDevs();
for (i = -1; i < count; i++) for (i = -1; i < count; i++)
@ -724,9 +707,6 @@ static void register_vfw_codecs(void)
int i = 0; int i = 0;
HIC hic; HIC hic;
hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory);
if (FAILED(hr)) return;
while (ICInfo(ICTYPE_VIDEO, i++, &info)) while (ICInfo(ICTYPE_VIDEO, i++, &info))
{ {
WCHAR name[5] = {LOBYTE(LOWORD(info.fccHandler)), HIBYTE(LOWORD(info.fccHandler)), WCHAR name[5] = {LOBYTE(LOWORD(info.fccHandler)), HIBYTE(LOWORD(info.fccHandler)),
@ -784,10 +764,6 @@ static void register_avicap_devices(void)
HRESULT hr; HRESULT hr;
int i = 0; int i = 0;
hr = DEVENUM_CreateAMCategoryKey(&CLSID_VideoInputDeviceCategory);
if (FAILED(hr))
return;
for (i = 0; i < 10; ++i) for (i = 0; i < 10; ++i)
{ {
if (!capGetDriverDescriptionW(i, friendlyname, ARRAY_SIZE(friendlyname), if (!capGetDriverDescriptionW(i, friendlyname, ARRAY_SIZE(friendlyname),
@ -896,35 +872,3 @@ static const ICreateDevEnumVtbl ICreateDevEnum_Vtbl =
* static CreateDevEnum instance * static CreateDevEnum instance
*/ */
ICreateDevEnum DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl }; ICreateDevEnum DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl };
/**********************************************************************
* DEVENUM_CreateAMCategoryKey (INTERNAL)
*
* Creates a registry key for a category at HKEY_CURRENT_USER\Software\
* Microsoft\ActiveMovie\devenum\{clsid}
*/
static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory)
{
WCHAR wszRegKey[MAX_PATH];
HRESULT res = S_OK;
HKEY hkeyDummy = NULL;
lstrcpyW(wszRegKey, wszActiveMovieKey);
if (!StringFromGUID2(clsidCategory, wszRegKey + lstrlenW(wszRegKey), ARRAY_SIZE(wszRegKey) - lstrlenW(wszRegKey)))
res = E_INVALIDARG;
if (SUCCEEDED(res))
{
LONG lRes = RegCreateKeyW(HKEY_CURRENT_USER, wszRegKey, &hkeyDummy);
res = HRESULT_FROM_WIN32(lRes);
}
if (hkeyDummy)
RegCloseKey(hkeyDummy);
if (FAILED(res))
ERR("Failed to create key HKEY_CURRENT_USER\\%s\n", debugstr_w(wszRegKey));
return res;
}