Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Mayr
wine
Commits
a10a8eb1
Commit
a10a8eb1
authored
17 years ago
by
Juan Lang
Committed by
Alexandre Julliard
17 years ago
Browse files
Options
Downloads
Patches
Plain Diff
setupapi: Correct device enumeration.
parent
162911ba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/setupapi/devinst.c
+59
-23
59 additions, 23 deletions
dlls/setupapi/devinst.c
with
59 additions
and
23 deletions
dlls/setupapi/devinst.c
+
59
−
23
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
(
subKey
Name
)
+
2
)
*
sizeof
(
WCHAR
));
(
lstrlenW
(
device
Name
)
+
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
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment