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
9b767ad6
Commit
9b767ad6
authored
Jul 29, 2018
by
Zebediah Figura
Committed by
Alexandre Julliard
Aug 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Correctly implement SetupDiDeleteDeviceInterfaceRegKey().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1d17352c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
57 deletions
+33
-57
devinst.c
dlls/setupapi/devinst.c
+33
-55
devinst.c
dlls/setupapi/tests/devinst.c
+0
-2
No files found.
dlls/setupapi/devinst.c
View file @
9b767ad6
...
...
@@ -2531,32 +2531,6 @@ HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyA(
return
key
;
}
static
PWSTR
SETUPDI_GetInstancePath
(
struct
device_iface
*
iface
)
{
static
const
WCHAR
hash
[]
=
{
'#'
,
0
};
PWSTR
instancePath
=
NULL
;
if
(
iface
->
refstr
)
{
instancePath
=
heap_alloc
((
lstrlenW
(
iface
->
refstr
)
+
2
)
*
sizeof
(
WCHAR
));
if
(
instancePath
)
{
lstrcpyW
(
instancePath
,
hash
);
lstrcatW
(
instancePath
,
iface
->
refstr
);
}
else
SetLastError
(
ERROR_OUTOFMEMORY
);
}
else
{
instancePath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
hash
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
instancePath
)
lstrcpyW
(
instancePath
,
hash
);
}
return
instancePath
;
}
/***********************************************************************
* SetupDiCreateDeviceInterfaceRegKeyW (SETUPAPI.@)
*/
...
...
@@ -2622,51 +2596,55 @@ HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyW(HDEVINFO devinfo,
/***********************************************************************
* SetupDiDeleteDeviceInterfaceRegKey (SETUPAPI.@)
*/
BOOL
WINAPI
SetupDiDeleteDeviceInterfaceRegKey
(
HDEVINFO
DeviceInfoSet
,
PSP_DEVICE_INTERFACE_DATA
DeviceInterfaceData
,
DWORD
Reserved
)
BOOL
WINAPI
SetupDiDeleteDeviceInterfaceRegKey
(
HDEVINFO
devinfo
,
SP_DEVICE_INTERFACE_DATA
*
iface_data
,
DWORD
reserved
)
{
struct
DeviceInfoSet
*
set
=
DeviceInfoSet
;
HKEY
parent
;
BOOL
ret
=
FALSE
;
struct
DeviceInfoSet
*
set
=
devinfo
;
struct
device_iface
*
iface
;
HKEY
refstr_key
;
WCHAR
*
path
;
LONG
ret
;
TRACE
(
"%p %p %d
\n
"
,
DeviceInfoSet
,
DeviceInterfaceData
,
R
eserved
);
TRACE
(
"%p %p %d
\n
"
,
devinfo
,
iface_data
,
r
eserved
);
if
(
!
DeviceInfoSet
||
DeviceInfoSet
==
INVALID_HANDLE_VALUE
||
if
(
!
devinfo
||
devinfo
==
INVALID_HANDLE_VALUE
||
set
->
magic
!=
SETUP_DEVICE_INFO_SET_MAGIC
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
!
DeviceInterfaceData
||
DeviceInterfaceData
->
cbSize
!=
sizeof
(
SP_DEVICE_INTERFACE_DATA
)
||
!
DeviceInterfaceData
->
Reserved
)
if
(
!
iface_data
||
iface_data
->
cbSize
!=
sizeof
(
SP_DEVICE_INTERFACE_DATA
)
||
!
iface_data
->
Reserved
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
parent
=
SetupDiOpenClassRegKeyExW
(
&
DeviceInterfaceData
->
InterfaceClassGuid
,
KEY_ALL_ACCESS
,
DIOCR_INTERFACE
,
NULL
,
NULL
)
;
if
(
parent
!=
INVALID_HANDLE_VALUE
)
iface
=
(
struct
device_iface
*
)
iface_data
->
Reserved
;
if
(
!
(
path
=
get_refstr_key_path
(
iface
))
)
{
struct
device_iface
*
ifaceInfo
=
(
struct
device_iface
*
)
DeviceInterfaceData
->
Reserved
;
PWSTR
instancePath
=
SETUPDI_GetInstancePath
(
ifaceInfo
);
SetLastError
(
ERROR_OUTOFMEMORY
);
return
FALSE
;
}
if
(
instancePath
)
{
LONG
l
=
RegDeleteKeyW
(
parent
,
instancePath
);
ret
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
path
,
0
,
NULL
,
0
,
0
,
NULL
,
&
refstr_key
,
NULL
);
heap_free
(
path
);
if
(
ret
)
{
SetLastError
(
ret
);
return
FALSE
;
}
if
(
l
)
SetLastError
(
l
);
else
ret
=
TRUE
;
HeapFree
(
GetProcessHeap
(),
0
,
instancePath
);
}
RegCloseKey
(
parent
);
ret
=
RegDeleteKeyW
(
refstr_key
,
DeviceParameters
);
RegCloseKey
(
refstr_key
);
if
(
ret
)
{
SetLastError
(
ret
);
return
FALSE
;
}
return
ret
;
return
TRUE
;
}
/***********************************************************************
...
...
dlls/setupapi/tests/devinst.c
View file @
9b767ad6
...
...
@@ -1419,11 +1419,9 @@ static void test_device_interface_key(void)
RegCloseKey
(
key
);
ret
=
SetupDiDeleteDeviceInterfaceRegKey
(
set
,
&
iface
,
0
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ret
=
RegOpenKeyA
(
parent
,
"#
\\
Device Parameters"
,
&
key
);
todo_wine
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"key shouldn't exist
\n
"
);
RegCloseKey
(
parent
);
...
...
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