ReactOS  0.4.14-dev-49-gfb4591c
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;
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 }
#define IN
Definition: typedefs.h:38
_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:454
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
NTSTATUS NTAPI SermouseInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
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:2966
IoMarkIrpPending(Irp)
#define WARN_(ch,...)
Definition: debug.h:157