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
a10a8eb1
Commit
a10a8eb1
authored
Oct 12, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Oct 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Correct device enumeration.
parent
162911ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
23 deletions
+59
-23
devinst.c
dlls/setupapi/devinst.c
+59
-23
No files found.
dlls/setupapi/devinst.c
View file @
a10a8eb1
...
...
@@ -2137,25 +2137,26 @@ static void SETUPDI_EnumerateInterfaces(HDEVINFO DeviceInfoSet,
}
}
static
void
SETUPDI_EnumerateMatchingDevices
(
HDEVINFO
DeviceInfoSet
,
LPCWSTR
parent
,
HKEY
key
,
const
GUID
*
class
,
DWORD
flags
)
static
void
SETUPDI_EnumerateMatchingDeviceInstances
(
struct
DeviceInfoSet
*
set
,
LPCWSTR
enumerator
,
LPCWSTR
deviceName
,
HKEY
deviceKey
,
const
GUID
*
class
,
DWORD
flags
)
{
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
DWORD
i
,
len
;
WCHAR
subKeyNam
e
[
MAX_PATH
];
WCHAR
deviceInstanc
e
[
MAX_PATH
];
LONG
l
=
ERROR_SUCCESS
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
parent
));
TRACE
(
"%s
%s
\n
"
,
debugstr_w
(
enumerator
),
debugstr_w
(
deviceName
));
for
(
i
=
0
;
!
l
;
i
++
)
{
len
=
sizeof
(
subKeyName
)
/
sizeof
(
subKeyName
[
0
]);
l
=
RegEnumKeyExW
(
key
,
i
,
subKeyName
,
&
len
,
NULL
,
NULL
,
NULL
,
NULL
);
len
=
sizeof
(
deviceInstance
)
/
sizeof
(
deviceInstance
[
0
]);
l
=
RegEnumKeyExW
(
deviceKey
,
i
,
deviceInstance
,
&
len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
!
l
)
{
HKEY
subKey
;
l
=
RegOpenKeyExW
(
key
,
subKeyNam
e
,
0
,
KEY_READ
,
&
subKey
);
l
=
RegOpenKeyExW
(
deviceKey
,
deviceInstanc
e
,
0
,
KEY_READ
,
&
subKey
);
if
(
!
l
)
{
WCHAR
classGuid
[
40
];
...
...
@@ -2179,11 +2180,12 @@ static void SETUPDI_EnumerateMatchingDevices(HDEVINFO DeviceInfoSet,
LPWSTR
instanceId
;
instanceId
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
parent
)
+
lstrlenW
(
subKeyName
)
+
2
)
*
sizeof
(
WCHAR
));
(
lstrlenW
(
deviceName
)
+
lstrlenW
(
deviceInstance
)
+
2
)
*
sizeof
(
WCHAR
));
if
(
instanceId
)
{
sprintfW
(
instanceId
,
fmt
,
parent
,
subKeyName
);
sprintfW
(
instanceId
,
fmt
,
deviceName
,
deviceInstance
);
SETUPDI_AddDeviceToSet
(
set
,
&
deviceClass
,
0
/* FIXME: DevInst */
,
instanceId
,
FALSE
,
NULL
);
...
...
@@ -2200,46 +2202,80 @@ static void SETUPDI_EnumerateMatchingDevices(HDEVINFO DeviceInfoSet,
}
}
static
void
SETUPDI_EnumerateMatchingDevices
(
HDEVINFO
DeviceInfoSet
,
LPCWSTR
parent
,
HKEY
key
,
const
GUID
*
class
,
DWORD
flags
)
{
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
DWORD
i
,
len
;
WCHAR
subKeyName
[
MAX_PATH
];
LONG
l
=
ERROR_SUCCESS
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
parent
));
for
(
i
=
0
;
!
l
;
i
++
)
{
len
=
sizeof
(
subKeyName
)
/
sizeof
(
subKeyName
[
0
]);
l
=
RegEnumKeyExW
(
key
,
i
,
subKeyName
,
&
len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
!
l
)
{
HKEY
subKey
;
l
=
RegOpenKeyExW
(
key
,
subKeyName
,
0
,
KEY_READ
,
&
subKey
);
if
(
!
l
)
{
TRACE
(
"%s
\n
"
,
debugstr_w
(
subKeyName
));
SETUPDI_EnumerateMatchingDeviceInstances
(
set
,
parent
,
subKeyName
,
subKey
,
class
,
flags
);
RegCloseKey
(
subKey
);
}
/* Allow enumeration to continue */
l
=
ERROR_SUCCESS
;
}
}
}
static
void
SETUPDI_EnumerateDevices
(
HDEVINFO
DeviceInfoSet
,
const
GUID
*
class
,
LPCWSTR
enumstr
,
DWORD
flags
)
{
HKEY
classesKey
=
SetupDiOpenClassRegKeyExW
(
class
,
KEY_READ
,
DIOCR_INSTALLER
,
NULL
,
NULL
)
;
HKEY
enumKey
;
LONG
l
;
TRACE
(
"%p, %s, %s, %08x
\n
"
,
DeviceInfoSet
,
debugstr_guid
(
class
),
debugstr_w
(
enumstr
),
flags
);
if
(
classesKey
!=
INVALID_HANDLE_VALUE
)
l
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
Enum
,
0
,
NULL
,
0
,
KEY_READ
,
NULL
,
&
enumKey
,
NULL
);
if
(
enumKey
!=
INVALID_HANDLE_VALUE
)
{
if
(
enumstr
)
{
HKEY
enumKey
;
LONG
l
=
RegOpenKeyExW
(
classesKey
,
enumstr
,
0
,
KEY_READ
,
&
enumKey
);
HKEY
enumStrKey
;
l
=
RegOpenKeyExW
(
enumKey
,
enumstr
,
0
,
KEY_READ
,
&
enumStrKey
);
if
(
!
l
)
{
SETUPDI_EnumerateMatchingDevices
(
DeviceInfoSet
,
enumstr
,
enumKey
,
class
,
flags
);
RegCloseKey
(
enumKey
);
enum
Str
Key
,
class
,
flags
);
RegCloseKey
(
enum
Str
Key
);
}
}
else
{
DWORD
i
,
len
;
WCHAR
subKeyName
[
MAX_PATH
];
LONG
l
=
ERROR_SUCCESS
;
l
=
ERROR_SUCCESS
;
for
(
i
=
0
;
!
l
;
i
++
)
{
len
=
sizeof
(
subKeyName
)
/
sizeof
(
subKeyName
[
0
]);
l
=
RegEnumKeyExW
(
classes
Key
,
i
,
subKeyName
,
&
len
,
NULL
,
l
=
RegEnumKeyExW
(
enum
Key
,
i
,
subKeyName
,
&
len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
!
l
)
{
HKEY
subKey
;
l
=
RegOpenKeyExW
(
classes
Key
,
subKeyName
,
0
,
KEY_READ
,
l
=
RegOpenKeyExW
(
enum
Key
,
subKeyName
,
0
,
KEY_READ
,
&
subKey
);
if
(
!
l
)
{
...
...
@@ -2252,7 +2288,7 @@ static void SETUPDI_EnumerateDevices(HDEVINFO DeviceInfoSet, const GUID *class,
}
}
}
RegCloseKey
(
classes
Key
);
RegCloseKey
(
enum
Key
);
}
}
...
...
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