Leaked source code of windows server 2003
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.

204 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. kbfilter.h
  5. Abstract:
  6. This module contains the common private declarations for the keyboard
  7. packet filter
  8. Environment:
  9. kernel mode only
  10. Notes:
  11. Revision History:
  12. --*/
  13. #ifndef KBFILTER_H
  14. #define KBFILTER_H
  15. #include "ntddk.h"
  16. #include "kbdmou.h"
  17. #include <ntddkbd.h>
  18. #include <ntdd8042.h>
  19. #define KBFILTER_POOL_TAG (ULONG) 'tlfK'
  20. #undef ExAllocatePool
  21. #define ExAllocatePool(type, size) \
  22. ExAllocatePoolWithTag (type, size, KBFILTER_POOL_TAG)
  23. #if DBG
  24. #define TRAP() DbgBreakPoint()
  25. #define DbgRaiseIrql(_x_,_y_) KeRaiseIrql(_x_,_y_)
  26. #define DbgLowerIrql(_x_) KeLowerIrql(_x_)
  27. #ifndef DebugPrint
  28. #define DebugPrint(_x_) DbgPrint _x_
  29. #endif
  30. #else // DBG
  31. #define TRAP()
  32. #define DbgRaiseIrql(_x_,_y_)
  33. #define DbgLowerIrql(_x_)
  34. #ifndef DebugPrint
  35. #define DebugPrint(_x_)
  36. #endif
  37. #endif
  38. #define MIN(_A_,_B_) (((_A_) < (_B_)) ? (_A_) : (_B_))
  39. typedef struct _DEVICE_EXTENSION
  40. {
  41. //
  42. // A backpointer to the device object for which this is the extension
  43. //
  44. PDEVICE_OBJECT Self;
  45. //
  46. // "THE PDO" (ejected by the root bus or ACPI)
  47. //
  48. PDEVICE_OBJECT PDO;
  49. //
  50. // The top of the stack before this filter was added. AKA the location
  51. // to which all IRPS should be directed.
  52. //
  53. PDEVICE_OBJECT TopOfStack;
  54. //
  55. // Number of creates sent down
  56. //
  57. LONG EnableCount;
  58. //
  59. // The real connect data that this driver reports to
  60. //
  61. CONNECT_DATA UpperConnectData;
  62. //
  63. // Previous initialization and hook routines (and context)
  64. //
  65. PVOID UpperContext;
  66. PI8042_KEYBOARD_INITIALIZATION_ROUTINE UpperInitializationRoutine;
  67. PI8042_KEYBOARD_ISR UpperIsrHook;
  68. //
  69. // Write function from within KbFilter_IsrHook
  70. //
  71. IN PI8042_ISR_WRITE_PORT IsrWritePort;
  72. //
  73. // Queue the current packet (ie the one passed into KbFilter_IsrHook)
  74. //
  75. IN PI8042_QUEUE_PACKET QueueKeyboardPacket;
  76. //
  77. // Context for IsrWritePort, QueueKeyboardPacket
  78. //
  79. IN PVOID CallContext;
  80. //
  81. // current power state of the device
  82. //
  83. DEVICE_POWER_STATE DeviceState;
  84. BOOLEAN Started;
  85. BOOLEAN SurpriseRemoved;
  86. BOOLEAN Removed;
  87. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  88. //
  89. // Prototypes
  90. //
  91. NTSTATUS
  92. KbFilter_AddDevice(
  93. IN PDRIVER_OBJECT DriverObject,
  94. IN PDEVICE_OBJECT BusDeviceObject
  95. );
  96. NTSTATUS
  97. KbFilter_CreateClose (
  98. IN PDEVICE_OBJECT DeviceObject,
  99. IN PIRP Irp
  100. );
  101. NTSTATUS
  102. KbFilter_DispatchPassThrough(
  103. IN PDEVICE_OBJECT DeviceObject,
  104. IN PIRP Irp
  105. );
  106. NTSTATUS
  107. KbFilter_InternIoCtl (
  108. IN PDEVICE_OBJECT DeviceObject,
  109. IN PIRP Irp
  110. );
  111. NTSTATUS
  112. KbFilter_IoCtl (
  113. IN PDEVICE_OBJECT DeviceObject,
  114. IN PIRP Irp
  115. );
  116. NTSTATUS
  117. KbFilter_PnP (
  118. IN PDEVICE_OBJECT DeviceObject,
  119. IN PIRP Irp
  120. );
  121. NTSTATUS
  122. KbFilter_Power (
  123. IN PDEVICE_OBJECT DeviceObject,
  124. IN PIRP Irp
  125. );
  126. NTSTATUS
  127. KbFilter_InitializationRoutine(
  128. IN PDEVICE_OBJECT DeviceObject, // InitializationContext
  129. IN PVOID SynchFuncContext,
  130. IN PI8042_SYNCH_READ_PORT ReadPort,
  131. IN PI8042_SYNCH_WRITE_PORT WritePort,
  132. OUT PBOOLEAN TurnTranslationOn
  133. );
  134. BOOLEAN
  135. KbFilter_IsrHook(
  136. PDEVICE_OBJECT DeviceObject, // IsrContext
  137. PKEYBOARD_INPUT_DATA CurrentInput,
  138. POUTPUT_PACKET CurrentOutput,
  139. UCHAR StatusByte,
  140. PUCHAR DataByte,
  141. PBOOLEAN ContinueProcessing,
  142. PKEYBOARD_SCAN_STATE ScanState
  143. );
  144. VOID
  145. KbFilter_ServiceCallback(
  146. IN PDEVICE_OBJECT DeviceObject,
  147. IN PKEYBOARD_INPUT_DATA InputDataStart,
  148. IN PKEYBOARD_INPUT_DATA InputDataEnd,
  149. IN OUT PULONG InputDataConsumed
  150. );
  151. VOID
  152. KbFilter_Unload (
  153. IN PDRIVER_OBJECT DriverObject
  154. );
  155. #endif // KBFILTER_H