Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.1 KiB

  1. /*************************************************************************
  2. *
  3. * mouse.c
  4. *
  5. * This module contains routines for managing the ICA mouse channel.
  6. *
  7. * Copyright 1998, Microsoft.
  8. *
  9. *
  10. *************************************************************************/
  11. /*
  12. * Includes
  13. */
  14. #include <precomp.h>
  15. #pragma hdrstop
  16. #include <ntddmou.h>
  17. NTSTATUS
  18. IcaDeviceControlMouse(
  19. IN PICA_CHANNEL pChannel,
  20. IN PIRP Irp,
  21. IN PIO_STACK_LOCATION IrpSp
  22. )
  23. /*++
  24. Routine Description:
  25. This is the DeviceControl routine for the ICA mouse channel.
  26. Arguments:
  27. pChannel -- pointer to ICA_CHANNEL object
  28. Irp - Pointer to I/O request packet
  29. IrpSp - pointer to the stack location to use for this request.
  30. Return Value:
  31. NTSTATUS -- Indicates whether the request was successfully queued.
  32. --*/
  33. {
  34. ULONG code;
  35. SD_IOCTL SdIoctl;
  36. PICA_STACK pStack;
  37. NTSTATUS Status;
  38. /*
  39. * Extract the IOCTL control code and process the request.
  40. */
  41. code = IrpSp->Parameters.DeviceIoControl.IoControlCode;
  42. switch ( code ) {
  43. #if 0 // no longer used
  44. /*
  45. * Special IOCTL to allow mouse input data to be fed
  46. * into the mouse channel.
  47. */
  48. case IOCTL_MOUSE_ICA_INPUT :
  49. /*
  50. * Make sure the input data is the correct size.
  51. */
  52. if ( IrpSp->Parameters.DeviceIoControl.InputBufferLength %
  53. sizeof(MOUSE_INPUT_DATA) )
  54. return( STATUS_BUFFER_TOO_SMALL );
  55. /*
  56. * We need a stack object to pass to IcaChannelInputInternal.
  57. * Any one will do so we grab the head of the stack list.
  58. * (There MUST be one for this IOCTL to succeed.)
  59. */
  60. IcaLockConnection( pChannel->pConnect );
  61. if ( IsListEmpty( &pChannel->pConnect->StackHead ) ) {
  62. IcaUnlockConnection( pChannel->pConnect );
  63. return( STATUS_INVALID_DEVICE_REQUEST );
  64. }
  65. pStack = CONTAINING_RECORD( pChannel->pConnect->StackHead.Flink,
  66. ICA_STACK, StackEntry );
  67. IcaReferenceStack( pStack );
  68. IcaUnlockConnection( pChannel->pConnect );
  69. /*
  70. * Send mouse input
  71. */
  72. IcaChannelInputInternal( pStack, Channel_Mouse, 0, NULL,
  73. (PCHAR)IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
  74. IrpSp->Parameters.DeviceIoControl.InputBufferLength );
  75. IcaDereferenceStack( pStack );
  76. Status = STATUS_SUCCESS;
  77. break;
  78. #endif
  79. default:
  80. SdIoctl.IoControlCode = code;
  81. SdIoctl.InputBuffer = Irp->AssociatedIrp.SystemBuffer;
  82. SdIoctl.InputBufferLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
  83. SdIoctl.OutputBuffer = Irp->UserBuffer;
  84. SdIoctl.OutputBufferLength = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
  85. Status = IcaCallDriver( pChannel, SD$IOCTL, &SdIoctl );
  86. break;
  87. }
  88. return( Status );
  89. }