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.

216 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. keyboard.hxx
  5. Abstract:
  6. This module contains the declaration for the KEYBOARD class.
  7. The KEYBOARD class is a derived from BUFFER_STREAM that provides
  8. methods to access the keyboard as a stream of bytes with read-only
  9. access.
  10. It also provides some methods that set/reset the keyboard mode.
  11. Author:
  12. Jaime Sasson (jaimes) 21-Mar-1991
  13. Environment:
  14. ULIB, User Mode
  15. --*/
  16. #if !defined( _KEYBOARD_ )
  17. #define _KEYBOARD_
  18. #include "bufstrm.hxx"
  19. DECLARE_CLASS( KEYBOARD );
  20. class KEYBOARD : public BUFFER_STREAM {
  21. public:
  22. ULIB_EXPORT
  23. DECLARE_CONSTRUCTOR( KEYBOARD );
  24. ULIB_EXPORT
  25. DECLARE_CAST_MEMBER_FUNCTION( KEYBOARD );
  26. NONVIRTUAL
  27. ~KEYBOARD (
  28. );
  29. NONVIRTUAL
  30. ULIB_EXPORT
  31. BOOLEAN
  32. Initialize(
  33. IN BOOLEAN LineMode DEFAULT TRUE,
  34. IN BOOLEAN EchoMode DEFAULT TRUE
  35. );
  36. STATIC
  37. ULIB_EXPORT
  38. BOOLEAN
  39. DisableBreakHandling (
  40. );
  41. NONVIRTUAL
  42. BOOLEAN
  43. DisableEchoMode(
  44. );
  45. NONVIRTUAL
  46. ULIB_EXPORT
  47. BOOLEAN
  48. DisableLineMode(
  49. );
  50. STATIC
  51. ULIB_EXPORT
  52. BOOLEAN
  53. EnableBreakHandling (
  54. );
  55. NONVIRTUAL
  56. BOOLEAN
  57. EnableEchoMode(
  58. );
  59. NONVIRTUAL
  60. ULIB_EXPORT
  61. BOOLEAN
  62. EnableLineMode(
  63. );
  64. VIRTUAL
  65. BOOLEAN
  66. EndOfFile(
  67. ) CONST;
  68. VIRTUAL
  69. BOOLEAN
  70. FillBuffer(
  71. IN PBYTE Buffer,
  72. IN ULONG BufferSize,
  73. OUT PULONG BytesRead
  74. );
  75. NONVIRTUAL
  76. ULIB_EXPORT
  77. BOOLEAN
  78. Flush(
  79. );
  80. STATIC
  81. ULIB_EXPORT
  82. BOOLEAN
  83. GotABreak (
  84. );
  85. NONVIRTUAL
  86. BOOLEAN
  87. IsEchoModeEnabled(
  88. OUT PBOOLEAN EchoInput
  89. ) CONST;
  90. NONVIRTUAL
  91. ULIB_EXPORT
  92. BOOLEAN
  93. IsKeyAvailable(
  94. OUT PBOOLEAN Available
  95. ) CONST;
  96. NONVIRTUAL
  97. BOOLEAN
  98. IsLineModeEnabled(
  99. OUT PBOOLEAN LineMode
  100. ) CONST;
  101. VIRTUAL
  102. STREAMACCESS
  103. QueryAccess(
  104. ) CONST;
  105. NONVIRTUAL
  106. ULONG
  107. QueryDelay (
  108. ) CONST;
  109. VIRTUAL
  110. HANDLE
  111. QueryHandle(
  112. ) CONST;
  113. NONVIRTUAL
  114. ULONG
  115. QuerySpeed (
  116. ) CONST;
  117. NONVIRTUAL
  118. BOOLEAN
  119. SetDelay (
  120. IN ULONG Delay
  121. ) CONST;
  122. NONVIRTUAL
  123. BOOLEAN
  124. SetSpeed (
  125. IN ULONG Speed
  126. ) CONST;
  127. NONVIRTUAL
  128. ULIB_EXPORT
  129. CONST
  130. PBOOL
  131. GetPFlagBreak (
  132. VOID
  133. ) CONST;
  134. NONVIRTUAL
  135. ULIB_EXPORT
  136. VOID
  137. DoNotRestoreConsoleMode(
  138. );
  139. protected:
  140. NONVIRTUAL
  141. VOID
  142. Construct(
  143. );
  144. private:
  145. HANDLE _KeyboardHandle;
  146. ULONG _PreviousMode;
  147. BOOLEAN _DoNotRestoreConsoleMode;
  148. BOOLEAN _FlagCtrlZ;
  149. STATIC BOOL _FlagBreak;
  150. NONVIRTUAL
  151. BOOLEAN
  152. CheckForAsciiKey(
  153. IN PINPUT_RECORD InputRecord,
  154. IN ULONG NumberOfInputRecords
  155. ) CONST;
  156. STATIC
  157. BOOL
  158. BreakHandler (
  159. IN ULONG CtrlType
  160. );
  161. };
  162. #endif // _KEYBOARD_