JwaWinCon.pas
上传用户:davidchvip
上传日期:2009-07-28
资源大小:1749k
文件大小:62k
源码类别:

Windows编程

开发平台:

Delphi

  1. {******************************************************************************}
  2. {                                                                       }
  3. { Console Applications API interface Unit for Object Pascal                    }
  4. {                                                                       }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
  6. { Corporation. All Rights Reserved.                                            }
  7. {                 }
  8. { The original file is: wincon.h, released June 2000. The original Pascal      }
  9. { code is: WinCon.pas, released December 2000. The initial developer of the    }
  10. { Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
  11. {                                                                              }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
  13. { Marcel van Brakel. All Rights Reserved.                                      }
  14. {                 }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  16. {                }
  17. { You may retrieve the latest version of this file at the Project JEDI home    }
  18. { page, located at http://delphi-jedi.org or my personal homepage located at   }
  19. { http://members.chello.nl/m.vanbrakel2                                        }
  20. {                }
  21. { The contents of this file are used with permission, subject to the Mozilla   }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at      }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  25. {                                                                              }
  26. { Software distributed under the License is distributed on an "AS IS" basis,   }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License.    }
  29. {                                                                              }
  30. { Alternatively, the contents of this file may be used under the terms of the  }
  31. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  32. { provisions of the LGPL License are applicable instead of those above.        }
  33. { If you wish to allow use of your version of this file only under the terms   }
  34. { of the LGPL License and not to allow others to use your version of this file }
  35. { under the MPL, indicate your decision by deleting  the provisions above and  }
  36. { replace  them with the notice and other provisions required by the LGPL      }
  37. { License.  If you do not delete the provisions above, a recipient may use     }
  38. { your version of this file under either the MPL or the LGPL License.          }
  39. {                 }
  40. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  41. {                 }
  42. {******************************************************************************}
  43. unit JwaWinCon;
  44. {$WEAKPACKAGEUNIT}
  45. {$HPPEMIT ''}
  46. {$HPPEMIT '#include "WinCon.h"'}
  47. {$HPPEMIT ''}
  48. {$I WINDEFINES.INC}
  49. interface
  50. uses
  51.   JwaWinBase, JwaWinType;
  52. type
  53.   PCOORD = ^COORD;
  54.   {$EXTERNALSYM PCOORD}
  55.   _COORD = record
  56.     X: SHORT;
  57.     Y: SHORT;
  58.   end;
  59.   {$EXTERNALSYM _COORD}
  60.   COORD = _COORD;
  61.   {$EXTERNALSYM COORD}
  62.   TCoord = _COORD;
  63.   PSMALL_RECT = ^SMALL_RECT;
  64.   {$EXTERNALSYM PSMALL_RECT}
  65.   _SMALL_RECT = record
  66.     Left: SHORT;
  67.     Top: SHORT;
  68.     Right: SHORT;
  69.     Bottom: SHORT;
  70.   end;
  71.   {$EXTERNALSYM _SMALL_RECT}
  72.   SMALL_RECT = _SMALL_RECT;
  73.   {$EXTERNALSYM SMALL_RECT}
  74.   TSmallRect = SMALL_RECT;
  75.   PSmallRect = PSMALL_RECT;
  76.   TCharUnion = record
  77.     case Integer of
  78.       0: (UnicodeChar: WCHAR);
  79.       1: (AsciiChar: CHAR);
  80.   end;
  81.   PKEY_EVENT_RECORD = ^KEY_EVENT_RECORD;
  82.   {$EXTERNALSYM PKEY_EVENT_RECORD}
  83.   _KEY_EVENT_RECORD = record
  84.     bKeyDown: BOOL;
  85.     wRepeatCount: WORD;
  86.     wVirtualKeyCode: WORD;
  87.     wVirtualScanCode: WORD;
  88.     uChar: TCharUnion;
  89.     dwControlKeyState: DWORD;
  90.   end;
  91.   {$EXTERNALSYM _KEY_EVENT_RECORD}
  92.   KEY_EVENT_RECORD = _KEY_EVENT_RECORD;
  93.   {$EXTERNALSYM KEY_EVENT_RECORD}
  94.   TKeyEventRecord = KEY_EVENT_RECORD;
  95.   PKeyEventRecord = PKEY_EVENT_RECORD;
  96. //
  97. // ControlKeyState flags
  98. //
  99. const
  100.   RIGHT_ALT_PRESSED  = $0001; // the right alt key is pressed.
  101.   {$EXTERNALSYM RIGHT_ALT_PRESSED}
  102.   LEFT_ALT_PRESSED   = $0002; // the left alt key is pressed.
  103.   {$EXTERNALSYM LEFT_ALT_PRESSED}
  104.   RIGHT_CTRL_PRESSED = $0004; // the right ctrl key is pressed.
  105.   {$EXTERNALSYM RIGHT_CTRL_PRESSED}
  106.   LEFT_CTRL_PRESSED  = $0008; // the left ctrl key is pressed.
  107.   {$EXTERNALSYM LEFT_CTRL_PRESSED}
  108.   SHIFT_PRESSED      = $0010; // the shift key is pressed.
  109.   {$EXTERNALSYM SHIFT_PRESSED}
  110.   NUMLOCK_ON         = $0020; // the numlock light is on.
  111.   {$EXTERNALSYM NUMLOCK_ON}
  112.   SCROLLLOCK_ON      = $0040; // the scrolllock light is on.
  113.   {$EXTERNALSYM SCROLLLOCK_ON}
  114.   CAPSLOCK_ON        = $0080; // the capslock light is on.
  115.   {$EXTERNALSYM CAPSLOCK_ON}
  116.   ENHANCED_KEY       = $0100; // the key is enhanced.
  117.   {$EXTERNALSYM ENHANCED_KEY}
  118.   NLS_DBCSCHAR       = $00010000; // DBCS for JPN: SBCS/DBCS mode.
  119.   {$EXTERNALSYM NLS_DBCSCHAR}
  120.   NLS_ALPHANUMERIC   = $00000000; // DBCS for JPN: Alphanumeric mode.
  121.   {$EXTERNALSYM NLS_ALPHANUMERIC}
  122.   NLS_KATAKANA       = $00020000; // DBCS for JPN: Katakana mode.
  123.   {$EXTERNALSYM NLS_KATAKANA}
  124.   NLS_HIRAGANA       = $00040000; // DBCS for JPN: Hiragana mode.
  125.   {$EXTERNALSYM NLS_HIRAGANA}
  126.   NLS_ROMAN          = $00400000; // DBCS for JPN: Roman/Noroman mode.
  127.   {$EXTERNALSYM NLS_ROMAN}
  128.   NLS_IME_CONVERSION = $00800000; // DBCS for JPN: IME conversion.
  129.   {$EXTERNALSYM NLS_IME_CONVERSION}
  130.   NLS_IME_DISABLE    = $20000000; // DBCS for JPN: IME enable/disable.
  131.   {$EXTERNALSYM NLS_IME_DISABLE}
  132. type
  133.   PMOUSE_EVENT_RECORD = ^MOUSE_EVENT_RECORD;
  134.   {$EXTERNALSYM PMOUSE_EVENT_RECORD}
  135.   _MOUSE_EVENT_RECORD = record
  136.     dwMousePosition: COORD;
  137.     dwButtonState: DWORD;
  138.     dwControlKeyState: DWORD;
  139.     dwEventFlags: DWORD;
  140.   end;
  141.   {$EXTERNALSYM _MOUSE_EVENT_RECORD}
  142.   MOUSE_EVENT_RECORD = _MOUSE_EVENT_RECORD;
  143.   {$EXTERNALSYM MOUSE_EVENT_RECORD}
  144.   TMouseEventRecord = MOUSE_EVENT_RECORD;
  145.   PMouseEventRecord = PMOUSE_EVENT_RECORD;
  146. //
  147. // ButtonState flags
  148. //
  149. const
  150.   FROM_LEFT_1ST_BUTTON_PRESSED = $0001;
  151.   {$EXTERNALSYM FROM_LEFT_1ST_BUTTON_PRESSED}
  152.   RIGHTMOST_BUTTON_PRESSED     = $0002;
  153.   {$EXTERNALSYM RIGHTMOST_BUTTON_PRESSED}
  154.   FROM_LEFT_2ND_BUTTON_PRESSED = $0004;
  155.   {$EXTERNALSYM FROM_LEFT_2ND_BUTTON_PRESSED}
  156.   FROM_LEFT_3RD_BUTTON_PRESSED = $0008;
  157.   {$EXTERNALSYM FROM_LEFT_3RD_BUTTON_PRESSED}
  158.   FROM_LEFT_4TH_BUTTON_PRESSED = $0010;
  159.   {$EXTERNALSYM FROM_LEFT_4TH_BUTTON_PRESSED}
  160. //
  161. // EventFlags
  162. //
  163.   MOUSE_MOVED   = $0001;
  164.   {$EXTERNALSYM MOUSE_MOVED}
  165.   DOUBLE_CLICK  = $0002;
  166.   {$EXTERNALSYM DOUBLE_CLICK}
  167.   MOUSE_WHEELED = $0004;
  168.   {$EXTERNALSYM MOUSE_WHEELED}
  169. type
  170.   PWINDOW_BUFFER_SIZE_RECORD = ^WINDOW_BUFFER_SIZE_RECORD;
  171.   {$EXTERNALSYM PWINDOW_BUFFER_SIZE_RECORD}
  172.   _WINDOW_BUFFER_SIZE_RECORD = record
  173.     dwSize: COORD;
  174.   end;
  175.   {$EXTERNALSYM _WINDOW_BUFFER_SIZE_RECORD}
  176.   WINDOW_BUFFER_SIZE_RECORD = _WINDOW_BUFFER_SIZE_RECORD;
  177.   {$EXTERNALSYM WINDOW_BUFFER_SIZE_RECORD}
  178.   TWindowBufferSizeRecord = WINDOW_BUFFER_SIZE_RECORD;
  179.   PWindowBufferSizeRecord = PWINDOW_BUFFER_SIZE_RECORD;
  180.   PMENU_EVENT_RECORD = ^MENU_EVENT_RECORD;
  181.   {$EXTERNALSYM PMENU_EVENT_RECORD}
  182.   _MENU_EVENT_RECORD = record
  183.     dwCommandId: UINT;
  184.   end;
  185.   {$EXTERNALSYM _MENU_EVENT_RECORD}
  186.   MENU_EVENT_RECORD = _MENU_EVENT_RECORD;
  187.   {$EXTERNALSYM MENU_EVENT_RECORD}
  188.   TMenuEventRecord = MENU_EVENT_RECORD;
  189.   PMenuEventRecord = PMENU_EVENT_RECORD;
  190.   PFOCUS_EVENT_RECORD = ^FOCUS_EVENT_RECORD;
  191.   {$EXTERNALSYM PFOCUS_EVENT_RECORD}
  192.   _FOCUS_EVENT_RECORD = record
  193.     bSetFocus: BOOL;
  194.   end;
  195.   {$EXTERNALSYM _FOCUS_EVENT_RECORD}
  196.   FOCUS_EVENT_RECORD = _FOCUS_EVENT_RECORD;
  197.   {$EXTERNALSYM FOCUS_EVENT_RECORD}
  198.   TFocusEventRecord = FOCUS_EVENT_RECORD;
  199.   PFocusEventRecord = PFOCUS_EVENT_RECORD;
  200.   PINPUT_RECORD = ^INPUT_RECORD;
  201.   {$EXTERNALSYM PINPUT_RECORD}
  202.   _INPUT_RECORD = record
  203.     EventType: WORD;
  204.     case Integer of
  205.       0: (KeyEvent: KEY_EVENT_RECORD);
  206.       1: (MouseEvent: MOUSE_EVENT_RECORD);
  207.       2: (WindowBufferSizeEvent: WINDOW_BUFFER_SIZE_RECORD);
  208.       3: (MenuEvent: MENU_EVENT_RECORD);
  209.       4: (FocusEvent: FOCUS_EVENT_RECORD);
  210.   end;
  211.   {$EXTERNALSYM _INPUT_RECORD}
  212.   INPUT_RECORD = _INPUT_RECORD;
  213.   {$EXTERNALSYM INPUT_RECORD}
  214.   TInputRecord = INPUT_RECORD;
  215.   PInputRecord = PINPUT_RECORD;
  216. //
  217. //  EventType flags:
  218. //
  219. const
  220.   KEY_EVENT                = $0001; // Event contains key event record
  221.   {$EXTERNALSYM KEY_EVENT}
  222.   MOUSE_EVENT              = $0002; // Event contains mouse event record
  223.   {$EXTERNALSYM MOUSE_EVENT}
  224.   WINDOW_BUFFER_SIZE_EVENT = $0004; // Event contains window change event record
  225.   {$EXTERNALSYM WINDOW_BUFFER_SIZE_EVENT}
  226.   MENU_EVENT               = $0008; // Event contains menu event record
  227.   {$EXTERNALSYM MENU_EVENT}
  228.   FOCUS_EVENT              = $0010; // event contains focus change
  229.   {$EXTERNALSYM FOCUS_EVENT}
  230. type
  231.   PCHAR_INFO = ^CHAR_INFO;
  232.   {$EXTERNALSYM PCHAR_INFO}
  233.   _CHAR_INFO = record
  234.     uChar: TCharUnion;
  235.     Attributes: WORD;
  236.   end;
  237.   {$EXTERNALSYM _CHAR_INFO}
  238.   CHAR_INFO = _CHAR_INFO;
  239.   {$EXTERNALSYM CHAR_INFO}
  240.   TCharInfo = CHAR_INFO;
  241.   PCharInfo = PCHAR_INFO;
  242. //
  243. // Attributes flags:
  244. //
  245. const
  246.   FOREGROUND_BLUE            = $0001; // text color contains blue.
  247.   {$EXTERNALSYM FOREGROUND_BLUE}
  248.   FOREGROUND_GREEN           = $0002; // text color contains green.
  249.   {$EXTERNALSYM FOREGROUND_GREEN}
  250.   FOREGROUND_RED             = $0004; // text color contains red.
  251.   {$EXTERNALSYM FOREGROUND_RED}
  252.   FOREGROUND_INTENSITY       = $0008; // text color is intensified.
  253.   {$EXTERNALSYM FOREGROUND_INTENSITY}
  254.   BACKGROUND_BLUE            = $0010; // background color contains blue.
  255.   {$EXTERNALSYM BACKGROUND_BLUE}
  256.   BACKGROUND_GREEN           = $0020; // background color contains green.
  257.   {$EXTERNALSYM BACKGROUND_GREEN}
  258.   BACKGROUND_RED             = $0040; // background color contains red.
  259.   {$EXTERNALSYM BACKGROUND_RED}
  260.   BACKGROUND_INTENSITY       = $0080; // background color is intensified.
  261.   {$EXTERNALSYM BACKGROUND_INTENSITY}
  262.   COMMON_LVB_LEADING_BYTE    = $0100; // Leading Byte of DBCS
  263.   {$EXTERNALSYM COMMON_LVB_LEADING_BYTE}
  264.   COMMON_LVB_TRAILING_BYTE   = $0200; // Trailing Byte of DBCS
  265.   {$EXTERNALSYM COMMON_LVB_TRAILING_BYTE}
  266.   COMMON_LVB_GRID_HORIZONTAL = $0400; // DBCS: Grid attribute: top horizontal.
  267.   {$EXTERNALSYM COMMON_LVB_GRID_HORIZONTAL}
  268.   COMMON_LVB_GRID_LVERTICAL  = $0800; // DBCS: Grid attribute: left vertical.
  269.   {$EXTERNALSYM COMMON_LVB_GRID_LVERTICAL}
  270.   COMMON_LVB_GRID_RVERTICAL  = $1000; // DBCS: Grid attribute: right vertical.
  271.   {$EXTERNALSYM COMMON_LVB_GRID_RVERTICAL}
  272.   COMMON_LVB_REVERSE_VIDEO   = $4000; // DBCS: Reverse fore/back ground attribute.
  273.   {$EXTERNALSYM COMMON_LVB_REVERSE_VIDEO}
  274.   COMMON_LVB_UNDERSCORE      = $8000; // DBCS: Underscore.
  275.   {$EXTERNALSYM COMMON_LVB_UNDERSCORE}
  276.   COMMON_LVB_SBCSDBCS        = $0300; // SBCS or DBCS flag.
  277.   {$EXTERNALSYM COMMON_LVB_SBCSDBCS}
  278. type
  279.   PCONSOLE_SCREEN_BUFFER_INFO = ^CONSOLE_SCREEN_BUFFER_INFO;
  280.   {$EXTERNALSYM PCONSOLE_SCREEN_BUFFER_INFO}
  281.   _CONSOLE_SCREEN_BUFFER_INFO = record
  282.     dwSize: COORD;
  283.     dwCursorPosition: COORD;
  284.     wAttributes: WORD;
  285.     srWindow: SMALL_RECT;
  286.     dwMaximumWindowSize: COORD;
  287.   end;
  288.   {$EXTERNALSYM _CONSOLE_SCREEN_BUFFER_INFO}
  289.   CONSOLE_SCREEN_BUFFER_INFO = _CONSOLE_SCREEN_BUFFER_INFO;
  290.   {$EXTERNALSYM CONSOLE_SCREEN_BUFFER_INFO}
  291.   TConsoleScreenBufferInfo = CONSOLE_SCREEN_BUFFER_INFO;
  292.   PConsoleScreenBufferInfo = PCONSOLE_SCREEN_BUFFER_INFO;
  293.   PCONSOLE_CURSOR_INFO = ^CONSOLE_CURSOR_INFO;
  294.   {$EXTERNALSYM PCONSOLE_CURSOR_INFO}
  295.   _CONSOLE_CURSOR_INFO = record
  296.     dwSize: DWORD;
  297.     bVisible: BOOL;
  298.   end;
  299.   {$EXTERNALSYM _CONSOLE_CURSOR_INFO}
  300.   CONSOLE_CURSOR_INFO = _CONSOLE_CURSOR_INFO;
  301.   {$EXTERNALSYM CONSOLE_CURSOR_INFO}
  302.   TConsoleCursorInfo = CONSOLE_CURSOR_INFO;
  303.   PConsoleCursorInfo = PCONSOLE_CURSOR_INFO;
  304.   _CONSOLE_FONT_INFO = record
  305.     nFont: DWORD;
  306.     dwFontSize: COORD;
  307.   end;
  308.   {$EXTERNALSYM _CONSOLE_FONT_INFO}
  309.   CONSOLE_FONT_INFO = _CONSOLE_FONT_INFO;
  310.   {$EXTERNALSYM CONSOLE_FONT_INFO}
  311.   PCONSOLE_FONT_INFO = ^CONSOLE_FONT_INFO;
  312.   {$EXTERNALSYM PCONSOLE_FONT_INFO}
  313.   TConsoleFontInfo = CONSOLE_FONT_INFO;
  314.   PConsoleFontInfo = PCONSOLE_FONT_INFO;
  315.   _CONSOLE_SELECTION_INFO = record
  316.     dwFlags: DWORD;
  317.     dwSelectionAnchor: COORD;
  318.     srSelection: SMALL_RECT;
  319.   end;
  320.   {$EXTERNALSYM _CONSOLE_SELECTION_INFO}
  321.   CONSOLE_SELECTION_INFO = _CONSOLE_SELECTION_INFO;
  322.   {$EXTERNALSYM CONSOLE_SELECTION_INFO}
  323.   PCONSOLE_SELECTION_INFO = ^CONSOLE_SELECTION_INFO;
  324.   {$EXTERNALSYM PCONSOLE_SELECTION_INFO}
  325.   TConsoleSelectionInfo = CONSOLE_SELECTION_INFO;
  326.   PConsoleSelectionInfo = PCONSOLE_SELECTION_INFO;  
  327. //
  328. // Selection flags
  329. //
  330. const
  331.   CONSOLE_NO_SELECTION          = $0000;
  332.   {$EXTERNALSYM CONSOLE_NO_SELECTION}
  333.   CONSOLE_SELECTION_IN_PROGRESS = $0001;   // selection has begun
  334.   {$EXTERNALSYM CONSOLE_SELECTION_IN_PROGRESS}
  335.   CONSOLE_SELECTION_NOT_EMPTY   = $0002;   // non-null select rectangle
  336.   {$EXTERNALSYM CONSOLE_SELECTION_NOT_EMPTY}
  337.   CONSOLE_MOUSE_SELECTION       = $0004;   // selecting with mouse
  338.   {$EXTERNALSYM CONSOLE_MOUSE_SELECTION}
  339.   CONSOLE_MOUSE_DOWN            = $0008;   // mouse is down
  340.   {$EXTERNALSYM CONSOLE_MOUSE_DOWN}
  341. //
  342. // typedef for ctrl-c handler routines
  343. //
  344. type
  345.   PHANDLER_ROUTINE = function (CtrlType: DWORD): BOOL; stdcall;
  346.   {$EXTERNALSYM PHANDLER_ROUTINE}
  347.   THandlerRoutine = PHANDLER_ROUTINE;
  348. const
  349.   CTRL_C_EVENT        = 0;
  350.   {$EXTERNALSYM CTRL_C_EVENT}
  351.   CTRL_BREAK_EVENT    = 1;
  352.   {$EXTERNALSYM CTRL_BREAK_EVENT}
  353.   CTRL_CLOSE_EVENT    = 2;
  354.   {$EXTERNALSYM CTRL_CLOSE_EVENT}
  355.   // 3 is reserved!
  356.   // 4 is reserved!
  357.   CTRL_LOGOFF_EVENT   = 5;
  358.   {$EXTERNALSYM CTRL_LOGOFF_EVENT}
  359.   CTRL_SHUTDOWN_EVENT = 6;
  360.   {$EXTERNALSYM CTRL_SHUTDOWN_EVENT}
  361. //
  362. //  Input Mode flags:
  363. //
  364.   ENABLE_PROCESSED_INPUT = $0001;
  365.   {$EXTERNALSYM ENABLE_PROCESSED_INPUT}
  366.   ENABLE_LINE_INPUT      = $0002;
  367.   {$EXTERNALSYM ENABLE_LINE_INPUT}
  368.   ENABLE_ECHO_INPUT      = $0004;
  369.   {$EXTERNALSYM ENABLE_ECHO_INPUT}
  370.   ENABLE_WINDOW_INPUT    = $0008;
  371.   {$EXTERNALSYM ENABLE_WINDOW_INPUT}
  372.   ENABLE_MOUSE_INPUT     = $0010;
  373.   {$EXTERNALSYM ENABLE_MOUSE_INPUT}
  374. //
  375. // Output Mode flags:
  376. //
  377.   ENABLE_PROCESSED_OUTPUT   = $0001;
  378.   {$EXTERNALSYM ENABLE_PROCESSED_OUTPUT}
  379.   ENABLE_WRAP_AT_EOL_OUTPUT = $0002;
  380.   {$EXTERNALSYM ENABLE_WRAP_AT_EOL_OUTPUT}
  381. //
  382. // direct API definitions.
  383. //
  384. function PeekConsoleInputA(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  385.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  386. {$EXTERNALSYM PeekConsoleInputA}
  387. function PeekConsoleInputW(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  388.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  389. {$EXTERNALSYM PeekConsoleInputW}
  390. {$IFDEF UNICODE}
  391. function PeekConsoleInput(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  392.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  393. {$EXTERNALSYM PeekConsoleInput}
  394. {$ELSE}
  395. function PeekConsoleInput(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  396.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  397. {$EXTERNALSYM PeekConsoleInput}
  398. {$ENDIF}
  399. function ReadConsoleInputA(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  400.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  401. {$EXTERNALSYM ReadConsoleInputA}
  402. function ReadConsoleInputW(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  403.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  404. {$EXTERNALSYM ReadConsoleInputW}
  405. {$IFDEF UNICODE}
  406. function ReadConsoleInput(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  407.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  408. {$EXTERNALSYM ReadConsoleInput}
  409. {$ELSE}
  410. function ReadConsoleInput(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  411.   nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
  412. {$EXTERNALSYM ReadConsoleInput}
  413. {$ENDIF}
  414. function WriteConsoleInputA(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  415.   nLength: DWORD; var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
  416. {$EXTERNALSYM WriteConsoleInputA}
  417. function WriteConsoleInputW(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  418.   nLength: DWORD; var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
  419. {$EXTERNALSYM WriteConsoleInputW}
  420. {$IFDEF UNICODE}
  421. function WriteConsoleInput(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  422.   nLength: DWORD; var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
  423. {$EXTERNALSYM WriteConsoleInput}
  424. {$ELSE}
  425. function WriteConsoleInput(hConsoleInput: HANDLE; lpBuffer: PINPUT_RECORD;
  426.   nLength: DWORD; var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
  427. {$EXTERNALSYM WriteConsoleInput}
  428. {$ENDIF}
  429. function ReadConsoleOutputA(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  430.   dwBufferSize: COORD; dwBufferCoord: COORD;
  431.   var lpReadRegion: SMALL_RECT): BOOL; stdcall;
  432. {$EXTERNALSYM ReadConsoleOutputA}
  433. function ReadConsoleOutputW(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  434.   dwBufferSize: COORD; dwBufferCoord: COORD;
  435.   var lpReadRegion: SMALL_RECT): BOOL; stdcall;
  436. {$EXTERNALSYM ReadConsoleOutputW}
  437. {$IFDEF UNICODE}
  438. function ReadConsoleOutput(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  439.   dwBufferSize: COORD; dwBufferCoord: COORD;
  440.   var lpReadRegion: SMALL_RECT): BOOL; stdcall;
  441. {$EXTERNALSYM ReadConsoleOutput}
  442. {$ELSE}
  443. function ReadConsoleOutput(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  444.   dwBufferSize: COORD; dwBufferCoord: COORD;
  445.   var lpReadRegion: SMALL_RECT): BOOL; stdcall;
  446. {$EXTERNALSYM ReadConsoleOutput}
  447. {$ENDIF}
  448. function WriteConsoleOutputA(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  449.   dwBufferSize: COORD; dwBufferCoord: COORD;
  450.   var lpWriteRegion: SMALL_RECT): BOOL; stdcall;
  451. {$EXTERNALSYM WriteConsoleOutputA}
  452. function WriteConsoleOutputW(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  453.   dwBufferSize: COORD; dwBufferCoord: COORD;
  454.   var lpWriteRegion: SMALL_RECT): BOOL; stdcall;
  455. {$EXTERNALSYM WriteConsoleOutputW}
  456. {$IFDEF UNICODE}
  457. function WriteConsoleOutput(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  458.   dwBufferSize: COORD; dwBufferCoord: COORD;
  459.   var lpWriteRegion: SMALL_RECT): BOOL; stdcall;
  460. {$EXTERNALSYM WriteConsoleOutput}
  461. {$ELSE}
  462. function WriteConsoleOutput(hConsoleOutput: HANDLE; lpBuffer: PCHAR_INFO;
  463.   dwBufferSize: COORD; dwBufferCoord: COORD;
  464.   var lpWriteRegion: SMALL_RECT): BOOL; stdcall;
  465. {$EXTERNALSYM WriteConsoleOutput}
  466. {$ENDIF}
  467. function ReadConsoleOutputCharacterA(hConsoleOutput: HANDLE; lpCharacter: LPSTR;
  468.   nLength: DWORD; dwReadCoord: COORD; var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
  469. {$EXTERNALSYM ReadConsoleOutputCharacterA}
  470. function ReadConsoleOutputCharacterW(hConsoleOutput: HANDLE; lpCharacter: LPWSTR;
  471.   nLength: DWORD; dwReadCoord: COORD; var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
  472. {$EXTERNALSYM ReadConsoleOutputCharacterW}
  473. {$IFDEF UNICODE}
  474. function ReadConsoleOutputCharacter(hConsoleOutput: HANDLE; lpCharacter: LPWSTR;
  475.   nLength: DWORD; dwReadCoord: COORD; var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
  476. {$EXTERNALSYM ReadConsoleOutputCharacter}
  477. {$ELSE}
  478. function ReadConsoleOutputCharacter(hConsoleOutput: HANDLE; lpCharacter: LPSTR;
  479.   nLength: DWORD; dwReadCoord: COORD; var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
  480. {$EXTERNALSYM ReadConsoleOutputCharacter}
  481. {$ENDIF}
  482. function ReadConsoleOutputAttribute(hConsoleOutput: HANDLE;
  483.   var lpAttribute: DWORD; nLength: DWORD; dwReadCoord: COORD;
  484.   var lpNumberOfAttrsRead: DWORD): BOOL; stdcall;
  485. {$EXTERNALSYM ReadConsoleOutputAttribute}
  486. function WriteConsoleOutputCharacterA(hConsoleOutput: HANDLE;
  487.   lpCharacter: LPCSTR; nLength: DWORD; dwWriteCoord: COORD;
  488.   var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  489. {$EXTERNALSYM WriteConsoleOutputCharacterA}
  490. function WriteConsoleOutputCharacterW(hConsoleOutput: HANDLE;
  491.   lpCharacter: LPCWSTR; nLength: DWORD; dwWriteCoord: COORD;
  492.   var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  493. {$EXTERNALSYM WriteConsoleOutputCharacterW}
  494. {$IFDEF UNICODE}
  495. function WriteConsoleOutputCharacter(hConsoleOutput: HANDLE;
  496.   lpCharacter: LPCWSTR; nLength: DWORD; dwWriteCoord: COORD;
  497.   var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  498. {$EXTERNALSYM WriteConsoleOutputCharacter}
  499. {$ELSE}
  500. function WriteConsoleOutputCharacter(hConsoleOutput: HANDLE;
  501.   lpCharacter: LPCSTR; nLength: DWORD; dwWriteCoord: COORD;
  502.   var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  503. {$EXTERNALSYM WriteConsoleOutputCharacter}
  504. {$ENDIF}
  505. function WriteConsoleOutputAttribute(hConsoleOutput: HANDLE; lpAttribute: PWORD;
  506.   nLength: DWORD; dwWriteCoord: COORD; var lpNumberOfAttrsWritten: DWORD): BOOL; stdcall;
  507. {$EXTERNALSYM WriteConsoleOutputAttribute}
  508. function FillConsoleOutputCharacterA(hConsoleOutput: HANDLE; cCharacter: CHAR;
  509.   nLength: DWORD; dwWriteCoord: COORD; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  510. {$EXTERNALSYM FillConsoleOutputCharacterA}
  511. function FillConsoleOutputCharacterW(hConsoleOutput: HANDLE; cCharacter: WCHAR;
  512.   nLength: DWORD; dwWriteCoord: COORD; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  513. {$EXTERNALSYM FillConsoleOutputCharacterW}
  514. {$IFDEF UNICODE}
  515. function FillConsoleOutputCharacter(hConsoleOutput: HANDLE; cCharacter: WCHAR;
  516.   nLength: DWORD; dwWriteCoord: COORD; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  517. {$EXTERNALSYM FillConsoleOutputCharacter}
  518. {$ELSE}
  519. function FillConsoleOutputCharacter(hConsoleOutput: HANDLE; cCharacter: CHAR;
  520.   nLength: DWORD; dwWriteCoord: COORD; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
  521. {$EXTERNALSYM FillConsoleOutputCharacter}
  522. {$ENDIF}
  523. function FillConsoleOutputAttribute(hConsoleOutput: HANDLE; wAttribute: WORD;
  524.   nLength: DWORD; dwWriteCoord: COORD; var lpNumberOfAttrsWritten: DWORD): BOOL; stdcall;
  525. {$EXTERNALSYM FillConsoleOutputAttribute}
  526. function GetConsoleMode(hConsoleHandle: HANDLE; var lpMode: DWORD): BOOL; stdcall;
  527. {$EXTERNALSYM GetConsoleMode}
  528. function GetNumberOfConsoleInputEvents(hConsoleInput: HANDLE;
  529.   var lpNumberOfEvents: DWORD): BOOL; stdcall;
  530. {$EXTERNALSYM GetNumberOfConsoleInputEvents}
  531. function GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE;
  532.   var lpConsoleScreenBufferInfo: CONSOLE_SCREEN_BUFFER_INFO): BOOL; stdcall;
  533. {$EXTERNALSYM GetConsoleScreenBufferInfo}
  534. function GetLargestConsoleWindowSize(hConsoleOutput: HANDLE): COORD; stdcall;
  535. {$EXTERNALSYM GetLargestConsoleWindowSize}
  536. function GetConsoleCursorInfo(hConsoleOutput: HANDLE;
  537.   var lpConsoleCursorInfo: CONSOLE_CURSOR_INFO): BOOL; stdcall;
  538. function GetCurrentConsoleFont(hConsoleOutput: HANDLE; bMaximumWindow: BOOL;
  539.   var lpConsoleCurrentFont: CONSOLE_FONT_INFO): BOOL; stdcall;
  540. {$EXTERNALSYM GetCurrentConsoleFont}
  541. function GetConsoleFontSize(hConsoleOutput: HANDLE; nFont: DWORD): COORD; stdcall;
  542. {$EXTERNALSYM GetConsoleFontSize}
  543. function GetConsoleSelectionInfo(var lpConsoleSelectionInfo: CONSOLE_SELECTION_INFO): BOOL; stdcall;
  544. {$EXTERNALSYM GetConsoleSelectionInfo}
  545. {$EXTERNALSYM GetConsoleCursorInfo}
  546. function GetNumberOfConsoleMouseButtons(var lpNumberOfMouseButtons: DWORD): BOOL; stdcall;
  547. {$EXTERNALSYM GetNumberOfConsoleMouseButtons}
  548. function SetConsoleMode(hConsoleHandle: HANDLE; dwMode: DWORD): BOOL; stdcall;
  549. {$EXTERNALSYM SetConsoleMode}
  550. function SetConsoleActiveScreenBuffer(hConsoleOutput: HANDLE): BOOL; stdcall;
  551. {$EXTERNALSYM SetConsoleActiveScreenBuffer}
  552. function FlushConsoleInputBuffer(hConsoleInput: HANDLE): BOOL; stdcall;
  553. {$EXTERNALSYM FlushConsoleInputBuffer}
  554. function SetConsoleScreenBufferSize(hConsoleOutput: HANDLE; dwSize: COORD): BOOL; stdcall;
  555. {$EXTERNALSYM SetConsoleScreenBufferSize}
  556. function SetConsoleCursorPosition(hConsoleOutput: HANDLE; dwCursorPosition: COORD): BOOL; stdcall;
  557. {$EXTERNALSYM SetConsoleCursorPosition}
  558. function SetConsoleCursorInfo(hConsoleOutput: HANDLE;
  559.   var lpConsoleCursorInfo: CONSOLE_CURSOR_INFO): BOOL; stdcall;
  560. {$EXTERNALSYM SetConsoleCursorInfo}
  561. function ScrollConsoleScreenBufferA(hConsoleOutput: HANDLE;
  562.   const lpScrollRectangle: SMALL_RECT; lpClipRectangle: PSMALL_RECT;
  563.   dwDestinationOrigin: COORD; const lpFill: CHAR_INFO): BOOL; stdcall;
  564. {$EXTERNALSYM ScrollConsoleScreenBufferA}
  565. function ScrollConsoleScreenBufferW(hConsoleOutput: HANDLE;
  566.   const lpScrollRectangle: PSMALL_RECT; lpClipRectangle: PSMALL_RECT;
  567.   dwDestinationOrigin: COORD; const lpFill: CHAR_INFO): BOOL; stdcall;
  568. {$EXTERNALSYM ScrollConsoleScreenBufferW}
  569. {$IFDEF UNICODE}
  570. function ScrollConsoleScreenBuffer(hConsoleOutput: HANDLE;
  571.   const lpScrollRectangle: PSMALL_RECT; lpClipRectangle: PSMALL_RECT;
  572.   dwDestinationOrigin: COORD; const lpFill: CHAR_INFO): BOOL; stdcall;
  573. {$EXTERNALSYM ScrollConsoleScreenBuffer}
  574. {$ELSE}
  575. function ScrollConsoleScreenBuffer(hConsoleOutput: HANDLE;
  576.   const lpScrollRectangle: SMALL_RECT; lpClipRectangle: PSMALL_RECT;
  577.   dwDestinationOrigin: COORD; const lpFill: CHAR_INFO): BOOL; stdcall;
  578. {$EXTERNALSYM ScrollConsoleScreenBuffer}
  579. {$ENDIF}
  580. function SetConsoleWindowInfo(hConsoleOutput: HANDLE; bAbsolute: BOOL;
  581.   const lpConsoleWindow: SMALL_RECT): BOOL; stdcall;
  582. {$EXTERNALSYM SetConsoleWindowInfo}
  583. function SetConsoleTextAttribute(hConsoleOutput: HANDLE; wAttributes: WORD): BOOL; stdcall;
  584. {$EXTERNALSYM SetConsoleTextAttribute}
  585. function SetConsoleCtrlHandler(HandlerRoutine: PHANDLER_ROUTINE; Add: BOOL): BOOL; stdcall;
  586. {$EXTERNALSYM SetConsoleCtrlHandler}
  587. function GenerateConsoleCtrlEvent(dwCtrlEvent: DWORD; dwProcessGroupId: DWORD): BOOL; stdcall;
  588. {$EXTERNALSYM GenerateConsoleCtrlEvent}
  589. function AllocConsole: BOOL; stdcall;
  590. {$EXTERNALSYM AllocConsole}
  591. function FreeConsole: BOOL; stdcall;
  592. {$EXTERNALSYM FreeConsole}
  593. function AttachConsole(dwProcessId: DWORD): BOOL; stdcall;
  594. {$EXTERNALSYM AttachConsole}
  595. function GetConsoleTitleA(lpConsoleTitle: LPSTR; nSize: DWORD): DWORD; stdcall;
  596. {$EXTERNALSYM GetConsoleTitleA}
  597. function GetConsoleTitleW(lpConsoleTitle: LPWSTR; nSize: DWORD): DWORD; stdcall;
  598. {$EXTERNALSYM GetConsoleTitleW}
  599. {$IFDEF UNICODE}
  600. function GetConsoleTitle(lpConsoleTitle: LPWSTR; nSize: DWORD): DWORD; stdcall;
  601. {$EXTERNALSYM GetConsoleTitle}
  602. {$ELSE}
  603. function GetConsoleTitle(lpConsoleTitle: LPSTR; nSize: DWORD): DWORD; stdcall;
  604. {$EXTERNALSYM GetConsoleTitle}
  605. {$ENDIF}
  606. function SetConsoleTitleA(lpConsoleTitle: LPCSTR): BOOL; stdcall;
  607. {$EXTERNALSYM SetConsoleTitleA}
  608. function SetConsoleTitleW(lpConsoleTitle: LPCWSTR): BOOL; stdcall;
  609. {$EXTERNALSYM SetConsoleTitleW}
  610. {$IFDEF UNICODE}
  611. function SetConsoleTitle(lpConsoleTitle: LPCWSTR): BOOL; stdcall;
  612. {$EXTERNALSYM SetConsoleTitle}
  613. {$ELSE}
  614. function SetConsoleTitle(lpConsoleTitle: LPCSTR): BOOL; stdcall;
  615. {$EXTERNALSYM SetConsoleTitle}
  616. {$ENDIF}
  617. function ReadConsoleA(hConsoleInput: HANDLE; lpBuffer: LPVOID;
  618.   nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD;
  619.   lpReserved: LPVOID): BOOL; stdcall;
  620. {$EXTERNALSYM ReadConsoleA}
  621. function ReadConsoleW(hConsoleInput: HANDLE; lpBuffer: LPVOID;
  622.   nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD;
  623.   lpReserved: LPVOID): BOOL; stdcall;
  624. {$EXTERNALSYM ReadConsoleW}
  625. {$IFDEF UNICODE}
  626. function ReadConsole(hConsoleInput: HANDLE; lpBuffer: LPVOID;
  627.   nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD;
  628.   lpReserved: LPVOID): BOOL; stdcall;
  629. {$EXTERNALSYM ReadConsole}
  630. {$ELSE}
  631. function ReadConsole(hConsoleInput: HANDLE; lpBuffer: LPVOID;
  632.   nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD;
  633.   lpReserved: LPVOID): BOOL; stdcall;
  634. {$EXTERNALSYM ReadConsole}
  635. {$ENDIF}
  636. function WriteConsoleA(hConsoleOutput: HANDLE; lpBuffer: LPVOID;
  637.   nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD;
  638.   lpReserved: LPVOID): BOOL; stdcall;
  639. {$EXTERNALSYM WriteConsoleA}
  640. function WriteConsoleW(hConsoleOutput: HANDLE; lpBuffer: LPVOID;
  641.   nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD;
  642.   lpReserved: LPVOID): BOOL; stdcall;
  643. {$EXTERNALSYM WriteConsoleW}
  644. {$IFDEF UNICODE}
  645. function WriteConsole(hConsoleOutput: HANDLE; lpBuffer: LPVOID;
  646.   nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD;
  647.   lpReserved: LPVOID): BOOL; stdcall;
  648. {$EXTERNALSYM WriteConsole}
  649. {$ELSE}
  650. function WriteConsole(hConsoleOutput: HANDLE; lpBuffer: LPVOID;
  651.   nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD;
  652.   lpReserved: LPVOID): BOOL; stdcall;
  653. {$EXTERNALSYM WriteConsole}
  654. {$ENDIF}
  655. const
  656.   CONSOLE_TEXTMODE_BUFFER = 1;
  657.   {$EXTERNALSYM CONSOLE_TEXTMODE_BUFFER}
  658. function CreateConsoleScreenBuffer(dwDesiredAccess: DWORD; dwShareMode: DWORD;
  659.   lpSecurityAttributes: PSECURITY_ATTRIBUTES; dwFlags: DWORD;
  660.   lpScreenBufferData: LPVOID): HANDLE; stdcall;
  661. {$EXTERNALSYM CreateConsoleScreenBuffer}
  662. function GetConsoleCP: UINT; stdcall;
  663. {$EXTERNALSYM GetConsoleCP}
  664. function SetConsoleCP(wCodePageID: UINT): BOOL; stdcall;
  665. {$EXTERNALSYM SetConsoleCP}
  666. function GetConsoleOutputCP: UINT; stdcall;
  667. {$EXTERNALSYM GetConsoleOutputCP}
  668. function SetConsoleOutputCP(wCodePageID: UINT): BOOL; stdcall;
  669. {$EXTERNALSYM SetConsoleOutputCP}
  670. const
  671.   CONSOLE_FULLSCREEN = 1;            // fullscreen console
  672.   {$EXTERNALSYM CONSOLE_FULLSCREEN}
  673.   CONSOLE_FULLSCREEN_HARDWARE = 2;   // console owns the hardware
  674.   {$EXTERNALSYM CONSOLE_FULLSCREEN_HARDWARE}
  675. function GetConsoleDisplayMode(var lpModeFlags: DWORD): BOOL; stdcall;
  676. {$EXTERNALSYM GetConsoleDisplayMode}
  677. function GetConsoleWindow: HWND; stdcall;
  678. {$EXTERNALSYM GetConsoleWindow}
  679. function GetConsoleProcessList(var lpdwProcessList: LPDWORD; dwProcessCount: DWORD): DWORD; stdcall;
  680. {$EXTERNALSYM GetConsoleProcessList}
  681. implementation
  682. const
  683.   kernel32 = 'kernel32.dll';
  684. {$IFDEF DYNAMIC_LINK}
  685. var
  686.   _PeekConsoleInputA: Pointer;
  687. function PeekConsoleInputA;
  688. begin
  689.   GetProcedureAddress(_PeekConsoleInputA, kernel32, 'PeekConsoleInputA');
  690.   asm
  691.     mov esp, ebp
  692.     pop ebp
  693.     jmp [_PeekConsoleInputA]
  694.   end;
  695. end;
  696. {$ELSE}
  697. function PeekConsoleInputA; external kernel32 name 'PeekConsoleInputA';
  698. {$ENDIF DYNAMIC_LINK}
  699. {$IFDEF DYNAMIC_LINK}
  700. var
  701.   _PeekConsoleInputW: Pointer;
  702. function PeekConsoleInputW;
  703. begin
  704.   GetProcedureAddress(_PeekConsoleInputW, kernel32, 'PeekConsoleInputW');
  705.   asm
  706.     mov esp, ebp
  707.     pop ebp
  708.     jmp [_PeekConsoleInputW]
  709.   end;
  710. end;
  711. {$ELSE}
  712. function PeekConsoleInputW; external kernel32 name 'PeekConsoleInputW';
  713. {$ENDIF DYNAMIC_LINK}
  714. {$IFDEF UNICODE}
  715. {$IFDEF DYNAMIC_LINK}
  716. var
  717.   _PeekConsoleInput: Pointer;
  718. function PeekConsoleInput;
  719. begin
  720.   GetProcedureAddress(_PeekConsoleInput, kernel32, 'PeekConsoleInputW');
  721.   asm
  722.     mov esp, ebp
  723.     pop ebp
  724.     jmp [_PeekConsoleInput]
  725.   end;
  726. end;
  727. {$ELSE}
  728. function PeekConsoleInput; external kernel32 name 'PeekConsoleInputW';
  729. {$ENDIF DYNAMIC_LINK}
  730. {$ELSE}
  731. {$IFDEF DYNAMIC_LINK}
  732. var
  733.   _PeekConsoleInput: Pointer;
  734. function PeekConsoleInput;
  735. begin
  736.   GetProcedureAddress(_PeekConsoleInput, kernel32, 'PeekConsoleInputA');
  737.   asm
  738.     mov esp, ebp
  739.     pop ebp
  740.     jmp [_PeekConsoleInput]
  741.   end;
  742. end;
  743. {$ELSE}
  744. function PeekConsoleInput; external kernel32 name 'PeekConsoleInputA';
  745. {$ENDIF DYNAMIC_LINK}
  746. {$ENDIF}
  747. {$IFDEF DYNAMIC_LINK}
  748. var
  749.   _ReadConsoleInputA: Pointer;
  750. function ReadConsoleInputA;
  751. begin
  752.   GetProcedureAddress(_ReadConsoleInputA, kernel32, 'ReadConsoleInputA');
  753.   asm
  754.     mov esp, ebp
  755.     pop ebp
  756.     jmp [_ReadConsoleInputA]
  757.   end;
  758. end;
  759. {$ELSE}
  760. function ReadConsoleInputA; external kernel32 name 'ReadConsoleInputA';
  761. {$ENDIF DYNAMIC_LINK}
  762. {$IFDEF DYNAMIC_LINK}
  763. var
  764.   _ReadConsoleInputW: Pointer;
  765. function ReadConsoleInputW;
  766. begin
  767.   GetProcedureAddress(_ReadConsoleInputW, kernel32, 'ReadConsoleInputW');
  768.   asm
  769.     mov esp, ebp
  770.     pop ebp
  771.     jmp [_ReadConsoleInputW]
  772.   end;
  773. end;
  774. {$ELSE}
  775. function ReadConsoleInputW; external kernel32 name 'ReadConsoleInputW';
  776. {$ENDIF DYNAMIC_LINK}
  777. {$IFDEF UNICODE}
  778. {$IFDEF DYNAMIC_LINK}
  779. var
  780.   _ReadConsoleInput: Pointer;
  781. function ReadConsoleInput;
  782. begin
  783.   GetProcedureAddress(_ReadConsoleInput, kernel32, 'ReadConsoleInputW');
  784.   asm
  785.     mov esp, ebp
  786.     pop ebp
  787.     jmp [_ReadConsoleInput]
  788.   end;
  789. end;
  790. {$ELSE}
  791. function ReadConsoleInput; external kernel32 name 'ReadConsoleInputW';
  792. {$ENDIF DYNAMIC_LINK}
  793. {$ELSE}
  794. {$IFDEF DYNAMIC_LINK}
  795. var
  796.   _ReadConsoleInput: Pointer;
  797. function ReadConsoleInput;
  798. begin
  799.   GetProcedureAddress(_ReadConsoleInput, kernel32, 'ReadConsoleInputA');
  800.   asm
  801.     mov esp, ebp
  802.     pop ebp
  803.     jmp [_ReadConsoleInput]
  804.   end;
  805. end;
  806. {$ELSE}
  807. function ReadConsoleInput; external kernel32 name 'ReadConsoleInputA';
  808. {$ENDIF DYNAMIC_LINK}
  809. {$ENDIF}
  810. {$IFDEF DYNAMIC_LINK}
  811. var
  812.   _WriteConsoleInputA: Pointer;
  813. function WriteConsoleInputA;
  814. begin
  815.   GetProcedureAddress(_WriteConsoleInputA, kernel32, 'WriteConsoleInputA');
  816.   asm
  817.     mov esp, ebp
  818.     pop ebp
  819.     jmp [_WriteConsoleInputA]
  820.   end;
  821. end;
  822. {$ELSE}
  823. function WriteConsoleInputA; external kernel32 name 'WriteConsoleInputA';
  824. {$ENDIF DYNAMIC_LINK}
  825. {$IFDEF DYNAMIC_LINK}
  826. var
  827.   _WriteConsoleInputW: Pointer;
  828. function WriteConsoleInputW;
  829. begin
  830.   GetProcedureAddress(_WriteConsoleInputW, kernel32, 'WriteConsoleInputW');
  831.   asm
  832.     mov esp, ebp
  833.     pop ebp
  834.     jmp [_WriteConsoleInputW]
  835.   end;
  836. end;
  837. {$ELSE}
  838. function WriteConsoleInputW; external kernel32 name 'WriteConsoleInputW';
  839. {$ENDIF DYNAMIC_LINK}
  840. {$IFDEF UNICODE}
  841. {$IFDEF DYNAMIC_LINK}
  842. var
  843.   _WriteConsoleInput: Pointer;
  844. function WriteConsoleInput;
  845. begin
  846.   GetProcedureAddress(_WriteConsoleInput, kernel32, 'WriteConsoleInputW');
  847.   asm
  848.     mov esp, ebp
  849.     pop ebp
  850.     jmp [_WriteConsoleInput]
  851.   end;
  852. end;
  853. {$ELSE}
  854. function WriteConsoleInput; external kernel32 name 'WriteConsoleInputW';
  855. {$ENDIF DYNAMIC_LINK}
  856. {$ELSE}
  857. {$IFDEF DYNAMIC_LINK}
  858. var
  859.   _WriteConsoleInput: Pointer;
  860. function WriteConsoleInput;
  861. begin
  862.   GetProcedureAddress(_WriteConsoleInput, kernel32, 'WriteConsoleInputA');
  863.   asm
  864.     mov esp, ebp
  865.     pop ebp
  866.     jmp [_WriteConsoleInput]
  867.   end;
  868. end;
  869. {$ELSE}
  870. function WriteConsoleInput; external kernel32 name 'WriteConsoleInputA';
  871. {$ENDIF DYNAMIC_LINK}
  872. {$ENDIF}
  873. {$IFDEF DYNAMIC_LINK}
  874. var
  875.   _ReadConsoleOutputA: Pointer;
  876. function ReadConsoleOutputA;
  877. begin
  878.   GetProcedureAddress(_ReadConsoleOutputA, kernel32, 'ReadConsoleOutputA');
  879.   asm
  880.     mov esp, ebp
  881.     pop ebp
  882.     jmp [_ReadConsoleOutputA]
  883.   end;
  884. end;
  885. {$ELSE}
  886. function ReadConsoleOutputA; external kernel32 name 'ReadConsoleOutputA';
  887. {$ENDIF DYNAMIC_LINK}
  888. {$IFDEF DYNAMIC_LINK}
  889. var
  890.   _ReadConsoleOutputW: Pointer;
  891. function ReadConsoleOutputW;
  892. begin
  893.   GetProcedureAddress(_ReadConsoleOutputW, kernel32, 'ReadConsoleOutputW');
  894.   asm
  895.     mov esp, ebp
  896.     pop ebp
  897.     jmp [_ReadConsoleOutputW]
  898.   end;
  899. end;
  900. {$ELSE}
  901. function ReadConsoleOutputW; external kernel32 name 'ReadConsoleOutputW';
  902. {$ENDIF DYNAMIC_LINK}
  903. {$IFDEF UNICODE}
  904. {$IFDEF DYNAMIC_LINK}
  905. var
  906.   _ReadConsoleOutput: Pointer;
  907. function ReadConsoleOutput;
  908. begin
  909.   GetProcedureAddress(_ReadConsoleOutput, kernel32, 'ReadConsoleOutputW');
  910.   asm
  911.     mov esp, ebp
  912.     pop ebp
  913.     jmp [_ReadConsoleOutput]
  914.   end;
  915. end;
  916. {$ELSE}
  917. function ReadConsoleOutput; external kernel32 name 'ReadConsoleOutputW';
  918. {$ENDIF DYNAMIC_LINK}
  919. {$ELSE}
  920. {$IFDEF DYNAMIC_LINK}
  921. var
  922.   _ReadConsoleOutput: Pointer;
  923. function ReadConsoleOutput;
  924. begin
  925.   GetProcedureAddress(_ReadConsoleOutput, kernel32, 'ReadConsoleOutputA');
  926.   asm
  927.     mov esp, ebp
  928.     pop ebp
  929.     jmp [_ReadConsoleOutput]
  930.   end;
  931. end;
  932. {$ELSE}
  933. function ReadConsoleOutput; external kernel32 name 'ReadConsoleOutputA';
  934. {$ENDIF DYNAMIC_LINK}
  935. {$ENDIF}
  936. {$IFDEF DYNAMIC_LINK}
  937. var
  938.   _WriteConsoleOutputA: Pointer;
  939. function WriteConsoleOutputA;
  940. begin
  941.   GetProcedureAddress(_WriteConsoleOutputA, kernel32, 'WriteConsoleOutputA');
  942.   asm
  943.     mov esp, ebp
  944.     pop ebp
  945.     jmp [_WriteConsoleOutputA]
  946.   end;
  947. end;
  948. {$ELSE}
  949. function WriteConsoleOutputA; external kernel32 name 'WriteConsoleOutputA';
  950. {$ENDIF DYNAMIC_LINK}
  951. {$IFDEF DYNAMIC_LINK}
  952. var
  953.   _WriteConsoleOutputW: Pointer;
  954. function WriteConsoleOutputW;
  955. begin
  956.   GetProcedureAddress(_WriteConsoleOutputW, kernel32, 'WriteConsoleOutputW');
  957.   asm
  958.     mov esp, ebp
  959.     pop ebp
  960.     jmp [_WriteConsoleOutputW]
  961.   end;
  962. end;
  963. {$ELSE}
  964. function WriteConsoleOutputW; external kernel32 name 'WriteConsoleOutputW';
  965. {$ENDIF DYNAMIC_LINK}
  966. {$IFDEF UNICODE}
  967. {$IFDEF DYNAMIC_LINK}
  968. var
  969.   _WriteConsoleOutput: Pointer;
  970. function WriteConsoleOutput;
  971. begin
  972.   GetProcedureAddress(_WriteConsoleOutput, kernel32, 'WriteConsoleOutputW');
  973.   asm
  974.     mov esp, ebp
  975.     pop ebp
  976.     jmp [_WriteConsoleOutput]
  977.   end;
  978. end;
  979. {$ELSE}
  980. function WriteConsoleOutput; external kernel32 name 'WriteConsoleOutputW';
  981. {$ENDIF DYNAMIC_LINK}
  982. {$ELSE}
  983. {$IFDEF DYNAMIC_LINK}
  984. var
  985.   _WriteConsoleOutput: Pointer;
  986. function WriteConsoleOutput;
  987. begin
  988.   GetProcedureAddress(_WriteConsoleOutput, kernel32, 'WriteConsoleOutputA');
  989.   asm
  990.     mov esp, ebp
  991.     pop ebp
  992.     jmp [_WriteConsoleOutput]
  993.   end;
  994. end;
  995. {$ELSE}
  996. function WriteConsoleOutput; external kernel32 name 'WriteConsoleOutputA';
  997. {$ENDIF DYNAMIC_LINK}
  998. {$ENDIF}
  999. {$IFDEF DYNAMIC_LINK}
  1000. var
  1001.   _ReadConsoleOutputCharacterA: Pointer;
  1002. function ReadConsoleOutputCharacterA;
  1003. begin
  1004.   GetProcedureAddress(_ReadConsoleOutputCharacterA, kernel32, 'ReadConsoleOutputCharacterA');
  1005.   asm
  1006.     mov esp, ebp
  1007.     pop ebp
  1008.     jmp [_ReadConsoleOutputCharacterA]
  1009.   end;
  1010. end;
  1011. {$ELSE}
  1012. function ReadConsoleOutputCharacterA; external kernel32 name 'ReadConsoleOutputCharacterA';
  1013. {$ENDIF DYNAMIC_LINK}
  1014. {$IFDEF DYNAMIC_LINK}
  1015. var
  1016.   _ReadConsoleOutputCharacterW: Pointer;
  1017. function ReadConsoleOutputCharacterW;
  1018. begin
  1019.   GetProcedureAddress(_ReadConsoleOutputCharacterW, kernel32, 'ReadConsoleOutputCharacterW');
  1020.   asm
  1021.     mov esp, ebp
  1022.     pop ebp
  1023.     jmp [_ReadConsoleOutputCharacterW]
  1024.   end;
  1025. end;
  1026. {$ELSE}
  1027. function ReadConsoleOutputCharacterW; external kernel32 name 'ReadConsoleOutputCharacterW';
  1028. {$ENDIF DYNAMIC_LINK}
  1029. {$IFDEF UNICODE}
  1030. {$IFDEF DYNAMIC_LINK}
  1031. var
  1032.   _ReadConsoleOutputCharacter: Pointer;
  1033. function ReadConsoleOutputCharacter;
  1034. begin
  1035.   GetProcedureAddress(_ReadConsoleOutputCharacter, kernel32, 'ReadConsoleOutputCharacterW');
  1036.   asm
  1037.     mov esp, ebp
  1038.     pop ebp
  1039.     jmp [_ReadConsoleOutputCharacter]
  1040.   end;
  1041. end;
  1042. {$ELSE}
  1043. function ReadConsoleOutputCharacter; external kernel32 name 'ReadConsoleOutputCharacterW';
  1044. {$ENDIF DYNAMIC_LINK}
  1045. {$ELSE}
  1046. {$IFDEF DYNAMIC_LINK}
  1047. var
  1048.   _ReadConsoleOutputCharacter: Pointer;
  1049. function ReadConsoleOutputCharacter;
  1050. begin
  1051.   GetProcedureAddress(_ReadConsoleOutputCharacter, kernel32, 'ReadConsoleOutputCharacterA');
  1052.   asm
  1053.     mov esp, ebp
  1054.     pop ebp
  1055.     jmp [_ReadConsoleOutputCharacter]
  1056.   end;
  1057. end;
  1058. {$ELSE}
  1059. function ReadConsoleOutputCharacter; external kernel32 name 'ReadConsoleOutputCharacterA';
  1060. {$ENDIF DYNAMIC_LINK}
  1061. {$ENDIF}
  1062. {$IFDEF DYNAMIC_LINK}
  1063. var
  1064.   _ReadConsoleOutputAttribute: Pointer;
  1065. function ReadConsoleOutputAttribute;
  1066. begin
  1067.   GetProcedureAddress(_ReadConsoleOutputAttribute, kernel32, 'ReadConsoleOutputAttribute');
  1068.   asm
  1069.     mov esp, ebp
  1070.     pop ebp
  1071.     jmp [_ReadConsoleOutputAttribute]
  1072.   end;
  1073. end;
  1074. {$ELSE}
  1075. function ReadConsoleOutputAttribute; external kernel32 name 'ReadConsoleOutputAttribute';
  1076. {$ENDIF DYNAMIC_LINK}
  1077. {$IFDEF DYNAMIC_LINK}
  1078. var
  1079.   _WriteConsoleOutputCharacterA: Pointer;
  1080. function WriteConsoleOutputCharacterA;
  1081. begin
  1082.   GetProcedureAddress(_WriteConsoleOutputCharacterA, kernel32, 'WriteConsoleOutputCharacterA');
  1083.   asm
  1084.     mov esp, ebp
  1085.     pop ebp
  1086.     jmp [_WriteConsoleOutputCharacterA]
  1087.   end;
  1088. end;
  1089. {$ELSE}
  1090. function WriteConsoleOutputCharacterA; external kernel32 name 'WriteConsoleOutputCharacterA';
  1091. {$ENDIF DYNAMIC_LINK}
  1092. {$IFDEF DYNAMIC_LINK}
  1093. var
  1094.   _WriteConsoleOutputCharacterW: Pointer;
  1095. function WriteConsoleOutputCharacterW;
  1096. begin
  1097.   GetProcedureAddress(_WriteConsoleOutputCharacterW, kernel32, 'WriteConsoleOutputCharacterW');
  1098.   asm
  1099.     mov esp, ebp
  1100.     pop ebp
  1101.     jmp [_WriteConsoleOutputCharacterW]
  1102.   end;
  1103. end;
  1104. {$ELSE}
  1105. function WriteConsoleOutputCharacterW; external kernel32 name 'WriteConsoleOutputCharacterW';
  1106. {$ENDIF DYNAMIC_LINK}
  1107. {$IFDEF UNICODE}
  1108. {$IFDEF DYNAMIC_LINK}
  1109. var
  1110.   _WriteConsoleOutputCharacter: Pointer;
  1111. function WriteConsoleOutputCharacter;
  1112. begin
  1113.   GetProcedureAddress(_WriteConsoleOutputCharacter, kernel32, 'WriteConsoleOutputCharacterW');
  1114.   asm
  1115.     mov esp, ebp
  1116.     pop ebp
  1117.     jmp [_WriteConsoleOutputCharacter]
  1118.   end;
  1119. end;
  1120. {$ELSE}
  1121. function WriteConsoleOutputCharacter; external kernel32 name 'WriteConsoleOutputCharacterW';
  1122. {$ENDIF DYNAMIC_LINK}
  1123. {$ELSE}
  1124. {$IFDEF DYNAMIC_LINK}
  1125. var
  1126.   _WriteConsoleOutputCharacter: Pointer;
  1127. function WriteConsoleOutputCharacter;
  1128. begin
  1129.   GetProcedureAddress(_WriteConsoleOutputCharacter, kernel32, 'WriteConsoleOutputCharacterA');
  1130.   asm
  1131.     mov esp, ebp
  1132.     pop ebp
  1133.     jmp [_WriteConsoleOutputCharacter]
  1134.   end;
  1135. end;
  1136. {$ELSE}
  1137. function WriteConsoleOutputCharacter; external kernel32 name 'WriteConsoleOutputCharacterA';
  1138. {$ENDIF DYNAMIC_LINK}
  1139. {$ENDIF}
  1140. {$IFDEF DYNAMIC_LINK}
  1141. var
  1142.   _WriteConsoleOutputAttribute: Pointer;
  1143. function WriteConsoleOutputAttribute;
  1144. begin
  1145.   GetProcedureAddress(_WriteConsoleOutputAttribute, kernel32, 'WriteConsoleOutputAttribute');
  1146.   asm
  1147.     mov esp, ebp
  1148.     pop ebp
  1149.     jmp [_WriteConsoleOutputAttribute]
  1150.   end;
  1151. end;
  1152. {$ELSE}
  1153. function WriteConsoleOutputAttribute; external kernel32 name 'WriteConsoleOutputAttribute';
  1154. {$ENDIF DYNAMIC_LINK}
  1155. {$IFDEF DYNAMIC_LINK}
  1156. var
  1157.   _FillConsoleOutputCharacterA: Pointer;
  1158. function FillConsoleOutputCharacterA;
  1159. begin
  1160.   GetProcedureAddress(_FillConsoleOutputCharacterA, kernel32, 'FillConsoleOutputCharacterA');
  1161.   asm
  1162.     mov esp, ebp
  1163.     pop ebp
  1164.     jmp [_FillConsoleOutputCharacterA]
  1165.   end;
  1166. end;
  1167. {$ELSE}
  1168. function FillConsoleOutputCharacterA; external kernel32 name 'FillConsoleOutputCharacterA';
  1169. {$ENDIF DYNAMIC_LINK}
  1170. {$IFDEF DYNAMIC_LINK}
  1171. var
  1172.   _FillConsoleOutputCharacterW: Pointer;
  1173. function FillConsoleOutputCharacterW;
  1174. begin
  1175.   GetProcedureAddress(_FillConsoleOutputCharacterW, kernel32, 'FillConsoleOutputCharacterW');
  1176.   asm
  1177.     mov esp, ebp
  1178.     pop ebp
  1179.     jmp [_FillConsoleOutputCharacterW]
  1180.   end;
  1181. end;
  1182. {$ELSE}
  1183. function FillConsoleOutputCharacterW; external kernel32 name 'FillConsoleOutputCharacterW';
  1184. {$ENDIF DYNAMIC_LINK}
  1185. {$IFDEF UNICODE}
  1186. {$IFDEF DYNAMIC_LINK}
  1187. var
  1188.   _FillConsoleOutputCharacter: Pointer;
  1189. function FillConsoleOutputCharacter;
  1190. begin
  1191.   GetProcedureAddress(_FillConsoleOutputCharacter, kernel32, 'FillConsoleOutputCharacterW');
  1192.   asm
  1193.     mov esp, ebp
  1194.     pop ebp
  1195.     jmp [_FillConsoleOutputCharacter]
  1196.   end;
  1197. end;
  1198. {$ELSE}
  1199. function FillConsoleOutputCharacter; external kernel32 name 'FillConsoleOutputCharacterW';
  1200. {$ENDIF DYNAMIC_LINK}
  1201. {$ELSE}
  1202. {$IFDEF DYNAMIC_LINK}
  1203. var
  1204.   _FillConsoleOutputCharacter: Pointer;
  1205. function FillConsoleOutputCharacter;
  1206. begin
  1207.   GetProcedureAddress(_FillConsoleOutputCharacter, kernel32, 'FillConsoleOutputCharacterA');
  1208.   asm
  1209.     mov esp, ebp
  1210.     pop ebp
  1211.     jmp [_FillConsoleOutputCharacter]
  1212.   end;
  1213. end;
  1214. {$ELSE}
  1215. function FillConsoleOutputCharacter; external kernel32 name 'FillConsoleOutputCharacterA';
  1216. {$ENDIF DYNAMIC_LINK}
  1217. {$ENDIF}
  1218. {$IFDEF DYNAMIC_LINK}
  1219. var
  1220.   _FillConsoleOutputAttribute: Pointer;
  1221. function FillConsoleOutputAttribute;
  1222. begin
  1223.   GetProcedureAddress(_FillConsoleOutputAttribute, kernel32, 'FillConsoleOutputAttribute');
  1224.   asm
  1225.     mov esp, ebp
  1226.     pop ebp
  1227.     jmp [_FillConsoleOutputAttribute]
  1228.   end;
  1229. end;
  1230. {$ELSE}
  1231. function FillConsoleOutputAttribute; external kernel32 name 'FillConsoleOutputAttribute';
  1232. {$ENDIF DYNAMIC_LINK}
  1233. {$IFDEF DYNAMIC_LINK}
  1234. var
  1235.   _GetConsoleMode: Pointer;
  1236. function GetConsoleMode;
  1237. begin
  1238.   GetProcedureAddress(_GetConsoleMode, kernel32, 'GetConsoleMode');
  1239.   asm
  1240.     mov esp, ebp
  1241.     pop ebp
  1242.     jmp [_GetConsoleMode]
  1243.   end;
  1244. end;
  1245. {$ELSE}
  1246. function GetConsoleMode; external kernel32 name 'GetConsoleMode';
  1247. {$ENDIF DYNAMIC_LINK}
  1248. {$IFDEF DYNAMIC_LINK}
  1249. var
  1250.   _GetNumberOfConsoleInputEvents: Pointer;
  1251. function GetNumberOfConsoleInputEvents;
  1252. begin
  1253.   GetProcedureAddress(_GetNumberOfConsoleInputEvents, kernel32, 'GetNumberOfConsoleInputEvents');
  1254.   asm
  1255.     mov esp, ebp
  1256.     pop ebp
  1257.     jmp [_GetNumberOfConsoleInputEvents]
  1258.   end;
  1259. end;
  1260. {$ELSE}
  1261. function GetNumberOfConsoleInputEvents; external kernel32 name 'GetNumberOfConsoleInputEvents';
  1262. {$ENDIF DYNAMIC_LINK}
  1263. {$IFDEF DYNAMIC_LINK}
  1264. var
  1265.   _GetConsoleScreenBufferInfo: Pointer;
  1266. function GetConsoleScreenBufferInfo;
  1267. begin
  1268.   GetProcedureAddress(_GetConsoleScreenBufferInfo, kernel32, 'GetConsoleScreenBufferInfo');
  1269.   asm
  1270.     mov esp, ebp
  1271.     pop ebp
  1272.     jmp [_GetConsoleScreenBufferInfo]
  1273.   end;
  1274. end;
  1275. {$ELSE}
  1276. function GetConsoleScreenBufferInfo; external kernel32 name 'GetConsoleScreenBufferInfo';
  1277. {$ENDIF DYNAMIC_LINK}
  1278. {$IFDEF DYNAMIC_LINK}
  1279. var
  1280.   _GetLargestConsoleWindowSize: Pointer;
  1281. function GetLargestConsoleWindowSize;
  1282. begin
  1283.   GetProcedureAddress(_GetLargestConsoleWindowSize, kernel32, 'GetLargestConsoleWindowSize');
  1284.   asm
  1285.     mov esp, ebp
  1286.     pop ebp
  1287.     jmp [_GetLargestConsoleWindowSize]
  1288.   end;
  1289. end;
  1290. {$ELSE}
  1291. function GetLargestConsoleWindowSize; external kernel32 name 'GetLargestConsoleWindowSize';
  1292. {$ENDIF DYNAMIC_LINK}
  1293. {$IFDEF DYNAMIC_LINK}
  1294. var
  1295.   _GetConsoleCursorInfo: Pointer;
  1296. function GetConsoleCursorInfo;
  1297. begin
  1298.   GetProcedureAddress(_GetConsoleCursorInfo, kernel32, 'GetConsoleCursorInfo');
  1299.   asm
  1300.     mov esp, ebp
  1301.     pop ebp
  1302.     jmp [_GetConsoleCursorInfo]
  1303.   end;
  1304. end;
  1305. {$ELSE}
  1306. function GetConsoleCursorInfo; external kernel32 name 'GetConsoleCursorInfo';
  1307. {$ENDIF DYNAMIC_LINK}
  1308. {$IFDEF DYNAMIC_LINK}
  1309. var
  1310.   _GetCurrentConsoleFont: Pointer;
  1311. function GetCurrentConsoleFont;
  1312. begin
  1313.   GetProcedureAddress(_GetCurrentConsoleFont, kernel32, 'GetCurrentConsoleFont');
  1314.   asm
  1315.     mov esp, ebp
  1316.     pop ebp
  1317.     jmp [_GetCurrentConsoleFont]
  1318.   end;
  1319. end;
  1320. {$ELSE}
  1321. function GetCurrentConsoleFont; external kernel32 name 'GetCurrentConsoleFont';
  1322. {$ENDIF DYNAMIC_LINK}
  1323. {$IFDEF DYNAMIC_LINK}
  1324. var
  1325.   _GetConsoleFontSize: Pointer;
  1326. function GetConsoleFontSize;
  1327. begin
  1328.   GetProcedureAddress(_GetConsoleFontSize, kernel32, 'GetConsoleFontSize');
  1329.   asm
  1330.     mov esp, ebp
  1331.     pop ebp
  1332.     jmp [_GetConsoleFontSize]
  1333.   end;
  1334. end;
  1335. {$ELSE}
  1336. function GetConsoleFontSize; external kernel32 name 'GetConsoleFontSize';
  1337. {$ENDIF DYNAMIC_LINK}
  1338. {$IFDEF DYNAMIC_LINK}
  1339. var
  1340.   _GetConsoleSelectionInfo: Pointer;
  1341. function GetConsoleSelectionInfo;
  1342. begin
  1343.   GetProcedureAddress(_GetConsoleSelectionInfo, kernel32, 'GetConsoleSelectionInfo');
  1344.   asm
  1345.     mov esp, ebp
  1346.     pop ebp
  1347.     jmp [_GetConsoleSelectionInfo]
  1348.   end;
  1349. end;
  1350. {$ELSE}
  1351. function GetConsoleSelectionInfo; external kernel32 name 'GetConsoleSelectionInfo';
  1352. {$ENDIF DYNAMIC_LINK}
  1353. {$IFDEF DYNAMIC_LINK}
  1354. var
  1355.   _GetNumberOfConsoleMouseButtons: Pointer;
  1356. function GetNumberOfConsoleMouseButtons;
  1357. begin
  1358.   GetProcedureAddress(_GetNumberOfConsoleMouseButtons, kernel32, 'GetNumberOfConsoleMouseButtons');
  1359.   asm
  1360.     mov esp, ebp
  1361.     pop ebp
  1362.     jmp [_GetNumberOfConsoleMouseButtons]
  1363.   end;
  1364. end;
  1365. {$ELSE}
  1366. function GetNumberOfConsoleMouseButtons; external kernel32 name 'GetNumberOfConsoleMouseButtons';
  1367. {$ENDIF DYNAMIC_LINK}
  1368. {$IFDEF DYNAMIC_LINK}
  1369. var
  1370.   _SetConsoleMode: Pointer;
  1371. function SetConsoleMode;
  1372. begin
  1373.   GetProcedureAddress(_SetConsoleMode, kernel32, 'SetConsoleMode');
  1374.   asm
  1375.     mov esp, ebp
  1376.     pop ebp
  1377.     jmp [_SetConsoleMode]
  1378.   end;
  1379. end;
  1380. {$ELSE}
  1381. function SetConsoleMode; external kernel32 name 'SetConsoleMode';
  1382. {$ENDIF DYNAMIC_LINK}
  1383. {$IFDEF DYNAMIC_LINK}
  1384. var
  1385.   _SetConsoleActiveScreenBuffer: Pointer;
  1386. function SetConsoleActiveScreenBuffer;
  1387. begin
  1388.   GetProcedureAddress(_SetConsoleActiveScreenBuffer, kernel32, 'SetConsoleActiveScreenBuffer');
  1389.   asm
  1390.     mov esp, ebp
  1391.     pop ebp
  1392.     jmp [_SetConsoleActiveScreenBuffer]
  1393.   end;
  1394. end;
  1395. {$ELSE}
  1396. function SetConsoleActiveScreenBuffer; external kernel32 name 'SetConsoleActiveScreenBuffer';
  1397. {$ENDIF DYNAMIC_LINK}
  1398. {$IFDEF DYNAMIC_LINK}
  1399. var
  1400.   _FlushConsoleInputBuffer: Pointer;
  1401. function FlushConsoleInputBuffer;
  1402. begin
  1403.   GetProcedureAddress(_FlushConsoleInputBuffer, kernel32, 'FlushConsoleInputBuffer');
  1404.   asm
  1405.     mov esp, ebp
  1406.     pop ebp
  1407.     jmp [_FlushConsoleInputBuffer]
  1408.   end;
  1409. end;
  1410. {$ELSE}
  1411. function FlushConsoleInputBuffer; external kernel32 name 'FlushConsoleInputBuffer';
  1412. {$ENDIF DYNAMIC_LINK}
  1413. {$IFDEF DYNAMIC_LINK}
  1414. var
  1415.   _SetConsoleScreenBufferSize: Pointer;
  1416. function SetConsoleScreenBufferSize;
  1417. begin
  1418.   GetProcedureAddress(_SetConsoleScreenBufferSize, kernel32, 'SetConsoleScreenBufferSize');
  1419.   asm
  1420.     mov esp, ebp
  1421.     pop ebp
  1422.     jmp [_SetConsoleScreenBufferSize]
  1423.   end;
  1424. end;
  1425. {$ELSE}
  1426. function SetConsoleScreenBufferSize; external kernel32 name 'SetConsoleScreenBufferSize';
  1427. {$ENDIF DYNAMIC_LINK}
  1428. {$IFDEF DYNAMIC_LINK}
  1429. var
  1430.   _SetConsoleCursorPosition: Pointer;
  1431. function SetConsoleCursorPosition;
  1432. begin
  1433.   GetProcedureAddress(_SetConsoleCursorPosition, kernel32, 'SetConsoleCursorPosition');
  1434.   asm
  1435.     mov esp, ebp
  1436.     pop ebp
  1437.     jmp [_SetConsoleCursorPosition]
  1438.   end;
  1439. end;
  1440. {$ELSE}
  1441. function SetConsoleCursorPosition; external kernel32 name 'SetConsoleCursorPosition';
  1442. {$ENDIF DYNAMIC_LINK}
  1443. {$IFDEF DYNAMIC_LINK}
  1444. var
  1445.   _SetConsoleCursorInfo: Pointer;
  1446. function SetConsoleCursorInfo;
  1447. begin
  1448.   GetProcedureAddress(_SetConsoleCursorInfo, kernel32, 'SetConsoleCursorInfo');
  1449.   asm
  1450.     mov esp, ebp
  1451.     pop ebp
  1452.     jmp [_SetConsoleCursorInfo]
  1453.   end;
  1454. end;
  1455. {$ELSE}
  1456. function SetConsoleCursorInfo; external kernel32 name 'SetConsoleCursorInfo';
  1457. {$ENDIF DYNAMIC_LINK}
  1458. {$IFDEF DYNAMIC_LINK}
  1459. var
  1460.   _ScrollConsoleScreenBufferA: Pointer;
  1461. function ScrollConsoleScreenBufferA;
  1462. begin
  1463.   GetProcedureAddress(_ScrollConsoleScreenBufferA, kernel32, 'ScrollConsoleScreenBufferA');
  1464.   asm
  1465.     mov esp, ebp
  1466.     pop ebp
  1467.     jmp [_ScrollConsoleScreenBufferA]
  1468.   end;
  1469. end;
  1470. {$ELSE}
  1471. function ScrollConsoleScreenBufferA; external kernel32 name 'ScrollConsoleScreenBufferA';
  1472. {$ENDIF DYNAMIC_LINK}
  1473. {$IFDEF DYNAMIC_LINK}
  1474. var
  1475.   _ScrollConsoleScreenBufferW: Pointer;
  1476. function ScrollConsoleScreenBufferW;
  1477. begin
  1478.   GetProcedureAddress(_ScrollConsoleScreenBufferW, kernel32, 'ScrollConsoleScreenBufferW');
  1479.   asm
  1480.     mov esp, ebp
  1481.     pop ebp
  1482.     jmp [_ScrollConsoleScreenBufferW]
  1483.   end;
  1484. end;
  1485. {$ELSE}
  1486. function ScrollConsoleScreenBufferW; external kernel32 name 'ScrollConsoleScreenBufferW';
  1487. {$ENDIF DYNAMIC_LINK}
  1488. {$IFDEF UNICODE}
  1489. {$IFDEF DYNAMIC_LINK}
  1490. var
  1491.   _ScrollConsoleScreenBuffer: Pointer;
  1492. function ScrollConsoleScreenBuffer;
  1493. begin
  1494.   GetProcedureAddress(_ScrollConsoleScreenBuffer, kernel32, 'ScrollConsoleScreenBufferW');
  1495.   asm
  1496.     mov esp, ebp
  1497.     pop ebp
  1498.     jmp [_ScrollConsoleScreenBuffer]
  1499.   end;
  1500. end;
  1501. {$ELSE}
  1502. function ScrollConsoleScreenBuffer; external kernel32 name 'ScrollConsoleScreenBufferW';
  1503. {$ENDIF DYNAMIC_LINK}
  1504. {$ELSE}
  1505. {$IFDEF DYNAMIC_LINK}
  1506. var
  1507.   _ScrollConsoleScreenBuffer: Pointer;
  1508. function ScrollConsoleScreenBuffer;
  1509. begin
  1510.   GetProcedureAddress(_ScrollConsoleScreenBuffer, kernel32, 'ScrollConsoleScreenBufferA');
  1511.   asm
  1512.     mov esp, ebp
  1513.     pop ebp
  1514.     jmp [_ScrollConsoleScreenBuffer]
  1515.   end;
  1516. end;
  1517. {$ELSE}
  1518. function ScrollConsoleScreenBuffer; external kernel32 name 'ScrollConsoleScreenBufferA';
  1519. {$ENDIF DYNAMIC_LINK}
  1520. {$ENDIF}
  1521. {$IFDEF DYNAMIC_LINK}
  1522. var
  1523.   _SetConsoleWindowInfo: Pointer;
  1524. function SetConsoleWindowInfo;
  1525. begin
  1526.   GetProcedureAddress(_SetConsoleWindowInfo, kernel32, 'SetConsoleWindowInfo');
  1527.   asm
  1528.     mov esp, ebp
  1529.     pop ebp
  1530.     jmp [_SetConsoleWindowInfo]
  1531.   end;
  1532. end;
  1533. {$ELSE}
  1534. function SetConsoleWindowInfo; external kernel32 name 'SetConsoleWindowInfo';
  1535. {$ENDIF DYNAMIC_LINK}
  1536. {$IFDEF DYNAMIC_LINK}
  1537. var
  1538.   _SetConsoleTextAttribute: Pointer;
  1539. function SetConsoleTextAttribute;
  1540. begin
  1541.   GetProcedureAddress(_SetConsoleTextAttribute, kernel32, 'SetConsoleTextAttribute');
  1542.   asm
  1543.     mov esp, ebp
  1544.     pop ebp
  1545.     jmp [_SetConsoleTextAttribute]
  1546.   end;
  1547. end;
  1548. {$ELSE}
  1549. function SetConsoleTextAttribute; external kernel32 name 'SetConsoleTextAttribute';
  1550. {$ENDIF DYNAMIC_LINK}
  1551. {$IFDEF DYNAMIC_LINK}
  1552. var
  1553.   _SetConsoleCtrlHandler: Pointer;
  1554. function SetConsoleCtrlHandler;
  1555. begin
  1556.   GetProcedureAddress(_SetConsoleCtrlHandler, kernel32, 'SetConsoleCtrlHandler');
  1557.   asm
  1558.     mov esp, ebp
  1559.     pop ebp
  1560.     jmp [_SetConsoleCtrlHandler]
  1561.   end;
  1562. end;
  1563. {$ELSE}
  1564. function SetConsoleCtrlHandler; external kernel32 name 'SetConsoleCtrlHandler';
  1565. {$ENDIF DYNAMIC_LINK}
  1566. {$IFDEF DYNAMIC_LINK}
  1567. var
  1568.   _GenerateConsoleCtrlEvent: Pointer;
  1569. function GenerateConsoleCtrlEvent;
  1570. begin
  1571.   GetProcedureAddress(_GenerateConsoleCtrlEvent, kernel32, 'GenerateConsoleCtrlEvent');
  1572.   asm
  1573.     mov esp, ebp
  1574.     pop ebp
  1575.     jmp [_GenerateConsoleCtrlEvent]
  1576.   end;
  1577. end;
  1578. {$ELSE}
  1579. function GenerateConsoleCtrlEvent; external kernel32 name 'GenerateConsoleCtrlEvent';
  1580. {$ENDIF DYNAMIC_LINK}
  1581. {$IFDEF DYNAMIC_LINK}
  1582. var
  1583.   _AllocConsole: Pointer;
  1584. function AllocConsole;
  1585. begin
  1586.   GetProcedureAddress(_AllocConsole, kernel32, 'AllocConsole');
  1587.   asm
  1588.     mov esp, ebp
  1589.     pop ebp
  1590.     jmp [_AllocConsole]
  1591.   end;
  1592. end;
  1593. {$ELSE}
  1594. function AllocConsole; external kernel32 name 'AllocConsole';
  1595. {$ENDIF DYNAMIC_LINK}
  1596. {$IFDEF DYNAMIC_LINK}
  1597. var
  1598.   _FreeConsole: Pointer;
  1599. function FreeConsole;
  1600. begin
  1601.   GetProcedureAddress(_FreeConsole, kernel32, 'FreeConsole');
  1602.   asm
  1603.     mov esp, ebp
  1604.     pop ebp
  1605.     jmp [_FreeConsole]
  1606.   end;
  1607. end;
  1608. {$ELSE}
  1609. function FreeConsole; external kernel32 name 'FreeConsole';
  1610. {$ENDIF DYNAMIC_LINK}
  1611. {$IFDEF DYNAMIC_LINK}
  1612. var
  1613.   _AttachConsole: Pointer;
  1614. function AttachConsole;
  1615. begin
  1616.   GetProcedureAddress(_AttachConsole, kernel32, 'AttachConsole');
  1617.   asm
  1618.     mov esp, ebp
  1619.     pop ebp
  1620.     jmp [_AttachConsole]
  1621.   end;
  1622. end;
  1623. {$ELSE}
  1624. function AttachConsole; external kernel32 name 'AttachConsole';
  1625. {$ENDIF DYNAMIC_LINK}
  1626. {$IFDEF DYNAMIC_LINK}
  1627. var
  1628.   _GetConsoleTitleA: Pointer;
  1629. function GetConsoleTitleA;
  1630. begin
  1631.   GetProcedureAddress(_GetConsoleTitleA, kernel32, 'GetConsoleTitleA');
  1632.   asm
  1633.     mov esp, ebp
  1634.     pop ebp
  1635.     jmp [_GetConsoleTitleA]
  1636.   end;
  1637. end;
  1638. {$ELSE}
  1639. function GetConsoleTitleA; external kernel32 name 'GetConsoleTitleA';
  1640. {$ENDIF DYNAMIC_LINK}
  1641. {$IFDEF DYNAMIC_LINK}
  1642. var
  1643.   _GetConsoleTitleW: Pointer;
  1644. function GetConsoleTitleW;
  1645. begin
  1646.   GetProcedureAddress(_GetConsoleTitleW, kernel32, 'GetConsoleTitleW');
  1647.   asm
  1648.     mov esp, ebp
  1649.     pop ebp
  1650.     jmp [_GetConsoleTitleW]
  1651.   end;
  1652. end;
  1653. {$ELSE}
  1654. function GetConsoleTitleW; external kernel32 name 'GetConsoleTitleW';
  1655. {$ENDIF DYNAMIC_LINK}
  1656. {$IFDEF UNICODE}
  1657. {$IFDEF DYNAMIC_LINK}
  1658. var
  1659.   _GetConsoleTitle: Pointer;
  1660. function GetConsoleTitle;
  1661. begin
  1662.   GetProcedureAddress(_GetConsoleTitle, kernel32, 'GetConsoleTitleW');
  1663.   asm
  1664.     mov esp, ebp
  1665.     pop ebp
  1666.     jmp [_GetConsoleTitle]
  1667.   end;
  1668. end;
  1669. {$ELSE}
  1670. function GetConsoleTitle; external kernel32 name 'GetConsoleTitleW';
  1671. {$ENDIF DYNAMIC_LINK}
  1672. {$ELSE}
  1673. {$IFDEF DYNAMIC_LINK}
  1674. var
  1675.   _GetConsoleTitle: Pointer;
  1676. function GetConsoleTitle;
  1677. begin
  1678.   GetProcedureAddress(_GetConsoleTitle, kernel32, 'GetConsoleTitleA');
  1679.   asm
  1680.     mov esp, ebp
  1681.     pop ebp
  1682.     jmp [_GetConsoleTitle]
  1683.   end;
  1684. end;
  1685. {$ELSE}
  1686. function GetConsoleTitle; external kernel32 name 'GetConsoleTitleA';
  1687. {$ENDIF DYNAMIC_LINK}
  1688. {$ENDIF}
  1689. {$IFDEF DYNAMIC_LINK}
  1690. var
  1691.   _SetConsoleTitleA: Pointer;
  1692. function SetConsoleTitleA;
  1693. begin
  1694.   GetProcedureAddress(_SetConsoleTitleA, kernel32, 'SetConsoleTitleA');
  1695.   asm
  1696.     mov esp, ebp
  1697.     pop ebp
  1698.     jmp [_SetConsoleTitleA]
  1699.   end;
  1700. end;
  1701. {$ELSE}
  1702. function SetConsoleTitleA; external kernel32 name 'SetConsoleTitleA';
  1703. {$ENDIF DYNAMIC_LINK}
  1704. {$IFDEF DYNAMIC_LINK}
  1705. var
  1706.   _SetConsoleTitleW: Pointer;
  1707. function SetConsoleTitleW;
  1708. begin
  1709.   GetProcedureAddress(_SetConsoleTitleW, kernel32, 'SetConsoleTitleW');
  1710.   asm
  1711.     mov esp, ebp
  1712.     pop ebp
  1713.     jmp [_SetConsoleTitleW]
  1714.   end;
  1715. end;
  1716. {$ELSE}
  1717. function SetConsoleTitleW; external kernel32 name 'SetConsoleTitleW';
  1718. {$ENDIF DYNAMIC_LINK}
  1719. {$IFDEF UNICODE}
  1720. {$IFDEF DYNAMIC_LINK}
  1721. var
  1722.   _SetConsoleTitle: Pointer;
  1723. function SetConsoleTitle;
  1724. begin
  1725.   GetProcedureAddress(_SetConsoleTitle, kernel32, 'SetConsoleTitleW');
  1726.   asm
  1727.     mov esp, ebp
  1728.     pop ebp
  1729.     jmp [_SetConsoleTitle]
  1730.   end;
  1731. end;
  1732. {$ELSE}
  1733. function SetConsoleTitle; external kernel32 name 'SetConsoleTitleW';
  1734. {$ENDIF DYNAMIC_LINK}
  1735. {$ELSE}
  1736. {$IFDEF DYNAMIC_LINK}
  1737. var
  1738.   _SetConsoleTitle: Pointer;
  1739. function SetConsoleTitle;
  1740. begin
  1741.   GetProcedureAddress(_SetConsoleTitle, kernel32, 'SetConsoleTitleA');
  1742.   asm
  1743.     mov esp, ebp
  1744.     pop ebp
  1745.     jmp [_SetConsoleTitle]
  1746.   end;
  1747. end;
  1748. {$ELSE}
  1749. function SetConsoleTitle; external kernel32 name 'SetConsoleTitleA';
  1750. {$ENDIF DYNAMIC_LINK}
  1751. {$ENDIF}
  1752. {$IFDEF DYNAMIC_LINK}
  1753. var
  1754.   _ReadConsoleA: Pointer;
  1755. function ReadConsoleA;
  1756. begin
  1757.   GetProcedureAddress(_ReadConsoleA, kernel32, 'ReadConsoleA');
  1758.   asm
  1759.     mov esp, ebp
  1760.     pop ebp
  1761.     jmp [_ReadConsoleA]
  1762.   end;
  1763. end;
  1764. {$ELSE}
  1765. function ReadConsoleA; external kernel32 name 'ReadConsoleA';
  1766. {$ENDIF DYNAMIC_LINK}
  1767. {$IFDEF DYNAMIC_LINK}
  1768. var
  1769.   _ReadConsoleW: Pointer;
  1770. function ReadConsoleW;
  1771. begin
  1772.   GetProcedureAddress(_ReadConsoleW, kernel32, 'ReadConsoleW');
  1773.   asm
  1774.     mov esp, ebp
  1775.     pop ebp
  1776.     jmp [_ReadConsoleW]
  1777.   end;
  1778. end;
  1779. {$ELSE}
  1780. function ReadConsoleW; external kernel32 name 'ReadConsoleW';
  1781. {$ENDIF DYNAMIC_LINK}
  1782. {$IFDEF UNICODE}
  1783. {$IFDEF DYNAMIC_LINK}
  1784. var
  1785.   _ReadConsole: Pointer;
  1786. function ReadConsole;
  1787. begin
  1788.   GetProcedureAddress(_ReadConsole, kernel32, 'ReadConsoleW');
  1789.   asm
  1790.     mov esp, ebp
  1791.     pop ebp
  1792.     jmp [_ReadConsole]
  1793.   end;
  1794. end;
  1795. {$ELSE}
  1796. function ReadConsole; external kernel32 name 'ReadConsoleW';
  1797. {$ENDIF DYNAMIC_LINK}
  1798. {$ELSE}
  1799. {$IFDEF DYNAMIC_LINK}
  1800. var
  1801.   _ReadConsole: Pointer;
  1802. function ReadConsole;
  1803. begin
  1804.   GetProcedureAddress(_ReadConsole, kernel32, 'ReadConsoleA');
  1805.   asm
  1806.     mov esp, ebp
  1807.     pop ebp
  1808.     jmp [_ReadConsole]
  1809.   end;
  1810. end;
  1811. {$ELSE}
  1812. function ReadConsole; external kernel32 name 'ReadConsoleA';
  1813. {$ENDIF DYNAMIC_LINK}
  1814. {$ENDIF}
  1815. {$IFDEF DYNAMIC_LINK}
  1816. var
  1817.   _WriteConsoleA: Pointer;
  1818. function WriteConsoleA;
  1819. begin
  1820.   GetProcedureAddress(_WriteConsoleA, kernel32, 'WriteConsoleA');
  1821.   asm
  1822.     mov esp, ebp
  1823.     pop ebp
  1824.     jmp [_WriteConsoleA]
  1825.   end;
  1826. end;
  1827. {$ELSE}
  1828. function WriteConsoleA; external kernel32 name 'WriteConsoleA';
  1829. {$ENDIF DYNAMIC_LINK}
  1830. {$IFDEF DYNAMIC_LINK}
  1831. var
  1832.   _WriteConsoleW: Pointer;
  1833. function WriteConsoleW;
  1834. begin
  1835.   GetProcedureAddress(_WriteConsoleW, kernel32, 'WriteConsoleW');
  1836.   asm
  1837.     mov esp, ebp
  1838.     pop ebp
  1839.     jmp [_WriteConsoleW]
  1840.   end;
  1841. end;
  1842. {$ELSE}
  1843. function WriteConsoleW; external kernel32 name 'WriteConsoleW';
  1844. {$ENDIF DYNAMIC_LINK}
  1845. {$IFDEF UNICODE}
  1846. {$IFDEF DYNAMIC_LINK}
  1847. var
  1848.   _WriteConsole: Pointer;
  1849. function WriteConsole;
  1850. begin
  1851.   GetProcedureAddress(_WriteConsole, kernel32, 'WriteConsoleW');
  1852.   asm
  1853.     mov esp, ebp
  1854.     pop ebp
  1855.     jmp [_WriteConsole]
  1856.   end;
  1857. end;
  1858. {$ELSE}
  1859. function WriteConsole; external kernel32 name 'WriteConsoleW';
  1860. {$ENDIF DYNAMIC_LINK}
  1861. {$ELSE}
  1862. {$IFDEF DYNAMIC_LINK}
  1863. var
  1864.   _WriteConsole: Pointer;
  1865. function WriteConsole;
  1866. begin
  1867.   GetProcedureAddress(_WriteConsole, kernel32, 'WriteConsoleA');
  1868.   asm
  1869.     mov esp, ebp
  1870.     pop ebp
  1871.     jmp [_WriteConsole]
  1872.   end;
  1873. end;
  1874. {$ELSE}
  1875. function WriteConsole; external kernel32 name 'WriteConsoleA';
  1876. {$ENDIF DYNAMIC_LINK}
  1877. {$ENDIF}
  1878. {$IFDEF DYNAMIC_LINK}
  1879. var
  1880.   _CreateConsoleScreenBuffer: Pointer;
  1881. function CreateConsoleScreenBuffer;
  1882. begin
  1883.   GetProcedureAddress(_CreateConsoleScreenBuffer, kernel32, 'CreateConsoleScreenBuffer');
  1884.   asm
  1885.     mov esp, ebp
  1886.     pop ebp
  1887.     jmp [_CreateConsoleScreenBuffer]
  1888.   end;
  1889. end;
  1890. {$ELSE}
  1891. function CreateConsoleScreenBuffer; external kernel32 name 'CreateConsoleScreenBuffer';
  1892. {$ENDIF DYNAMIC_LINK}
  1893. {$IFDEF DYNAMIC_LINK}
  1894. var
  1895.   _GetConsoleCP: Pointer;
  1896. function GetConsoleCP;
  1897. begin
  1898.   GetProcedureAddress(_GetConsoleCP, kernel32, 'GetConsoleCP');
  1899.   asm
  1900.     mov esp, ebp
  1901.     pop ebp
  1902.     jmp [_GetConsoleCP]
  1903.   end;
  1904. end;
  1905. {$ELSE}
  1906. function GetConsoleCP; external kernel32 name 'GetConsoleCP';
  1907. {$ENDIF DYNAMIC_LINK}
  1908. {$IFDEF DYNAMIC_LINK}
  1909. var
  1910.   _SetConsoleCP: Pointer;
  1911. function SetConsoleCP;
  1912. begin
  1913.   GetProcedureAddress(_SetConsoleCP, kernel32, 'SetConsoleCP');
  1914.   asm
  1915.     mov esp, ebp
  1916.     pop ebp
  1917.     jmp [_SetConsoleCP]
  1918.   end;
  1919. end;
  1920. {$ELSE}
  1921. function SetConsoleCP; external kernel32 name 'SetConsoleCP';
  1922. {$ENDIF DYNAMIC_LINK}
  1923. {$IFDEF DYNAMIC_LINK}
  1924. var
  1925.   _GetConsoleOutputCP: Pointer;
  1926. function GetConsoleOutputCP;
  1927. begin
  1928.   GetProcedureAddress(_GetConsoleOutputCP, kernel32, 'GetConsoleOutputCP');
  1929.   asm
  1930.     mov esp, ebp
  1931.     pop ebp
  1932.     jmp [_GetConsoleOutputCP]
  1933.   end;
  1934. end;
  1935. {$ELSE}
  1936. function GetConsoleOutputCP; external kernel32 name 'GetConsoleOutputCP';
  1937. {$ENDIF DYNAMIC_LINK}
  1938. {$IFDEF DYNAMIC_LINK}
  1939. var
  1940.   _SetConsoleOutputCP: Pointer;
  1941. function SetConsoleOutputCP;
  1942. begin
  1943.   GetProcedureAddress(_SetConsoleOutputCP, kernel32, 'SetConsoleOutputCP');
  1944.   asm
  1945.     mov esp, ebp
  1946.     pop ebp
  1947.     jmp [_SetConsoleOutputCP]
  1948.   end;
  1949. end;
  1950. {$ELSE}
  1951. function SetConsoleOutputCP; external kernel32 name 'SetConsoleOutputCP';
  1952. {$ENDIF DYNAMIC_LINK}
  1953. {$IFDEF DYNAMIC_LINK}
  1954. var
  1955.   _GetConsoleDisplayMode: Pointer;
  1956. function GetConsoleDisplayMode;
  1957. begin
  1958.   GetProcedureAddress(_GetConsoleDisplayMode, kernel32, 'GetConsoleDisplayMode');
  1959.   asm
  1960.     mov esp, ebp
  1961.     pop ebp
  1962.     jmp [_GetConsoleDisplayMode]
  1963.   end;
  1964. end;
  1965. {$ELSE}
  1966. function GetConsoleDisplayMode; external kernel32 name 'GetConsoleDisplayMode';
  1967. {$ENDIF DYNAMIC_LINK}
  1968. {$IFDEF DYNAMIC_LINK}
  1969. var
  1970.   _GetConsoleWindow: Pointer;
  1971. function GetConsoleWindow;
  1972. begin
  1973.   GetProcedureAddress(_GetConsoleWindow, kernel32, 'GetConsoleWindow');
  1974.   asm
  1975.     mov esp, ebp
  1976.     pop ebp
  1977.     jmp [_GetConsoleWindow]
  1978.   end;
  1979. end;
  1980. {$ELSE}
  1981. function GetConsoleWindow; external kernel32 name 'GetConsoleWindow';
  1982. {$ENDIF DYNAMIC_LINK}
  1983. {$IFDEF DYNAMIC_LINK}
  1984. var
  1985.   _GetConsoleProcessList: Pointer;
  1986. function GetConsoleProcessList;
  1987. begin
  1988.   GetProcedureAddress(_GetConsoleProcessList, kernel32, 'GetConsoleProcessList');
  1989.   asm
  1990.     mov esp, ebp
  1991.     pop ebp
  1992.     jmp [_GetConsoleProcessList]
  1993.   end;
  1994. end;
  1995. {$ELSE}
  1996. function GetConsoleProcessList; external kernel32 name 'GetConsoleProcessList';
  1997. {$ENDIF DYNAMIC_LINK}
  1998. end.