ReactOS 0.4.16-dev-1405-gc14a14e
console.c
Go to the documentation of this file.
1/*
2 * Win32 console functions
3 *
4 * Copyright 1995 Martin von Loewis and Cameron Heide
5 * Copyright 1997 Karl Garrison
6 * Copyright 1998 John Richardson
7 * Copyright 1998 Marcus Meissner
8 * Copyright 2001,2002,2004,2005,2010 Eric Pouech
9 * Copyright 2001 Alexandre Julliard
10 * Copyright 2020 Jacek Caban for CodeWeavers
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include <stdarg.h>
28#include <stdio.h>
29#include <string.h>
30#include <limits.h>
31
32#include "ntstatus.h"
33#define WIN32_NO_STATUS
34#include "windef.h"
35#include "winbase.h"
36#include "winnls.h"
37#include "winerror.h"
38#include "wincon.h"
39#include "winternl.h"
40#include "wine/condrv.h"
41#include "wine/exception.h"
42#include "wine/debug.h"
43#include "kernelbase.h"
44
46
47
50{
51 0, 0, &console_section,
53 0, 0, { (DWORD_PTR)(__FILE__ ": console_section") }
54};
55static CRITICAL_SECTION console_section = { &critsect_debug, -1, 0, 0, 0, 0 };
56
58static unsigned int console_flags;
59
60#define CONSOLE_INPUT_HANDLE 0x01
61#define CONSOLE_OUTPUT_HANDLE 0x02
62#define CONSOLE_ERROR_HANDLE 0x04
63
65
67{
70};
71
73{
74 FIXME( "Terminating process %lx on event %lx\n", GetCurrentProcessId(), type );
77 else
79 return TRUE;
80}
81
84
85static BOOL console_ioctl( HANDLE handle, DWORD code, void *in_buff, DWORD in_count,
86 void *out_buff, DWORD out_count, DWORD *read )
87{
90
91 if (handle == CONSOLE_HANDLE_SHELL_NO_WINDOW)
92 {
93 WARN("Incorrect access to Shell-no-window console (ioctl=%lx)\n", code);
95 return FALSE;
96 }
97 status = NtDeviceIoControlFile( handle, NULL, NULL, NULL, &io, code, in_buff, in_count,
98 out_buff, out_count );
99 switch( status )
100 {
101 case STATUS_SUCCESS:
102 if (read) *read = io.Information;
103 return TRUE;
105 break;
106 default:
108 break;
109 }
110 if (read) *read = 0;
111 return set_ntstatus( status );
112}
113
114/* map input records to ASCII */
116{
117 UINT cp = GetConsoleCP();
118 int i;
119 char ch;
120
121 for (i = 0; i < count; i++)
122 {
123 if (buffer[i].EventType != KEY_EVENT) continue;
124 WideCharToMultiByte( cp, 0, &buffer[i].Event.KeyEvent.uChar.UnicodeChar, 1, &ch, 1, NULL, NULL );
125 buffer[i].Event.KeyEvent.uChar.AsciiChar = ch;
126 }
127}
128
129/* map input records to Unicode */
131{
132 UINT cp = GetConsoleCP();
133 int i;
134 WCHAR ch;
135
136 for (i = 0; i < count; i++)
137 {
138 if (buffer[i].EventType != KEY_EVENT) continue;
139 MultiByteToWideChar( cp, 0, &buffer[i].Event.KeyEvent.uChar.AsciiChar, 1, &ch, 1 );
140 buffer[i].Event.KeyEvent.uChar.UnicodeChar = ch;
141 }
142}
143
144/* map char infos to ASCII */
146{
147 char ch;
148
149 while (count-- > 0)
150 {
151 WideCharToMultiByte( cp, 0, &buffer->Char.UnicodeChar, 1, &ch, 1, NULL, NULL );
152 buffer->Char.AsciiChar = ch;
153 buffer++;
154 }
155}
156
157/* map char infos to Unicode */
159{
161 WCHAR ch;
162
163 while (count-- > 0)
164 {
165 MultiByteToWideChar( cp, 0, &buffer->Char.AsciiChar, 1, &ch, 1 );
166 buffer->Char.UnicodeChar = ch;
167 buffer++;
168 }
169}
170
171/* helper function for GetLargestConsoleWindowSize */
173{
174 struct condrv_output_info info;
175 COORD c = { 0, 0 };
176
177 if (!console_ioctl( handle, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
178 return c;
179
180 c.X = info.max_width;
181 c.Y = info.max_height;
182 TRACE( "(%p), returning %dx%d\n", handle, c.X, c.Y );
183 return c;
184}
185
186/* helper function for GetConsoleFontSize */
188{
189 struct condrv_output_info info;
190 COORD c = {0,0};
191
192 if (index >= 1 /* number of console fonts */)
193 {
195 return c;
196 }
197
198 if (DeviceIoControl( handle, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0, &info, sizeof(info), NULL, NULL ))
199 {
200 c.X = info.font_width;
201 c.Y = info.font_height;
202 }
204 return c;
205}
206
207/* helper function for GetConsoleTitle and GetConsoleOriginalTitle */
208static DWORD get_console_title( WCHAR *title, DWORD size, BOOL current_title )
209{
210 struct condrv_title_params *params;
211 size_t max_size = sizeof(*params) + (size - 1) * sizeof(WCHAR);
212
213 if (!title || !size) return 0;
214
215 if (!(params = HeapAlloc( GetProcessHeap(), 0, max_size )))
216 return 0;
217
218 if (console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle, IOCTL_CONDRV_GET_TITLE,
219 &current_title, sizeof(current_title), params, max_size, &size ) &&
220 size >= sizeof(*params))
221 {
222 size -= sizeof(*params);
223 memcpy( title, params->buffer, size );
224 title[ size / sizeof(WCHAR) ] = 0;
225 size = params->title_len;
226 }
227 else size = 0;
228
230 return size;
231}
232
234{
235 OBJECT_ATTRIBUTES attr = {sizeof(attr)};
236 UNICODE_STRING string = RTL_CONSTANT_STRING( L"\\Device\\ConDrv\\Server" );
240
241 attr.ObjectName = &string;
242 attr.Attributes = OBJ_INHERIT;
246 return set_ntstatus( status ) ? handle : NULL;
247}
248
250{
251 OBJECT_ATTRIBUTES attr = {sizeof(attr)};
252 UNICODE_STRING string = RTL_CONSTANT_STRING( L"Reference" );
256
257 attr.RootDirectory = root;
258 attr.ObjectName = &string;
262 return set_ntstatus( status ) ? handle : NULL;
263}
264
266{
267 OBJECT_ATTRIBUTES attr = {sizeof(attr)};
271
272 RtlInitUnicodeString( &string, root ? L"Connection" : L"\\Device\\ConDrv\\Connection" );
273 attr.RootDirectory = root;
274 attr.ObjectName = &string;
277 return set_ntstatus( status );
278}
279
280static BOOL init_console_std_handles( BOOL override_all )
281{
282 HANDLE std_out = NULL, std_err = NULL, handle;
283 OBJECT_ATTRIBUTES attr = {sizeof(attr)};
287
288 attr.ObjectName = &name;
289 attr.Attributes = OBJ_INHERIT;
290
291 if (override_all || !GetStdHandle( STD_INPUT_HANDLE ))
292 {
293 RtlInitUnicodeString( &name, L"\\Device\\ConDrv\\Input" );
298 if (!set_ntstatus( status )) return FALSE;
301 }
302
303 if (!override_all)
304 {
305 std_out = GetStdHandle( STD_OUTPUT_HANDLE );
306 std_err = GetStdHandle( STD_ERROR_HANDLE );
307 if (std_out && std_err) return TRUE;
308 }
309
310 RtlInitUnicodeString( &name, L"\\Device\\ConDrv\\Output" );
315 if (!set_ntstatus( status )) return FALSE;
316 if (!std_out)
317 {
320 }
321
322 if (!std_err)
323 {
326 return FALSE;
329 }
330
331 return TRUE;
332}
333
334
335/******************************************************************
336 * AddConsoleAliasA (kernelbase.@)
337 */
339{
340 FIXME( ": (%s, %s, %s) stub!\n", debugstr_a(source), debugstr_a(target), debugstr_a(exename) );
342 return FALSE;
343}
344
345
346/******************************************************************
347 * AddConsoleAliasW (kernelbase.@)
348 */
350{
351 FIXME( ": (%s, %s, %s) stub!\n", debugstr_w(source), debugstr_w(target), debugstr_w(exename) );
353 return FALSE;
354}
355
356
357/******************************************************************
358 * AttachConsole (kernelbase.@)
359 */
361{
362 BOOL ret;
363
364 TRACE( "(%lx)\n", pid );
365
367
368 if (RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle)
369 {
371 WARN( "console already attached\n" );
373 return FALSE;
374 }
375
377 console_ioctl( console_connection, IOCTL_CONDRV_BIND_PID, &pid, sizeof(pid), NULL, 0, NULL );
378 if (ret)
379 {
381 if (RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle)
382 {
383 STARTUPINFOW si;
384 GetStartupInfoW( &si );
386 }
387 else ret = FALSE;
388 }
389
390 if (!ret) FreeConsole();
392 return ret;
393}
394
395
396static BOOL alloc_console( BOOL headless )
397{
398 SECURITY_ATTRIBUTES inheritable_attr = { sizeof(inheritable_attr), NULL, TRUE };
399 STARTUPINFOEXW console_si;
400 STARTUPINFOW app_si;
401 HANDLE server, console = NULL;
402 WCHAR buffer[1024], cmd[256], conhost_path[MAX_PATH];
404 SIZE_T size;
405 void *redir;
406 BOOL ret;
407
408 TRACE("()\n");
409
411
412 if (RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle)
413 {
414 /* we already have a console opened on this process, don't create a new one */
417 return FALSE;
418 }
419
420 memset( &console_si, 0, sizeof(console_si) );
421 console_si.StartupInfo.cb = sizeof(console_si);
423 if (!(console_si.lpAttributeList = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
424 InitializeProcThreadAttributeList( console_si.lpAttributeList, 1, 0, &size );
425
426 if (!(server = create_console_server()) || !(console = create_console_reference( server ))) goto error;
427
428 GetStartupInfoW(&app_si);
429
430 /* setup a view arguments for conhost (it'll use them as default values) */
431 if (app_si.dwFlags & STARTF_USECOUNTCHARS)
432 {
433 console_si.StartupInfo.dwFlags |= STARTF_USECOUNTCHARS;
434 console_si.StartupInfo.dwXCountChars = app_si.dwXCountChars;
435 console_si.StartupInfo.dwYCountChars = app_si.dwYCountChars;
436 }
437 if (app_si.dwFlags & STARTF_USEFILLATTRIBUTE)
438 {
439 console_si.StartupInfo.dwFlags |= STARTF_USEFILLATTRIBUTE;
440 console_si.StartupInfo.dwFillAttribute = app_si.dwFillAttribute;
441 }
442 if (app_si.dwFlags & STARTF_USESHOWWINDOW)
443 {
444 console_si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW;
445 console_si.StartupInfo.wShowWindow = app_si.wShowWindow;
446 }
447 if (app_si.lpTitle)
448 console_si.StartupInfo.lpTitle = app_si.lpTitle;
450 {
451 buffer[ARRAY_SIZE(buffer) - 1] = 0;
452 console_si.StartupInfo.lpTitle = buffer;
453 }
454
455
456 UpdateProcThreadAttribute( console_si.lpAttributeList, 0, PROC_THREAD_ATTRIBUTE_HANDLE_LIST,
457 &server, sizeof(server), NULL, NULL );
458 swprintf( conhost_path, ARRAY_SIZE(conhost_path), L"%s\\conhost.exe", system_dir );
459 swprintf( cmd, ARRAY_SIZE(cmd), L"\"%s\" --server 0x%x", conhost_path, condrv_handle( server ));
460 if (headless) wcscat( cmd, L" --headless" );
463 NULL, NULL, &console_si.StartupInfo, &pi );
465
466 if (!ret || !create_console_connection( console)) goto error;
468
470 TRACE( "Started conhost pid=%08lx tid=%08lx\n", pi.dwProcessId, pi.dwThreadId );
471
472 HeapFree( GetProcessHeap(), 0, console_si.lpAttributeList );
476 return TRUE;
477
478error:
479 ERR("Can't allocate console\n");
480 HeapFree( GetProcessHeap(), 0, console_si.lpAttributeList );
481 NtClose( console );
482 NtClose( server );
483 FreeConsole();
485 return FALSE;
486}
487
488
489/******************************************************************
490 * AllocConsole (kernelbase.@)
491 */
493{
494 return alloc_console( FALSE );
495}
496
497
498/******************************************************************************
499 * CreateConsoleScreenBuffer (kernelbase.@)
500 */
503 void *data )
504{
505 OBJECT_ATTRIBUTES attr = {sizeof(attr)};
507 UNICODE_STRING name = RTL_CONSTANT_STRING( L"\\Device\\ConDrv\\ScreenBuffer" );
510
511 TRACE( "(%lx,%lx,%p,%lx,%p)\n", access, share, sa, flags, data );
512
514 {
517 }
518
519 attr.ObjectName = &name;
520 attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
521 if (sa && sa->bInheritHandle) attr.Attributes |= OBJ_INHERIT;
525}
526
527
528/******************************************************************************
529 * CtrlRoutine (kernelbase.@)
530 */
532{
533 DWORD_PTR event = (DWORD_PTR)arg;
534 struct ctrl_handler *handler;
535
536 if (event == CTRL_C_EVENT)
537 {
538 BOOL caught_by_dbg = TRUE;
539 /* First, try to pass the ctrl-C event to the debugger (if any)
540 * If it continues, there's nothing more to do
541 * Otherwise, we need to send the ctrl-C event to the handlers
542 */
543 __TRY
544 {
546 }
548 {
549 caught_by_dbg = FALSE;
550 }
552 if (caught_by_dbg) return 0;
553 }
554
555 if (NtCurrentTeb()->Peb->ProcessParameters->ConsoleFlags & 1) return 0;
556
559 {
560 if (handler->func( event )) break;
561 }
563 return 1;
564}
565
566
567/******************************************************************
568 * ExpungeConsoleCommandHistoryA (kernelbase.@)
569 */
571{
572 FIXME( ": (%s) stub!\n", debugstr_a(exename) );
574}
575
576
577/******************************************************************
578 * ExpungeConsoleCommandHistoryW (kernelbase.@)
579 */
581{
582 FIXME( ": (%s) stub!\n", debugstr_w(exename) );
584}
585
586
587/******************************************************************************
588 * FillConsoleOutputAttribute (kernelbase.@)
589 */
591 COORD coord, DWORD *written )
592{
593 struct condrv_fill_output_params params;
594
595 TRACE( "(%p,%d,%ld,(%dx%d),%p)\n", handle, attr, length, coord.X, coord.Y, written );
596
597 if (!written)
598 {
600 return FALSE;
601 }
602
603 *written = 0;
604
605 params.mode = CHAR_INFO_MODE_ATTR;
606 params.x = coord.X;
607 params.y = coord.Y;
608 params.count = length;
609 params.wrap = TRUE;
610 params.ch = 0;
611 params.attr = attr;
612 return console_ioctl( handle, IOCTL_CONDRV_FILL_OUTPUT, &params, sizeof(params),
613 written, sizeof(*written), NULL );
614}
615
616
617/******************************************************************************
618 * FillConsoleOutputCharacterA (kernelbase.@)
619 */
621 COORD coord, DWORD *written )
622{
623 WCHAR wch;
624
625 MultiByteToWideChar( GetConsoleOutputCP(), 0, &ch, 1, &wch, 1 );
626 return FillConsoleOutputCharacterW( handle, wch, length, coord, written );
627}
628
629
630/******************************************************************************
631 * FillConsoleOutputCharacterW (kernelbase.@)
632 */
634 COORD coord, DWORD *written )
635{
636 struct condrv_fill_output_params params;
637
638 TRACE( "(%p,%s,%ld,(%dx%d),%p)\n", handle, debugstr_wn(&ch, 1), length, coord.X, coord.Y, written );
639
640 if (!written)
641 {
643 return FALSE;
644 }
645
646 *written = 0;
647
648 params.mode = CHAR_INFO_MODE_TEXT;
649 params.x = coord.X;
650 params.y = coord.Y;
651 params.count = length;
652 params.wrap = TRUE;
653 params.ch = ch;
654 params.attr = 0;
655 return console_ioctl( handle, IOCTL_CONDRV_FILL_OUTPUT, &params, sizeof(params),
656 written, sizeof(*written), NULL );
657}
658
659
660/***********************************************************************
661 * FreeConsole (kernelbase.@)
662 */
664{
666
667 if (RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != CONSOLE_HANDLE_SHELL_NO_WINDOW)
668 {
671
672 NtClose( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle );
673 }
675
679 console_flags = 0;
680
682 return TRUE;
683}
684
685
686/******************************************************************************
687 * GenerateConsoleCtrlEvent (kernelbase.@)
688 */
690{
691 struct condrv_ctrl_event ctrl_event;
692
693 TRACE( "(%ld, %lx)\n", event, group );
694
696 {
697 ERR( "Invalid event %ld for PGID %lx\n", event, group );
698 return FALSE;
699 }
700
701 ctrl_event.event = event;
702 ctrl_event.group_id = group;
703 return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
704 IOCTL_CONDRV_CTRL_EVENT, &ctrl_event, sizeof(ctrl_event), NULL, 0, NULL );
705}
706
707
708/******************************************************************
709 * GetConsoleAliasA (kernelbase.@)
710 */
712{
713 FIXME( "(%s,%p,%ld,%s): stub\n", debugstr_a(source), buffer, len, debugstr_a(exename) );
715 return 0;
716}
717
718
719/******************************************************************
720 * GetConsoleAliasW (kernelbase.@)
721 */
723{
724 FIXME( "(%s,%p,%ld,%s): stub\n", debugstr_w(source), buffer, len, debugstr_w(exename) );
726 return 0;
727}
728
729
730/******************************************************************
731 * GetConsoleAliasExesLengthA (kernelbase.@)
732 */
734{
735 FIXME( ": stub\n" );
737 return 0;
738}
739
740
741/******************************************************************
742 * GetConsoleAliasExesLengthW (kernelbase.@)
743 */
745{
746 FIXME( ": stub\n" );
748 return 0;
749}
750
751
752/******************************************************************
753 * GetConsoleAliasesLengthA (kernelbase.@)
754 */
756{
757 FIXME( ": (%s) stub!\n", debugstr_a(unknown) );
759 return 0;
760}
761
762
763/******************************************************************
764 * GetConsoleAliasesLengthW (kernelbase.@)
765 */
767{
768 FIXME( ": (%s) stub!\n", debugstr_w(unknown) );
770 return 0;
771}
772
773
774/******************************************************************
775 * GetConsoleCommandHistoryA (kernelbase.@)
776 */
778{
779 FIXME( ": (%p, 0x%lx, %s) stub\n", buffer, len, debugstr_a(exename) );
781 return 0;
782}
783
784
785/******************************************************************
786 * GetConsoleCommandHistoryW (kernelbase.@)
787 */
789{
790 FIXME( ": (%p, 0x%lx, %s) stub\n", buffer, len, debugstr_w(exename) );
792 return 0;
793}
794
795
796/******************************************************************
797 * GetConsoleCommandHistoryLengthA (kernelbase.@)
798 */
800{
801 FIXME( ": (%s) stub!\n", debugstr_a(exename) );
803 return 0;
804}
805
806
807/******************************************************************
808 * GetConsoleCommandHistoryLengthW (kernelbase.@)
809 */
811{
812 FIXME( ": (%s) stub!\n", debugstr_w(exename) );
814 return 0;
815}
816
817
818/******************************************************************************
819 * GetConsoleCP (kernelbase.@)
820 */
822{
823 struct condrv_input_info info;
824
825 if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
826 IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
827 return 0;
828 return info.input_cp;
829}
830
831
832/******************************************************************************
833 * GetConsoleCursorInfo (kernelbase.@)
834 */
836{
837 struct condrv_output_info condrv_info;
838
839 if (!console_ioctl( handle, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0, &condrv_info, sizeof(condrv_info), NULL ))
840 return FALSE;
841
842 if (!info)
843 {
845 return FALSE;
846 }
847
848 info->dwSize = condrv_info.cursor_size;
849 info->bVisible = condrv_info.cursor_visible;
850 TRACE("(%p) returning (%ld,%d)\n", handle, info->dwSize, info->bVisible);
851 return TRUE;
852}
853
854
855/***********************************************************************
856 * GetConsoleDisplayMode (kernelbase.@)
857 */
859{
860 TRACE( "semi-stub: %p\n", flags );
861 /* It is safe to successfully report windowed mode */
862 *flags = 0;
863 return TRUE;
864}
865
866
867/***********************************************************************
868 * GetConsoleFontSize (kernelbase.@)
869 */
870#if defined(__i386__) && !defined(__MINGW32__) && !defined(_MSC_VER)
871#undef GetConsoleFontSize
873{
874 union {
875 COORD c;
876 DWORD w;
877 } x;
878
880 return x.w;
881}
882#else
884{
886}
887#endif /* !defined(__i386__) */
888
889
890/***********************************************************************
891 * GetConsoleInputExeNameA (kernelbase.@)
892 */
894{
896 if (WideCharToMultiByte( CP_ACP, 0, input_exe, -1, NULL, 0, NULL, NULL ) <= len)
900 return TRUE;
901}
902
903
904/***********************************************************************
905 * GetConsoleInputExeNameW (kernelbase.@)
906 */
908{
913 return TRUE;
914}
915
916
917/***********************************************************************
918 * GetConsoleMode (kernelbase.@)
919 */
921{
922 return console_ioctl( handle, IOCTL_CONDRV_GET_MODE, NULL, 0, mode, sizeof(*mode), NULL );
923}
924
925
926/***********************************************************************
927 * GetConsoleOriginalTitleA (kernelbase.@)
928 */
930{
931 WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) );
932 DWORD ret;
933
934 if (!ptr) return 0;
935
937 if (ret)
939
940 HeapFree( GetProcessHeap(), 0, ptr );
941 return ret;
942}
943
944
945/***********************************************************************
946 * GetConsoleOriginalTitleW (kernelbase.@)
947 */
949{
950 return get_console_title( title, size, FALSE );
951}
952
953
954/***********************************************************************
955 * GetConsoleOutputCP (kernelbase.@)
956 */
958{
959 struct condrv_input_info info;
960
961 if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
962 IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
963 return 0;
964 return info.output_cp;
965}
966
967
968/***********************************************************************
969 * GetConsoleProcessList (kernelbase.@)
970 */
972{
973 DWORD saved;
976
977 TRACE( "(%p,%ld)\n", list, count);
978
979 if (!list || count < 1)
980 {
982 return 0;
983 }
984
985 saved = *list;
986 status = NtDeviceIoControlFile( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
987 NULL, NULL, NULL, &io, IOCTL_CONDRV_GET_PROCESS_LIST,
988 NULL, 0, list, count * sizeof(DWORD) );
989
990 if (!status) return io.Information / sizeof(DWORD);
992 {
993 DWORD ret = *list;
994 *list = saved;
995 return ret;
996 }
997
998 *list = saved;
1000 return 0;
1001}
1002
1003
1004/***********************************************************************
1005 * GetConsoleScreenBufferInfo (kernelbase.@)
1006 */
1008{
1009 struct condrv_output_info condrv_info;
1010
1011 if (!console_ioctl( handle , IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0,
1012 &condrv_info, sizeof(condrv_info), NULL ))
1013 return FALSE;
1014
1015 info->dwSize.X = condrv_info.width;
1016 info->dwSize.Y = condrv_info.height;
1017 info->dwCursorPosition.X = condrv_info.cursor_x;
1018 info->dwCursorPosition.Y = condrv_info.cursor_y;
1019 info->wAttributes = condrv_info.attr;
1020 info->srWindow.Left = condrv_info.win_left;
1021 info->srWindow.Right = condrv_info.win_right;
1022 info->srWindow.Top = condrv_info.win_top;
1023 info->srWindow.Bottom = condrv_info.win_bottom;
1024 info->dwMaximumWindowSize.X = min(condrv_info.width, condrv_info.max_width);
1025 info->dwMaximumWindowSize.Y = min(condrv_info.height, condrv_info.max_height);
1026
1027 TRACE( "(%p,(%d,%d) (%d,%d) %d (%d,%d-%d,%d) (%d,%d)\n", handle,
1028 info->dwSize.X, info->dwSize.Y, info->dwCursorPosition.X, info->dwCursorPosition.Y,
1029 info->wAttributes, info->srWindow.Left, info->srWindow.Top, info->srWindow.Right,
1030 info->srWindow.Bottom, info->dwMaximumWindowSize.X, info->dwMaximumWindowSize.Y );
1031 return TRUE;
1032}
1033
1034
1035/***********************************************************************
1036 * GetConsoleScreenBufferInfoEx (kernelbase.@)
1037 */
1040{
1041 struct condrv_output_info condrv_info;
1042
1043 if (info->cbSize != sizeof(CONSOLE_SCREEN_BUFFER_INFOEX))
1044 {
1046 return FALSE;
1047 }
1048
1049 if (!console_ioctl( handle, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0, &condrv_info,
1050 sizeof(condrv_info), NULL ))
1051 return FALSE;
1052
1053 info->dwSize.X = condrv_info.width;
1054 info->dwSize.Y = condrv_info.height;
1055 info->dwCursorPosition.X = condrv_info.cursor_x;
1056 info->dwCursorPosition.Y = condrv_info.cursor_y;
1057 info->wAttributes = condrv_info.attr;
1058 info->srWindow.Left = condrv_info.win_left;
1059 info->srWindow.Top = condrv_info.win_top;
1060 info->srWindow.Right = condrv_info.win_right;
1061 info->srWindow.Bottom = condrv_info.win_bottom;
1062 info->dwMaximumWindowSize.X = min( condrv_info.width, condrv_info.max_width );
1063 info->dwMaximumWindowSize.Y = min( condrv_info.height, condrv_info.max_height );
1064 info->wPopupAttributes = condrv_info.popup_attr;
1065 info->bFullscreenSupported = FALSE;
1066 memcpy( info->ColorTable, condrv_info.color_map, sizeof(info->ColorTable) );
1067 return TRUE;
1068}
1069
1070
1071/******************************************************************************
1072 * GetConsoleTitleA (kernelbase.@)
1073 */
1075{
1076 WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * size );
1077 DWORD ret;
1078
1079 if (!ptr) return 0;
1080
1082 if (ret)
1084
1085 HeapFree( GetProcessHeap(), 0, ptr );
1086 return ret;
1087}
1088
1089
1090/******************************************************************************
1091 * GetConsoleTitleW (kernelbase.@)
1092 */
1094{
1095 return get_console_title( title, size, TRUE );
1096}
1097
1098
1099/******************************************************************************
1100 * GetConsoleWindow (kernelbase.@)
1101 */
1103{
1104 condrv_handle_t win;
1105 BOOL ret;
1106
1107 ret = DeviceIoControl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
1108 IOCTL_CONDRV_GET_WINDOW, NULL, 0, &win, sizeof(win), NULL, NULL );
1109 return ret ? LongToHandle( win ) : NULL;
1110}
1111
1112
1113/***********************************************************************
1114 * GetCurrentConsoleFontEx (kernelbase.@)
1115 */
1117{
1118 DWORD size;
1119 struct
1120 {
1121 struct condrv_output_info info;
1122 WCHAR face_name[LF_FACESIZE - 1];
1123 } data;
1124
1125 if (info->cbSize != sizeof(CONSOLE_FONT_INFOEX))
1126 {
1128 return FALSE;
1129 }
1130
1131 if (!DeviceIoControl( handle, IOCTL_CONDRV_GET_OUTPUT_INFO, NULL, 0,
1132 &data, sizeof(data), &size, NULL ))
1133 {
1135 return FALSE;
1136 }
1137
1138 info->nFont = 0;
1139 if (maxwindow)
1140 {
1141 info->dwFontSize.X = min( data.info.width, data.info.max_width );
1142 info->dwFontSize.Y = min( data.info.height, data.info.max_height );
1143 }
1144 else
1145 {
1146 info->dwFontSize.X = data.info.font_width;
1147 info->dwFontSize.Y = data.info.font_height;
1148 }
1149 size -= sizeof(data.info);
1150 if (size) memcpy( info->FaceName, data.face_name, size );
1151 info->FaceName[size / sizeof(WCHAR)] = 0;
1152 info->FontFamily = data.info.font_pitch_family;
1153 info->FontWeight = data.info.font_weight;
1154 return TRUE;
1155}
1156
1157
1158/***********************************************************************
1159 * GetCurrentConsoleFont (kernelbase.@)
1160 */
1162{
1163 BOOL ret;
1165
1166 res.cbSize = sizeof(CONSOLE_FONT_INFOEX);
1167
1168 ret = GetCurrentConsoleFontEx( handle, maxwindow, &res );
1169 if (ret)
1170 {
1171 info->nFont = res.nFont;
1172 info->dwFontSize.X = res.dwFontSize.X;
1173 info->dwFontSize.Y = res.dwFontSize.Y;
1174 }
1175 return ret;
1176}
1177
1178
1179/***********************************************************************
1180 * GetLargestConsoleWindowSize (kernelbase.@)
1181 */
1182#if defined(__i386__) && !defined(__MINGW32__) && !defined(_MSC_VER)
1183#undef GetLargestConsoleWindowSize
1185{
1186 union {
1187 COORD c;
1188 DWORD w;
1189 } x;
1191 return x.w;
1192}
1193
1194#else
1195
1197{
1199}
1200
1201#endif /* !defined(__i386__) */
1202
1203
1204/***********************************************************************
1205 * GetNumberOfConsoleInputEvents (kernelbase.@)
1206 */
1208{
1209 return console_ioctl( handle, IOCTL_CONDRV_GET_INPUT_COUNT, NULL, 0,
1210 count, sizeof(*count), NULL );
1211}
1212
1213
1214/***********************************************************************
1215 * GetNumberOfConsoleMouseButtons (kernelbase.@)
1216 */
1218{
1219 FIXME( "(%p): stub\n", count );
1220 *count = 2;
1221 return TRUE;
1222}
1223
1224
1225/***********************************************************************
1226 * PeekConsoleInputA (kernelbase.@)
1227 */
1230{
1231 DWORD read;
1232
1233 if (!PeekConsoleInputW( handle, buffer, length, &read )) return FALSE;
1235 if (count) *count = read;
1236 return TRUE;
1237}
1238
1239
1240/***********************************************************************
1241 * PeekConsoleInputW (kernelbase.@)
1242 */
1245{
1246 DWORD read;
1247 if (!console_ioctl( handle, IOCTL_CONDRV_PEEK, NULL, 0, buffer, length * sizeof(*buffer), &read ))
1248 return FALSE;
1249 if (count) *count = read / sizeof(*buffer);
1250 return TRUE;
1251}
1252
1253
1254/******************************************************************************
1255 * ReadConsoleOutputAttribute (kernelbase.@)
1256 */
1259{
1260 struct condrv_output_params params;
1261 BOOL ret;
1262
1263 TRACE( "(%p,%p,%ld,%dx%d,%p)\n", handle, attr, length, coord.X, coord.Y, count );
1264
1265 if (!count)
1266 {
1268 return FALSE;
1269 }
1270
1271 params.mode = CHAR_INFO_MODE_ATTR;
1272 params.x = coord.X;
1273 params.y = coord.Y;
1274 params.width = 0;
1275 ret = console_ioctl( handle, IOCTL_CONDRV_READ_OUTPUT, &params, sizeof(params),
1276 attr, length * sizeof(*attr), count );
1277 *count /= sizeof(*attr);
1278 return ret;
1279}
1280
1281
1282/******************************************************************************
1283 * ReadConsoleOutputCharacterA (kernelbase.@)
1284 */
1287{
1288 DWORD read;
1289 BOOL ret;
1290 LPWSTR wptr;
1291
1292 if (!count)
1293 {
1295 return FALSE;
1296 }
1297
1298 *count = 0;
1299 if (!(wptr = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) )))
1300 {
1302 return FALSE;
1303 }
1305 {
1307 *count = read;
1308 }
1309 HeapFree( GetProcessHeap(), 0, wptr );
1310 return ret;
1311}
1312
1313
1314/******************************************************************************
1315 * ReadConsoleOutputCharacterW (kernelbase.@)
1316 */
1319{
1320 struct condrv_output_params params;
1321 BOOL ret;
1322
1323 TRACE( "(%p,%p,%ld,%dx%d,%p)\n", handle, buffer, length, coord.X, coord.Y, count );
1324
1325 if (!count)
1326 {
1328 return FALSE;
1329 }
1330
1331 params.mode = CHAR_INFO_MODE_TEXT;
1332 params.x = coord.X;
1333 params.y = coord.Y;
1334 params.width = 0;
1335 ret = console_ioctl( handle, IOCTL_CONDRV_READ_OUTPUT, &params, sizeof(params), buffer,
1336 length * sizeof(*buffer), count );
1337 *count /= sizeof(*buffer);
1338 return ret;
1339}
1340
1341
1342/******************************************************************************
1343 * ReadConsoleOutputA (kernelbase.@)
1344 */
1346 COORD coord, SMALL_RECT *region )
1347{
1348 BOOL ret;
1349 int y;
1350
1351 ret = ReadConsoleOutputW( handle, buffer, size, coord, region );
1352 if (ret && region->Right >= region->Left)
1353 {
1355 for (y = 0; y <= region->Bottom - region->Top; y++)
1356 char_info_WtoA( cp, &buffer[(coord.Y + y) * size.X + coord.X], region->Right - region->Left + 1 );
1357 }
1358 return ret;
1359}
1360
1361
1362/******************************************************************************
1363 * ReadConsoleOutputW (kernelbase.@)
1364 */
1366 COORD coord, SMALL_RECT *region )
1367{
1368 struct condrv_output_params params;
1369 unsigned int width, height, y;
1371 DWORD count;
1372 BOOL ret;
1373
1374 if (region->Left > region->Right || region->Top > region->Bottom)
1375 {
1377 return FALSE;
1378 }
1379 if (size.X <= coord.X || size.Y <= coord.Y)
1380 {
1381 region->Right = region->Left - 1;
1382 region->Bottom = region->Top - 1;
1384 return FALSE;
1385 }
1386 width = min( region->Right - region->Left + 1, size.X - coord.X );
1387 height = min( region->Bottom - region->Top + 1, size.Y - coord.Y );
1388 region->Right = region->Left + width - 1;
1389 region->Bottom = region->Top + height - 1;
1390
1391 count = sizeof(*result) + width * height * sizeof(*buffer);
1392 if (!(result = HeapAlloc( GetProcessHeap(), 0, count )))
1393 {
1395 return FALSE;
1396 }
1397
1398 params.mode = CHAR_INFO_MODE_TEXTATTR;
1399 params.x = region->Left;
1400 params.y = region->Top;
1401 params.width = width;
1402 if ((ret = console_ioctl( handle, IOCTL_CONDRV_READ_OUTPUT, &params, sizeof(params), result, count, &count )) && count)
1403 {
1404 CHAR_INFO *char_info = (CHAR_INFO *)(result + 1);
1405 *region = *result;
1406 width = region->Right - region->Left + 1;
1407 height = region->Bottom - region->Top + 1;
1408 for (y = 0; y < height; y++)
1409 memcpy( &buffer[(y + coord.Y) * size.X + coord.X], &char_info[y * width], width * sizeof(*buffer) );
1410 }
1412 return ret;
1413}
1414
1415
1416/******************************************************************************
1417 * ScrollConsoleScreenBufferA (kernelbase.@)
1418 */
1420 const SMALL_RECT *clip, COORD origin, const CHAR_INFO *fill )
1421{
1422 CHAR_INFO ciW;
1423
1424 ciW.Attributes = fill->Attributes;
1425 MultiByteToWideChar( GetConsoleOutputCP(), 0, &fill->Char.AsciiChar, 1, &ciW.Char.UnicodeChar, 1 );
1426
1427 return ScrollConsoleScreenBufferW( handle, scroll, clip, origin, &ciW );
1428}
1429
1430
1431/******************************************************************************
1432 * ScrollConsoleScreenBufferW (kernelbase.@)
1433 */
1435 const SMALL_RECT *clip_rect, COORD origin,
1436 const CHAR_INFO *fill )
1437{
1438 struct condrv_scroll_params params;
1439
1440 if (clip_rect)
1441 TRACE( "(%p,(%d,%d-%d,%d),(%d,%d-%d,%d),%d-%d,%p)\n", handle,
1442 scroll->Left, scroll->Top, scroll->Right, scroll->Bottom,
1443 clip_rect->Left, clip_rect->Top, clip_rect->Right, clip_rect->Bottom,
1444 origin.X, origin.Y, fill );
1445 else
1446 TRACE("(%p,(%d,%d-%d,%d),(nil),%d-%d,%p)\n", handle,
1447 scroll->Left, scroll->Top, scroll->Right, scroll->Bottom,
1448 origin.X, origin.Y, fill );
1449
1450 params.scroll = *scroll;
1451 params.origin = origin;
1452 params.fill.ch = fill->Char.UnicodeChar;
1453 params.fill.attr = fill->Attributes;
1454 if (!clip_rect)
1455 {
1456 params.clip.Left = params.clip.Top = 0;
1457 params.clip.Right = params.clip.Bottom = SHRT_MAX;
1458 }
1459 else params.clip = *clip_rect;
1460 return console_ioctl( handle, IOCTL_CONDRV_SCROLL, (void *)&params, sizeof(params), NULL, 0, NULL );
1461}
1462
1463
1464/******************************************************************************
1465 * SetConsoleActiveScreenBuffer (kernelbase.@)
1466 */
1468{
1469 TRACE( "(%p)\n", handle );
1470 return console_ioctl( handle, IOCTL_CONDRV_ACTIVATE, NULL, 0, NULL, 0, NULL );
1471}
1472
1473
1474/******************************************************************************
1475 * SetConsoleCP (kernelbase.@)
1476 */
1478{
1479 struct condrv_input_info_params params = { SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE };
1480
1481 params.info.input_cp = cp;
1482 return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
1483 IOCTL_CONDRV_SET_INPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
1484}
1485
1486
1487/******************************************************************************
1488 * SetConsoleCtrlHandler (kernelbase.@)
1489 */
1491{
1492 struct ctrl_handler *handler;
1493 BOOL ret = FALSE;
1494
1495 TRACE( "(%p,%d)\n", func, add );
1496
1498
1499 if (!func)
1500 {
1501 if (add) NtCurrentTeb()->Peb->ProcessParameters->ConsoleFlags |= 1;
1502 else NtCurrentTeb()->Peb->ProcessParameters->ConsoleFlags &= ~1;
1503 ret = TRUE;
1504 }
1505 else if (add)
1506 {
1507 if ((handler = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*handler) )))
1508 {
1509 handler->func = func;
1510 handler->next = ctrl_handlers;
1512 ret = TRUE;
1513 }
1514 }
1515 else
1516 {
1517 struct ctrl_handler **p_handler;
1518
1519 for (p_handler = &ctrl_handlers; *p_handler; p_handler = &(*p_handler)->next)
1520 {
1521 if ((*p_handler)->func == func) break;
1522 }
1523 if (*p_handler && *p_handler != &default_handler)
1524 {
1525 handler = *p_handler;
1526 *p_handler = handler->next;
1528 ret = TRUE;
1529 }
1531 }
1532
1534 return ret;
1535}
1536
1537
1538/******************************************************************************
1539 * SetConsoleCursorInfo (kernelbase.@)
1540 */
1542{
1543 struct condrv_output_info_params params = { SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM };
1544
1545 TRACE( "(%p,%ld,%d)\n", handle, info->dwSize, info->bVisible);
1546
1547 params.info.cursor_size = info->dwSize;
1548 params.info.cursor_visible = info->bVisible;
1549 return console_ioctl( handle, IOCTL_CONDRV_SET_OUTPUT_INFO, &params, sizeof(params),
1550 NULL, 0, NULL );
1551}
1552
1553
1554/******************************************************************************
1555 * SetConsoleCursorPosition (kernelbase.@)
1556 */
1558{
1559 struct condrv_output_info_params params = { SET_CONSOLE_OUTPUT_INFO_CURSOR_POS };
1560
1561 TRACE( "%p %d %d\n", handle, pos.X, pos.Y );
1562
1563 params.info.cursor_x = pos.X;
1564 params.info.cursor_y = pos.Y;
1565 return console_ioctl( handle, IOCTL_CONDRV_SET_OUTPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
1566}
1567
1568
1569/***********************************************************************
1570 * SetConsoleDisplayMode (kernelbase.@)
1571 */
1573{
1574 TRACE( "(%p, %lx, (%d, %d))\n", handle, flags, size->X, size->Y );
1575 if (flags == 1)
1576 {
1577 /* We cannot switch to fullscreen */
1578 return FALSE;
1579 }
1580 return TRUE;
1581}
1582
1583
1584/******************************************************************************
1585 * SetConsoleInputExeNameA (kernelbase.@)
1586 */
1588{
1589 if (!name || !name[0])
1590 {
1592 return FALSE;
1593 }
1597 return TRUE;
1598}
1599
1600
1601/******************************************************************************
1602 * SetConsoleInputExeNameW (kernelbase.@)
1603 */
1605{
1606 if (!name || !name[0])
1607 {
1609 return FALSE;
1610 }
1614 return TRUE;
1615}
1616
1617
1618/******************************************************************************
1619 * SetConsoleMode (kernelbase.@)
1620 */
1622{
1623 TRACE( "(%p,%lx)\n", handle, mode );
1624 return console_ioctl( handle, IOCTL_CONDRV_SET_MODE, &mode, sizeof(mode), NULL, 0, NULL );
1625}
1626
1627
1628/******************************************************************************
1629 * SetConsoleOutputCP (kernelbase.@)
1630 */
1632{
1633 struct condrv_input_info_params params = { SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE };
1634
1635 params.info.output_cp = cp;
1636 return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
1637 IOCTL_CONDRV_SET_INPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
1638}
1639
1640
1641/******************************************************************************
1642 * SetConsoleScreenBufferInfoEx (kernelbase.@)
1643 */
1646{
1647 struct condrv_output_info_params params =
1648 { SET_CONSOLE_OUTPUT_INFO_CURSOR_POS | SET_CONSOLE_OUTPUT_INFO_SIZE |
1649 SET_CONSOLE_OUTPUT_INFO_ATTR | SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR |
1650 SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW | SET_CONSOLE_OUTPUT_INFO_MAX_SIZE };
1651
1652 TRACE("(%p, %p)\n", handle, info);
1653
1654 if (info->cbSize != sizeof(CONSOLE_SCREEN_BUFFER_INFOEX))
1655 {
1657 return FALSE;
1658 }
1659
1660 params.info.width = info->dwSize.X;
1661 params.info.height = info->dwSize.Y;
1662 params.info.cursor_x = info->dwCursorPosition.X;
1663 params.info.cursor_y = info->dwCursorPosition.Y;
1664 params.info.attr = info->wAttributes;
1665 params.info.win_left = info->srWindow.Left;
1666 params.info.win_top = info->srWindow.Top;
1667 params.info.win_right = info->srWindow.Right;
1668 params.info.win_bottom = info->srWindow.Bottom;
1669 params.info.popup_attr = info->wPopupAttributes;
1670 params.info.max_width = min( info->dwMaximumWindowSize.X, info->dwSize.X );
1671 params.info.max_height = min( info->dwMaximumWindowSize.Y, info->dwSize.Y );
1672 return console_ioctl( handle, IOCTL_CONDRV_SET_OUTPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
1673}
1674
1675
1676/******************************************************************************
1677 * SetConsoleScreenBufferSize (kernelbase.@)
1678 */
1680{
1681 struct condrv_output_info_params params = { SET_CONSOLE_OUTPUT_INFO_SIZE };
1682
1683 TRACE( "(%p,(%d,%d))\n", handle, size.X, size.Y );
1684
1685 params.info.width = size.X;
1686 params.info.height = size.Y;
1687 return console_ioctl( handle, IOCTL_CONDRV_SET_OUTPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
1688}
1689
1690
1691/******************************************************************************
1692 * SetConsoleTextAttribute (kernelbase.@)
1693 */
1695{
1696 struct condrv_output_info_params params = { SET_CONSOLE_OUTPUT_INFO_ATTR };
1697
1698 TRACE( "(%p,%d)\n", handle, attr );
1699
1700 params.info.attr = attr;
1701 return console_ioctl( handle, IOCTL_CONDRV_SET_OUTPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
1702}
1703
1704
1705/******************************************************************************
1706 * SetConsoleTitleA (kernelbase.@)
1707 */
1709{
1710 LPWSTR titleW;
1711 BOOL ret;
1713 if (!(titleW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE;
1717 return ret;
1718}
1719
1720
1721/******************************************************************************
1722 * SetConsoleTitleW (kernelbase.@)
1723 */
1725{
1726 TRACE( "%s\n", debugstr_w( title ));
1727
1728 return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle, IOCTL_CONDRV_SET_TITLE,
1729 (void *)title, lstrlenW(title) * sizeof(WCHAR), NULL, 0, NULL );
1730}
1731
1732
1733/******************************************************************************
1734 * SetConsoleWindowInfo (kernelbase.@)
1735 */
1737{
1738 struct condrv_output_info_params params = { SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW };
1740
1741 TRACE( "(%p,%d,(%d,%d-%d,%d))\n", handle, absolute, rect.Left, rect.Top, rect.Right, rect.Bottom );
1742
1743 if (!absolute)
1744 {
1746
1747 if (!GetConsoleScreenBufferInfo( handle, &info )) return FALSE;
1748 rect.Left += info.srWindow.Left;
1749 rect.Top += info.srWindow.Top;
1750 rect.Right += info.srWindow.Right;
1751 rect.Bottom += info.srWindow.Bottom;
1752 }
1753
1754 params.info.win_left = rect.Left;
1755 params.info.win_top = rect.Top;
1756 params.info.win_right = rect.Right;
1757 params.info.win_bottom = rect.Bottom;
1758 return console_ioctl( handle, IOCTL_CONDRV_SET_OUTPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
1759}
1760
1761
1762/******************************************************************************
1763 * SetCurrentConsoleFontEx (kernelbase.@)
1764 */
1766{
1767 struct
1768 {
1769 struct condrv_output_info_params params;
1770 WCHAR face_name[LF_FACESIZE];
1771 } data;
1772
1773 size_t size;
1774
1775 TRACE( "(%p %d %p)\n", handle, maxwindow, info );
1776
1777 if (info->cbSize != sizeof(*info))
1778 {
1780 return FALSE;
1781 }
1782
1783 data.params.mask = SET_CONSOLE_OUTPUT_INFO_FONT;
1784
1785 data.params.info.font_width = info->dwFontSize.X;
1786 data.params.info.font_height = info->dwFontSize.Y;
1787 data.params.info.font_pitch_family = info->FontFamily;
1788 data.params.info.font_weight = info->FontWeight;
1789
1790 size = wcsnlen( info->FaceName, LF_FACESIZE - 1 ) * sizeof(WCHAR);
1791 memcpy( data.face_name, info->FaceName, size );
1792
1793 size += sizeof(struct condrv_output_info_params);
1794 return console_ioctl( handle, IOCTL_CONDRV_SET_OUTPUT_INFO, &data, size, NULL, 0, NULL );
1795}
1796
1797
1798/***********************************************************************
1799 * ReadConsoleInputA (kernelbase.@)
1800 */
1802{
1803 DWORD read;
1804
1805 if (!ReadConsoleInputW( handle, buffer, length, &read )) return FALSE;
1807 if (count) *count = read;
1808 return TRUE;
1809}
1810
1811
1812/***********************************************************************
1813 * ReadConsoleInputW (kernelbase.@)
1814 */
1816{
1817 if (!console_ioctl( handle, IOCTL_CONDRV_READ_INPUT, NULL, 0,
1818 buffer, length * sizeof(*buffer), count ))
1819 return FALSE;
1820 *count /= sizeof(*buffer);
1821 return TRUE;
1822}
1823
1824
1825/******************************************************************************
1826 * WriteConsoleInputA (kernelbase.@)
1827 */
1829 DWORD count, DWORD *written )
1830{
1831 INPUT_RECORD *recW = NULL;
1832 BOOL ret;
1833
1834 if (count > 0)
1835 {
1836 if (!buffer)
1837 {
1839 return FALSE;
1840 }
1841 if (!(recW = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*recW) )))
1842 {
1844 return FALSE;
1845 }
1846 memcpy( recW, buffer, count * sizeof(*recW) );
1847 input_records_AtoW( recW, count );
1848 }
1849 ret = WriteConsoleInputW( handle, recW, count, written );
1850 HeapFree( GetProcessHeap(), 0, recW );
1851 return ret;
1852}
1853
1854
1855/******************************************************************************
1856 * WriteConsoleInputW (kernelbase.@)
1857 */
1859 DWORD count, DWORD *written )
1860{
1861 TRACE( "(%p,%p,%ld,%p)\n", handle, buffer, count, written );
1862
1863 if (count > 0 && !buffer)
1864 {
1866 return FALSE;
1867 }
1868
1869 if (!DeviceIoControl( handle, IOCTL_CONDRV_WRITE_INPUT, (void *)buffer, count * sizeof(*buffer), NULL, 0, NULL, NULL ))
1870 return FALSE;
1871
1872 if (!written)
1873 {
1875 return FALSE;
1876 }
1877 *written = count;
1878 return TRUE;
1879}
1880
1881
1882/***********************************************************************
1883 * WriteConsoleOutputA (kernelbase.@)
1884 */
1886 COORD size, COORD coord, SMALL_RECT *region )
1887{
1888 int y;
1889 BOOL ret;
1890 COORD new_size, new_coord;
1891 CHAR_INFO *ciW;
1892
1893 new_size.X = min( region->Right - region->Left + 1, size.X - coord.X );
1894 new_size.Y = min( region->Bottom - region->Top + 1, size.Y - coord.Y );
1895
1896 if (new_size.X <= 0 || new_size.Y <= 0)
1897 {
1898 region->Bottom = region->Top + new_size.Y - 1;
1899 region->Right = region->Left + new_size.X - 1;
1900 return TRUE;
1901 }
1902
1903 /* only copy the useful rectangle */
1904 if (!(ciW = HeapAlloc( GetProcessHeap(), 0, sizeof(CHAR_INFO) * new_size.X * new_size.Y )))
1905 return FALSE;
1906 for (y = 0; y < new_size.Y; y++)
1907 memcpy( &ciW[y * new_size.X], &buffer[(y + coord.Y) * size.X + coord.X],
1908 new_size.X * sizeof(CHAR_INFO) );
1909 char_info_AtoW( ciW, new_size.X * new_size.Y );
1910 new_coord.X = new_coord.Y = 0;
1911 ret = WriteConsoleOutputW( handle, ciW, new_size, new_coord, region );
1912 HeapFree( GetProcessHeap(), 0, ciW );
1913 return ret;
1914}
1915
1916
1917/***********************************************************************
1918 * WriteConsoleOutputW (kernelbase.@)
1919 */
1921 COORD size, COORD coord, SMALL_RECT *region )
1922{
1923 struct condrv_output_params *params;
1924 unsigned int width, height, y;
1925 size_t params_size;
1926 BOOL ret;
1927
1928 TRACE( "(%p,%p,(%d,%d),(%d,%d),(%d,%dx%d,%d)\n",
1929 handle, buffer, size.X, size.Y, coord.X, coord.Y,
1930 region->Left, region->Top, region->Right, region->Bottom );
1931
1932 if (region->Left > region->Right || region->Top > region->Bottom || size.X <= coord.X || size.Y <= coord.Y)
1933 {
1935 return FALSE;
1936 }
1937
1938 width = min( region->Right - region->Left + 1, size.X - coord.X );
1939 height = min( region->Bottom - region->Top + 1, size.Y - coord.Y );
1940 region->Right = region->Left + width - 1;
1941 region->Bottom = region->Top + height - 1;
1942
1943 params_size = sizeof(*params) + width * height * sizeof(*buffer);
1944 if (!(params = HeapAlloc( GetProcessHeap(), 0, params_size )))
1945 {
1947 return FALSE;
1948 }
1949
1950 params->mode = CHAR_INFO_MODE_TEXTATTR;
1951 params->x = region->Left;
1952 params->y = region->Top;
1953 params->width = width;
1954
1955 for (y = 0; y < height; y++)
1956 memcpy( &((CHAR_INFO *)(params + 1))[y * width], &buffer[(y + coord.Y) * size.X + coord.X], width * sizeof(CHAR_INFO) );
1957
1958 ret = console_ioctl( handle, IOCTL_CONDRV_WRITE_OUTPUT, params, params_size, region, sizeof(*region), NULL );
1960 return ret;
1961}
1962
1963
1964/******************************************************************************
1965 * WriteConsoleOutputAttribute (kernelbase.@)
1966 */
1968 COORD coord, DWORD *written )
1969{
1970 struct condrv_output_params *params;
1971 size_t size;
1972 BOOL ret;
1973
1974 TRACE( "(%p,%p,%ld,%dx%d,%p)\n", handle, attr, length, coord.X, coord.Y, written );
1975
1976 if ((length > 0 && !attr) || !written)
1977 {
1979 return FALSE;
1980 }
1981
1982 *written = 0;
1983 size = sizeof(*params) + length * sizeof(WORD);
1984 if (!(params = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
1985 params->mode = CHAR_INFO_MODE_ATTR;
1986 params->x = coord.X;
1987 params->y = coord.Y;
1988 params->width = 0;
1989 memcpy( params + 1, attr, length * sizeof(*attr) );
1990 ret = console_ioctl( handle, IOCTL_CONDRV_WRITE_OUTPUT, params, size, written, sizeof(*written), NULL );
1992 return ret;
1993}
1994
1995
1996/******************************************************************************
1997 * WriteConsoleOutputCharacterA (kernelbase.@)
1998 */
2000 COORD coord, DWORD *written )
2001{
2002 BOOL ret;
2003 LPWSTR strW = NULL;
2004 DWORD lenW = 0;
2005
2006 TRACE( "(%p,%s,%ld,%dx%d,%p)\n", handle, debugstr_an(str, length), length, coord.X, coord.Y, written );
2007
2008 if (length > 0)
2009 {
2011 if (!str)
2012 {
2014 return FALSE;
2015 }
2016 lenW = MultiByteToWideChar( cp, 0, str, length, NULL, 0 );
2017
2018 if (!(strW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) )))
2019 {
2021 return FALSE;
2022 }
2023 MultiByteToWideChar( cp, 0, str, length, strW, lenW );
2024 }
2025 ret = WriteConsoleOutputCharacterW( handle, strW, lenW, coord, written );
2026 HeapFree( GetProcessHeap(), 0, strW );
2027 return ret;
2028}
2029
2030
2031/******************************************************************************
2032 * WriteConsoleOutputCharacterW (kernelbase.@)
2033 */
2035 COORD coord, DWORD *written )
2036{
2037 struct condrv_output_params *params;
2038 size_t size;
2039 BOOL ret;
2040
2041 TRACE( "(%p,%s,%ld,%dx%d,%p)\n", handle, debugstr_wn(str, length), length, coord.X, coord.Y, written );
2042
2043 if ((length > 0 && !str) || !written)
2044 {
2046 return FALSE;
2047 }
2048
2049 *written = 0;
2050 size = sizeof(*params) + length * sizeof(WCHAR);
2051 if (!(params = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
2052 params->mode = CHAR_INFO_MODE_TEXT;
2053 params->x = coord.X;
2054 params->y = coord.Y;
2055 params->width = 0;
2056 memcpy( params + 1, str, length * sizeof(*str) );
2057 ret = console_ioctl( handle, IOCTL_CONDRV_WRITE_OUTPUT, params, size, written, sizeof(*written), NULL );
2059 return ret;
2060}
2061
2062
2063/***********************************************************************
2064 * ReadConsoleA (kernelbase.@)
2065 */
2067{
2068 if (length > INT_MAX)
2069 {
2071 return FALSE;
2072 }
2073
2074 return console_ioctl( handle, IOCTL_CONDRV_READ_FILE, NULL, 0, buffer, length, count );
2075}
2076
2077
2078/***********************************************************************
2079 * ReadConsoleW (kernelbase.@)
2080 */
2082{
2083 BOOL ret;
2084
2085 TRACE( "(%p,%p,%ld,%p,%p)\n", handle, buffer, length, count, reserved );
2086
2087 if (length > INT_MAX)
2088 {
2090 return FALSE;
2091 }
2092
2093 if (reserved)
2094 {
2096 char *tmp;
2097
2098 if (crc->nLength != sizeof(*crc) || crc->nInitialChars >= length)
2099 {
2101 return FALSE;
2102 }
2103 if (!(tmp = HeapAlloc( GetProcessHeap(), 0, sizeof(DWORD) + length * sizeof(WCHAR) )))
2104 {
2106 return FALSE;
2107 }
2108
2109 memcpy( tmp, &crc->dwCtrlWakeupMask, sizeof(DWORD) );
2110 memcpy( tmp + sizeof(DWORD), buffer, crc->nInitialChars * sizeof(WCHAR) );
2111 ret = console_ioctl( handle, IOCTL_CONDRV_READ_CONSOLE_CONTROL,
2112 tmp, sizeof(DWORD) + crc->nInitialChars * sizeof(WCHAR),
2113 tmp, sizeof(DWORD) + length * sizeof(WCHAR), count );
2114 if (ret)
2115 {
2116 memcpy( &crc->dwConsoleKeyState, tmp, sizeof(DWORD) );
2117 *count -= sizeof(DWORD);
2118 memcpy( buffer, tmp + sizeof(DWORD), *count );
2119 }
2120 HeapFree( GetProcessHeap(), 0, tmp );
2121 }
2122 else
2123 {
2124 ret = console_ioctl( handle, IOCTL_CONDRV_READ_CONSOLE, NULL, 0, buffer,
2125 length * sizeof(WCHAR), count );
2126 }
2127 if (ret) *count /= sizeof(WCHAR);
2128 return ret;
2129}
2130
2131
2132/***********************************************************************
2133 * WriteConsoleA (kernelbase.@)
2134 */
2136 DWORD *written, void *reserved )
2137{
2138 BOOL ret;
2139
2140 TRACE( "(%p,%s,%ld,%p,%p)\n", handle, debugstr_an(buffer, length), length, written, reserved );
2141
2142 ret = console_ioctl( handle, IOCTL_CONDRV_WRITE_FILE, (void *)buffer, length, NULL, 0, NULL );
2143 if (written) *written = ret ? length : 0;
2144 return ret;
2145}
2146
2147
2148/***********************************************************************
2149 * WriteConsoleW (kernelbase.@)
2150 */
2152 DWORD *written, void *reserved )
2153{
2154 BOOL ret;
2155
2156 TRACE( "(%p,%s,%ld,%p,%p)\n", handle, debugstr_wn(buffer, length), length, written, reserved );
2157
2158 ret = console_ioctl( handle, IOCTL_CONDRV_WRITE_CONSOLE, (void *)buffer,
2159 length * sizeof(WCHAR), NULL, 0, NULL );
2160 if (written) *written = ret ? length : 0;
2161 return ret;
2162}
2163
2164
2165/***********************************************************************
2166 * FlushConsoleInputBuffer (kernelbase.@)
2167 */
2169{
2170 return console_ioctl( handle, IOCTL_CONDRV_FLUSH, NULL, 0, NULL, 0, NULL );
2171}
2172
2173
2174/***********************************************************************
2175 * Beep (kernelbase.@)
2176 */
2178{
2179 /* FIXME: we should not require a console to be attached */
2180 console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
2181 IOCTL_CONDRV_BEEP, NULL, 0, NULL, 0, NULL );
2182 return TRUE;
2183}
2184
2185
2188{
2189 WCHAR cmd[MAX_PATH], conhost_path[MAX_PATH];
2190 unsigned int inherit_count;
2192 HANDLE server, console;
2193 HANDLE inherit[2];
2194 STARTUPINFOEXW si;
2195 SIZE_T attr_size;
2196 void *redir;
2197 BOOL res;
2198
2199 if (!(server = create_console_server())) return NULL;
2200
2201 console = create_console_reference( server );
2202 if (!console)
2203 {
2204 NtClose( server );
2205 return NULL;
2206 }
2207
2208 memset( &si, 0, sizeof(si) );
2209 si.StartupInfo.cb = sizeof(STARTUPINFOEXW);
2210 si.StartupInfo.hStdInput = input;
2211 si.StartupInfo.hStdOutput = output;
2212 si.StartupInfo.hStdError = output;
2213 si.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
2214
2215 inherit[0] = server;
2216 inherit[1] = signal;
2217 inherit_count = signal ? 2 : 1;
2218 InitializeProcThreadAttributeList( NULL, inherit_count, 0, &attr_size );
2219 if (!(si.lpAttributeList = HeapAlloc( GetProcessHeap(), 0, attr_size )))
2220 {
2221 NtClose( console );
2222 NtClose( server );
2223 return FALSE;
2224 }
2225 InitializeProcThreadAttributeList( si.lpAttributeList, inherit_count, 0, &attr_size );
2227 inherit, sizeof(*inherit) * inherit_count, NULL, NULL );
2228
2229 swprintf( conhost_path, ARRAY_SIZE(conhost_path), L"%s\\conhost.exe", system_dir );
2230 if (signal)
2231 {
2233 L"\"%s\" --headless %s--width %u --height %u --signal 0x%x --server 0x%x",
2234 conhost_path, (flags & PSEUDOCONSOLE_INHERIT_CURSOR) ? L"--inheritcursor " : L"",
2235 size.X, size.Y, signal, server );
2236 }
2237 else
2238 {
2239 swprintf( cmd, ARRAY_SIZE(cmd), L"\"%s\" --unix --width %u --height %u --server 0x%x",
2240 conhost_path, size.X, size.Y, server );
2241 }
2244 NULL, NULL, &si.StartupInfo, &pi );
2245 HeapFree( GetProcessHeap(), 0, si.lpAttributeList );
2247 NtClose( server );
2248 if (!res)
2249 {
2250 NtClose( console );
2251 return NULL;
2252 }
2253
2254 NtClose( pi.hThread );
2255 *process = pi.hProcess;
2256 return console;
2257}
2258
2259/******************************************************************************
2260 * CreatePseudoConsole (kernelbase.@)
2261 */
2263{
2264 SECURITY_ATTRIBUTES inherit_attr = { sizeof(inherit_attr), NULL, TRUE };
2266 HANDLE tty_input = NULL, tty_output;
2267 HANDLE signal = NULL;
2268 WCHAR pipe_name[64];
2269
2270 TRACE( "(%u,%u) %p %p %lx %p\n", size.X, size.Y, input, output, flags, ret );
2271
2272 if (!size.X || !size.Y || !ret) return E_INVALIDARG;
2273
2275
2276 swprintf( pipe_name, ARRAY_SIZE(pipe_name), L"\\\\.\\pipe\\wine_pty_signal_pipe%x",
2279 PIPE_UNLIMITED_INSTANCES, 4096, 4096, NMPWAIT_USE_DEFAULT_WAIT, &inherit_attr );
2281 {
2283 return HRESULT_FROM_WIN32( GetLastError() );
2284 }
2289 {
2290 pseudo_console->reference = create_pseudo_console( size, tty_input, tty_output, signal, flags,
2292 NtClose( tty_output );
2293 }
2294 NtClose( tty_input );
2295 NtClose( signal );
2297 {
2299 return HRESULT_FROM_WIN32( GetLastError() );
2300 }
2301
2303 return S_OK;
2304}
2305
2306/******************************************************************************
2307 * ClosePseudoConsole (kernelbase.@)
2308 */
2310{
2312
2313 TRACE( "%p\n", handle );
2314
2315 if (!pseudo_console) return;
2318 {
2321 }
2323}
2324
2325/******************************************************************************
2326 * ResizePseudoConsole (kernelbase.@)
2327 */
2329{
2330 FIXME( "%p (%u,%u)\n", handle, size.X, size.Y );
2331 return E_NOTIMPL;
2332}
2333
2335{
2336 return ((UINT_PTR)handle & 3) == 1;
2337}
2338
2339void init_console( void )
2340{
2342
2343 if (params->ConsoleHandle == CONSOLE_HANDLE_SHELL)
2344 {
2345 HANDLE tty_in = NULL, tty_out = NULL, process = NULL;
2346 COORD size;
2347
2348 if (is_tty_handle( params->hStdInput ))
2349 {
2350 tty_in = params->hStdInput;
2351 params->hStdInput = NULL;
2352 }
2353 if (is_tty_handle( params->hStdOutput ))
2354 {
2355 tty_out = params->hStdOutput;
2356 params->hStdOutput = NULL;
2357 }
2358 if (is_tty_handle( params->hStdError ))
2359 {
2360 if (tty_out) CloseHandle( params->hStdError );
2361 else tty_out = params->hStdError;
2362 params->hStdError = NULL;
2363 }
2364
2365 size.X = params->dwXCountChars;
2366 size.Y = params->dwYCountChars;
2367 TRACE( "creating unix console (size %u %u)\n", size.X, size.Y );
2368 params->ConsoleHandle = create_pseudo_console( size, tty_in, tty_out, NULL, 0, &process );
2370 CloseHandle( tty_in );
2371 CloseHandle( tty_out );
2372
2373 if (params->ConsoleHandle && create_console_connection( params->ConsoleHandle ))
2374 {
2376 }
2377 }
2378 else if (params->ConsoleHandle == CONSOLE_HANDLE_ALLOC ||
2379 params->ConsoleHandle == CONSOLE_HANDLE_ALLOC_NO_WINDOW)
2380 {
2381 BOOL no_window = params->ConsoleHandle == CONSOLE_HANDLE_ALLOC_NO_WINDOW;
2383 params->ConsoleHandle = NULL;
2384 if (RtlImageNtHeader( mod )->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
2385 alloc_console( no_window );
2386 }
2387 else if (params->ConsoleHandle && params->ConsoleHandle != CONSOLE_HANDLE_SHELL_NO_WINDOW)
2388 create_console_connection( params->ConsoleHandle );
2389}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:66
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
#define read
Definition: acwin.h:96
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define ARRAY_SIZE(A)
Definition: main.h:20
BOOL WINAPI SetConsoleOutputCP(IN UINT wCodepage)
Definition: console.c:695
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:407
BOOL WINAPI FlushConsoleInputBuffer(IN HANDLE hConsoleInput)
Definition: console.c:220
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:560
BOOL WINAPI SetConsoleCursorPosition(IN HANDLE hConsoleOutput, IN COORD dwCursorPosition)
Definition: console.c:641
BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE hConsoleOutput, IN LPCWSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:451
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
BOOL WINAPI SetConsoleTextAttribute(IN HANDLE hConsoleOutput, IN WORD wAttributes)
Definition: console.c:672
BOOL WINAPI SetConsoleCursorInfo(IN HANDLE hConsoleOutput, IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo)
Definition: console.c:618
BOOL WINAPI AttachConsole(IN DWORD dwProcessId)
Definition: console.c:147
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
Definition: console.c:525
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
Definition: console.c:595
static INT max_size
Definition: history.c:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define LongToHandle(h)
Definition: basetsd.h:82
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
struct _root root
Definition: list.h:37
wcscat
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI Beep(IN DWORD dwFreq, IN DWORD dwDuration)
Definition: deviceio.c:48
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define LF_FACESIZE
Definition: dimm.idl:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:227
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define __TRY
Definition: compat.h:80
#define GetCurrentProcess()
Definition: compat.h:759
#define RtlImageNtHeader
Definition: compat.h:806
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define __ENDTRY
Definition: compat.h:82
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define FILE_SHARE_READ
Definition: compat.h:136
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI SetConsoleWindowInfo(HANDLE hConsoleOutput, BOOL bAbsolute, CONST SMALL_RECT *lpConsoleWindow)
Definition: console.c:1972
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA(LPSTR lpConsoleTitle, DWORD nSize)
Definition: console.c:2237
BOOL WINAPI DECLSPEC_HOTPATCH ScrollConsoleScreenBufferA(HANDLE hConsoleOutput, CONST SMALL_RECT *lpScrollRectangle, CONST SMALL_RECT *lpClipRectangle, COORD dwDestinationOrigin, CONST CHAR_INFO *lpFill)
Definition: console.c:1931
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize)
Definition: console.c:1857
COORD WINAPI DECLSPEC_HOTPATCH GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
Definition: console.c:1675
BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD lpNumberOfMouseButtons)
Definition: console.c:1773
HANDLE WINAPI CreateConsoleScreenBuffer(DWORD dwDesiredAccess, DWORD dwShareMode, CONST SECURITY_ATTRIBUTES *lpSecurityAttributes, DWORD dwFlags, LPVOID lpScreenBufferData)
Definition: console.c:2315
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
Definition: console.c:1571
BOOL WINAPI GetCurrentConsoleFont(IN HANDLE hConsoleOutput, IN BOOL bMaximumWindow, OUT PCONSOLE_FONT_INFO lpConsoleCurrentFont)
Definition: console.c:694
BOOL WINAPI GetConsoleDisplayMode(LPDWORD lpModeFlags)
Definition: console.c:526
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTitleA(LPCSTR lpConsoleTitle)
Definition: console.c:2304
COORD WINAPI DECLSPEC_HOTPATCH GetConsoleFontSize(IN HANDLE hConsoleOutput, IN DWORD nFont)
Definition: console.c:613
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCP(UINT wCodePageID)
Definition: console.c:2422
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTitleW(LPCWSTR lpConsoleTitle)
Definition: console.c:2292
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
Definition: console.c:1608
BOOL WINAPI SetConsoleDisplayMode(HANDLE hConsoleOutput, DWORD dwFlags, PCOORD lpNewScreenBufferDimensions)
Definition: console.c:877
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2111
BOOL WINAPI DECLSPEC_HOTPATCH SetStdHandle(DWORD nStdHandle, HANDLE hHandle)
Definition: console.c:1215
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
Definition: console.c:1801
BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, LPDWORD lpNumberOfEvents)
Definition: console.c:1637
BOOL WINAPI GetConsoleCursorInfo(HANDLE hConsoleOutput, PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
Definition: console.c:1704
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleInputExeNameW(IN DWORD nBufferLength, OUT LPWSTR lpExeName)
Definition: console.c:2907
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleW(LPWSTR lpConsoleTitle, DWORD nSize)
Definition: console.c:2224
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleInputExeNameW(IN LPCWSTR lpExeName)
Definition: console.c:2791
DWORD WINAPI GetConsoleProcessList(LPDWORD lpdwProcessList, DWORD dwProcessCount)
Definition: console.c:2515
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleInputExeNameA(IN DWORD nBufferLength, OUT LPSTR lpExeName)
Definition: console.c:2946
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleInputExeNameA(IN LPCSTR lpExeName)
Definition: console.c:2831
BOOL WINAPI DECLSPEC_HOTPATCH GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, DWORD dwProcessGroupId)
Definition: console.c:2134
BOOL WINAPI DECLSPEC_HOTPATCH ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, CONST SMALL_RECT *lpScrollRectangle, CONST SMALL_RECT *lpClipRectangle, COORD dwDestinationOrigin, CONST CHAR_INFO *lpFill)
Definition: console.c:1952
PPEB Peb
Definition: dllmain.c:27
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4598
VOID WINAPI GetStartupInfoW(IN LPSTARTUPINFOW lpStartupInfo)
Definition: proc.c:1279
BOOL WINAPI Wow64RevertWow64FsRedirection(IN PVOID OldValue)
Definition: utils.c:808
BOOL WINAPI Wow64DisableWow64FsRedirection(IN PVOID *OldValue)
Definition: utils.c:785
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputA(HANDLE handle, const INPUT_RECORD *buffer, DWORD count, DWORD *written)
Definition: console.c:1828
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputA(HANDLE handle, const CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
Definition: console.c:1885
DWORD WINAPI GetConsoleCommandHistoryW(LPWSTR buffer, DWORD len, LPCWSTR exename)
Definition: console.c:788
BOOL WINAPI DECLSPEC_HOTPATCH FreeConsole(void)
Definition: console.c:663
void WINAPI ClosePseudoConsole(HPCON handle)
Definition: console.c:2309
DWORD WINAPI GetConsoleCommandHistoryA(LPSTR buffer, DWORD len, LPCSTR exename)
Definition: console.c:777
static void char_info_WtoA(UINT cp, CHAR_INFO *buffer, int count)
Definition: console.c:145
BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputA(HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
Definition: console.c:1228
BOOL WINAPI AddConsoleAliasW(LPWSTR source, LPWSTR target, LPWSTR exename)
Definition: console.c:349
static BOOL alloc_console(BOOL headless)
Definition: console.c:396
void WINAPI ExpungeConsoleCommandHistoryA(LPCSTR exename)
Definition: console.c:570
static HANDLE create_console_server(void)
Definition: console.c:233
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleCP(void)
Definition: console.c:821
static BOOL WINAPI default_ctrl_handler(DWORD type)
Definition: console.c:72
static HANDLE create_pseudo_console(COORD size, HANDLE input, HANDLE output, HANDLE signal, DWORD flags, HANDLE *process)
Definition: console.c:2186
static BOOL create_console_connection(HANDLE root)
Definition: console.c:265
BOOL WINAPI ReadConsoleInputA(HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
Definition: console.c:1801
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferInfoEx(HANDLE handle, CONSOLE_SCREEN_BUFFER_INFOEX *info)
Definition: console.c:1644
BOOL WINAPI GetCurrentConsoleFontEx(HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFOEX *info)
Definition: console.c:1116
static COORD get_largest_console_window_size(HANDLE handle)
Definition: console.c:172
BOOL WINAPI ReadConsoleA(HANDLE handle, void *buffer, DWORD length, DWORD *count, void *reserved)
Definition: console.c:2066
static struct ctrl_handler * ctrl_handlers
Definition: console.c:83
#define CONSOLE_INPUT_HANDLE
Definition: console.c:60
DWORD WINAPI GetConsoleAliasW(LPWSTR source, LPWSTR buffer, DWORD len, LPWSTR exename)
Definition: console.c:722
BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputW(HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
Definition: console.c:1243
static WCHAR input_exe[MAX_PATH+1]
Definition: console.c:64
DWORD WINAPI GetConsoleAliasExesLengthW(void)
Definition: console.c:744
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleA(LPSTR title, DWORD size)
Definition: console.c:929
static struct ctrl_handler default_handler
Definition: console.c:82
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: console.c:49
BOOL WINAPI AddConsoleAliasA(LPSTR source, LPSTR target, LPSTR exename)
Definition: console.c:338
HRESULT WINAPI CreatePseudoConsole(COORD size, HANDLE input, HANDLE output, DWORD flags, HPCON *ret)
Definition: console.c:2262
static void char_info_AtoW(CHAR_INFO *buffer, int count)
Definition: console.c:158
BOOL WINAPI ReadConsoleInputW(HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
Definition: console.c:1815
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleW(LPWSTR title, DWORD size)
Definition: console.c:948
BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfoEx(HANDLE handle, CONSOLE_SCREEN_BUFFER_INFOEX *info)
Definition: console.c:1038
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void)
Definition: console.c:957
DWORD WINAPI GetConsoleCommandHistoryLengthA(LPCSTR exename)
Definition: console.c:799
BOOL WINAPI SetCurrentConsoleFontEx(HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFOEX *info)
Definition: console.c:1765
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW(HANDLE handle, const INPUT_RECORD *buffer, DWORD count, DWORD *written)
Definition: console.c:1858
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputW(HANDLE handle, CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
Definition: console.c:1365
#define CONSOLE_OUTPUT_HANDLE
Definition: console.c:61
DWORD WINAPI GetConsoleAliasesLengthA(LPSTR unknown)
Definition: console.c:755
void init_console(void)
Definition: console.c:2339
void WINAPI ExpungeConsoleCommandHistoryW(LPCWSTR exename)
Definition: console.c:580
DWORD WINAPI CtrlRoutine(void *arg)
Definition: console.c:531
DWORD WINAPI GetConsoleCommandHistoryLengthW(LPCWSTR exename)
Definition: console.c:810
static void input_records_WtoA(INPUT_RECORD *buffer, int count)
Definition: console.c:115
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputCharacterW(HANDLE handle, LPWSTR buffer, DWORD length, COORD coord, DWORD *count)
Definition: console.c:1317
#define CONSOLE_ERROR_HANDLE
Definition: console.c:62
BOOL WINAPI AllocConsole(void)
Definition: console.c:492
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputCharacterA(HANDLE handle, LPSTR buffer, DWORD length, COORD coord, DWORD *count)
Definition: console.c:1285
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(HANDLE handle, const void *buffer, DWORD length, DWORD *written, void *reserved)
Definition: console.c:2151
static COORD get_console_font_size(HANDLE handle, DWORD index)
Definition: console.c:187
HRESULT WINAPI ResizePseudoConsole(HPCON handle, COORD size)
Definition: console.c:2328
static CRITICAL_SECTION console_section
Definition: console.c:48
BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterW(HANDLE handle, WCHAR ch, DWORD length, COORD coord, DWORD *written)
Definition: console.c:633
static BOOL console_ioctl(HANDLE handle, DWORD code, void *in_buff, DWORD in_count, void *out_buff, DWORD out_count, DWORD *read)
Definition: console.c:85
static HANDLE console_connection
Definition: console.c:57
DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR unknown)
Definition: console.c:766
static DWORD get_console_title(WCHAR *title, DWORD size, BOOL current_title)
Definition: console.c:208
HWND WINAPI GetConsoleWindow(void)
Definition: console.c:1102
static HANDLE create_console_reference(HANDLE root)
Definition: console.c:249
static BOOL init_console_std_handles(BOOL override_all)
Definition: console.c:280
static BOOL is_tty_handle(HANDLE handle)
Definition: console.c:2334
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA(HANDLE handle, const void *buffer, DWORD length, DWORD *written, void *reserved)
Definition: console.c:2135
DWORD WINAPI GetConsoleAliasA(LPSTR source, LPSTR buffer, DWORD len, LPSTR exename)
Definition: console.c:711
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputAttribute(HANDLE handle, WORD *attr, DWORD length, COORD coord, DWORD *count)
Definition: console.c:1257
static unsigned int console_flags
Definition: console.c:58
BOOL WINAPI ReadConsoleW(HANDLE handle, void *buffer, DWORD length, DWORD *count, void *reserved)
Definition: console.c:2081
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputA(HANDLE handle, CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
Definition: console.c:1345
static void input_records_AtoW(INPUT_RECORD *buffer, int count)
Definition: console.c:130
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputW(HANDLE handle, const CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
Definition: console.c:1920
DWORD WINAPI GetConsoleAliasExesLengthA(void)
Definition: console.c:733
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputAttribute(HANDLE handle, const WORD *attr, DWORD length, COORD coord, DWORD *written)
Definition: console.c:1967
const WCHAR system_dir[]
Definition: file.c:68
BOOL WINAPI DECLSPEC_HOTPATCH UpdateProcThreadAttribute(struct _PROC_THREAD_ATTRIBUTE_LIST *list, DWORD flags, DWORD_PTR attr, void *value, SIZE_T size, void *prev_ret, SIZE_T *size_ret)
Definition: process.c:1820
BOOL WINAPI DECLSPEC_HOTPATCH InitializeProcThreadAttributeList(struct _PROC_THREAD_ATTRIBUTE_LIST *list, DWORD count, DWORD flags, SIZE_T *size)
Definition: process.c:1753
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
#define swprintf
Definition: precomp.h:40
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
#define INFINITE
Definition: serial.h:102
size_t const new_size
Definition: expand.cpp:66
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum func
Definition: glext.h:6028
struct _cl_event * event
Definition: glext.h:7739
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint coord
Definition: glext.h:9511
const GLubyte * c
Definition: glext.h:8905
GLuint index
Definition: glext.h:6031
GLenum mode
Definition: glext.h:6217
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLboolean GLuint group
Definition: glext.h:11120
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLenum target
Definition: glext.h:7315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR titleW[]
Definition: htmlelem.c:1067
#define OBJ_INHERIT
Definition: winternl.h:225
NTSYSAPI PEB *WINAPI RtlGetCurrentPeb(void)
Definition: libsupp.c:65
NTSYSAPI void DECLSPEC_NORETURN WINAPI RtlExitUserProcess(ULONG)
#define SHRT_MAX
Definition: limits.h:37
#define S_OK
Definition: intsafe.h:52
#define INT_MAX
Definition: intsafe.h:150
voidpf uLong int origin
Definition: ioapi.h:144
#define NtCurrentTeb
#define c
Definition: ke_i.h:80
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
static real win[4][36]
POINT cp
Definition: magnifier.c:59
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char string[160]
Definition: util.h:11
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
static PVOID ptr
Definition: dispmode.c:27
static char * exename
Definition: process.c:101
static IHTMLWindow2 * window
Definition: events.c:77
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
static LARGE_INTEGER * frequency
Definition: time.c:106
static refpint_t pi[]
Definition: server.c:96
WCHAR strW[12]
Definition: clipboard.c:2029
static UINT UINT * out_count
Definition: clipboard.c:35
#define min(a, b)
Definition: monoChain.cc:55
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:167
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: npipe.c:246
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define DWORD
Definition: nt_native.h:44
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define GENERIC_WRITE
Definition: nt_native.h:90
#define IMAGE_SUBSYSTEM_WINDOWS_CUI
Definition: ntimage.h:438
#define STATUS_CONTROL_C_EXIT
Definition: ntstatus.h:550
#define DBG_CONTROL_C
Definition: ntstatus.h:52
static char title[]
Definition: ps.c:92
#define __EXCEPT_ALL
Definition: exception.h:62
#define list
Definition: rosglue.h:35
const WCHAR * str
#define DECLSPEC_HOTPATCH
Definition: config.h:9
int signal
Definition: except.c:84
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
size_t __cdecl wcsnlen(wchar_t const *const string, size_t const maximum_count)
Definition: strnlen.cpp:210
WCHAR UnicodeChar
Definition: wincon.h:214
WORD Attributes
Definition: wincon.h:217
union _CHAR_INFO::@3472 Char
Definition: bl.h:1338
ULONG Y
Definition: bl.h:1340
ULONG X
Definition: bl.h:1339
LIST_ENTRY ProcessLocksList
Definition: winbase.h:918
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
SHORT Top
Definition: tui.c:25
SHORT Right
Definition: tui.c:26
SHORT Left
Definition: tui.c:24
SHORT Bottom
Definition: tui.c:27
DWORD dwXCountChars
Definition: winbase.h:895
DWORD dwFillAttribute
Definition: winbase.h:897
DWORD dwFlags
Definition: winbase.h:898
LPWSTR lpTitle
Definition: winbase.h:890
WORD wShowWindow
Definition: winbase.h:899
DWORD dwYCountChars
Definition: winbase.h:896
Definition: cookie.c:202
Definition: ftp_var.h:139
Definition: inflate.c:139
PHANDLER_ROUTINE func
Definition: console.c:68
struct ctrl_handler * next
Definition: console.c:69
Definition: name.c:39
HANDLE signal
Definition: kernelbase.h:34
HANDLE reference
Definition: kernelbase.h:35
HANDLE process
Definition: kernelbase.h:36
Definition: ps.c:97
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define DWORD_PTR
Definition: treelist.c:76
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t DWORD_PTR
Definition: typedefs.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define PIPE_ACCESS_INBOUND
Definition: winbase.h:173
#define STD_OUTPUT_HANDLE
Definition: winbase.h:301
#define STD_INPUT_HANDLE
Definition: winbase.h:300
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define STARTF_USESHOWWINDOW
Definition: winbase.h:524
#define STARTF_USECOUNTCHARS
Definition: winbase.h:527
#define NMPWAIT_USE_DEFAULT_WAIT
Definition: winbase.h:142
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define STD_ERROR_HANDLE
Definition: winbase.h:302
#define STARTF_USEFILLATTRIBUTE
Definition: winbase.h:528
#define EXTENDED_STARTUPINFO_PRESENT
Definition: winbase.h:210
#define PIPE_TYPE_BYTE
Definition: winbase.h:175
#define PROC_THREAD_ATTRIBUTE_HANDLE_LIST
Definition: winbase.h:1471
#define STARTF_USESTDHANDLES
Definition: winbase.h:532
#define DETACHED_PROCESS
Definition: winbase.h:189
#define PIPE_UNLIMITED_INSTANCES
Definition: winbase.h:183
#define CTRL_C_EVENT
Definition: wincon.h:96
struct _CONSOLE_FONT_INFOEX CONSOLE_FONT_INFOEX
#define KEY_EVENT
Definition: wincon.h:156
#define CTRL_BREAK_EVENT
Definition: wincon.h:97
#define CONSOLE_TEXTMODE_BUFFER
Definition: wincon.h:90
BOOL(WINAPI * PHANDLER_ROUTINE)(_In_ DWORD CtrlType)
Definition: wincon.h:257
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define WINAPI
Definition: msvc.h:6
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_INVALID_ACCESS
Definition: winerror.h:115
#define FILE_READ_PROPERTIES
Definition: winnt_old.h:215
#define FILE_WRITE_PROPERTIES
Definition: winnt_old.h:217
#define DUPLICATE_SAME_ACCESS
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175