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
4a3cd01b
Commit
4a3cd01b
authored
Feb 04, 2020
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Feb 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Implement SetupDiOpenDeviceInterfaceRegKey().
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b29d9301
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
1 deletion
+86
-1
devinst.c
dlls/setupapi/devinst.c
+25
-0
setupapi.spec
dlls/setupapi/setupapi.spec
+1
-1
devinst.c
dlls/setupapi/tests/devinst.c
+60
-0
No files found.
dlls/setupapi/devinst.c
View file @
4a3cd01b
...
...
@@ -3526,6 +3526,31 @@ BOOL WINAPI SetupDiOpenDeviceInterfaceA(
}
/***********************************************************************
* SetupDiOpenDeviceInterfaceRegKey (SETUPAPI.@)
*/
HKEY
WINAPI
SetupDiOpenDeviceInterfaceRegKey
(
HDEVINFO
devinfo
,
PSP_DEVICE_INTERFACE_DATA
iface_data
,
DWORD
reserved
,
REGSAM
access
)
{
struct
device_iface
*
iface
;
LSTATUS
lr
;
HKEY
key
;
TRACE
(
"devinfo %p, iface_data %p, reserved %d, access %#x.
\n
"
,
devinfo
,
iface_data
,
reserved
,
access
);
if
(
!
(
iface
=
get_device_iface
(
devinfo
,
iface_data
)))
return
INVALID_HANDLE_VALUE
;
lr
=
RegOpenKeyExW
(
iface
->
refstr_key
,
DeviceParameters
,
0
,
access
,
&
key
);
if
(
lr
)
{
SetLastError
(
lr
);
return
INVALID_HANDLE_VALUE
;
}
return
key
;
}
/***********************************************************************
* SetupDiSetClassInstallParamsA (SETUPAPI.@)
*/
BOOL
WINAPI
SetupDiSetClassInstallParamsA
(
...
...
dlls/setupapi/setupapi.spec
View file @
4a3cd01b
...
...
@@ -380,7 +380,7 @@
@ stdcall SetupDiOpenDeviceInfoA(ptr str ptr long ptr)
@ stdcall SetupDiOpenDeviceInfoW(ptr wstr ptr long ptr)
@ stdcall SetupDiOpenDeviceInterfaceA(ptr str long ptr)
@ st
ub SetupDiOpenDeviceInterfaceRegKey
@ st
dcall SetupDiOpenDeviceInterfaceRegKey(ptr ptr long long)
@ stdcall SetupDiOpenDeviceInterfaceW(ptr wstr long ptr)
@ stdcall SetupDiRegisterCoDeviceInstallers(ptr ptr)
@ stdcall SetupDiRegisterDeviceInfo(ptr ptr long ptr ptr ptr)
...
...
dlls/setupapi/tests/devinst.c
View file @
4a3cd01b
...
...
@@ -2011,6 +2011,7 @@ static void test_device_interface_key(void)
ok
(
!
ret
,
"key should exist: %u
\n
"
,
ret
);
ret
=
RegSetValueA
(
key
,
NULL
,
REG_SZ
,
"test"
,
5
);
ok
(
!
ret
,
"RegSetValue failed: %u
\n
"
,
ret
);
sz
=
sizeof
(
buffer
);
ret
=
RegQueryValueA
(
dikey
,
NULL
,
buffer
,
&
sz
);
ok
(
!
ret
,
"RegQueryValue failed: %u
\n
"
,
ret
);
...
...
@@ -2031,6 +2032,64 @@ static void test_device_interface_key(void)
SetupDiDestroyDeviceInfoList
(
set
);
}
static
void
test_open_device_interface_key
(
void
)
{
SP_DEVICE_INTERFACE_DATA
iface
;
SP_DEVINFO_DATA
device
;
CHAR
buffer
[
5
];
HDEVINFO
set
;
LSTATUS
lr
;
LONG
size
;
HKEY
key
;
BOOL
ret
;
set
=
SetupDiCreateDeviceInfoList
(
&
guid
,
NULL
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"Failed to create device list, error %#x
\n
"
,
GetLastError
());
device
.
cbSize
=
sizeof
(
device
);
ret
=
SetupDiCreateDeviceInfoA
(
set
,
"ROOT
\\
LEGACY_BOGUS
\\
0000"
,
&
guid
,
NULL
,
NULL
,
0
,
&
device
);
ok
(
ret
,
"Failed to create device, error %#x.
\n
"
,
GetLastError
());
iface
.
cbSize
=
sizeof
(
iface
);
ret
=
SetupDiCreateDeviceInterfaceA
(
set
,
&
device
,
&
guid
,
NULL
,
0
,
&
iface
);
ok
(
ret
,
"Failed to create interface, error %#x.
\n
"
,
GetLastError
());
/* Test open before creation */
key
=
SetupDiOpenDeviceInterfaceRegKey
(
set
,
&
iface
,
0
,
KEY_ALL_ACCESS
);
ok
(
key
==
INVALID_HANDLE_VALUE
,
"Expect open interface registry key failure
\n
"
);
/* Test opened key is from SetupDiCreateDeviceInterfaceRegKey */
key
=
SetupDiCreateDeviceInterfaceRegKeyW
(
set
,
&
iface
,
0
,
KEY_ALL_ACCESS
,
NULL
,
NULL
);
ok
(
key
!=
INVALID_HANDLE_VALUE
,
"Failed to create interface registry key, error %#x
\n
"
,
GetLastError
());
lr
=
RegSetValueA
(
key
,
NULL
,
REG_SZ
,
"test"
,
5
);
ok
(
!
lr
,
"RegSetValue failed, error %#x
\n
"
,
lr
);
RegCloseKey
(
key
);
key
=
SetupDiOpenDeviceInterfaceRegKey
(
set
,
&
iface
,
0
,
KEY_ALL_ACCESS
);
ok
(
key
!=
INVALID_HANDLE_VALUE
,
"Failed to open interface registry key, error %#x
\n
"
,
GetLastError
());
size
=
sizeof
(
buffer
);
lr
=
RegQueryValueA
(
key
,
NULL
,
buffer
,
&
size
);
ok
(
!
lr
,
"RegQueryValue failed, error %#x
\n
"
,
lr
);
ok
(
!
strcmp
(
buffer
,
"test"
),
"got wrong data %s
\n
"
,
buffer
);
RegCloseKey
(
key
);
/* Test open after removal */
ret
=
SetupDiRemoveDeviceInterface
(
set
,
&
iface
);
ok
(
ret
,
"Failed to remove device interface, error %#x.
\n
"
,
GetLastError
());
key
=
SetupDiOpenDeviceInterfaceRegKey
(
set
,
&
iface
,
0
,
KEY_ALL_ACCESS
);
ok
(
key
==
INVALID_HANDLE_VALUE
,
"Expect open interface registry key failure
\n
"
);
ret
=
SetupDiRemoveDevice
(
set
,
&
device
);
ok
(
ret
,
"Failed to remove device, error %#x.
\n
"
,
GetLastError
());
ret
=
SetupDiDestroyDeviceInfoList
(
set
);
ok
(
ret
,
"Failed to destroy device list, error %#x.
\n
"
,
GetLastError
());
}
static
void
test_device_install_params
(
void
)
{
SP_DEVINFO_DATA
device
=
{
sizeof
(
device
)};
...
...
@@ -3142,6 +3201,7 @@ START_TEST(devinst)
test_get_inf_class
();
test_devnode
();
test_device_interface_key
();
test_open_device_interface_key
();
test_device_install_params
();
test_driver_list
();
test_call_class_installer
();
...
...
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