ReactOS  0.4.15-dev-341-g17c5fb8
internaldevctl.c File Reference
#include "sermouse.h"
#include <debug.h>
Include dependency graph for internaldevctl.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI SermouseInternalDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Function Documentation

◆ SermouseInternalDeviceControl()

NTSTATUS NTAPI SermouseInternalDeviceControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 14 of file internaldevctl.c.

17 {
18  PSERMOUSE_DEVICE_EXTENSION DeviceExtension;
19  PIO_STACK_LOCATION Stack;
21 
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);
64  ASSERT(FALSE);
66  break;
67  }
68  }
69 
70  Irp->IoStatus.Status = Status;
71  if (Status == STATUS_PENDING)
72  {
75  }
76  else
77  {
79  }
80 
81  return Status;
82 }
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
struct _SERMOUSE_DEVICE_EXTENSION * PSERMOUSE_DEVICE_EXTENSION
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
LONG KPRIORITY
Definition: compat.h:463
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
VOID NTAPI IoStartPacket(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PULONG Key, IN PDRIVER_CANCEL CancelFunction)
Definition: device.c:1876
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
#define TRACE_(x)
Definition: compat.h:66
#define STATUS_PENDING
Definition: ntstatus.h:82
struct _MOUSE_ATTRIBUTES * PMOUSE_ATTRIBUTES
MOUSE_ATTRIBUTES AttributesInformation
Definition: sermouse.h:72
#define IOCTL_INTERNAL_MOUSE_DISCONNECT
Definition: kbdmou.h:71
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IOCTL_INTERNAL_MOUSE_CONNECT
Definition: kbdmou.h:68
#define IOCTL_MOUSE_QUERY_ATTRIBUTES
Definition: ntddmou.h:32
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define IO_NO_INCREMENT
Definition: iotypes.h:566
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
CONNECT_DATA ConnectData
Definition: sermouse.h:67
struct _CONNECT_DATA * PCONNECT_DATA
return STATUS_SUCCESS
Definition: btrfs.c:3014
IoMarkIrpPending(Irp)
#define WARN_(ch,...)
Definition: debug.h:157