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
b95027f0
Commit
b95027f0
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 IOCTL_GET(SET)_NUM_DEVICE_INPUT_BUFFERS.
Signed-off-by:
Aric Stewart
<
aric@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d03b8780
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
+65
-0
buffer.c
dlls/hidclass.sys/buffer.c
+35
-0
device.c
dlls/hidclass.sys/device.c
+28
-0
hid.h
dlls/hidclass.sys/hid.h
+2
-0
No files found.
dlls/hidclass.sys/buffer.c
View file @
b95027f0
...
...
@@ -27,6 +27,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
hid
);
#define BASE_BUFFER_SIZE 32
#define MIN_BUFFER_SIZE 2
#define MAX_BUFFER_SIZE 512
struct
ReportRingBuffer
{
...
...
@@ -85,6 +87,39 @@ UINT RingBuffer_GetBufferSize(struct ReportRingBuffer *ring)
return
ring
->
buffer_size
;
}
UINT
RingBuffer_GetSize
(
struct
ReportRingBuffer
*
ring
)
{
return
ring
->
size
;
}
NTSTATUS
RingBuffer_SetSize
(
struct
ReportRingBuffer
*
ring
,
UINT
size
)
{
BYTE
*
new_buffer
;
int
i
;
if
(
size
<
MIN_BUFFER_SIZE
||
size
>
MAX_BUFFER_SIZE
||
size
==
ring
->
size
)
return
STATUS_INVALID_PARAMETER
;
EnterCriticalSection
(
&
ring
->
lock
);
ring
->
start
=
ring
->
end
=
0
;
for
(
i
=
0
;
i
<
ring
->
pointer_alloc
;
i
++
)
{
if
(
ring
->
pointers
[
i
]
!=
0xffffffff
)
ring
->
pointers
[
i
]
=
0
;
}
new_buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ring
->
buffer_size
*
size
);
if
(
!
new_buffer
)
{
LeaveCriticalSection
(
&
ring
->
lock
);
return
STATUS_NO_MEMORY
;
}
HeapFree
(
GetProcessHeap
(),
0
,
ring
->
buffer
);
ring
->
buffer
=
new_buffer
;
ring
->
size
=
size
;
LeaveCriticalSection
(
&
ring
->
lock
);
return
STATUS_SUCCESS
;
}
void
RingBuffer_Read
(
struct
ReportRingBuffer
*
ring
,
UINT
index
,
void
*
output
,
UINT
*
size
)
{
void
*
ret
=
NULL
;
...
...
dlls/hidclass.sys/device.c
View file @
b95027f0
...
...
@@ -512,6 +512,34 @@ NTSTATUS WINAPI HID_Device_ioctl(DEVICE_OBJECT *device, IRP *irp)
irp
->
IoStatus
.
u
.
Status
=
STATUS_SUCCESS
;
break
;
}
case
IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS
:
{
irp
->
IoStatus
.
Information
=
0
;
if
(
irpsp
->
Parameters
.
DeviceIoControl
.
InputBufferLength
!=
sizeof
(
ULONG
))
{
irp
->
IoStatus
.
u
.
Status
=
rc
=
STATUS_BUFFER_OVERFLOW
;
}
else
{
rc
=
RingBuffer_SetSize
(
extension
->
ring_buffer
,
*
(
ULONG
*
)
irp
->
AssociatedIrp
.
SystemBuffer
);
irp
->
IoStatus
.
u
.
Status
=
rc
;
}
break
;
}
case
IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS
:
{
if
(
irpsp
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
<
sizeof
(
ULONG
))
{
irp
->
IoStatus
.
u
.
Status
=
rc
=
STATUS_BUFFER_TOO_SMALL
;
}
else
{
*
(
ULONG
*
)
irp
->
AssociatedIrp
.
SystemBuffer
=
RingBuffer_GetSize
(
extension
->
ring_buffer
);
rc
=
irp
->
IoStatus
.
u
.
Status
=
STATUS_SUCCESS
;
}
break
;
}
default:
{
ULONG
code
=
irpsp
->
Parameters
.
DeviceIoControl
.
IoControlCode
;
...
...
dlls/hidclass.sys/hid.h
View file @
b95027f0
...
...
@@ -61,8 +61,10 @@ UINT RingBuffer_AddPointer(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
void
RingBuffer_RemovePointer
(
struct
ReportRingBuffer
*
ring
,
UINT
index
)
DECLSPEC_HIDDEN
;
void
RingBuffer_Read
(
struct
ReportRingBuffer
*
buffer
,
UINT
index
,
void
*
output
,
UINT
*
size
)
DECLSPEC_HIDDEN
;
UINT
RingBuffer_GetBufferSize
(
struct
ReportRingBuffer
*
buffer
)
DECLSPEC_HIDDEN
;
UINT
RingBuffer_GetSize
(
struct
ReportRingBuffer
*
buffer
)
DECLSPEC_HIDDEN
;
void
RingBuffer_Destroy
(
struct
ReportRingBuffer
*
buffer
)
DECLSPEC_HIDDEN
;
struct
ReportRingBuffer
*
RingBuffer_Create
(
UINT
buffer_size
)
DECLSPEC_HIDDEN
;
NTSTATUS
RingBuffer_SetSize
(
struct
ReportRingBuffer
*
buffer
,
UINT
size
)
DECLSPEC_HIDDEN
;
typedef
struct
_minidriver
{
...
...
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