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
629123ba
Commit
629123ba
authored
Oct 12, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Oct 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Implement SetupDiOpenDevRegKey.
parent
559f89af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
9 deletions
+97
-9
devinst.c
dlls/setupapi/devinst.c
+97
-2
devinst.c
dlls/setupapi/tests/devinst.c
+0
-7
No files found.
dlls/setupapi/devinst.c
View file @
629123ba
...
...
@@ -3558,6 +3558,46 @@ BOOL WINAPI SetupDiGetDeviceInstallParamsA(
return
FALSE
;
}
static
HKEY
SETUPDI_OpenDevKey
(
struct
DeviceInfo
*
devInfo
,
REGSAM
samDesired
)
{
HKEY
enumKey
,
key
=
INVALID_HANDLE_VALUE
;
LONG
l
;
l
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
Enum
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
enumKey
,
NULL
);
if
(
!
l
)
{
RegOpenKeyExW
(
enumKey
,
devInfo
->
instanceId
,
0
,
samDesired
,
&
key
);
RegCloseKey
(
enumKey
);
}
return
key
;
}
static
HKEY
SETUPDI_OpenDrvKey
(
struct
DeviceInfo
*
devInfo
,
REGSAM
samDesired
)
{
static
const
WCHAR
slash
[]
=
{
'\\'
,
0
};
WCHAR
classKeyPath
[
MAX_PATH
];
HKEY
classKey
,
key
=
INVALID_HANDLE_VALUE
;
LONG
l
;
lstrcpyW
(
classKeyPath
,
ControlClass
);
lstrcatW
(
classKeyPath
,
slash
);
SETUPDI_GuidToString
(
&
devInfo
->
set
->
ClassGuid
,
classKeyPath
+
lstrlenW
(
classKeyPath
));
l
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
classKeyPath
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
classKey
,
NULL
);
if
(
!
l
)
{
static
const
WCHAR
fmt
[]
=
{
'%'
,
'0'
,
'4'
,
'u'
,
0
};
WCHAR
devId
[
10
];
sprintfW
(
devId
,
fmt
,
devInfo
->
devId
);
RegOpenKeyExW
(
classKey
,
devId
,
0
,
samDesired
,
&
key
);
RegCloseKey
(
classKey
);
}
return
key
;
}
/***********************************************************************
* SetupDiOpenDevRegKey (SETUPAPI.@)
*/
...
...
@@ -3569,7 +3609,62 @@ HKEY WINAPI SetupDiOpenDevRegKey(
DWORD
KeyType
,
REGSAM
samDesired
)
{
FIXME
(
"%p %p %d %d %d %x
\n
"
,
DeviceInfoSet
,
DeviceInfoData
,
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
struct
DeviceInfo
*
devInfo
;
HKEY
key
=
INVALID_HANDLE_VALUE
;
TRACE
(
"%p %p %d %d %d %x
\n
"
,
DeviceInfoSet
,
DeviceInfoData
,
Scope
,
HwProfile
,
KeyType
,
samDesired
);
return
INVALID_HANDLE_VALUE
;
if
(
!
DeviceInfoSet
||
DeviceInfoSet
==
(
HDEVINFO
)
INVALID_HANDLE_VALUE
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
INVALID_HANDLE_VALUE
;
}
if
(
set
->
magic
!=
SETUP_DEVICE_INFO_SET_MAGIC
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
INVALID_HANDLE_VALUE
;
}
if
(
!
DeviceInfoData
||
DeviceInfoData
->
cbSize
!=
sizeof
(
SP_DEVINFO_DATA
)
||
!
DeviceInfoData
->
Reserved
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
INVALID_HANDLE_VALUE
;
}
if
(
Scope
!=
DICS_FLAG_GLOBAL
&&
Scope
!=
DICS_FLAG_CONFIGSPECIFIC
)
{
SetLastError
(
ERROR_INVALID_FLAGS
);
return
INVALID_HANDLE_VALUE
;
}
if
(
KeyType
!=
DIREG_DEV
&&
KeyType
!=
DIREG_DRV
)
{
SetLastError
(
ERROR_INVALID_FLAGS
);
return
INVALID_HANDLE_VALUE
;
}
devInfo
=
(
struct
DeviceInfo
*
)
DeviceInfoData
->
Reserved
;
if
(
devInfo
->
set
!=
set
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
INVALID_HANDLE_VALUE
;
}
if
(
devInfo
->
phantom
)
{
SetLastError
(
ERROR_DEVINFO_NOT_REGISTERED
);
return
INVALID_HANDLE_VALUE
;
}
if
(
Scope
!=
DICS_FLAG_GLOBAL
)
FIXME
(
"unimplemented for scope %d
\n
"
,
Scope
);
switch
(
KeyType
)
{
case
DIREG_DEV
:
key
=
SETUPDI_OpenDevKey
(
devInfo
,
samDesired
);
break
;
case
DIREG_DRV
:
key
=
SETUPDI_OpenDrvKey
(
devInfo
,
samDesired
);
break
;
default:
WARN
(
"unknown KeyType %d
\n
"
,
KeyType
);
}
return
key
;
}
dlls/setupapi/tests/devinst.c
View file @
629123ba
...
...
@@ -618,39 +618,33 @@ static void testDevRegKey(void)
ok
(
ret
,
"SetupDiCreateDeviceInfoA failed: %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
key
=
pSetupDiOpenDevRegKey
(
NULL
,
NULL
,
0
,
0
,
0
,
0
);
todo_wine
ok
(
key
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
key
=
pSetupDiOpenDevRegKey
(
set
,
NULL
,
0
,
0
,
0
,
0
);
todo_wine
ok
(
key
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
key
=
pSetupDiOpenDevRegKey
(
set
,
&
devInfo
,
0
,
0
,
0
,
0
);
todo_wine
ok
(
key
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_INVALID_FLAGS
,
"Expected ERROR_INVALID_FLAGS, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
key
=
pSetupDiOpenDevRegKey
(
set
,
&
devInfo
,
DICS_FLAG_GLOBAL
,
0
,
0
,
0
);
todo_wine
ok
(
key
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_INVALID_FLAGS
,
"Expected ERROR_INVALID_FLAGS, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
key
=
pSetupDiOpenDevRegKey
(
set
,
&
devInfo
,
DICS_FLAG_GLOBAL
,
0
,
DIREG_BOTH
,
0
);
todo_wine
ok
(
key
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_INVALID_FLAGS
,
"Expected ERROR_INVALID_FLAGS, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
key
=
pSetupDiOpenDevRegKey
(
set
,
&
devInfo
,
DICS_FLAG_GLOBAL
,
0
,
DIREG_DRV
,
0
);
todo_wine
ok
(
key
==
INVALID_HANDLE_VALUE
&&
GetLastError
()
==
ERROR_DEVINFO_NOT_REGISTERED
,
"Expected ERROR_DEVINFO_NOT_REGISTERED, got %08x
\n
"
,
GetLastError
());
...
...
@@ -687,7 +681,6 @@ static void testDevRegKey(void)
"Expected ERROR_INVALID_DATA, got %08x
\n
"
,
GetLastError
());
key
=
pSetupDiOpenDevRegKey
(
set
,
&
devInfo
,
DICS_FLAG_GLOBAL
,
0
,
DIREG_DRV
,
KEY_READ
);
todo_wine
ok
(
key
!=
INVALID_HANDLE_VALUE
,
"SetupDiOpenDevRegKey failed: %08x
\n
"
,
GetLastError
());
ret
=
pSetupDiCallClassInstaller
(
DIF_REMOVE
,
set
,
&
devInfo
);
...
...
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