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
cba5674d
Commit
cba5674d
authored
Nov 06, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Nov 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Implement AddDevice().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9fa62ce6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
1 deletion
+64
-1
main.c
dlls/winebus.sys/main.c
+64
-1
No files found.
dlls/winebus.sys/main.c
View file @
cba5674d
...
...
@@ -88,6 +88,9 @@ static DRIVER_OBJECT *driver_obj;
static
DEVICE_OBJECT
*
mouse_obj
;
/* The root-enumerated device stack. */
static
DEVICE_OBJECT
*
bus_pdo
,
*
bus_fdo
;
HANDLE
driver_key
;
struct
pnp_device
...
...
@@ -490,7 +493,33 @@ static NTSTATUS handle_IRP_MN_QUERY_ID(DEVICE_OBJECT *device, IRP *irp)
return
status
;
}
static
NTSTATUS
WINAPI
common_pnp_dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
static
NTSTATUS
fdo_pnp_dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
IO_STACK_LOCATION
*
irpsp
=
IoGetCurrentIrpStackLocation
(
irp
);
NTSTATUS
ret
;
switch
(
irpsp
->
MinorFunction
)
{
case
IRP_MN_START_DEVICE
:
case
IRP_MN_SURPRISE_REMOVAL
:
irp
->
IoStatus
.
u
.
Status
=
STATUS_SUCCESS
;
break
;
case
IRP_MN_REMOVE_DEVICE
:
irp
->
IoStatus
.
u
.
Status
=
STATUS_SUCCESS
;
IoSkipCurrentIrpStackLocation
(
irp
);
ret
=
IoCallDriver
(
bus_pdo
,
irp
);
IoDetachDevice
(
bus_pdo
);
IoDeleteDevice
(
device
);
return
ret
;
default:
FIXME
(
"Unhandled minor function %#x.
\n
"
,
irpsp
->
MinorFunction
);
}
IoSkipCurrentIrpStackLocation
(
irp
);
return
IoCallDriver
(
bus_pdo
,
irp
);
}
static
NTSTATUS
pdo_pnp_dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
NTSTATUS
status
=
irp
->
IoStatus
.
u
.
Status
;
IO_STACK_LOCATION
*
irpsp
=
IoGetCurrentIrpStackLocation
(
irp
);
...
...
@@ -519,6 +548,13 @@ static NTSTATUS WINAPI common_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
return
status
;
}
static
NTSTATUS
WINAPI
common_pnp_dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
if
(
device
==
bus_fdo
)
return
fdo_pnp_dispatch
(
device
,
irp
);
return
pdo_pnp_dispatch
(
device
,
irp
);
}
static
NTSTATUS
deliver_last_report
(
struct
device_extension
*
ext
,
DWORD
buffer_length
,
BYTE
*
buffer
,
ULONG_PTR
*
out_length
)
{
if
(
buffer_length
<
ext
->
last_report_size
)
...
...
@@ -592,6 +628,12 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
TRACE
(
"(%p, %p)
\n
"
,
device
,
irp
);
if
(
device
==
bus_fdo
)
{
IoSkipCurrentIrpStackLocation
(
irp
);
return
IoCallDriver
(
bus_pdo
,
irp
);
}
switch
(
irpsp
->
Parameters
.
DeviceIoControl
.
IoControlCode
)
{
case
IOCTL_HID_GET_DEVICE_ATTRIBUTES
:
...
...
@@ -836,6 +878,26 @@ BOOL is_xbox_gamepad(WORD vid, WORD pid)
return
FALSE
;
}
static
NTSTATUS
WINAPI
driver_add_device
(
DRIVER_OBJECT
*
driver
,
DEVICE_OBJECT
*
pdo
)
{
NTSTATUS
ret
;
TRACE
(
"driver %p, pdo %p.
\n
"
,
driver
,
pdo
);
if
((
ret
=
IoCreateDevice
(
driver
,
0
,
NULL
,
FILE_DEVICE_BUS_EXTENDER
,
0
,
FALSE
,
&
bus_fdo
)))
{
ERR
(
"Failed to create FDO, status %#x.
\n
"
,
ret
);
return
ret
;
}
IoAttachDeviceToDeviceStack
(
bus_fdo
,
pdo
);
bus_pdo
=
pdo
;
bus_fdo
->
Flags
&=
~
DO_DEVICE_INITIALIZING
;
return
STATUS_SUCCESS
;
}
static
void
WINAPI
driver_unload
(
DRIVER_OBJECT
*
driver
)
{
udev_driver_unload
();
...
...
@@ -933,6 +995,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
driver
->
MajorFunction
[
IRP_MJ_PNP
]
=
common_pnp_dispatch
;
driver
->
MajorFunction
[
IRP_MJ_INTERNAL_DEVICE_CONTROL
]
=
hid_internal_dispatch
;
driver
->
DriverExtension
->
AddDevice
=
driver_add_device
;
driver
->
DriverUnload
=
driver_unload
;
mouse_device_create
();
...
...
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