Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
737ed17f
Commit
737ed17f
authored
Jan 30, 2010
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Feb 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
devenum: Scan special device categories more often.
parent
201c9a14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
21 deletions
+54
-21
createdevenum.c
dlls/devenum/createdevenum.c
+54
-21
No files found.
dlls/devenum/createdevenum.c
View file @
737ed17f
...
...
@@ -481,28 +481,25 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator(
if
(
FAILED
(
hr
))
return
hr
;
if
(
RegOpenKeyW
(
hbasekey
,
wszRegKey
,
&
hkey
)
!=
ERROR_SUCCESS
)
if
(
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_AudioRendererCategory
)
||
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_AudioInputDeviceCategory
)
||
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_VideoInputDeviceCategory
)
||
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_MidiRendererCategory
))
{
if
(
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_AudioRendererCategory
)
||
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_AudioInputDeviceCategory
)
||
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_VideoInputDeviceCategory
)
||
IsEqualGUID
(
clsidDeviceClass
,
&
CLSID_MidiRendererCategory
))
{
hr
=
DEVENUM_CreateSpecialCategories
();
if
(
FAILED
(
hr
))
return
hr
;
if
(
RegOpenKeyW
(
hbasekey
,
wszRegKey
,
&
hkey
)
!=
ERROR_SUCCESS
)
{
ERR
(
"Couldn't open registry key for special device: %s
\n
"
,
debugstr_guid
(
clsidDeviceClass
));
return
S_FALSE
;
}
}
else
{
FIXME
(
"Category %s not found
\n
"
,
debugstr_guid
(
clsidDeviceClass
));
return
S_FALSE
;
}
hr
=
DEVENUM_CreateSpecialCategories
();
if
(
FAILED
(
hr
))
return
hr
;
if
(
RegOpenKeyW
(
hbasekey
,
wszRegKey
,
&
hkey
)
!=
ERROR_SUCCESS
)
{
ERR
(
"Couldn't open registry key for special device: %s
\n
"
,
debugstr_guid
(
clsidDeviceClass
));
return
S_FALSE
;
}
}
else
if
(
RegOpenKeyW
(
hbasekey
,
wszRegKey
,
&
hkey
)
!=
ERROR_SUCCESS
)
{
FIXME
(
"Category %s not found
\n
"
,
debugstr_guid
(
clsidDeviceClass
));
return
S_FALSE
;
}
return
DEVENUM_IEnumMoniker_Construct
(
hkey
,
ppEnumMoniker
);
...
...
@@ -556,6 +553,12 @@ static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory)
return
res
;
}
static
HANDLE
DEVENUM_populate_handle
;
static
const
WCHAR
DEVENUM_populate_handle_nameW
[]
=
{
'_'
,
'_'
,
'W'
,
'I'
,
'N'
,
'E'
,
'_'
,
'D'
,
'e'
,
'v'
,
'e'
,
'n'
,
'u'
,
'm'
,
'_'
,
'P'
,
'o'
,
'p'
,
'u'
,
'l'
,
'a'
,
't'
,
'e'
,
0
};
/**********************************************************************
* DEVENUM_CreateSpecialCategories (INTERNAL)
*
...
...
@@ -571,6 +574,35 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
IFilterMapper2
*
pMapper
=
NULL
;
REGFILTER2
rf2
;
REGFILTERPINS2
rfp2
;
WCHAR
path
[
MAX_PATH
];
HKEY
basekey
;
if
(
DEVENUM_populate_handle
)
return
S_OK
;
DEVENUM_populate_handle
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
DEVENUM_populate_handle_nameW
);
if
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
)
{
/* Webcams can take some time to scan if the driver is badly written and it enables them,
* so have a 10 s timeout here
*/
if
(
WaitForSingleObject
(
DEVENUM_populate_handle
,
10000
)
==
WAIT_TIMEOUT
)
WARN
(
"Waiting for object timed out
\n
"
);
TRACE
(
"No need to rescan
\n
"
);
return
S_OK
;
}
TRACE
(
"Scanning for devices
\n
"
);
/* Since devices can change between session, for example because you just plugged in a webcam
* or switched from pulseaudio to alsa, delete all old devices first
*/
if
(
SUCCEEDED
(
DEVENUM_GetCategoryKey
(
&
CLSID_AudioRendererCategory
,
&
basekey
,
path
,
MAX_PATH
)))
RegDeleteTreeW
(
basekey
,
path
);
if
(
SUCCEEDED
(
DEVENUM_GetCategoryKey
(
&
CLSID_AudioInputDeviceCategory
,
&
basekey
,
path
,
MAX_PATH
)))
RegDeleteTreeW
(
basekey
,
path
);
if
(
SUCCEEDED
(
DEVENUM_GetCategoryKey
(
&
CLSID_VideoInputDeviceCategory
,
&
basekey
,
path
,
MAX_PATH
)))
RegDeleteTreeW
(
basekey
,
path
);
if
(
SUCCEEDED
(
DEVENUM_GetCategoryKey
(
&
CLSID_MidiRendererCategory
,
&
basekey
,
path
,
MAX_PATH
)))
RegDeleteTreeW
(
basekey
,
path
);
rf2
.
dwVersion
=
2
;
rf2
.
dwMerit
=
MERIT_PREFERRED
;
...
...
@@ -814,5 +846,6 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
if
(
pMapper
)
IFilterMapper2_Release
(
pMapper
);
SetEvent
(
DEVENUM_populate_handle
);
return
res
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment