<s> from ctypes import Union , Structure , c_char , c_short , c_long , c_ulong <EOL> from ctypes . wintypes import DWORD , BOOL , LPVOID , WORD , WCHAR <EOL> STD_INPUT_HANDLE = c_ulong ( - <NUM_LIT:10> ) <EOL> STD_OUTPUT_HANDLE = c_ulong ( - <NUM_LIT:11> ) <EOL> STD_ERROR_HANDLE = c_ulong ( - <NUM_LIT:12> ) <EOL> class COORD ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT:X>' , c_short ) , <EOL> ( '<STR_LIT:Y>' , c_short ) , <EOL> ] <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( <EOL> self . __class__ . __name__ , self . X , self . Y , type ( self . X ) , type ( self . Y ) ) <EOL> class UNICODE_OR_ASCII ( Union ) : <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , c_char ) , <EOL> ( '<STR_LIT>' , WCHAR ) , <EOL> ] <EOL> class KEY_EVENT_RECORD ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , c_long ) , <EOL> ( '<STR_LIT>' , c_short ) , <EOL> ( '<STR_LIT>' , c_short ) , <EOL> ( '<STR_LIT>' , c_short ) , <EOL> ( '<STR_LIT>' , UNICODE_OR_ASCII ) , <EOL> ( '<STR_LIT>' , c_long ) <EOL> ] <EOL> class MOUSE_EVENT_RECORD ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , COORD ) , <EOL> ( '<STR_LIT>' , c_long ) , <EOL> ( '<STR_LIT>' , c_long ) , <EOL> ( '<STR_LIT>' , c_long ) <EOL> ] <EOL> class WINDOW_BUFFER_SIZE_RECORD ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , COORD ) <EOL> ] <EOL> class MENU_EVENT_RECORD ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , c_long ) <EOL> ] <EOL> class FOCUS_EVENT_RECORD ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , c_long ) <EOL> ] <EOL> class EVENT_RECORD ( Union ) : <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , KEY_EVENT_RECORD ) , <EOL> ( '<STR_LIT>' , MOUSE_EVENT_RECORD ) , <EOL> ( '<STR_LIT>' , WINDOW_BUFFER_SIZE_RECORD ) , <EOL> ( '<STR_LIT>' , MENU_EVENT_RECORD ) , <EOL> ( '<STR_LIT>' , FOCUS_EVENT_RECORD ) <EOL> ] <EOL> class INPUT_RECORD ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , c_short ) , <EOL> ( '<STR_LIT>' , EVENT_RECORD ) <EOL> ] <EOL> EventTypes = { <EOL> <NUM_LIT:1> : '<STR_LIT>' , <EOL> <NUM_LIT:2> : '<STR_LIT>' , <EOL> <NUM_LIT:4> : '<STR_LIT>' , <EOL> <NUM_LIT:8> : '<STR_LIT>' , <EOL> <NUM_LIT:16> : '<STR_LIT>' <EOL> } <EOL> class SMALL_RECT ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_short ) , <EOL> ( "<STR_LIT>" , c_short ) , <EOL> ( "<STR_LIT>" , c_short ) , <EOL> ( "<STR_LIT>" , c_short ) , <EOL> ] <EOL> class CONSOLE_SCREEN_BUFFER_INFO ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , COORD ) , <EOL> ( "<STR_LIT>" , COORD ) , <EOL> ( "<STR_LIT>" , WORD ) , <EOL> ( "<STR_LIT>" , SMALL_RECT ) , <EOL> ( "<STR_LIT>" , COORD ) , <EOL> ] <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % ( <EOL> self . dwSize . Y , self . dwSize . X , <EOL> self . dwCursorPosition . Y , self . dwCursorPosition . X , <EOL> self . wAttributes , <EOL> self . srWindow . Top , self . srWindow . Left , self . srWindow . Bottom , self . srWindow . Right , <EOL> self . dwMaximumWindowSize . Y , self . dwMaximumWindowSize . X , <EOL> ) <EOL> class SECURITY_ATTRIBUTES ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _fields_ = [ <EOL> ( '<STR_LIT>' , DWORD ) , <EOL> ( '<STR_LIT>' , LPVOID ) , <EOL> ( '<STR_LIT>' , BOOL ) , <EOL> ] </s>
