ReactOS 0.4.15-dev-7907-g95bf896
internaldevctl.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Serial mouse driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/input/sermouse/fdo.c
5 * PURPOSE: IRP_MJ_INTERNAL_DEVICE_CONTROL operations
6 * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
7 */
8
9#include "sermouse.h"
10
11#include <debug.h>
12
16 IN PIRP Irp)
17{
18 PSERMOUSE_DEVICE_EXTENSION DeviceExtension;
21
22 DeviceExtension = (PSERMOUSE_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
24
25 switch (Stack->Parameters.DeviceIoControl.IoControlCode)
26 {
28 {
29 TRACE_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_MOUSE_CONNECT\n");
30 DeviceExtension->ConnectData =
31 *((PCONNECT_DATA)Stack->Parameters.DeviceIoControl.Type3InputBuffer);
33 break;
34 }
36 {
37 TRACE_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_MOUSE_DISCONNECT\n");
38
39 /* Ask read loop to end */
40 KeSetEvent(&DeviceExtension->StopWorkerThreadEvent, (KPRIORITY)0, FALSE);
42 break;
43 }
45 {
46 TRACE_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_MOUSE_QUERY_ATTRIBUTES\n");
47 if (Stack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(MOUSE_ATTRIBUTES))
48 {
49 *(PMOUSE_ATTRIBUTES)Irp->AssociatedIrp.SystemBuffer =
50 DeviceExtension->AttributesInformation;
51 Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES);
53 }
54 else
55 {
57 }
58 break;
59 }
60 default:
61 {
62 WARN_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
63 Stack->Parameters.DeviceIoControl.IoControlCode);
66 break;
67 }
68 }
69
70 Irp->IoStatus.Status = Status;
72 {
75 }
76 else
77 {
79 }
80
81 return Status;
82}
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 FALSE
Definition: types.h:117
#define TRACE_(x)
Definition: compat.h:76
LONG KPRIORITY
Definition: compat.h:803
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
Status
Definition: gdiplustypes.h:25
IoMarkIrpPending(Irp)
struct _CONNECT_DATA * PCONNECT_DATA
#define IOCTL_INTERNAL_MOUSE_DISCONNECT
Definition: kbdmou.h:71
#define IOCTL_INTERNAL_MOUSE_CONNECT
Definition: kbdmou.h:68
#define ASSERT(a)
Definition: mode.c:44
struct _MOUSE_ATTRIBUTES * PMOUSE_ATTRIBUTES
#define IOCTL_MOUSE_QUERY_ATTRIBUTES
Definition: ntddmou.h:32
VOID NTAPI IoStartPacket(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PULONG Key, IN PDRIVER_CANCEL CancelFunction)
Definition: device.c:1876
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define WARN_(ch,...)
Definition: debug.h:157
DRIVER_DISPATCH SermouseInternalDeviceControl
Definition: sermouse.h:97
struct _SERMOUSE_DEVICE_EXTENSION * PSERMOUSE_DEVICE_EXTENSION
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
CONNECT_DATA ConnectData
Definition: sermouse.h:67
MOUSE_ATTRIBUTES AttributesInformation
Definition: sermouse.h:72
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
#define IO_NO_INCREMENT
Definition: iotypes.h:598