ReactOS 0.4.15-dev-8339-g4028de8
ioctl.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS InPort (Bus) Mouse Driver
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: I/O control handling
5 * COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
6 */
7
8/* INCLUDES *******************************************************************/
9
10#include "inport.h"
11
12#define NDEBUG
13#include <debug.h>
14
15/* FUNCTIONS ******************************************************************/
16
22{
24 PCONNECT_DATA ConnectData;
25 PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
27
28 DPRINT("%s(%p, %p) 0x%X\n", __FUNCTION__, DeviceObject, Irp,
29 IrpSp->Parameters.DeviceIoControl.IoControlCode);
30
31 switch (IrpSp->Parameters.DeviceIoControl.IoControlCode)
32 {
34 if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
35 {
37 break;
38 }
39
40 /* Already connected */
41 if (DeviceExtension->ClassService)
42 {
44 break;
45 }
46
47 ConnectData = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
48
49 DeviceExtension->ClassDeviceObject = ConnectData->ClassDeviceObject;
50 DeviceExtension->ClassService = ConnectData->ClassService;
51
53 break;
54
56 DeviceExtension->ClassService = NULL;
57
59 break;
60
62 if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUSE_ATTRIBUTES))
63 {
65 break;
66 }
67
68 *(PMOUSE_ATTRIBUTES)Irp->AssociatedIrp.SystemBuffer = DeviceExtension->MouseAttributes;
69 Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES);
70
72 break;
73
74 default:
76 break;
77 }
78
79 Irp->IoStatus.Status = Status;
81
82 return Status;
83}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define __FUNCTION__
Definition: types.h:116
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
NTSTATUS NTAPI InPortInternalDeviceControl(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: ioctl.c:19
Status
Definition: gdiplustypes.h:25
#define IOCTL_INTERNAL_MOUSE_DISCONNECT
Definition: kbdmou.h:71
#define IOCTL_INTERNAL_MOUSE_CONNECT
Definition: kbdmou.h:68
#define _Inout_
Definition: ms_sal.h:378
#define _In_
Definition: ms_sal.h:308
struct _MOUSE_ATTRIBUTES * PMOUSE_ATTRIBUTES
#define IOCTL_MOUSE_QUERY_ATTRIBUTES
Definition: ntddmou.h:32
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:73
PVOID ClassService
Definition: kbdmou.h:82
PDEVICE_OBJECT ClassDeviceObject
Definition: kbdmou.h:81
PDEVICE_OBJECT ClassDeviceObject
Definition: inport.h:66
MOUSE_ATTRIBUTES MouseAttributes
Definition: inport.h:76
struct _IO_STACK_LOCATION::@1574::@1575 DeviceIoControl
union _IO_STACK_LOCATION::@1574 Parameters
#define NTAPI
Definition: typedefs.h:36
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598