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
e30a1452
Commit
e30a1452
authored
Apr 15, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hidclass.sys: Merge main.c into pnp.c.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5cc9c5ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
111 deletions
+76
-111
Makefile.in
dlls/hidclass.sys/Makefile.in
+0
-1
hid.h
dlls/hidclass.sys/hid.h
+0
-5
main.c
dlls/hidclass.sys/main.c
+0
-102
pnp.c
dlls/hidclass.sys/pnp.c
+76
-3
No files found.
dlls/hidclass.sys/Makefile.in
View file @
e30a1452
...
...
@@ -9,5 +9,4 @@ C_SRCS = \
buffer.c
\
descriptor.c
\
device.c
\
main.c
\
pnp.c
dlls/hidclass.sys/hid.h
View file @
e30a1452
...
...
@@ -86,7 +86,6 @@ typedef struct _minidriver
}
minidriver
;
NTSTATUS
call_minidriver
(
ULONG
code
,
DEVICE_OBJECT
*
device
,
void
*
in_buff
,
ULONG
in_size
,
void
*
out_buff
,
ULONG
out_size
)
DECLSPEC_HIDDEN
;
minidriver
*
find_minidriver
(
DRIVER_OBJECT
*
driver
)
DECLSPEC_HIDDEN
;
/* Internal device functions */
NTSTATUS
HID_CreateDevice
(
DEVICE_OBJECT
*
native_device
,
HID_MINIDRIVER_REGISTRATION
*
driver
,
DEVICE_OBJECT
**
device
)
DECLSPEC_HIDDEN
;
...
...
@@ -99,10 +98,6 @@ NTSTATUS WINAPI HID_Device_read(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN
NTSTATUS
WINAPI
HID_Device_write
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
DECLSPEC_HIDDEN
;
NTSTATUS
WINAPI
HID_Device_create
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
DECLSPEC_HIDDEN
;
NTSTATUS
WINAPI
HID_Device_close
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
DECLSPEC_HIDDEN
;
NTSTATUS
WINAPI
HID_PNP_Dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
DECLSPEC_HIDDEN
;
/* Pseudo-Plug and Play support*/
NTSTATUS
WINAPI
PNP_AddDevice
(
DRIVER_OBJECT
*
driver
,
DEVICE_OBJECT
*
PDO
)
DECLSPEC_HIDDEN
;
/* Parsing HID Report Descriptors into preparsed data */
WINE_HIDP_PREPARSED_DATA
*
ParseDescriptor
(
BYTE
*
descriptor
,
unsigned
int
length
)
DECLSPEC_HIDDEN
;
dlls/hidclass.sys/main.c
deleted
100644 → 0
View file @
5cc9c5ab
/*
* WINE Hid device services
*
* Copyright 2015 Aric Stewart
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSUNION
#include <unistd.h>
#include <stdarg.h>
#include "hid.h"
#include "wine/debug.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
hid
);
static
struct
list
minidriver_list
=
LIST_INIT
(
minidriver_list
);
minidriver
*
find_minidriver
(
DRIVER_OBJECT
*
driver
)
{
minidriver
*
md
;
LIST_FOR_EACH_ENTRY
(
md
,
&
minidriver_list
,
minidriver
,
entry
)
{
if
(
md
->
minidriver
.
DriverObject
==
driver
)
return
md
;
}
return
NULL
;
}
static
VOID
WINAPI
UnloadDriver
(
DRIVER_OBJECT
*
driver
)
{
minidriver
*
md
;
TRACE
(
"Driver Unload
\n
"
);
md
=
find_minidriver
(
driver
);
if
(
md
)
{
if
(
md
->
DriverUnload
)
md
->
DriverUnload
(
md
->
minidriver
.
DriverObject
);
list_remove
(
&
md
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
md
);
}
}
NTSTATUS
WINAPI
HidRegisterMinidriver
(
HID_MINIDRIVER_REGISTRATION
*
registration
)
{
minidriver
*
driver
;
driver
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
driver
));
if
(
!
driver
)
return
STATUS_NO_MEMORY
;
driver
->
DriverUnload
=
registration
->
DriverObject
->
DriverUnload
;
registration
->
DriverObject
->
DriverUnload
=
UnloadDriver
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_DEVICE_CONTROL
]
=
HID_Device_ioctl
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_READ
]
=
HID_Device_read
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_WRITE
]
=
HID_Device_write
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_CREATE
]
=
HID_Device_create
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_CLOSE
]
=
HID_Device_close
;
driver
->
PNPDispatch
=
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_PNP
];
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_PNP
]
=
HID_PNP_Dispatch
;
driver
->
AddDevice
=
registration
->
DriverObject
->
DriverExtension
->
AddDevice
;
registration
->
DriverObject
->
DriverExtension
->
AddDevice
=
PNP_AddDevice
;
driver
->
minidriver
=
*
registration
;
list_add_tail
(
&
minidriver_list
,
&
driver
->
entry
);
return
STATUS_SUCCESS
;
}
NTSTATUS
call_minidriver
(
ULONG
code
,
DEVICE_OBJECT
*
device
,
void
*
in_buff
,
ULONG
in_size
,
void
*
out_buff
,
ULONG
out_size
)
{
IRP
*
irp
;
IO_STATUS_BLOCK
io
;
KEVENT
event
;
KeInitializeEvent
(
&
event
,
NotificationEvent
,
FALSE
);
irp
=
IoBuildDeviceIoControlRequest
(
code
,
device
,
in_buff
,
in_size
,
out_buff
,
out_size
,
TRUE
,
&
event
,
&
io
);
if
(
IoCallDriver
(
device
,
irp
)
==
STATUS_PENDING
)
KeWaitForSingleObject
(
&
event
,
Executive
,
KernelMode
,
FALSE
,
NULL
);
return
io
.
u
.
Status
;
}
dlls/hidclass.sys/pnp.c
View file @
e30a1452
/*
*
WINE HID Pseudo-Plug and Play support
*
Human Interface Device class driver
*
* Copyright 2015 Aric Stewart
*
...
...
@@ -30,6 +30,19 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
hid
);
static
struct
list
minidriver_list
=
LIST_INIT
(
minidriver_list
);
static
minidriver
*
find_minidriver
(
DRIVER_OBJECT
*
driver
)
{
minidriver
*
md
;
LIST_FOR_EACH_ENTRY
(
md
,
&
minidriver_list
,
minidriver
,
entry
)
{
if
(
md
->
minidriver
.
DriverObject
==
driver
)
return
md
;
}
return
NULL
;
}
static
NTSTATUS
WINAPI
internalComplete
(
DEVICE_OBJECT
*
deviceObject
,
IRP
*
irp
,
void
*
context
)
{
...
...
@@ -69,7 +82,7 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
return
status
;
}
NTSTATUS
WINAPI
PNP_AddD
evice
(
DRIVER_OBJECT
*
driver
,
DEVICE_OBJECT
*
PDO
)
static
NTSTATUS
WINAPI
driver_add_d
evice
(
DRIVER_OBJECT
*
driver
,
DEVICE_OBJECT
*
PDO
)
{
WCHAR
device_id
[
MAX_DEVICE_ID_LEN
],
instance_id
[
MAX_DEVICE_ID_LEN
];
DEVICE_OBJECT
*
device
=
NULL
;
...
...
@@ -211,7 +224,7 @@ static NTSTATUS remove_device(minidriver *minidriver, DEVICE_OBJECT *device, IRP
return
rc
;
}
NTSTATUS
WINAPI
HID_PNP_Dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
static
NTSTATUS
WINAPI
driver_pnp
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
NTSTATUS
rc
=
STATUS_NOT_SUPPORTED
;
IO_STACK_LOCATION
*
irpsp
=
IoGetCurrentIrpStackLocation
(
irp
);
...
...
@@ -296,3 +309,63 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
rc
;
}
static
void
WINAPI
driver_unload
(
DRIVER_OBJECT
*
driver
)
{
minidriver
*
md
;
TRACE
(
"
\n
"
);
if
((
md
=
find_minidriver
(
driver
)))
{
if
(
md
->
DriverUnload
)
md
->
DriverUnload
(
md
->
minidriver
.
DriverObject
);
list_remove
(
&
md
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
md
);
}
}
NTSTATUS
WINAPI
HidRegisterMinidriver
(
HID_MINIDRIVER_REGISTRATION
*
registration
)
{
minidriver
*
driver
;
if
(
!
(
driver
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
driver
))))
return
STATUS_NO_MEMORY
;
driver
->
DriverUnload
=
registration
->
DriverObject
->
DriverUnload
;
registration
->
DriverObject
->
DriverUnload
=
driver_unload
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_DEVICE_CONTROL
]
=
HID_Device_ioctl
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_READ
]
=
HID_Device_read
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_WRITE
]
=
HID_Device_write
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_CREATE
]
=
HID_Device_create
;
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_CLOSE
]
=
HID_Device_close
;
driver
->
PNPDispatch
=
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_PNP
];
registration
->
DriverObject
->
MajorFunction
[
IRP_MJ_PNP
]
=
driver_pnp
;
driver
->
AddDevice
=
registration
->
DriverObject
->
DriverExtension
->
AddDevice
;
registration
->
DriverObject
->
DriverExtension
->
AddDevice
=
driver_add_device
;
driver
->
minidriver
=
*
registration
;
list_add_tail
(
&
minidriver_list
,
&
driver
->
entry
);
return
STATUS_SUCCESS
;
}
NTSTATUS
call_minidriver
(
ULONG
code
,
DEVICE_OBJECT
*
device
,
void
*
in_buff
,
ULONG
in_size
,
void
*
out_buff
,
ULONG
out_size
)
{
IRP
*
irp
;
IO_STATUS_BLOCK
io
;
KEVENT
event
;
KeInitializeEvent
(
&
event
,
NotificationEvent
,
FALSE
);
irp
=
IoBuildDeviceIoControlRequest
(
code
,
device
,
in_buff
,
in_size
,
out_buff
,
out_size
,
TRUE
,
&
event
,
&
io
);
if
(
IoCallDriver
(
device
,
irp
)
==
STATUS_PENDING
)
KeWaitForSingleObject
(
&
event
,
Executive
,
KernelMode
,
FALSE
,
NULL
);
return
io
.
u
.
Status
;
}
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