summaryrefslogtreecommitdiffhomepage
path: root/include/ntcon/ntcon.h
blob: 95b19dda81de6ab1bce659eed5d2cca3fc5376e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
#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)
#define NT_ENABLE_EXTENDED_FLAGS	(0x0080)

/* 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;
	};

	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;
	};

	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_event;
		nt_menu_event_record		menu_event;
		nt_focus_event_record		focus_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