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
fdc6db8e
Commit
fdc6db8e
authored
Oct 08, 2015
by
Aric Stewart
Committed by
Alexandre Julliard
Oct 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hidclass.sys: Implement sending IRP_MJ_PNP to the minidriver.
Signed-off-by:
Aric Stewart
<
aric@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a89aa776
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
pnp.c
dlls/hidclass.sys/pnp.c
+57
-0
No files found.
dlls/hidclass.sys/pnp.c
View file @
fdc6db8e
...
...
@@ -41,6 +41,51 @@ typedef struct _NATIVE_DEVICE {
static
struct
list
tracked_devices
=
LIST_INIT
(
tracked_devices
);
static
NTSTATUS
WINAPI
internalComplete
(
DEVICE_OBJECT
*
deviceObject
,
IRP
*
irp
,
void
*
context
)
{
SetEvent
(
irp
->
UserEvent
);
return
STATUS_MORE_PROCESSING_REQUIRED
;
}
static
NTSTATUS
SendDeviceIRP
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
NTSTATUS
status
;
IO_STACK_LOCATION
*
irpsp
;
HANDLE
event
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
irp
->
UserEvent
=
event
;
irpsp
=
IoGetNextIrpStackLocation
(
irp
);
irpsp
->
CompletionRoutine
=
internalComplete
;
irpsp
->
Control
=
SL_INVOKE_ON_SUCCESS
|
SL_INVOKE_ON_ERROR
;
IoCallDriver
(
device
,
irp
);
if
(
irp
->
IoStatus
.
u
.
Status
==
STATUS_PENDING
)
WaitForSingleObject
(
event
,
INFINITE
);
status
=
irp
->
IoStatus
.
u
.
Status
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
CloseHandle
(
event
);
return
status
;
}
static
NTSTATUS
PNP_SendPnPIRP
(
DEVICE_OBJECT
*
device
,
UCHAR
minor
)
{
IO_STACK_LOCATION
*
irpsp
;
IO_STATUS_BLOCK
irp_status
;
IRP
*
irp
=
IoBuildSynchronousFsdRequest
(
IRP_MJ_PNP
,
device
,
NULL
,
0
,
NULL
,
NULL
,
&
irp_status
);
irpsp
=
IoGetNextIrpStackLocation
(
irp
);
irpsp
->
MinorFunction
=
minor
;
irpsp
->
Parameters
.
StartDevice
.
AllocatedResources
=
NULL
;
irpsp
->
Parameters
.
StartDevice
.
AllocatedResourcesTranslated
=
NULL
;
return
SendDeviceIRP
(
device
,
irp
);
}
NTSTATUS
WINAPI
PNP_AddDevice
(
DRIVER_OBJECT
*
driver
,
DEVICE_OBJECT
*
PDO
)
{
DEVICE_OBJECT
*
device
=
NULL
;
...
...
@@ -80,12 +125,21 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
return
status
;
}
status
=
PNP_SendPnPIRP
(
device
,
IRP_MN_START_DEVICE
);
if
(
status
!=
STATUS_SUCCESS
)
{
ERR
(
"Minidriver IRP_MN_START_DEVICE failed (%x)
\n
"
,
status
);
HID_DeleteDevice
(
&
minidriver
->
minidriver
,
device
);
return
status
;
}
status
=
call_minidriver
(
IOCTL_HID_GET_DEVICE_ATTRIBUTES
,
device
,
NULL
,
0
,
&
attr
,
sizeof
(
attr
));
if
(
status
!=
STATUS_SUCCESS
)
{
ERR
(
"Minidriver failed to get Attributes(%x)
\n
"
,
status
);
PNP_SendPnPIRP
(
device
,
IRP_MN_REMOVE_DEVICE
);
HID_DeleteDevice
(
&
minidriver
->
minidriver
,
device
);
return
status
;
}
...
...
@@ -112,6 +166,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
if
(
status
!=
STATUS_SUCCESS
)
{
ERR
(
"Cannot get Device Descriptor(%x)
\n
"
,
status
);
PNP_SendPnPIRP
(
device
,
IRP_MN_REMOVE_DEVICE
);
HID_DeleteDevice
(
&
minidriver
->
minidriver
,
device
);
return
status
;
}
...
...
@@ -122,6 +177,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
if
(
i
>=
descriptor
.
bNumDescriptors
)
{
ERR
(
"No Report Descriptor found in reply
\n
"
);
PNP_SendPnPIRP
(
device
,
IRP_MN_REMOVE_DEVICE
);
HID_DeleteDevice
(
&
minidriver
->
minidriver
,
device
);
return
status
;
}
...
...
@@ -180,6 +236,7 @@ void PNP_CleanupPNP(DRIVER_OBJECT *driver)
if
(
tracked_device
->
minidriver
->
DriverObject
==
driver
)
{
list_remove
(
&
tracked_device
->
entry
);
PNP_SendPnPIRP
(
tracked_device
->
FDO
,
IRP_MN_REMOVE_DEVICE
);
HID_DeleteDevice
(
tracked_device
->
minidriver
,
tracked_device
->
FDO
);
HeapFree
(
GetProcessHeap
(),
0
,
tracked_device
);
}
...
...
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