Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aaron Hill
wine
Commits
8a26c088
Commit
8a26c088
authored
7 months ago
by
Rémi Bernon
Committed by
Alexandre Julliard
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
hidclass: Allocate child PDOs array dynamically.
parent
6f4167a1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/hidclass.sys/hid.h
+2
-1
2 additions, 1 deletion
dlls/hidclass.sys/hid.h
dlls/hidclass.sys/pnp.c
+26
-21
26 additions, 21 deletions
dlls/hidclass.sys/pnp.c
with
28 additions
and
22 deletions
dlls/hidclass.sys/hid.h
+
2
−
1
View file @
8a26c088
...
...
@@ -51,7 +51,8 @@ typedef struct _BASE_DEVICE_EXTENSION
HID_DEVICE_ATTRIBUTES
attrs
;
HIDP_DEVICE_DESC
device_desc
;
DEVICE_OBJECT
*
child_pdo
;
DEVICE_OBJECT
**
child_pdos
;
UINT
child_count
;
}
fdo
;
struct
...
...
This diff is collapsed.
Click to expand it.
dlls/hidclass.sys/pnp.c
+
26
−
21
View file @
8a26c088
...
...
@@ -235,30 +235,37 @@ static NTSTATUS initialize_device( minidriver *minidriver, DEVICE_OBJECT *device
return
status
;
}
if
(
!
(
ext
->
u
.
fdo
.
child_pdos
=
malloc
(
ext
->
u
.
fdo
.
device_desc
.
CollectionDescLength
*
sizeof
(
ext
->
u
.
fdo
.
child_pdos
)
)))
{
ERR
(
"Cannot allocate child PDOs array
\n
"
);
return
STATUS_NO_MEMORY
;
}
return
STATUS_SUCCESS
;
}
static
void
create_child
(
minidriver
*
minidriver
,
DEVICE_OBJECT
*
fdo
)
static
NTSTATUS
create_child
_pdos
(
minidriver
*
minidriver
,
DEVICE_OBJECT
*
device
)
{
BASE_DEVICE_EXTENSION
*
fdo_ext
=
fdo
->
DeviceExtension
,
*
pdo_ext
;
BASE_DEVICE_EXTENSION
*
fdo_ext
=
device
->
DeviceExtension
,
*
pdo_ext
;
DEVICE_OBJECT
*
child_pdo
;
UNICODE_STRING
string
;
WCHAR
pdo_name
[
255
];
USAGE
page
,
usage
;
NTSTATUS
status
;
swprintf
(
pdo_name
,
ARRAY_SIZE
(
pdo_name
),
L"
\\
Device
\\
HID#%p&%p"
,
fdo
->
DriverObject
,
fdo_ext
->
u
.
fdo
.
hid_ext
.
PhysicalDeviceObject
);
swprintf
(
pdo_name
,
ARRAY_SIZE
(
pdo_name
),
L"
\\
Device
\\
HID#%p&%p"
,
device
->
DriverObject
,
fdo_ext
->
u
.
fdo
.
hid_ext
.
PhysicalDeviceObject
);
RtlInitUnicodeString
(
&
string
,
pdo_name
);
if
((
status
=
IoCreateDevice
(
fdo
->
DriverObject
,
sizeof
(
*
pdo_ext
),
&
string
,
0
,
0
,
FALSE
,
&
child_pdo
)))
if
((
status
=
IoCreateDevice
(
device
->
DriverObject
,
sizeof
(
*
pdo_ext
),
&
string
,
0
,
0
,
FALSE
,
&
child_pdo
)))
{
ERR
(
"Failed to create child PDO, status %#lx.
\n
"
,
status
);
return
;
return
status
;
}
fdo_ext
->
u
.
fdo
.
child_pdo
=
child_pdo
;
fdo_ext
->
u
.
fdo
.
child_pdos
[
0
]
=
child_pdo
;
fdo_ext
->
u
.
fdo
.
child_count
++
;
pdo_ext
=
child_pdo
->
DeviceExtension
;
pdo_ext
->
u
.
pdo
.
parent_fdo
=
fdo
;
pdo_ext
->
u
.
pdo
.
parent_fdo
=
device
;
list_init
(
&
pdo_ext
->
u
.
pdo
.
queues
);
KeInitializeSpinLock
(
&
pdo_ext
->
u
.
pdo
.
queues_lock
);
...
...
@@ -285,9 +292,10 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
pdo_ext
->
u
.
pdo
.
rawinput_handle
=
alloc_rawinput_handle
();
pdo_ext
->
u
.
pdo
.
poll_interval
=
DEFAULT_POLL_INTERVAL
;
IoInvalidateDeviceRelations
(
fdo_ext
->
u
.
fdo
.
hid_ext
.
PhysicalDeviceObject
,
BusRelations
);
TRACE
(
"created device %p, rawinput handle %#x
\n
"
,
pdo_ext
,
pdo_ext
->
u
.
pdo
.
rawinput_handle
);
IoInvalidateDeviceRelations
(
fdo_ext
->
u
.
fdo
.
hid_ext
.
PhysicalDeviceObject
,
BusRelations
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
fdo_pnp
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
...
...
@@ -304,27 +312,23 @@ static NTSTATUS fdo_pnp(DEVICE_OBJECT *device, IRP *irp)
case
IRP_MN_QUERY_DEVICE_RELATIONS
:
{
DEVICE_RELATIONS
*
devices
;
DEVICE_OBJECT
*
child
;
UINT32
i
;
if
(
stack
->
Parameters
.
QueryDeviceRelations
.
Type
!=
BusRelations
)
return
minidriver
->
PNPDispatch
(
device
,
irp
);
if
(
!
(
devices
=
ExAllocatePool
(
PagedPool
,
offsetof
(
DEVICE_RELATIONS
,
Objects
[
1
]))))
if
(
!
(
devices
=
ExAllocatePool
(
PagedPool
,
offsetof
(
DEVICE_RELATIONS
,
Objects
[
ext
->
u
.
fdo
.
child_count
]))))
{
irp
->
IoStatus
.
Status
=
STATUS_NO_MEMORY
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
STATUS_NO_MEMORY
;
}
if
((
child
=
ext
->
u
.
fdo
.
child_pdo
))
{
devices
->
Objects
[
0
]
=
ext
->
u
.
fdo
.
child_pdo
;
call_fastcall_func1
(
ObfReferenceObject
,
ext
->
u
.
fdo
.
child_pdo
);
devices
->
Count
=
1
;
}
else
for
(
i
=
0
,
devices
->
Count
=
0
;
i
<
ext
->
u
.
fdo
.
child_count
;
++
i
)
{
devices
->
Count
=
0
;
devices
->
Objects
[
i
]
=
ext
->
u
.
fdo
.
child_pdos
[
i
];
call_fastcall_func1
(
ObfReferenceObject
,
ext
->
u
.
fdo
.
child_pdos
[
i
]);
devices
->
Count
++
;
}
irp
->
IoStatus
.
Information
=
(
ULONG_PTR
)
devices
;
...
...
@@ -336,12 +340,13 @@ static NTSTATUS fdo_pnp(DEVICE_OBJECT *device, IRP *irp)
case
IRP_MN_START_DEVICE
:
status
=
minidriver
->
PNPDispatch
(
device
,
irp
);
if
(
!
status
)
status
=
initialize_device
(
minidriver
,
device
);
if
(
!
status
)
create_child
(
minidriver
,
device
);
if
(
!
status
)
status
=
create_child
_pdos
(
minidriver
,
device
);
return
status
;
case
IRP_MN_REMOVE_DEVICE
:
status
=
minidriver
->
PNPDispatch
(
device
,
irp
);
HidP_FreeCollectionDescription
(
&
ext
->
u
.
fdo
.
device_desc
);
free
(
ext
->
u
.
fdo
.
child_pdos
);
IoDetachDevice
(
ext
->
u
.
fdo
.
hid_ext
.
NextDeviceObject
);
IoDeleteDevice
(
device
);
return
status
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment