summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ntcon/ntcon.h884
-rw-r--r--include/ntcon/ntcon_api.h32
-rw-r--r--include/ntcon/ntcon_env.h22
3 files changed, 938 insertions, 0 deletions
diff --git a/include/ntcon/ntcon.h b/include/ntcon/ntcon.h
new file mode 100644
index 0000000..cef11cf
--- /dev/null
+++ b/include/ntcon/ntcon.h
@@ -0,0 +1,884 @@
+#ifndef NTCON_H
+#define NTCON_H
+
+#include "ntcon_api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* console standard handles */
+#define NT_STD_INPUT_HANDLE (uint32_t)-10
+#define NT_STD_OUTPUT_HANDLE (uint32_t)-11
+#define NT_STD_ERROR_HANDLE (uint32_t)-12
+
+/* console attachment */
+#define NT_ATTACH_PARENT_PROCESS (uint32_t)-1
+
+/* console screen buffer flags */
+#define NT_CONSOLE_TEXTMODE_BUFFER (0x01)
+
+/* console control signals */
+#define NT_CTRL_C_EVENT (0x00)
+#define NT_CTRL_BREAK_EVENT (0x01)
+#define NT_CTRL_CLOSE_EVENT (0x02)
+#define NT_CTRL_LOGOFF_EVENT (0x05)
+#define NT_CTRL_SHUTDOWN_EVENT (0x06)
+
+/* console history flags */
+#define NT_HISTORY_NO_DUP_FLAG (0x0001)
+
+/* console event types */
+#define NT_KEY_EVENT (0x0001)
+#define NT_MOUSE_EVENT (0x0002)
+#define NT_WINDOW_BUFFER_SIZE_EVENT (0x0004)
+#define NT_MENU_EVENT (0x0008)
+#define NT_FOCUS_EVENT (0x0010)
+
+/* control key states */
+#define NT_RIGHT_ALT_PRESSED (0x0001)
+#define NT_LEFT_ALT_PRESSED (0x0002)
+#define NT_RIGHT_CTRL_PRESSED (0x0004)
+#define NT_LEFT_CTRL_PRESSED (0x0008)
+#define NT_SHIFT_PRESSED (0x0010)
+#define NT_NUMLOCK_ON (0x0020)
+#define NT_SCROLLLOCK_ON (0x0040)
+#define NT_CAPSLOCK_ON (0x0080)
+#define NT_ENHANCED_KEY (0x0100)
+
+/* console foreground color attributes */
+#define NT_FOREGROUND_BLACK (0x0000)
+#define NT_FOREGROUND_BLUE (0x0001)
+#define NT_FOREGROUND_GREEN (0x0002)
+#define NT_FOREGROUND_CYAN (0x0003)
+#define NT_FOREGROUND_RED (0x0004)
+#define NT_FOREGROUND_MAGENTA (0x0005)
+#define NT_FOREGROUND_YELLOW (0x0006)
+#define NT_FOREGROUND_WHITE (0x0007)
+#define NT_FOREGROUND_INTENSITY (0x0008)
+
+/* console background color attributes */
+#define NT_BACKGROUND_BLACK (0x0000)
+#define NT_BACKGROUND_BLUE (0x0010)
+#define NT_BACKGROUND_GREEN (0x0020)
+#define NT_BACKGROUND_CYAN (0x0030)
+#define NT_BACKGROUND_RED (0x0040)
+#define NT_BACKGROUND_MAGENTA (0x0050)
+#define NT_BACKGROUND_YELLOW (0x0060)
+#define NT_BACKGROUND_WHITE (0x0070)
+#define NT_BACKGROUND_INTENSITY (0x0080)
+
+/* console common lvb attributes */
+#define NT_COMMON_LVB_LEADING_BYTE (0x0100)
+#define NT_COMMON_LVB_TRAILING_BYTE (0x0200)
+#define NT_COMMON_LVB_GRID_HORIZONTAL (0x0400)
+#define NT_COMMON_LVB_GRID_LVERTICAL (0x0800)
+#define NT_COMMON_LVB_GRID_RVERTICAL (0x1000)
+#define NT_COMMON_LVB_REVERSE_VIDEO (0x4000)
+#define NT_COMMON_LVB_UNDERSCORE (0x8000)
+
+/* console font name length limit */
+#define NT_LF_FACESIZE (0x20)
+
+/* console font families */
+#define NT_FF_DONTCARE (0x0 << 4)
+#define NT_FF_ROMAN (0x1 << 4)
+#define NT_FF_SWISS (0x2 << 4)
+#define NT_FF_MODERN (0x3 << 4)
+#define NT_FF_SCRIPT (0x4 << 4)
+#define NT_FF_DECORATIVE (0x5 << 4)
+
+/* console font weight */
+#define NT_FW_DONTCARE 0
+#define NT_FW_THIN 100
+#define NT_FW_EXTRALIGHT 200
+#define NT_FW_ULTRALIGHT 200
+#define NT_FW_LIGHT 300
+#define NT_FW_NORMAL 400
+#define NT_FW_REGULAR 400
+#define NT_FW_MEDIUM 500
+#define NT_FW_SEMIBOLD 600
+#define NT_FW_DEMIBOLD 600
+#define NT_FW_BOLD 700
+#define NT_FW_EXTRABOLD 800
+#define NT_FW_ULTRABOLD 800
+#define NT_FW_HEAVY 900
+#define NT_FW_BLACK 900
+
+/* console selection bits */
+#define NT_CONSOLE_NO_SELECTION (0x0000)
+#define NT_CONSOLE_SELECTION_IN_PROGRESS (0x0001)
+#define NT_CONSOLE_SELECTION_NOT_EMPTY (0x0002)
+#define NT_CONSOLE_MOUSE_SELECTION (0x0004)
+#define NT_CONSOLE_MOUSE_DOWN (0x0008)
+
+/* console mode bits */
+#define NT_ENABLE_PROCESSED_INPUT (0x0001)
+#define NT_ENABLE_LINE_INPUT (0x0002)
+#define NT_ENABLE_ECHO_INPUT (0x0004)
+#define NT_ENABLE_WINDOW_INPUT (0x0008)
+#define NT_ENABLE_MOUSE_INPUT (0x0010)
+#define NT_ENABLE_INSERT_MODE (0x0020)
+#define NT_ENABLE_QUICK_EDIT_MODE (0x0040)
+
+/* console display modes */
+#define NT_CONSOLE_FULLSCREEN (0x0001)
+#define NT_CONSOLE_FULLSCREEN_HARDWARE (0x0002)
+
+
+/* console structures */
+typedef struct _nt_coord {
+ int16_t x;
+ int16_t y;
+} nt_coord;
+
+
+typedef struct _nt_small_rect {
+ int16_t left;
+ int16_t top;
+ int16_t right;
+ int16_t bottom;
+} nt_small_rect;
+
+
+typedef struct _nt_char_info {
+ union {
+ wchar16_t unicode_char;
+ char ascii_char;
+ } uchar;
+
+ uint16_t attributes;
+} nt_char_info;
+
+
+typedef struct _nt_console_cursor_info {
+ uint32_t size;
+ int32_t visible;
+} nt_console_cursor_info;
+
+
+typedef struct _nt_console_font_info {
+ uint32_t font;
+ nt_coord font_size;
+} nt_console_font_info;
+
+
+typedef struct _nt_console_font_info_ex {
+ uint32_t info_size;
+ uint32_t font;
+ nt_coord font_size;
+ uint32_t font_family;
+ uint32_t font_weight;
+ wchar16_t face_name[NT_LF_FACESIZE];
+} nt_console_font_info_ex;
+
+
+typedef struct _nt_console_history_info {
+ uint32_t info_size;
+ uint32_t history_buffer_size;
+ uint32_t history_buffer_count;
+ uint32_t flags;
+} nt_console_history_info;
+
+
+typedef struct _nt_key_event_record {
+ int32_t key_down;
+ uint16_t repeat_count;
+ uint16_t virtual_key_code;
+ uint16_t virtual_scan_code;
+
+ union {
+ wchar16_t unicode_char;
+ char ascii_char;
+ } uchar;
+
+ uint32_t control_key_state;
+} nt_key_event_record;
+
+
+typedef struct _nt_mouse_event_record {
+ nt_coord mouse_position;
+ uint32_t button_state;
+ uint32_t control_key_state;
+ uint32_t event_flags;
+} nt_mouse_event_record;
+
+
+typedef struct _nt_window_buffer_size_record {
+ nt_coord size;
+} nt_window_buffer_size_record;
+
+
+typedef struct _nt_menu_event_record {
+ uint32_t command_id;
+} nt_menu_event_record;
+
+
+typedef struct _nt_focus_event_record {
+ int32_t set_focus;
+} nt_focus_event_record;
+
+
+typedef struct _nt_input_record {
+ uint16_t event_type;
+
+ union {
+ nt_key_event_record key_event;
+ nt_mouse_event_record mouse_event;
+ nt_window_buffer_size_record window_buffer_size_event;
+ nt_menu_event_record menu_event;
+ nt_focus_event_record focus_event;
+ } event;
+} nt_input_record;
+
+
+typedef struct _nt_console_screen_buffer_info {
+ nt_coord size;
+ nt_coord cursor_position;
+ uint16_t attributes;
+ nt_small_rect window;
+ nt_coord max_windows_size;
+} nt_console_screen_buffer_info;
+
+
+typedef struct _nt_console_screen_buffer_info_ex {
+ uint16_t info_size;
+ nt_coord size;
+ nt_coord cursor_position;
+ uint16_t attributes;
+ nt_small_rect window;
+ nt_coord max_windows_size;
+ uint16_t popup_attributes;
+ int32_t full_screen_supported;
+ uint32_t color_table[0x10];
+} nt_console_screen_buffer_info_ex;
+
+
+typedef struct _nt_console_read_console_control {
+ uint32_t length;
+ uint32_t initial_chars;
+ uint32_t crtl_wakeup_mask;
+ uint32_t ctrl_key_state;
+} nt_console_read_console_control;
+
+
+typedef struct _nt_console_selection_info {
+ uint32_t flags;
+ nt_coord selection_anchor;
+ nt_small_rect selection;
+} nt_console_selection_info;
+
+
+/* console api: console handles */
+typedef int32_t __stdcall ntcon_alloc_console(void);
+
+
+typedef int32_t __stdcall ntcon_attach_console(uint32_t pid);
+
+
+typedef int32_t __stdcall ntcon_free_console(void);
+
+
+typedef void * __stdcall ntcon_get_std_handle(uint32_t ntcon_std_type);
+
+
+/* console api: read/write using std handles */
+typedef int32_t __stdcall ntcon_get_number_of_console_input_events(
+ __in void * hconin,
+ __out uint32_t * number_of_events);
+
+
+typedef int32_t __stdcall ntcon_flush_console_input_buffer(
+ __in void * hconin);
+
+
+typedef int32_t __stdcall ntcon_peek_console_input_ansi(
+ __in void * hconin,
+ __out nt_input_record * buffer,
+ __in uint32_t length,
+ __out uint32_t * events_read);
+
+
+typedef int32_t __stdcall ntcon_peek_console_input_utf16(
+ __in void * hconin,
+ __out nt_input_record * buffer,
+ __in uint32_t length,
+ __out uint32_t * events_read);
+
+
+typedef int32_t __stdcall ntcon_read_console_ansi(
+ __in void * hconsole,
+ __out char * buffer,
+ __in uint32_t chars_to_read,
+ __out uint32_t * chars_read,
+ __in void * input_control __optional);
+
+
+typedef int32_t __stdcall ntcon_read_console_utf16(
+ __in void * hconsole,
+ __out wchar16_t * buffer,
+ __in uint32_t chars_to_read,
+ __out uint32_t * chars_read,
+ __in void * input_control __optional);
+
+
+typedef int32_t __stdcall ntcon_read_console_input_ansi(
+ __in void * hconin,
+ __out nt_input_record * buffer,
+ __in uint32_t length,
+ __out uint32_t * events_read);
+
+
+typedef int32_t __stdcall ntcon_read_console_input_utf16(
+ __in void * hconin,
+ __out nt_input_record * buffer,
+ __in uint32_t length,
+ __out uint32_t * events_read);
+
+
+typedef int32_t __stdcall ntcon_read_console_output_ansi(
+ __in void * hconout,
+ __out nt_char_info * buffer,
+ __in nt_coord buffer_size,
+ __in nt_coord buffer_coord,
+ __in_out nt_small_rect * read_region);
+
+
+typedef int32_t __stdcall ntcon_read_console_output_utf16(
+ __in void * hconout,
+ __out nt_char_info * buffer,
+ __in nt_coord buffer_size,
+ __in nt_coord buffer_coord,
+ __in_out nt_small_rect * read_region);
+
+
+typedef int32_t __stdcall ntcon_write_console_ansi(
+ __in void * hconsole,
+ __in const void * buffer,
+ __in uint32_t bytes_sent,
+ __out uint32_t * bytes_written,
+ __in_out void * overlapped __optional);
+
+typedef int32_t __stdcall ntcon_write_console_utf16(
+ __in void * hconsole,
+ __in const void * buffer,
+ __in uint32_t bytes_sent,
+ __out uint32_t * bytes_written,
+ __in_out void * overlapped __optional);
+
+
+typedef int32_t __stdcall ntcon_write_console_input_ansi(
+ __in void * hconin,
+ __in const nt_input_record * buffer,
+ __in uint32_t length,
+ __out uint32_t * events_written);
+
+
+typedef int32_t __stdcall ntcon_write_console_input_utf16(
+ __in void * hconin,
+ __in const nt_input_record * buffer,
+ __in uint32_t length,
+ __out uint32_t * events_written);
+
+
+typedef int32_t __stdcall ntcon_write_console_output_ansi(
+ __in void * hconout,
+ __in const nt_char_info * buffer,
+ __in nt_coord buffer_size,
+ __in nt_coord buffer_coord,
+ __in_out nt_small_rect * write_region);
+
+
+typedef int32_t __stdcall ntcon_write_console_output_utf16(
+ __in void * hconout,
+ __in const nt_char_info * buffer,
+ __in nt_coord buffer_size,
+ __in nt_coord buffer_coord,
+ __in_out nt_small_rect * write_region);
+
+
+/* console api: screen buffers */
+typedef struct _nt_security_attributes nt_security_attributes;
+
+typedef void * __stdcall ntcon_create_console_screen_buffer(
+ __in uint32_t desired_access,
+ __in uint32_t share_mode,
+ __in nt_security_attributes * sec_attr __optional,
+ __in uint32_t flags,
+ __in void * reserved);
+
+
+typedef int32_t __stdcall ntcon_get_console_screen_buffer_info(
+ __in void * hconout,
+ __out nt_console_screen_buffer_info * con_screen_buffer_info);
+
+
+typedef int32_t __stdcall ntcon_get_console_screen_buffer_info_ex(
+ __in void * hconout,
+ __out nt_console_screen_buffer_info_ex * con_screen_buffer_info_ex);
+
+
+typedef int32_t __stdcall ntcon_set_console_screen_buffer_info_ex(
+ __in void * hconout,
+ __out nt_console_screen_buffer_info_ex * con_screen_buffer_info_ex);
+
+
+typedef int32_t __stdcall ntcon_set_console_screen_buffer_size(
+ __in void * hconout,
+ __in nt_coord size);
+
+
+typedef int32_t __stdcall ntcon_set_console_active_screen_buffer(
+ __in void * hconout);
+
+
+typedef int32_t __stdcall ntcon_set_console_window_info(
+ __in void * hconout,
+ __in int32_t absolute,
+ __in const nt_small_rect * console_window);
+
+
+typedef int32_t __stdcall ntcon_scroll_console_screen_buffer_ansi(
+ __in void * hconout,
+ __in const nt_small_rect * scroll_rect,
+ __in const nt_small_rect * clip_rect __optional,
+ __in nt_coord dest_origin,
+ __in const nt_char_info * fill);
+
+
+typedef int32_t __stdcall ntcon_scroll_console_screen_buffer_utf16(
+ __in void * hconout,
+ __in const nt_small_rect * scroll_rect,
+ __in const nt_small_rect * clip_rect __optional,
+ __in nt_coord dest_origin,
+ __in const nt_char_info * fill);
+
+
+/* console api: code page */
+typedef uint32_t __stdcall ntcon_get_console_code_page(void);
+
+
+typedef int32_t __stdcall ntcon_set_console_code_page(uint32_t code_page);
+
+
+/* console api: console control */
+typedef int32_t __stdcall nt_console_handler_routine(
+ __in uint32_t console_ctrl_type);
+
+
+typedef int32_t __stdcall ntcon_generate_console_ctrl_event(
+ __in uint32_t ctrl_event,
+ __in uint32_t process_group_id);
+
+
+typedef int32_t __stdcall ntcon_set_console_ctrl_handler(
+ __in nt_console_handler_routine * handler_routine __optional,
+ __in int32_t add_or_remove);
+
+
+/* console api: interface mode */
+typedef int32_t __stdcall ntcon_get_console_mode(
+ __in void * hconsole,
+ __out uint32_t * mode);
+
+
+typedef int32_t __stdcall ntcon_set_console_mode(
+ __in void * hconsole,
+ __in uint32_t mode);
+
+
+/* console api: console process list */
+typedef uint32_t __stdcall ntcon_get_console_process_list(
+ __out uint32_t * process_list,
+ __in uint32_t process_count);
+
+
+/* console api: aliases */
+typedef int32_t __stdcall ntcon_add_console_alias_ansi(
+ __in char * source,
+ __in char * target,
+ __in char * exe_name);
+
+
+typedef int32_t __stdcall ntcon_add_console_alias_utf16(
+ __in wchar16_t * source,
+ __in wchar16_t * target,
+ __in wchar16_t * exe_name);
+
+
+typedef uint32_t __stdcall ntcon_get_console_alias_ansi(
+ __in char * source,
+ __out char * target_buffer,
+ __in uint32_t target_buffer_length,
+ __in char * exe_name);
+
+
+typedef uint32_t __stdcall ntcon_get_console_alias_utf16(
+ __in wchar16_t * source,
+ __out wchar16_t * target_buffer,
+ __in uint32_t target_buffer_length,
+ __in wchar16_t * exe_name);
+
+
+typedef uint32_t __stdcall ntcon_get_console_aliases_ansi(
+ __out char * alias_buffer,
+ __in uint32_t alias_buffer_length,
+ __in char * exe_name);
+
+
+typedef uint32_t __stdcall ntcon_get_console_aliases_utf16(
+ __out wchar16_t * alias_buffer,
+ __in uint32_t alias_buffer_length,
+ __in wchar16_t * exe_name);
+
+
+typedef uint32_t __stdcall ntcon_get_console_aliases_length_ansi(
+ __in char * exe_name);
+
+
+typedef uint32_t __stdcall ntcon_get_console_aliases_length_utf16(
+ __in wchar16_t * exe_name);
+
+
+typedef uint32_t __stdcall ntcon_get_console_alias_exes_ansi(
+ __out char * exe_name_buffer,
+ __in uint32_t exe_name_buffer_length);
+
+
+typedef uint32_t __stdcall ntcon_get_console_alias_exes_utf16(
+ __out wchar16_t * exe_name_buffer,
+ __in uint32_t exe_name_buffer_length);
+
+
+typedef uint32_t __stdcall ntcon_get_console_alias_exes_length_ansi(void);
+
+
+typedef uint32_t __stdcall ntcon_get_console_alias_exes_length_utf16(void);
+
+
+/* console api: output attributes */
+typedef int32_t __stdcall ntcon_fill_console_output_attribute(
+ __in void * hconout,
+ __in uint16_t attribute,
+ __in uint32_t length,
+ __in nt_coord write_coord,
+ __out uint32_t * attrs_written);
+
+
+typedef int32_t __stdcall ntcon_read_console_output_attribute(
+ __in void * hconout,
+ __in uint16_t * attribute,
+ __in uint32_t length,
+ __in nt_coord read_coord,
+ __out uint32_t * attrs_read);
+
+
+typedef int32_t __stdcall ntcon_write_console_output_attribute(
+ __in void * hconout,
+ __in uint16_t * attribute,
+ __in uint32_t length,
+ __in nt_coord write_coord,
+ __out uint32_t * attrs_written);
+
+
+/* console api: output characters */
+typedef int32_t __stdcall ntcon_fill_console_output_character_ansi(
+ __in void * hconout,
+ __in char character,
+ __in uint32_t length,
+ __in nt_coord write_coord,
+ __out uint32_t * chars_written);
+
+
+typedef int32_t __stdcall ntcon_fill_console_output_character_utf16(
+ __in void * hconout,
+ __in wchar16_t character,
+ __in uint32_t length,
+ __in nt_coord write_coord,
+ __out uint32_t * chars_written);
+
+
+typedef int32_t __stdcall ntcon_read_console_output_character_ansi(
+ __in void * hconout,
+ __in char * character,
+ __in uint32_t length,
+ __in nt_coord read_coord,
+ __out uint32_t * chars_read);
+
+
+typedef int32_t __stdcall ntcon_read_console_output_character_utf16(
+ __in void * hconout,
+ __in wchar16_t * character,
+ __in uint32_t length,
+ __in nt_coord read_coord,
+ __out uint32_t * chars_read);
+
+
+typedef int32_t __stdcall ntcon_write_console_output_character_ansi(
+ __in void * hconout,
+ __in char * character,
+ __in uint32_t length,
+ __in nt_coord write_coord,
+ __out uint32_t * chars_written);
+
+
+typedef int32_t __stdcall ntcon_write_console_output_character_utf16(
+ __in void * hconout,
+ __in wchar16_t * character,
+ __in uint32_t length,
+ __in nt_coord write_coord,
+ __out uint32_t * chars_written);
+
+
+/* console api: output code page */
+typedef uint32_t __stdcall ntcon_get_console_output_code_page(void);
+
+
+typedef int32_t __stdcall ntcon_set_console_output_code_page(
+ __in uint32_t code_page_id);
+
+
+/* console api: text attributes */
+typedef int32_t __stdcall ntcon_set_console_text_attribute(
+ __in void * hconout,
+ __in uint16_t attributes);
+
+
+/* console api: cursor info */
+typedef int32_t __stdcall ntcon_get_console_cursor_info(
+ __in void * hconout,
+ __out nt_console_cursor_info * console_cursor_info);
+
+
+typedef int32_t __stdcall ntcon_set_console_cursor_info(
+ __in void * hconout,
+ __in const nt_console_cursor_info * console_cursor_info);
+
+
+typedef int32_t __stdcall ntcon_set_console_cursor_position(
+ __in void * hconout,
+ __out nt_coord cursor_position);
+
+
+/* console api: selection info */
+typedef int32_t __stdcall ntcon_get_console_selection_info(
+ __out nt_console_selection_info * console_selection_info);
+
+
+/* console api: history info */
+typedef int32_t __stdcall ntcon_get_console_history_info(
+ __out nt_console_history_info * console_history_info);
+
+
+typedef int32_t __stdcall ntcon_set_console_history_info(
+ __in nt_console_history_info * console_history_info);
+
+
+/* console api: font info */
+typedef nt_coord __stdcall ntcon_get_console_font_size(
+ __in void * hconout,
+ __in uint32_t font);
+
+
+typedef int32_t __stdcall ntcon_get_current_console_font(
+ __in void * hconout,
+ __in int32_t maximum_window,
+ __out nt_console_font_info * console_current_font);
+
+
+typedef int32_t __stdcall ntcon_get_current_console_font_ex(
+ __in void * hconout,
+ __in int32_t maximum_window,
+ __out nt_console_font_info_ex * console_current_font_ex);
+
+
+typedef int32_t __stdcall ntcon_set_current_console_font_ex(
+ __in void * hconout,
+ __in int32_t maximum_window,
+ __in nt_console_font_info_ex * console_current_font_ex);
+
+
+/* console api: mouse capabilities */
+typedef int32_t __stdcall ntcon_get_number_of_console_mouse_buttons(
+ __out uint32_t * number_of_mouse_buttons);
+
+
+/* console api: window information */
+typedef void * __stdcall ntcon_get_console_window(void);
+
+
+typedef nt_coord __stdcall ntcon_get_largest_console_window_size(
+ __in void * hconout);
+
+
+/* console api: display mode */
+typedef int32_t __stdcall ntcon_get_console_display_mode(
+ __out uint32_t * mode_flags);
+
+
+typedef int32_t __stdcall ntcon_set_console_display_mode(
+ __in void * hconsole,
+ __in uint32_t mode_flags,
+ __out nt_coord * new_screen_buffer_dimensions __optional);
+
+
+/* console api: console title */
+typedef uint32_t __stdcall ntcon_get_console_title_ansi(
+ __out char * console_title,
+ __in uint32_t size);
+
+
+typedef uint32_t __stdcall ntcon_get_console_title_utf16(
+ __out wchar16_t * console_title,
+ __in uint32_t size);
+
+
+typedef int32_t __stdcall ntcon_set_console_title_ansi(
+ __in char * console_title);
+
+
+typedef int32_t __stdcall ntcon_set_console_title_utf16(
+ __in wchar16_t * console_title);
+
+
+typedef uint32_t __stdcall ntcon_get_console_original_title_ansi(
+ __out char * console_title,
+ __in uint32_t size);
+
+
+typedef uint32_t __stdcall ntcon_get_console_original_title_utf16(
+ __out wchar16_t * console_title,
+ __in uint32_t size);
+
+
+/* ntcon function vtbl */
+typedef struct _ntcon_vtbl {
+ /* console handles */
+ ntcon_alloc_console * alloc_console;
+ ntcon_attach_console * attach_console;
+ ntcon_free_console * free_console;
+ ntcon_get_std_handle * get_std_handle;
+
+ /* read/write using std handles */
+ ntcon_get_number_of_console_input_events * get_number_of_console_input_events;
+ ntcon_flush_console_input_buffer * flush_console_input_buffer;
+ ntcon_peek_console_input_ansi * peek_console_input_ansi;
+ ntcon_peek_console_input_utf16 * peek_console_input_utf16;
+ ntcon_read_console_ansi * read_console_ansi;
+ ntcon_read_console_utf16 * read_console_utf16;
+ ntcon_read_console_input_ansi * read_console_input_ansi;
+ ntcon_read_console_input_utf16 * read_console_input_utf16;
+ ntcon_read_console_output_ansi * read_console_output_ansi;
+ ntcon_read_console_output_utf16 * read_console_output_utf16;
+ ntcon_write_console_ansi * write_console_ansi;
+ ntcon_write_console_utf16 * write_console_utf16;
+ ntcon_write_console_input_ansi * write_console_input_ansi;
+ ntcon_write_console_input_utf16 * write_console_input_utf16;
+ ntcon_write_console_output_ansi * write_console_output_ansi;
+ ntcon_write_console_output_utf16 * write_console_output_utf16;
+
+ /* screen buffers */
+ ntcon_create_console_screen_buffer * create_console_screen_buffer;
+ ntcon_get_console_screen_buffer_info * get_console_screen_buffer_info;
+ ntcon_get_console_screen_buffer_info_ex * get_console_screen_buffer_info_ex;
+ ntcon_set_console_screen_buffer_info_ex * set_console_screen_buffer_info_ex;
+ ntcon_set_console_screen_buffer_size * set_console_screen_buffer_size;
+ ntcon_set_console_active_screen_buffer * set_console_active_screen_buffer;
+ ntcon_set_console_window_info * set_console_window_info;
+ ntcon_scroll_console_screen_buffer_ansi * scroll_console_screen_buffer_ansi;
+ ntcon_scroll_console_screen_buffer_utf16 * scroll_console_screen_buffer_utf16;
+
+ /* code page */
+ ntcon_get_console_code_page * get_console_code_page;
+ ntcon_set_console_code_page * set_console_code_page;
+
+ /* console control */
+ ntcon_generate_console_ctrl_event * generate_console_ctrl_event;
+ ntcon_set_console_ctrl_handler * set_console_ctrl_handler;
+
+ /* interface mode */
+ ntcon_get_console_mode * get_console_mode;
+ ntcon_set_console_mode * set_console_mode;
+
+ /* console process list */
+ ntcon_get_console_process_list * get_console_process_list;
+
+ /* aliases */
+ ntcon_add_console_alias_ansi * add_console_alias_ansi;
+ ntcon_add_console_alias_utf16 * add_console_alias_utf16;
+ ntcon_get_console_alias_ansi * get_console_alias_ansi;
+ ntcon_get_console_alias_utf16 * get_console_alias_utf16;
+ ntcon_get_console_aliases_ansi * get_console_aliases_ansi;
+ ntcon_get_console_aliases_utf16 * get_console_aliases_utf16;
+ ntcon_get_console_aliases_length_ansi * get_console_aliases_length_ansi;
+ ntcon_get_console_aliases_length_utf16 * get_console_aliases_length_utf16;
+ ntcon_get_console_alias_exes_ansi * get_console_alias_exes_ansi;
+ ntcon_get_console_alias_exes_utf16 * get_console_alias_exes_utf16;
+ ntcon_get_console_alias_exes_length_ansi * get_console_alias_exes_length_ansi;
+ ntcon_get_console_alias_exes_length_utf16 * get_console_alias_exes_length_utf16;
+
+ /* output attributes */
+ ntcon_fill_console_output_attribute * fill_console_output_attribute;
+ ntcon_read_console_output_attribute * read_console_output_attribute;
+ ntcon_write_console_output_attribute * write_console_output_attribute;
+
+ /* output characters */
+ ntcon_fill_console_output_character_ansi * fill_console_output_character_ansi;
+ ntcon_fill_console_output_character_utf16 * fill_console_output_character_utf16;
+ ntcon_read_console_output_character_ansi * read_console_output_character_ansi;
+ ntcon_read_console_output_character_utf16 * read_console_output_character_utf16;
+ ntcon_write_console_output_character_ansi * write_console_output_character_ansi;
+ ntcon_write_console_output_character_utf16 * write_console_output_character_utf16;
+
+ /* output code page */
+ ntcon_get_console_output_code_page * get_console_output_code_page;
+ ntcon_set_console_output_code_page * set_console_output_code_page;
+
+ /* text attributes */
+ ntcon_set_console_text_attribute * set_console_text_attribute;
+
+ /* cursor info */
+ ntcon_get_console_cursor_info * get_console_cursor_info;
+ ntcon_set_console_cursor_info * set_console_cursor_info;
+ ntcon_set_console_cursor_position * set_console_cursor_position;
+
+ /* selection info */
+ ntcon_get_console_selection_info * get_console_selection_info;
+
+ /* history info */
+ ntcon_get_console_history_info * get_console_history_info;
+ ntcon_set_console_history_info * set_console_history_info;
+
+ /* font info */
+ ntcon_get_console_font_size * get_console_font_size;
+ ntcon_get_current_console_font * get_current_console_font;
+ ntcon_get_current_console_font_ex * get_current_console_font_ex;
+ ntcon_set_current_console_font_ex * set_current_console_font_ex;
+
+ /* mouse capabilities */
+ ntcon_get_number_of_console_mouse_buttons * get_number_of_console_mouse_buttons;
+
+ /* window information */
+ ntcon_get_console_window * get_console_window;
+ ntcon_get_largest_console_window_size * get_largest_console_window_size;
+
+ /* display mode */
+ ntcon_get_console_display_mode * get_console_display_mode;
+ ntcon_set_console_display_mode * set_console_display_mode;
+
+ /* console title */
+ ntcon_get_console_title_ansi * get_console_title_ansi;
+ ntcon_get_console_title_utf16 * get_console_title_utf16;
+ ntcon_set_console_title_ansi * set_console_title_ansi;
+ ntcon_set_console_title_utf16 * set_console_title_utf16;
+ ntcon_get_console_original_title_ansi * get_console_original_title_ansi;
+ ntcon_get_console_original_title_utf16 * get_console_original_title_utf16;
+} ntcon_vtbl;
+
+ntcon_api
+int32_t __fastcall ntcon_vtbl_init(ntcon_vtbl * pvtbl);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/ntcon/ntcon_api.h b/include/ntcon/ntcon_api.h
new file mode 100644
index 0000000..15c89e8
--- /dev/null
+++ b/include/ntcon/ntcon_api.h
@@ -0,0 +1,32 @@
+#ifndef NTCON_API_H
+#define NTCON_API_H
+
+/* host type (posix-libc/free-standing) */
+#include "ntcon_env.h"
+
+/* ntcon_export */
+#if defined(__attr_export__)
+#define ntcon_export __attr_export__
+#else
+#define ntcon_export
+#endif
+
+/* ntcon_import */
+#if defined(__attr_import__)
+#define ntcon_import __attr_import__
+#else
+#define ntcon_import
+#endif
+
+/* ntcon_api */
+#if defined (NTCON_BUILD)
+#define ntcon_api ntcon_export
+#elif defined (NTCON_SHARED)
+#define ntcon_api ntcon_import
+#elif defined (NTCON_STATIC)
+#define ntcon_api
+#else
+#define ntcon_api
+#endif
+
+#endif
diff --git a/include/ntcon/ntcon_env.h b/include/ntcon/ntcon_env.h
new file mode 100644
index 0000000..9257834
--- /dev/null
+++ b/include/ntcon/ntcon_env.h
@@ -0,0 +1,22 @@
+#ifndef NTCON_ENV_H
+#define NTCON_ENV_H
+
+#if defined (MIDIPIX_FREESTANDING)
+
+#include <psxtypes/psxtypes.h>
+
+#else
+
+#include <stdint.h>
+
+#ifndef __cdecl
+#define __cdecl
+#endif
+
+#ifndef __stdcall
+#define __stdcall
+#endif
+
+#endif
+
+#endif