00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #define DEFAULT_NUMBER_OF_EVENTS 50
00023 #define INPUT_BUFFER_SIZE_INCREMENT 10
00024
00025 typedef struct _INPUT_INFORMATION {
00026 PINPUT_RECORD
InputBuffer;
00027 DWORD InputBufferSize;
00028 CONSOLE_SHARE_ACCESS ShareAccess;
00029 DWORD AllocatedBufferSize;
00030 DWORD InputMode;
00031 ULONG
RefCount;
00032 ULONG_PTR
First;
00033 ULONG_PTR
In;
00034 ULONG_PTR
Out;
00035 ULONG_PTR
Last;
00036 LIST_ENTRY
ReadWaitQueue;
00037 HANDLE
InputWaitEvent;
00038
#if defined(FE_SB)
00039
#if defined(FE_IME)
00040
struct {
00041
DWORD Disable : 1;
00042
DWORD Unavailable : 1;
00043
DWORD Open : 1;
00044
00045
DWORD ReadyConversion:1;
00046
00047
DWORD Conversion;
00048
00049 } ImeMode;
00050 HWND hWndConsoleIME;
00051
#endif // FE_IME
00052
struct _CONSOLE_INFORMATION *Console;
00053 INPUT_RECORD ReadConInpDbcsLeadByte;
00054 INPUT_RECORD WriteConInpDbcsLeadByte[2];
00055
#endif
00056
}
INPUT_INFORMATION, *
PINPUT_INFORMATION;
00057
00058 typedef struct _INPUT_READ_HANDLE_DATA {
00059
00060
00061
00062
00063
00064 CRITICAL_SECTION
ReadCountLock;
00065 ULONG
ReadCount;
00066 ULONG
InputHandleFlags;
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 ULONG
BytesAvailable;
00078 PWCHAR
CurrentBufPtr;
00079 PWCHAR
BufPtr;
00080 }
INPUT_READ_HANDLE_DATA, *
PINPUT_READ_HANDLE_DATA;
00081
00082 #define UNICODE_BACKSPACE ((WCHAR)0x08)
00083 #define UNICODE_BACKSPACE2 ((WCHAR)0x25d8)
00084 #define UNICODE_CARRIAGERETURN ((WCHAR)0x0d)
00085 #define UNICODE_LINEFEED ((WCHAR)0x0a)
00086 #define UNICODE_BELL ((WCHAR)0x07)
00087 #define UNICODE_TAB ((WCHAR)0x09)
00088 #define UNICODE_SPACE ((WCHAR)0x20)
00089
00090 #define TAB_SIZE 8
00091 #define TAB_MASK (TAB_SIZE-1)
00092 #define NUMBER_OF_SPACES_IN_TAB(POSITION) (TAB_SIZE - ((POSITION) & TAB_MASK))
00093
00094 #define AT_EOL(COOKEDREADDATA) ((COOKEDREADDATA)->BytesRead == ((COOKEDREADDATA)->CurrentPosition*2))
00095 #define INSERT_MODE(COOKEDREADDATA) ((COOKEDREADDATA)->InsertMode)
00096
00097 #define VIRTUAL_KEY_CODE_S 0x53
00098 #define VIRTUAL_KEY_CODE_C 0x43
00099
00100 #define VK_OEM_SCROLL 0x91
00101
00102 #define KEY_PRESSED 0x8000
00103 #define KEY_TOGGLED 0x01
00104 #define KEY_ENHANCED 0x01000000
00105 #define KEY_UP_TRANSITION 1
00106 #define KEY_PREVIOUS_DOWN 0x40000000
00107 #define KEY_TRANSITION_UP 0x80000000
00108
00109 #define CONSOLE_CTRL_C_SEEN 1
00110 #define CONSOLE_CTRL_BREAK_SEEN 2
00111
00112 #define LockReadCount(HANDLEPTR) RtlEnterCriticalSection(&(HANDLEPTR)->InputReadData->ReadCountLock)
00113 #define UnlockReadCount(HANDLEPTR) RtlLeaveCriticalSection(&(HANDLEPTR)->InputReadData->ReadCountLock)
00114
00115 #define LoadKeyEvent(PEVENT,KEYDOWN,CHAR,KEYCODE,SCANCODE,KEYSTATE) { \
00116
(PEVENT)->EventType = KEY_EVENT; \
00117
(PEVENT)->Event.KeyEvent.bKeyDown = KEYDOWN; \
00118
(PEVENT)->Event.KeyEvent.wRepeatCount = 1; \
00119
(PEVENT)->Event.KeyEvent.uChar.UnicodeChar = CHAR; \
00120
(PEVENT)->Event.KeyEvent.wVirtualKeyCode = KEYCODE; \
00121
(PEVENT)->Event.KeyEvent.wVirtualScanCode = SCANCODE; \
00122
(PEVENT)->Event.KeyEvent.dwControlKeyState = KEYSTATE; \
00123
}