home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / cwin / c.exe / $INSTDIR / include / ddk / ntdd8042.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-12-15  |  5.6 KB  |  219 lines

  1. /*
  2.  * ntdd8042.h
  3.  *
  4.  * i8042 IOCTL interface.
  5.  *
  6.  * This file is part of the w32api package.
  7.  *
  8.  * Contributors:
  9.  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
  10.  *
  11.  * THIS SOFTWARE IS NOT COPYRIGHTED
  12.  *
  13.  * This source code is offered for use in the public domain. You may
  14.  * use, modify or distribute it freely.
  15.  *
  16.  * This code is distributed in the hope that it will be useful but
  17.  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  18.  * DISCLAIMED. This includes but is not limited to warranties of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  */
  22.  
  23. #ifndef __NTDD8042_H
  24. #define __NTDD8042_H
  25.  
  26. #if __GNUC__ >=3
  27. #pragma GCC system_header
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #pragma pack(push,4)
  35.  
  36. #include "ntddk.h"
  37. #include "ntddkbd.h"
  38. #include "ntddmou.h"
  39.  
  40.  
  41. #define IOCTL_INTERNAL_I8042_CONTROLLER_WRITE_BUFFER \
  42.   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF2, METHOD_NEITHER, FILE_ANY_ACCESS)
  43.  
  44. #define IOCTL_INTERNAL_I8042_HOOK_KEYBOARD \
  45.   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF0, METHOD_NEITHER, FILE_ANY_ACCESS)
  46.  
  47. #define IOCTL_INTERNAL_I8042_KEYBOARD_START_INFORMATION \
  48.   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF3, METHOD_NEITHER, FILE_ANY_ACCESS)
  49.  
  50. #define IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER \
  51.   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF1, METHOD_NEITHER, FILE_ANY_ACCESS)
  52.  
  53. #define IOCTL_INTERNAL_I8042_HOOK_MOUSE \
  54.   CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF0, METHOD_NEITHER, FILE_ANY_ACCESS)
  55.  
  56. #define IOCTL_INTERNAL_I8042_MOUSE_START_INFORMATION \
  57.   CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF3, METHOD_NEITHER, FILE_ANY_ACCESS)
  58.  
  59. #define IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER \
  60.   CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF1, METHOD_NEITHER, FILE_ANY_ACCESS)
  61.  
  62. #define I8042_POWER_SYS_BUTTON            0x0001
  63. #define I8042_SLEEP_SYS_BUTTON            0x0002
  64. #define I8042_WAKE_SYS_BUTTON             0x0004
  65. #define I8042_SYS_BUTTONS                 (I8042_POWER_SYS_BUTTON | \
  66.                                            I8042_SLEEP_SYS_BUTTON | \
  67.                                            I8042_WAKE_SYS_BUTTON)
  68.  
  69. typedef enum _TRANSMIT_STATE {
  70.   Idle = 0,
  71.   SendingBytes
  72. } TRANSMIT_STATE;
  73.  
  74. typedef struct _OUTPUT_PACKET {
  75.   PUCHAR  Bytes;
  76.   ULONG  CurrentByte;
  77.   ULONG  ByteCount;
  78.   TRANSMIT_STATE  State;
  79. } OUTPUT_PACKET, *POUTPUT_PACKET;
  80.  
  81. typedef enum _KEYBOARD_SCAN_STATE {
  82.   Normal,
  83.   GotE0,
  84.   GotE1
  85. } KEYBOARD_SCAN_STATE, *PKEYBOARD_SCAN_STATE;
  86.  
  87. typedef enum _MOUSE_STATE {
  88.   MouseIdle,
  89.   XMovement,
  90.   YMovement,
  91.   ZMovement,
  92.   MouseExpectingACK,
  93.   MouseResetting
  94. } MOUSE_STATE, *PMOUSE_STATE;
  95.  
  96. typedef enum _MOUSE_RESET_SUBSTATE {
  97.     ExpectingReset,
  98.     ExpectingResetId,
  99.     ExpectingGetDeviceIdACK,
  100.     ExpectingGetDeviceIdValue,
  101.     ExpectingSetResolutionDefaultACK,
  102.     ExpectingSetResolutionDefaultValueACK,
  103.     ExpectingSetResolutionACK,
  104.     ExpectingSetResolutionValueACK,
  105.     ExpectingSetScaling1to1ACK,
  106.     ExpectingSetScaling1to1ACK2,
  107.     ExpectingSetScaling1to1ACK3,
  108.     ExpectingReadMouseStatusACK,
  109.     ExpectingReadMouseStatusByte1,
  110.     ExpectingReadMouseStatusByte2,
  111.     ExpectingReadMouseStatusByte3,
  112.     StartPnPIdDetection,
  113.     ExpectingLoopSetSamplingRateACK,
  114.     ExpectingLoopSetSamplingRateValueACK,
  115.     ExpectingPnpIdByte1,
  116.     ExpectingPnpIdByte2,
  117.     ExpectingPnpIdByte3,
  118.     ExpectingPnpIdByte4,
  119.     ExpectingPnpIdByte5,
  120.     ExpectingPnpIdByte6,
  121.     ExpectingPnpIdByte7,
  122.     EnableWheel,
  123.     Enable5Buttons,
  124.     ExpectingGetDeviceId2ACK,
  125.     ExpectingGetDeviceId2Value,
  126.     ExpectingSetSamplingRateACK,
  127.     ExpectingSetSamplingRateValueACK,
  128.     ExpectingEnableACK,
  129.     ExpectingFinalResolutionACK,
  130.     ExpectingFinalResolutionValueACK,
  131.     ExpectingGetDeviceIdDetectACK,
  132.     ExpectingGetDeviceIdDetectValue,
  133.     CustomHookStateMinimum = 100,
  134.     CustomHookStateMaximum = 999,
  135.     I8042ReservedMinimum = 1000
  136. } MOUSE_RESET_SUBSTATE, *PMOUSE_RESET_SUBSTATE;
  137.  
  138. typedef struct _INTERNAL_I8042_START_INFORMATION {
  139.   ULONG  Size;
  140.   PKINTERRUPT  InterruptObject;
  141.   ULONG  Reserved[8];
  142. } INTERNAL_I8042_START_INFORMATION, *PINTERNAL_I8042_START_INFORMATION;
  143.  
  144. typedef VOID DDKAPI
  145. (*PI8042_ISR_WRITE_PORT)(
  146.   IN PVOID  Context,
  147.   IN UCHAR  Value);
  148.  
  149. typedef VOID DDKAPI
  150. (*PI8042_QUEUE_PACKET)(
  151.   IN PVOID  Context);
  152.  
  153. typedef NTSTATUS DDKAPI
  154. (*PI8042_SYNCH_READ_PORT) (
  155.   IN PVOID  Context,
  156.   OUT PUCHAR  Value,
  157.   IN BOOLEAN  WaitForACK);
  158.  
  159. typedef NTSTATUS DDKAPI
  160. (*PI8042_SYNCH_WRITE_PORT)(
  161.   IN PVOID  Context,
  162.   IN UCHAR  Value,
  163.   IN BOOLEAN  WaitForACK);
  164.  
  165.  
  166. typedef NTSTATUS DDKAPI
  167. (*PI8042_KEYBOARD_INITIALIZATION_ROUTINE)(
  168.   IN PVOID  InitializationContext,
  169.   IN PVOID  SynchFuncContext,
  170.   IN PI8042_SYNCH_READ_PORT  ReadPort,
  171.   IN PI8042_SYNCH_WRITE_PORT  WritePort,
  172.   OUT PBOOLEAN  TurnTranslationOn);
  173.  
  174. typedef BOOLEAN DDKAPI
  175. (*PI8042_KEYBOARD_ISR)(
  176.   PVOID  IsrContext,
  177.   PKEYBOARD_INPUT_DATA  CurrentInput,
  178.   POUTPUT_PACKET  CurrentOutput,
  179.   UCHAR  StatusByte,
  180.   PUCHAR  Byte,
  181.   PBOOLEAN  ContinueProcessing,
  182.   PKEYBOARD_SCAN_STATE  ScanState);
  183.  
  184. typedef struct _INTERNAL_I8042_HOOK_KEYBOARD {
  185.     OUT PVOID  Context;
  186.     OUT PI8042_KEYBOARD_INITIALIZATION_ROUTINE  InitializationRoutine;
  187.     OUT PI8042_KEYBOARD_ISR  IsrRoutine;
  188.     IN PI8042_ISR_WRITE_PORT  IsrWritePort;
  189.     IN PI8042_QUEUE_PACKET  QueueKeyboardPacket;
  190.     IN PVOID  CallContext;
  191. } INTERNAL_I8042_HOOK_KEYBOARD, *PINTERNAL_I8042_HOOK_KEYBOARD;
  192.  
  193. typedef BOOLEAN DDKAPI
  194. (*PI8042_MOUSE_ISR)(
  195.   PVOID  IsrContext,
  196.   PMOUSE_INPUT_DATA  CurrentInput,
  197.   POUTPUT_PACKET  CurrentOutput,
  198.   UCHAR  StatusByte,
  199.   PUCHAR  Byte,
  200.   PBOOLEAN  ContinueProcessing,
  201.   PMOUSE_STATE  MouseState,
  202.   PMOUSE_RESET_SUBSTATE  ResetSubState);
  203.  
  204. typedef struct _INTERNAL_I8042_HOOK_MOUSE {
  205.   OUT PVOID  Context;
  206.   OUT PI8042_MOUSE_ISR  IsrRoutine;
  207.   IN PI8042_ISR_WRITE_PORT  IsrWritePort;
  208.   IN PI8042_QUEUE_PACKET  QueueMousePacket;
  209.   IN PVOID  CallContext;
  210. } INTERNAL_I8042_HOOK_MOUSE, *PINTERNAL_I8042_HOOK_MOUSE;
  211.  
  212. #pragma pack(pop)
  213.  
  214. #ifdef __cplusplus
  215. }
  216. #endif
  217.  
  218. #endif /* __NTDD8042_H */
  219.