ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

internaldevctl.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:     ReactOS Serial mouse driver
00003  * LICENSE:     GPL - See COPYING in the top level directory
00004  * FILE:        drivers/input/sermouse/fdo.c
00005  * PURPOSE:     IRP_MJ_INTERNAL_DEVICE_CONTROL operations
00006  * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
00007  */
00008 
00009 #include "sermouse.h"
00010 
00011 NTSTATUS NTAPI
00012 SermouseInternalDeviceControl(
00013     IN PDEVICE_OBJECT DeviceObject,
00014     IN PIRP Irp)
00015 {
00016     PSERMOUSE_DEVICE_EXTENSION DeviceExtension;
00017     PIO_STACK_LOCATION Stack;
00018     NTSTATUS Status;
00019 
00020     DeviceExtension = (PSERMOUSE_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
00021     Stack = IoGetCurrentIrpStackLocation(Irp);
00022 
00023     switch (Stack->Parameters.DeviceIoControl.IoControlCode)
00024     {
00025         case IOCTL_INTERNAL_MOUSE_CONNECT:
00026         {
00027             TRACE_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_MOUSE_CONNECT\n");
00028             DeviceExtension->ConnectData =
00029                 *((PCONNECT_DATA)Stack->Parameters.DeviceIoControl.Type3InputBuffer);
00030             Status = STATUS_SUCCESS;
00031             break;
00032         }
00033         case IOCTL_INTERNAL_MOUSE_DISCONNECT:
00034         {
00035             TRACE_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_MOUSE_DISCONNECT\n");
00036 
00037             /* Ask read loop to end */
00038             KeSetEvent(&DeviceExtension->StopWorkerThreadEvent, (KPRIORITY)0, FALSE);
00039             Status = STATUS_SUCCESS;
00040             break;
00041         }
00042         case IOCTL_MOUSE_QUERY_ATTRIBUTES:
00043         {
00044             TRACE_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_MOUSE_QUERY_ATTRIBUTES\n");
00045             if (Stack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(MOUSE_ATTRIBUTES))
00046             {
00047                 *(PMOUSE_ATTRIBUTES)Irp->AssociatedIrp.SystemBuffer =
00048                     DeviceExtension->AttributesInformation;
00049                 Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES);
00050                 Status = STATUS_SUCCESS;
00051             }
00052             else
00053             {
00054                 Status = STATUS_BUFFER_TOO_SMALL;
00055             }
00056             break;
00057         }
00058         default:
00059         {
00060             WARN_(SERMOUSE, "IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
00061                 Stack->Parameters.DeviceIoControl.IoControlCode);
00062             ASSERT(FALSE);
00063             Status = STATUS_INVALID_DEVICE_REQUEST;
00064             break;
00065         }
00066     }
00067 
00068     Irp->IoStatus.Status = Status;
00069     if (Status == STATUS_PENDING)
00070     {
00071         IoMarkIrpPending(Irp);
00072         IoStartPacket(DeviceObject, Irp, NULL, NULL);
00073     }
00074     else
00075     {
00076         IoCompleteRequest(Irp, IO_NO_INCREMENT);
00077     }
00078 
00079     return Status;
00080 }

Generated on Sat May 26 2012 04:26:32 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.