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
f745900a
Commit
f745900a
authored
Feb 08, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl: Preserve the device instance ID case in IoRegisterDeviceInterface().
parent
297e4ae7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
pnp.c
dlls/ntoskrnl.exe/pnp.c
+23
-17
driver_pnp.c
dlls/ntoskrnl.exe/tests/driver_pnp.c
+1
-1
No files found.
dlls/ntoskrnl.exe/pnp.c
View file @
f745900a
...
...
@@ -883,13 +883,12 @@ NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *cla
SP_DEVICE_INTERFACE_DATA
sp_iface
=
{
sizeof
(
sp_iface
)};
SP_DEVINFO_DATA
sp_device
=
{
sizeof
(
sp_device
)};
WCHAR
device_instance_id
[
MAX_DEVICE_ID_LEN
];
SP_DEVICE_INTERFACE_DETAIL_DATA_W
*
data
;
NTSTATUS
status
=
STATUS_SUCCESS
;
UNICODE_STRING
device_path
;
struct
device_interface
*
iface
;
struct
wine_rb_entry
*
entry
;
DWORD
required
;
HDEVINFO
set
;
WCHAR
*
p
;
TRACE
(
"device %p, class_guid %s, refstr %s, symbolic_link %p.
\n
"
,
device
,
debugstr_guid
(
class_guid
),
debugstr_us
(
refstr
),
symbolic_link
);
...
...
@@ -910,22 +909,31 @@ NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *cla
if
(
!
SetupDiCreateDeviceInterfaceW
(
set
,
&
sp_device
,
class_guid
,
refstr
?
refstr
->
Buffer
:
NULL
,
0
,
&
sp_iface
))
return
STATUS_UNSUCCESSFUL
;
required
=
0
;
SetupDiGetDeviceInterfaceDetailW
(
set
,
&
sp_iface
,
NULL
,
0
,
&
required
,
NULL
);
if
(
required
==
0
)
return
STATUS_UNSUCCESSFUL
;
/* setupapi mangles the case; construct the interface path manually. */
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
required
);
data
->
cbSize
=
sizeof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
);
device_path
.
Length
=
(
4
+
wcslen
(
device_instance_id
)
+
1
+
38
)
*
sizeof
(
WCHAR
);
if
(
refstr
)
device_path
.
Length
+=
sizeof
(
WCHAR
)
+
refstr
->
Length
;
device_path
.
MaximumLength
=
device_path
.
Length
+
sizeof
(
WCHAR
);
if
(
!
SetupDiGetDeviceInterfaceDetailW
(
set
,
&
sp_iface
,
data
,
required
,
NULL
,
NULL
))
device_path
.
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
device_path
.
MaximumLength
);
swprintf
(
device_path
.
Buffer
,
device_path
.
MaximumLength
/
sizeof
(
WCHAR
),
L"
\\
??
\\
%s#{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
device_instance_id
,
class_guid
->
Data1
,
class_guid
->
Data2
,
class_guid
->
Data3
,
class_guid
->
Data4
[
0
],
class_guid
->
Data4
[
1
],
class_guid
->
Data4
[
2
],
class_guid
->
Data4
[
3
],
class_guid
->
Data4
[
4
],
class_guid
->
Data4
[
5
],
class_guid
->
Data4
[
6
],
class_guid
->
Data4
[
7
]
);
for
(
p
=
device_path
.
Buffer
+
4
;
*
p
;
p
++
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
STATUS_UNSUCCESSFUL
;
if
(
*
p
==
'\\'
)
*
p
=
'#'
;
}
if
(
refstr
)
{
*
p
++
=
'\\'
;
wcscpy
(
p
,
refstr
->
Buffer
);
}
data
->
DevicePath
[
1
]
=
'?'
;
TRACE
(
"Returning path %s.
\n
"
,
debugstr_w
(
data
->
DevicePath
));
RtlCreateUnicodeString
(
&
device_path
,
data
->
DevicePath
);
TRACE
(
"Returning path %s.
\n
"
,
debugstr_us
(
&
device_path
));
entry
=
wine_rb_get
(
&
device_interfaces
,
&
device_path
);
if
(
entry
)
...
...
@@ -937,7 +945,7 @@ NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *cla
else
{
iface
=
heap_alloc_zero
(
sizeof
(
struct
device_interface
)
);
Rtl
CreateUnicodeString
(
&
iface
->
symbolic_link
,
data
->
DevicePath
);
Rtl
DuplicateUnicodeString
(
1
,
&
device_path
,
&
iface
->
symbolic_link
);
if
(
wine_rb_put
(
&
device_interfaces
,
&
iface
->
symbolic_link
,
&
iface
->
entry
))
ERR
(
"Failed to insert interface %s into tree.
\n
"
,
debugstr_us
(
&
iface
->
symbolic_link
));
}
...
...
@@ -945,9 +953,7 @@ NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *cla
iface
->
device
=
device
;
iface
->
interface_class
=
*
class_guid
;
if
(
symbolic_link
)
RtlCreateUnicodeString
(
symbolic_link
,
data
->
DevicePath
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
RtlDuplicateUnicodeString
(
1
,
&
device_path
,
symbolic_link
);
RtlFreeUnicodeString
(
&
device_path
);
...
...
dlls/ntoskrnl.exe/tests/driver_pnp.c
View file @
f745900a
...
...
@@ -285,7 +285,7 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp)
"Got length %u.
\n
"
,
device
->
child_symlink
.
Length
);
ok
(
device
->
child_symlink
.
MaximumLength
==
sizeof
(
expect_symlink
),
"Got maximum length %u.
\n
"
,
device
->
child_symlink
.
MaximumLength
);
todo_wine
ok
(
!
kmemcmp
(
device
->
child_symlink
.
Buffer
,
expect_symlink
,
device
->
child_symlink
.
MaximumLength
),
ok
(
!
kmemcmp
(
device
->
child_symlink
.
Buffer
,
expect_symlink
,
device
->
child_symlink
.
MaximumLength
),
"Got symlink
\"
%ls
\"
.
\n
"
,
device
->
child_symlink
.
Buffer
);
IoSetDeviceInterfaceState
(
&
device
->
child_symlink
,
TRUE
);
...
...
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