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.

253 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. console.h
  5. Abstract:
  6. Interface to the console-management functions for Win32 applications.
  7. Author:
  8. Ramon Juan San Andres (ramonsa) 30-Nov-1990
  9. Revision History:
  10. --*/
  11. //
  12. // Some common typedefs...
  13. //
  14. typedef ULONG ROW, *PROW; // row
  15. typedef ULONG COLUMN, *PCOLUMN; // column
  16. typedef DWORD KBDMODE, *PKBDMODE; // Keyboard mode
  17. typedef DWORD ATTRIBUTE, *PATTRIBUTE; // Screen Attribute
  18. typedef PVOID PSCREEN; // The screen
  19. //
  20. // Console Input Mode flags. They are the same as the NT flags
  21. //
  22. #define CONS_ENABLE_LINE_INPUT ENABLE_LINE_INPUT
  23. #define CONS_ENABLE_PROCESSED_INPUT ENABLE_PROCESSED_INPUT
  24. #define CONS_ENABLE_ECHO_INPUT ENABLE_ECHO_INPUT
  25. #define CONS_ENABLE_WINDOW_INPUT ENABLE_WINDOW_INPUT
  26. #define CONS_ENABLE_MOUSE_INPUT ENABLE_MOUSE_INPUT
  27. //
  28. // Cursor styles
  29. //
  30. #define CURSOR_STYLE_UNDERSCORE 0
  31. #define CURSOR_STYLE_BOX 1
  32. //
  33. // The information about a screen is retrieved in the following
  34. // structure:
  35. //
  36. typedef struct SCREEN_INFORMATION {
  37. ROW NumberOfRows; // Number of rows
  38. COLUMN NumberOfCols; // Number of columns
  39. ROW CursorRow; // Cursor row position
  40. COLUMN CursorCol; // Cursor column position
  41. } SCREEN_INFORMATION, *PSCREEN_INFORMATION;
  42. //
  43. // The information about each keystroke is returned in
  44. // the KBDKEY structure.
  45. //
  46. typedef struct KBDKEY {
  47. WORD Unicode; // character unicode
  48. WORD Scancode; // key scan code
  49. DWORD Flags; // keyboard state flags
  50. } KBDKEY, *PKBDKEY;
  51. //
  52. // The following macros access particular fields within the
  53. // KBDKEY structure. They exist to facilitate porting of OS/2
  54. // programs.
  55. //
  56. #define KBDKEY_ASCII(k) (UCHAR)((k).Unicode)
  57. #define KBDKEY_SCAN(k) ((k).Scancode)
  58. #define KBDKEY_FLAGS(k) ((k).Flags)
  59. #define NEXT_EVENT_NONE 0
  60. #define NEXT_EVENT_KEY 1
  61. #define NEXT_EVENT_WINDOW 2
  62. //
  63. // ControlKeyState flags. They are the same as the NT status flags.
  64. //
  65. #define CONS_RIGHT_ALT_PRESSED RIGHT_ALT_PRESSED
  66. #define CONS_LEFT_ALT_PRESSED LEFT_ALT_PRESSED
  67. #define CONS_RIGHT_CTRL_PRESSED RIGHT_CTRL_PRESSED
  68. #define CONS_LEFT_CTRL_PRESSED LEFT_CTRL_PRESSED
  69. #define CONS_SHIFT_PRESSED SHIFT_PRESSED
  70. #define CONS_NUMLOCK_PRESSED NUMLOCK_ON
  71. #define CONS_SCROLLLOCK_PRESSED SCROLLLOCK_ON
  72. #define CONS_CAPSLOCK_PRESSED CAPSLOCK_ON
  73. #define CONS_ENHANCED_KEY ENHANCED_KEY
  74. //
  75. // Screen Management functions
  76. //
  77. PSCREEN
  78. consoleNewScreen (
  79. void
  80. );
  81. BOOL
  82. consoleCloseScreen (
  83. PSCREEN pScreen
  84. );
  85. PSCREEN
  86. consoleGetCurrentScreen (
  87. void
  88. );
  89. BOOL
  90. consoleSetCurrentScreen (
  91. PSCREEN pScreen
  92. );
  93. BOOL
  94. consoleGetScreenInformation (
  95. PSCREEN pScreen,
  96. PSCREEN_INFORMATION pScreenInformation
  97. );
  98. BOOL
  99. consoleSetScreenSize (
  100. PSCREEN Screen,
  101. ROW Rows,
  102. COLUMN Cols
  103. );
  104. //
  105. // Cursor management
  106. //
  107. BOOL
  108. consoleSetCursor (
  109. PSCREEN pScreen,
  110. ROW Row,
  111. COLUMN Col
  112. );
  113. //
  114. // Cursor style
  115. //
  116. BOOL
  117. consoleSetCursorStyle (
  118. PSCREEN pScreen,
  119. ULONG Style
  120. );
  121. //
  122. // Screen output functions
  123. //
  124. ULONG
  125. consoleWriteLine (
  126. PSCREEN pScreen,
  127. PVOID pBuffer,
  128. ULONG BufferSize,
  129. ROW Row,
  130. COLUMN Col,
  131. ATTRIBUTE Attribute,
  132. BOOL Blank
  133. );
  134. BOOL
  135. consoleShowScreen (
  136. PSCREEN pScreen
  137. );
  138. BOOL
  139. consoleClearScreen (
  140. PSCREEN pScreen,
  141. BOOL ShowScreen
  142. );
  143. BOOL
  144. consoleSetAttribute (
  145. PSCREEN pScreen,
  146. ATTRIBUTE Attribute
  147. );
  148. //
  149. // Input functions
  150. //
  151. BOOL
  152. consoleFlushInput (
  153. void
  154. );
  155. BOOL
  156. consoleIsKeyAvailable (
  157. void
  158. );
  159. BOOL
  160. consoleDoWindow (
  161. void
  162. );
  163. BOOL
  164. consoleGetKey (
  165. PKBDKEY pKey,
  166. BOOL fWait
  167. );
  168. BOOL
  169. consolePutKey (
  170. PKBDKEY pKey
  171. );
  172. BOOL
  173. consolePutMouse (
  174. ROW Row,
  175. COLUMN Col,
  176. DWORD MouseFlags
  177. );
  178. BOOL
  179. consolePeekKey (
  180. PKBDKEY pKey
  181. );
  182. BOOL
  183. consoleGetMode (
  184. PKBDMODE Mode
  185. );
  186. BOOL
  187. consoleSetMode (
  188. KBDMODE Mode
  189. );