2.2 INPUT_RECORD

The INPUT_RECORD structure is used by a client to send keyboard input information to the server.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Eventtype

Padding

bkeyDown

Padding2

wRepeatCount

wVirtualKeyCode

wVirtualScanCode

uChar

dwControlKeyState

Eventtype (2 bytes): A 2-byte unsigned integer field, used to indicate the type of the device input data that is carried in the INPUT_RECORD structure. The value of this field MUST be 0x0001, which indicates that the INPUT_RECORD structure carries data generated by a keyboard input device.

Padding (2 bytes): This field can contain any value and MUST be ignored by the receiver.

bkeyDown (1 byte): An 8-bit unsigned integer field that indicates whether the particular keyboard key is pressed or released. This field MUST contain one of the following values:

Value

Meaning

0x01

Key is pressed.

0x00

Key is not pressed.

Padding2 (3 bytes): This field can contain any value and MUST be ignored by the receiver.

wRepeatCount (2 bytes): A 2-byte unsigned integer field that indicates the number of times the key is held down.

wVirtualKeyCode (2 bytes): A 2-byte unsigned integer field that carries the virtual key code of the key pressed. Telnet VTNT Terminal Type Format does not specify how to generate or process virtual key codes. The virtual key code is generated by the software that interfaces with the keyboard.

The implementer of a TELNET server that uses the Telnet VTNT Terminal Type Format decides how to use the value carried by this field. This field MAY be ignored if the server does not require the virtual key code to correctly identify the keyboard key sent by the client.

A client MUST set this field to the virtual key code value that is compatible with the server. If the server does not process this field, the client MUST set it to zero. Telnet VTNT Terminal Type Format does not offer a way for the client to determine if a server expects the client to set this field to zero or to a virtual key code. Rather, the server and client implementations SHOULD be preconfigured to ensure interoperability. Valid virtual key code values are specified in section 2.2.1.<3>

wVirtualScanCode (2 bytes): A 2-byte unsigned integer field that carries the Scan code of the key pressed. Telnet VTNT Terminal Type Format does not specify how to generate or process Scan codes. Scan code is generated by the software that interfaces with the keyboard.

It is a server implementation's choice to decide how to use the value carried by this field. A server implementation can also ignore this field if the console input interface does not require Scan code to correctly identify the Keyboard key sent by the client.

A client MUST set this field to the Scan code value that is compatible with the server. If the Server does not process this field, the client MUST set it to zero. Telnet VTNT Terminal Type Format does not offer a way for the client to determine if a server expects the Client to set this field to zero or Scan Code. Rather, the server and client implementations SHOULD be preconfigured to ensure interoperability.<4>

uChar (2 bytes): A 2-byte unsigned integer field that carries the character to which the key pressed corresponds. If there is no character associated with the key typed, then this field MUST be filled with zeros. Telnet VTNT Terminal Type Format does not specify what character set is to be used. Rather, the client and server implementations SHOULD be configured to use a compatible character set.<5>

dwControlKeyState (4 bytes): A 4-byte unsigned integer field that indicates the state of the control keys in the keyboard. It can be one or more of the following values. This field MUST contain zero, or the result of a bitwise OR of one or more of the following values:

Value

Meaning

0x00000080

 The CAPS LOCK light is on.

0x00000100

 The key is enhanced.

0x00000002

 The left ALT key is pressed.

0x00000008

 The left CTRL key is pressed.

0x00000020

 The NUM LOCK light is on.

0x00000001

 The right ALT key is pressed.

0x00000004

 The right CTRL key is pressed.

0x00000040

 The SCROLL LOCK light is on.

0x00000010

 The SHIFT key is pressed.

0x00010000

 Input method editor (IME) full shape mode. Valid only when IME is used to input.

0x00020000

 IME KATAKANA mode. Valid only when IME is used to input.

0x00040000

 IME HIRAGANA mode. Valid only when IME is used to input.

0x00400000

 IME ROMAN mode. Valid only when IME is used to input.

0x00800000

 IME input on. Valid only when IME is used to input.