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
8c12672b
Commit
8c12672b
authored
Feb 24, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Handle error translation in SetupDiCreateDevRegKey().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
922bc932
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
20 deletions
+16
-20
devinst.c
dlls/setupapi/devinst.c
+16
-20
No files found.
dlls/setupapi/devinst.c
View file @
8c12672b
...
...
@@ -542,25 +542,24 @@ static LONG open_driver_key(struct device *device, REGSAM access, HKEY *key)
return
l
;
}
static
HKEY
create_driver_key
(
struct
device
*
device
)
static
LONG
create_driver_key
(
struct
device
*
device
,
HKEY
*
key
)
{
static
const
WCHAR
formatW
[]
=
{
'%'
,
'0'
,
'4'
,
'u'
,
0
};
static
const
WCHAR
slash
[]
=
{
'\\'
,
0
};
HKEY
class_key
,
key
;
unsigned
int
i
=
0
;
WCHAR
path
[
50
];
HKEY
class_key
;
DWORD
dispos
;
LONG
l
;
if
(
!
open_driver_key
(
device
,
KEY_READ
|
KEY_WRITE
,
&
key
))
return
key
;
if
(
!
open_driver_key
(
device
,
KEY_READ
|
KEY_WRITE
,
key
))
return
ERROR_SUCCESS
;
if
((
l
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
ControlClass
,
0
,
NULL
,
0
,
KEY_CREATE_SUB_KEY
,
NULL
,
&
class_key
,
NULL
)))
{
ERR
(
"Failed to open driver class root key, error %u.
\n
"
,
l
);
SetLastError
(
l
);
return
INVALID_HANDLE_VALUE
;
return
l
;
}
SETUPDI_GuidToString
(
&
device
->
class
,
path
);
...
...
@@ -570,20 +569,19 @@ static HKEY create_driver_key(struct device *device)
for
(;;)
{
sprintfW
(
path
+
39
,
formatW
,
i
++
);
if
((
l
=
RegCreateKeyExW
(
class_key
,
path
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
key
,
&
dispos
)))
if
((
l
=
RegCreateKeyExW
(
class_key
,
path
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
key
,
&
dispos
)))
break
;
else
if
(
dispos
==
REG_CREATED_NEW_KEY
)
{
RegSetValueExW
(
device
->
key
,
Driver
,
0
,
REG_SZ
,
(
BYTE
*
)
path
,
strlenW
(
path
)
*
sizeof
(
WCHAR
));
RegCloseKey
(
class_key
);
return
key
;
return
ERROR_SUCCESS
;
}
RegCloseKey
(
key
);
RegCloseKey
(
*
key
);
}
ERR
(
"Failed to create driver key, error %u.
\n
"
,
l
);
RegCloseKey
(
class_key
);
SetLastError
(
l
);
return
INVALID_HANDLE_VALUE
;
return
l
;
}
static
LONG
delete_driver_key
(
struct
device
*
device
)
...
...
@@ -1449,23 +1447,21 @@ HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO devinfo, SP_DEVINFO_DATA *device_da
switch
(
KeyType
)
{
case
DIREG_DEV
:
if
((
l
=
RegCreateKeyExW
(
device
->
key
,
DeviceParameters
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
key
,
NULL
)))
{
key
=
INVALID_HANDLE_VALUE
;
}
SetLastError
(
l
);
l
=
RegCreateKeyExW
(
device
->
key
,
DeviceParameters
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
key
,
NULL
);
break
;
case
DIREG_DRV
:
key
=
create_driver_key
(
device
);
l
=
create_driver_key
(
device
,
&
key
);
break
;
default:
WARN
(
"unknown KeyType %d
\n
"
,
KeyType
);
FIXME
(
"Unhandled type %#x.
\n
"
,
KeyType
);
l
=
ERROR_CALL_NOT_IMPLEMENTED
;
}
if
(
InfHandle
)
SetupInstallFromInfSectionW
(
NULL
,
InfHandle
,
InfSectionName
,
SPINST_ALL
,
NULL
,
NULL
,
SP_COPY_NEWER_ONLY
,
NULL
,
NULL
,
devinfo
,
device_data
);
return
key
;
SetLastError
(
l
);
return
l
?
INVALID_HANDLE_VALUE
:
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