Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1fa7782c
Commit
1fa7782c
authored
Mar 15, 2019
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Mar 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Check registered device duplicate in SetupDiCreateDeviceInfo().
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7876234e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
devinst.c
dlls/setupapi/devinst.c
+14
-0
devinst.c
dlls/setupapi/tests/devinst.c
+3
-3
No files found.
dlls/setupapi/devinst.c
View file @
1fa7782c
...
...
@@ -1510,6 +1510,8 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const
{
WCHAR
id
[
MAX_DEVICE_ID_LEN
];
struct
DeviceInfoSet
*
set
;
HKEY
enum_hkey
;
HKEY
instance_hkey
;
struct
device
*
device
;
TRACE
(
"devinfo %p, name %s, class %s, description %s, hwnd %p, flags %#x, device_data %p.
\n
"
,
...
...
@@ -1570,6 +1572,18 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const
}
else
{
/* Check if instance is already in registry */
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
Enum
,
0
,
NULL
,
0
,
KEY_READ
,
NULL
,
&
enum_hkey
,
NULL
);
if
(
!
RegOpenKeyExW
(
enum_hkey
,
name
,
0
,
KEY_READ
,
&
instance_hkey
))
{
RegCloseKey
(
instance_hkey
);
RegCloseKey
(
enum_hkey
);
SetLastError
(
ERROR_DEVINST_ALREADY_EXISTS
);
return
FALSE
;
}
RegCloseKey
(
enum_hkey
);
/* Check if instance is already in set */
strcpyW
(
id
,
name
);
LIST_FOR_EACH_ENTRY
(
device
,
&
set
->
devices
,
struct
device
,
entry
)
{
...
...
dlls/setupapi/tests/devinst.c
View file @
1fa7782c
...
...
@@ -358,9 +358,9 @@ static void test_device_info(void)
set
=
SetupDiCreateDeviceInfoList
(
&
guid
,
NULL
);
ret
=
SetupDiCreateDeviceInfoA
(
set
,
"Root
\\
LEGACY_BOGUS
\\
0000"
,
&
guid
,
NULL
,
NULL
,
0
,
&
device
);
todo_wine
ok
(
!
ret
,
"Expect failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_DEVINST_ALREADY_EXISTS
,
"Got error %#x
\n
"
,
GetLastError
());
todo_wine
check_device_info
(
set
,
0
,
NULL
,
NULL
);
ok
(
!
ret
,
"Expect failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_DEVINST_ALREADY_EXISTS
,
"Got error %#x
\n
"
,
GetLastError
());
check_device_info
(
set
,
0
,
NULL
,
NULL
);
SetupDiDestroyDeviceInfoList
(
set
);
set
=
SetupDiGetClassDevsA
(
&
guid
,
NULL
,
NULL
,
0
);
...
...
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