devenum: Moved test for special category GUID to separated function.

This commit is contained in:
Jacek Caban 2014-01-08 14:12:00 +01:00 committed by Alexandre Julliard
parent 03b2e737d2
commit 6ce17c1fa4
1 changed files with 10 additions and 8 deletions

View File

@ -107,12 +107,17 @@ static ULONG WINAPI DEVENUM_ICreateDevEnum_Release(ICreateDevEnum * iface)
return 1; /* non-heap based object */
}
static BOOL IsSpecialCategory(const CLSID *clsid)
{
return IsEqualGUID(clsid, &CLSID_AudioRendererCategory) ||
IsEqualGUID(clsid, &CLSID_AudioInputDeviceCategory) ||
IsEqualGUID(clsid, &CLSID_VideoInputDeviceCategory) ||
IsEqualGUID(clsid, &CLSID_MidiRendererCategory);
}
HRESULT DEVENUM_GetCategoryKey(REFCLSID clsidDeviceClass, HKEY *pBaseKey, WCHAR *wszRegKeyName, UINT maxLen)
{
if (IsEqualGUID(clsidDeviceClass, &CLSID_AudioRendererCategory) ||
IsEqualGUID(clsidDeviceClass, &CLSID_AudioInputDeviceCategory) ||
IsEqualGUID(clsidDeviceClass, &CLSID_VideoInputDeviceCategory) ||
IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory))
if (IsSpecialCategory(clsidDeviceClass))
{
*pBaseKey = HKEY_CURRENT_USER;
strcpyW(wszRegKeyName, wszActiveMovieKey);
@ -482,10 +487,7 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator(
if (FAILED(hr))
return hr;
if (IsEqualGUID(clsidDeviceClass, &CLSID_AudioRendererCategory) ||
IsEqualGUID(clsidDeviceClass, &CLSID_AudioInputDeviceCategory) ||
IsEqualGUID(clsidDeviceClass, &CLSID_VideoInputDeviceCategory) ||
IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory))
if (IsSpecialCategory(clsidDeviceClass))
{
hr = DEVENUM_CreateSpecialCategories();
if (FAILED(hr))