ReactOS 0.4.16-dev-1481-ga753f34
console.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wincon.h"
#include "winternl.h"
#include "wine/condrv.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "kernelbase.h"
Include dependency graph for console.c:

Go to the source code of this file.

Classes

struct  ctrl_handler
 

Macros

#define WIN32_NO_STATUS
 
#define CONSOLE_INPUT_HANDLE   0x01
 
#define CONSOLE_OUTPUT_HANDLE   0x02
 
#define CONSOLE_ERROR_HANDLE   0x04
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (console)
 
static BOOL WINAPI default_ctrl_handler (DWORD type)
 
static BOOL console_ioctl (HANDLE handle, DWORD code, void *in_buff, DWORD in_count, void *out_buff, DWORD out_count, DWORD *read)
 
static void input_records_WtoA (INPUT_RECORD *buffer, int count)
 
static void input_records_AtoW (INPUT_RECORD *buffer, int count)
 
static void char_info_WtoA (UINT cp, CHAR_INFO *buffer, int count)
 
static void char_info_AtoW (CHAR_INFO *buffer, int count)
 
static COORD get_largest_console_window_size (HANDLE handle)
 
static COORD get_console_font_size (HANDLE handle, DWORD index)
 
static DWORD get_console_title (WCHAR *title, DWORD size, BOOL current_title)
 
static HANDLE create_console_server (void)
 
static HANDLE create_console_reference (HANDLE root)
 
static BOOL create_console_connection (HANDLE root)
 
static BOOL init_console_std_handles (BOOL override_all)
 
BOOL WINAPI AddConsoleAliasA (LPSTR source, LPSTR target, LPSTR exename)
 
BOOL WINAPI AddConsoleAliasW (LPWSTR source, LPWSTR target, LPWSTR exename)
 
BOOL WINAPI DECLSPEC_HOTPATCH AttachConsole (DWORD pid)
 
static BOOL alloc_console (BOOL headless)
 
BOOL WINAPI AllocConsole (void)
 
HANDLE WINAPI DECLSPEC_HOTPATCH CreateConsoleScreenBuffer (DWORD access, DWORD share, SECURITY_ATTRIBUTES *sa, DWORD flags, void *data)
 
DWORD WINAPI CtrlRoutine (void *arg)
 
void WINAPI ExpungeConsoleCommandHistoryA (LPCSTR exename)
 
void WINAPI ExpungeConsoleCommandHistoryW (LPCWSTR exename)
 
BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputAttribute (HANDLE handle, WORD attr, DWORD length, COORD coord, DWORD *written)
 
BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterA (HANDLE handle, CHAR ch, DWORD length, COORD coord, DWORD *written)
 
BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterW (HANDLE handle, WCHAR ch, DWORD length, COORD coord, DWORD *written)
 
BOOL WINAPI DECLSPEC_HOTPATCH FreeConsole (void)
 
BOOL WINAPI DECLSPEC_HOTPATCH GenerateConsoleCtrlEvent (DWORD event, DWORD group)
 
DWORD WINAPI GetConsoleAliasA (LPSTR source, LPSTR buffer, DWORD len, LPSTR exename)
 
DWORD WINAPI GetConsoleAliasW (LPWSTR source, LPWSTR buffer, DWORD len, LPWSTR exename)
 
DWORD WINAPI GetConsoleAliasExesLengthA (void)
 
DWORD WINAPI GetConsoleAliasExesLengthW (void)
 
DWORD WINAPI GetConsoleAliasesLengthA (LPSTR unknown)
 
DWORD WINAPI GetConsoleAliasesLengthW (LPWSTR unknown)
 
DWORD WINAPI GetConsoleCommandHistoryA (LPSTR buffer, DWORD len, LPCSTR exename)
 
DWORD WINAPI GetConsoleCommandHistoryW (LPWSTR buffer, DWORD len, LPCWSTR exename)
 
DWORD WINAPI GetConsoleCommandHistoryLengthA (LPCSTR exename)
 
DWORD WINAPI GetConsoleCommandHistoryLengthW (LPCWSTR exename)
 
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleCP (void)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleCursorInfo (HANDLE handle, CONSOLE_CURSOR_INFO *info)
 
BOOL WINAPI GetConsoleDisplayMode (LPDWORD flags)
 
COORD WINAPI GetConsoleFontSize (HANDLE handle, DWORD index)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleInputExeNameA (DWORD len, LPSTR buffer)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleInputExeNameW (DWORD len, LPWSTR buffer)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleMode (HANDLE handle, DWORD *mode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleA (LPSTR title, DWORD size)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleW (LPWSTR title, DWORD size)
 
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP (void)
 
DWORD WINAPI GetConsoleProcessList (DWORD *list, DWORD count)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfo (HANDLE handle, CONSOLE_SCREEN_BUFFER_INFO *info)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfoEx (HANDLE handle, CONSOLE_SCREEN_BUFFER_INFOEX *info)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA (LPSTR title, DWORD size)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleW (LPWSTR title, DWORD size)
 
HWND WINAPI GetConsoleWindow (void)
 
BOOL WINAPI GetCurrentConsoleFontEx (HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFOEX *info)
 
BOOL WINAPI GetCurrentConsoleFont (HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFO *info)
 
COORD WINAPI DECLSPEC_HOTPATCH GetLargestConsoleWindowSize (HANDLE handle)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetNumberOfConsoleInputEvents (HANDLE handle, DWORD *count)
 
BOOL WINAPI GetNumberOfConsoleMouseButtons (DWORD *count)
 
BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputA (HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
 
BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputW (HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
 
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputAttribute (HANDLE handle, WORD *attr, DWORD length, COORD coord, DWORD *count)
 
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputCharacterA (HANDLE handle, LPSTR buffer, DWORD length, COORD coord, DWORD *count)
 
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputCharacterW (HANDLE handle, LPWSTR buffer, DWORD length, COORD coord, DWORD *count)
 
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputA (HANDLE handle, CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
 
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputW (HANDLE handle, CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
 
BOOL WINAPI DECLSPEC_HOTPATCH ScrollConsoleScreenBufferA (HANDLE handle, const SMALL_RECT *scroll, const SMALL_RECT *clip, COORD origin, const CHAR_INFO *fill)
 
BOOL WINAPI DECLSPEC_HOTPATCH ScrollConsoleScreenBufferW (HANDLE handle, const SMALL_RECT *scroll, const SMALL_RECT *clip_rect, COORD origin, const CHAR_INFO *fill)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleActiveScreenBuffer (HANDLE handle)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCP (UINT cp)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler (PHANDLER_ROUTINE func, BOOL add)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCursorInfo (HANDLE handle, CONSOLE_CURSOR_INFO *info)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCursorPosition (HANDLE handle, COORD pos)
 
BOOL WINAPI SetConsoleDisplayMode (HANDLE handle, DWORD flags, COORD *size)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleInputExeNameA (LPCSTR name)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleInputExeNameW (LPCWSTR name)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode (HANDLE handle, DWORD mode)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleOutputCP (UINT cp)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferInfoEx (HANDLE handle, CONSOLE_SCREEN_BUFFER_INFOEX *info)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferSize (HANDLE handle, COORD size)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTextAttribute (HANDLE handle, WORD attr)
 
BOOL WINAPI SetConsoleTitleA (LPCSTR title)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTitleW (LPCWSTR title)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleWindowInfo (HANDLE handle, BOOL absolute, SMALL_RECT *window)
 
BOOL WINAPI SetCurrentConsoleFontEx (HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFOEX *info)
 
BOOL WINAPI ReadConsoleInputA (HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
 
BOOL WINAPI ReadConsoleInputW (HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputA (HANDLE handle, const INPUT_RECORD *buffer, DWORD count, DWORD *written)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW (HANDLE handle, const INPUT_RECORD *buffer, DWORD count, DWORD *written)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputA (HANDLE handle, const CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputW (HANDLE handle, const CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputAttribute (HANDLE handle, const WORD *attr, DWORD length, COORD coord, DWORD *written)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputCharacterA (HANDLE handle, LPCSTR str, DWORD length, COORD coord, DWORD *written)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputCharacterW (HANDLE handle, LPCWSTR str, DWORD length, COORD coord, DWORD *written)
 
BOOL WINAPI ReadConsoleA (HANDLE handle, void *buffer, DWORD length, DWORD *count, void *reserved)
 
BOOL WINAPI ReadConsoleW (HANDLE handle, void *buffer, DWORD length, DWORD *count, void *reserved)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA (HANDLE handle, const void *buffer, DWORD length, DWORD *written, void *reserved)
 
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW (HANDLE handle, const void *buffer, DWORD length, DWORD *written, void *reserved)
 
BOOL WINAPI FlushConsoleInputBuffer (HANDLE handle)
 
BOOL WINAPI Beep (DWORD frequency, DWORD duration)
 
static HANDLE create_pseudo_console (COORD size, HANDLE input, HANDLE output, HANDLE signal, DWORD flags, HANDLE *process)
 
HRESULT WINAPI CreatePseudoConsole (COORD size, HANDLE input, HANDLE output, DWORD flags, HPCON *ret)
 
void WINAPI ClosePseudoConsole (HPCON handle)
 
HRESULT WINAPI ResizePseudoConsole (HPCON handle, COORD size)
 
static BOOL is_tty_handle (HANDLE handle)
 
void init_console (void)
 

Variables

static CRITICAL_SECTION console_section = { &critsect_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG critsect_debug
 
static HANDLE console_connection
 
static unsigned int console_flags
 
static WCHAR input_exe [MAX_PATH+1]
 
static struct ctrl_handler default_handler = { default_ctrl_handler, NULL }
 
static struct ctrl_handlerctrl_handlers = &default_handler
 

Macro Definition Documentation

◆ CONSOLE_ERROR_HANDLE

#define CONSOLE_ERROR_HANDLE   0x04

Definition at line 62 of file console.c.

◆ CONSOLE_INPUT_HANDLE

#define CONSOLE_INPUT_HANDLE   0x01

Definition at line 60 of file console.c.

◆ CONSOLE_OUTPUT_HANDLE

#define CONSOLE_OUTPUT_HANDLE   0x02

Definition at line 61 of file console.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 33 of file console.c.

Function Documentation

◆ AddConsoleAliasA()

BOOL WINAPI AddConsoleAliasA ( LPSTR  source,
LPSTR  target,
LPSTR  exename 
)

Definition at line 338 of file console.c.

339{
340 FIXME( ": (%s, %s, %s) stub!\n", debugstr_a(source), debugstr_a(target), debugstr_a(exename) );
342 return FALSE;
343}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752
GLenum target
Definition: glext.h:7315
#define debugstr_a
Definition: kernel32.h:31
static char * exename
Definition: process.c:101

◆ AddConsoleAliasW()

BOOL WINAPI AddConsoleAliasW ( LPWSTR  source,
LPWSTR  target,
LPWSTR  exename 
)

Definition at line 349 of file console.c.

350{
351 FIXME( ": (%s, %s, %s) stub!\n", debugstr_w(source), debugstr_w(target), debugstr_w(exename) );
353 return FALSE;
354}
#define debugstr_w
Definition: kernel32.h:32

◆ alloc_console()

static BOOL alloc_console ( BOOL  headless)
static

Definition at line 396 of file console.c.

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}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define ERR(fmt,...)
Definition: precomp.h:57
wcscat
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
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 FreeConsole(void)
Definition: console.c:663
static HANDLE create_console_server(void)
Definition: console.c:233
static BOOL create_console_connection(HANDLE root)
Definition: console.c:265
static CRITICAL_SECTION console_section
Definition: console.c:48
static HANDLE create_console_reference(HANDLE root)
Definition: console.c:249
static BOOL init_console_std_handles(BOOL override_all)
Definition: console.c:280
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
#define swprintf
Definition: precomp.h:40
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
NTSYSAPI PEB *WINAPI RtlGetCurrentPeb(void)
Definition: libsupp.c:65
#define error(str)
Definition: mkdosfs.c:1605
static refpint_t pi[]
Definition: server.c:96
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
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: ftp_var.h:139
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define STARTF_USESHOWWINDOW
Definition: winbase.h:524
#define STARTF_USECOUNTCHARS
Definition: winbase.h:527
#define STARTF_USEFILLATTRIBUTE
Definition: winbase.h:528
#define EXTENDED_STARTUPINFO_PRESENT
Definition: winbase.h:210
#define PROC_THREAD_ATTRIBUTE_HANDLE_LIST
Definition: winbase.h:1471
#define STARTF_USESTDHANDLES
Definition: winbase.h:532
#define DETACHED_PROCESS
Definition: winbase.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by AllocConsole(), and init_console().

◆ AllocConsole()

BOOL WINAPI AllocConsole ( void  )

Definition at line 492 of file console.c.

493{
494 return alloc_console( FALSE );
495}
static BOOL alloc_console(BOOL headless)
Definition: console.c:396

Referenced by _tWinMain(), cmd_ctty(), CONSOLE_Init(), DoTest(), InitRappsConsole(), main(), START_TEST(), test_Console(), TUIInitialize(), and wWinMain().

◆ AttachConsole()

BOOL WINAPI DECLSPEC_HOTPATCH AttachConsole ( DWORD  pid)

Definition at line 360 of file console.c.

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}
#define WARN(fmt,...)
Definition: precomp.h:61
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
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837

◆ Beep()

BOOL WINAPI Beep ( DWORD  frequency,
DWORD  duration 
)

Definition at line 2177 of file console.c.

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}

◆ char_info_AtoW()

static void char_info_AtoW ( CHAR_INFO buffer,
int  count 
)
static

Definition at line 158 of file console.c.

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}
#define MultiByteToWideChar
Definition: compat.h:110
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void)
Definition: console.c:957
GLuint GLuint GLsizei count
Definition: gl.h:1545
POINT cp
Definition: magnifier.c:59
unsigned int UINT
Definition: ndis.h:50

Referenced by WriteConsoleOutputA().

◆ char_info_WtoA()

static void char_info_WtoA ( UINT  cp,
CHAR_INFO buffer,
int  count 
)
static

Definition at line 145 of file console.c.

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}
#define WideCharToMultiByte
Definition: compat.h:111

Referenced by ReadConsoleOutputA().

◆ ClosePseudoConsole()

void WINAPI ClosePseudoConsole ( HPCON  handle)

Definition at line 2309 of file console.c.

2310{
2312
2313 TRACE( "%p\n", handle );
2314
2315 if (!pseudo_console) return;
2318 {
2321 }
2323}
#define INFINITE
Definition: serial.h:102
HANDLE signal
Definition: kernelbase.h:34
HANDLE reference
Definition: kernelbase.h:35
HANDLE process
Definition: kernelbase.h:36
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82

Referenced by CreatePseudoConsole().

◆ console_ioctl()

static BOOL console_ioctl ( HANDLE  handle,
DWORD  code,
void in_buff,
DWORD  in_count,
void out_buff,
DWORD  out_count,
DWORD read 
)
static

Definition at line 85 of file console.c.

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}
#define read
Definition: acwin.h:96
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:227
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
static UINT UINT * out_count
Definition: clipboard.c:31
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 STATUS_SUCCESS
Definition: shellext.h:65
Definition: inflate.c:139
Definition: ps.c:97
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_INVALID_ACCESS
Definition: winerror.h:115

Referenced by AttachConsole(), Beep(), FillConsoleOutputAttribute(), FillConsoleOutputCharacterW(), FlushConsoleInputBuffer(), GenerateConsoleCtrlEvent(), get_console_title(), get_largest_console_window_size(), GetConsoleCP(), GetConsoleCursorInfo(), GetConsoleMode(), GetConsoleOutputCP(), GetConsoleScreenBufferInfo(), GetConsoleScreenBufferInfoEx(), GetNumberOfConsoleInputEvents(), PeekConsoleInputW(), ReadConsoleA(), ReadConsoleInputW(), ReadConsoleOutputAttribute(), ReadConsoleOutputCharacterW(), ReadConsoleOutputW(), ReadConsoleW(), ScrollConsoleScreenBufferW(), SetConsoleActiveScreenBuffer(), SetConsoleCP(), SetConsoleCursorInfo(), SetConsoleCursorPosition(), SetConsoleMode(), SetConsoleOutputCP(), SetConsoleScreenBufferInfoEx(), SetConsoleScreenBufferSize(), SetConsoleTextAttribute(), SetConsoleTitleW(), SetConsoleWindowInfo(), SetCurrentConsoleFontEx(), WriteConsoleA(), WriteConsoleOutputAttribute(), WriteConsoleOutputCharacterW(), WriteConsoleOutputW(), and WriteConsoleW().

◆ create_console_connection()

static BOOL create_console_connection ( HANDLE  root)
static

Definition at line 265 of file console.c.

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}
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
struct _root root
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_OPEN
Definition: from_kernel.h:54
char string[160]
Definition: util.h:11
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
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)
Definition: cookie.c:202
#define FILE_READ_PROPERTIES
Definition: winnt_old.h:217
#define FILE_WRITE_PROPERTIES
Definition: winnt_old.h:219

Referenced by alloc_console(), AttachConsole(), and init_console().

◆ create_console_reference()

static HANDLE create_console_reference ( HANDLE  root)
static

Definition at line 249 of file console.c.

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}
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by alloc_console(), AttachConsole(), and create_pseudo_console().

◆ create_console_server()

static HANDLE create_console_server ( void  )
static

Definition at line 233 of file console.c.

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}
#define OBJ_INHERIT
Definition: winternl.h:225

Referenced by alloc_console(), and create_pseudo_console().

◆ create_pseudo_console()

static HANDLE create_pseudo_console ( COORD  size,
HANDLE  input,
HANDLE  output,
HANDLE  signal,
DWORD  flags,
HANDLE process 
)
static

Definition at line 2186 of file console.c.

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}
GLuint res
Definition: glext.h:9613
GLbitfield flags
Definition: glext.h:7161
GLenum GLenum GLenum input
Definition: glext.h:9031
int signal
Definition: except.c:84

Referenced by CreatePseudoConsole(), and init_console().

◆ CreateConsoleScreenBuffer()

HANDLE WINAPI DECLSPEC_HOTPATCH CreateConsoleScreenBuffer ( DWORD  access,
DWORD  share,
SECURITY_ATTRIBUTES sa,
DWORD  flags,
void data 
)

Definition at line 501 of file console.c.

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}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: name.c:39
#define CONSOLE_TEXTMODE_BUFFER
Definition: wincon.h:90

◆ CreatePseudoConsole()

HRESULT WINAPI CreatePseudoConsole ( COORD  size,
HANDLE  input,
HANDLE  output,
DWORD  flags,
HPCON ret 
)

Definition at line 2262 of file console.c.

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}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define OPEN_EXISTING
Definition: compat.h:775
#define GetCurrentProcess()
Definition: compat.h:759
#define CreateFileW
Definition: compat.h:741
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
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
void WINAPI ClosePseudoConsole(HPCON handle)
Definition: console.c:2309
static HANDLE create_pseudo_console(COORD size, HANDLE input, HANDLE output, HANDLE signal, DWORD flags, HANDLE *process)
Definition: console.c:2186
#define S_OK
Definition: intsafe.h:52
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
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 GENERIC_WRITE
Definition: nt_native.h:90
#define PIPE_ACCESS_INBOUND
Definition: winbase.h:173
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define NMPWAIT_USE_DEFAULT_WAIT
Definition: winbase.h:142
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define PIPE_TYPE_BYTE
Definition: winbase.h:175
#define PIPE_UNLIMITED_INSTANCES
Definition: winbase.h:183
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define DUPLICATE_SAME_ACCESS

◆ CtrlRoutine()

DWORD WINAPI CtrlRoutine ( void arg)

Definition at line 531 of file console.c.

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}
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
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
static struct ctrl_handler * ctrl_handlers
Definition: console.c:83
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
struct _cl_event * event
Definition: glext.h:7739
#define NtCurrentTeb
#define DBG_CONTROL_C
Definition: ntstatus.h:52
#define __EXCEPT_ALL
Definition: exception.h:62
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CTRL_C_EVENT
Definition: wincon.h:96

Referenced by IntAllocConsole(), and IntAttachConsole().

◆ default_ctrl_handler()

static BOOL WINAPI default_ctrl_handler ( DWORD  type)
static

Definition at line 72 of file console.c.

73{
74 FIXME( "Terminating process %lx on event %lx\n", GetCurrentProcessId(), type );
77 else
79 return TRUE;
80}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
NTSYSAPI void DECLSPEC_NORETURN WINAPI RtlExitUserProcess(ULONG)
#define STATUS_CONTROL_C_EXIT
Definition: ntstatus.h:550
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define CTRL_BREAK_EVENT
Definition: wincon.h:97

◆ ExpungeConsoleCommandHistoryA()

void WINAPI ExpungeConsoleCommandHistoryA ( LPCSTR  exename)

Definition at line 570 of file console.c.

571{
572 FIXME( ": (%s) stub!\n", debugstr_a(exename) );
574}

◆ ExpungeConsoleCommandHistoryW()

void WINAPI ExpungeConsoleCommandHistoryW ( LPCWSTR  exename)

Definition at line 580 of file console.c.

581{
582 FIXME( ": (%s) stub!\n", debugstr_w(exename) );
584}

◆ FillConsoleOutputAttribute()

BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputAttribute ( HANDLE  handle,
WORD  attr,
DWORD  length,
COORD  coord,
DWORD written 
)

Definition at line 590 of file console.c.

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}
GLuint coord
Definition: glext.h:9511
GLenum const GLfloat * params
Definition: glext.h:5645
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

◆ FillConsoleOutputCharacterA()

BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterA ( HANDLE  handle,
CHAR  ch,
DWORD  length,
COORD  coord,
DWORD written 
)

Definition at line 620 of file console.c.

622{
623 WCHAR wch;
624
625 MultiByteToWideChar( GetConsoleOutputCP(), 0, &ch, 1, &wch, 1 );
626 return FillConsoleOutputCharacterW( handle, wch, length, coord, written );
627}
BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterW(HANDLE handle, WCHAR ch, DWORD length, COORD coord, DWORD *written)
Definition: console.c:633

◆ FillConsoleOutputCharacterW()

BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterW ( HANDLE  handle,
WCHAR  ch,
DWORD  length,
COORD  coord,
DWORD written 
)

Definition at line 633 of file console.c.

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}
#define debugstr_wn
Definition: kernel32.h:33

Referenced by FillConsoleOutputCharacterA(), and test_FillConsoleOutputCharacterW().

◆ FlushConsoleInputBuffer()

BOOL WINAPI FlushConsoleInputBuffer ( HANDLE  handle)

Definition at line 2168 of file console.c.

2169{
2170 return console_ioctl( handle, IOCTL_CONDRV_FLUSH, NULL, 0, NULL, 0, NULL );
2171}

◆ FreeConsole()

BOOL WINAPI DECLSPEC_HOTPATCH FreeConsole ( void  )

Definition at line 663 of file console.c.

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}
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
#define CONSOLE_INPUT_HANDLE
Definition: console.c:60
#define CONSOLE_OUTPUT_HANDLE
Definition: console.c:61
#define CONSOLE_ERROR_HANDLE
Definition: console.c:62
static unsigned int console_flags
Definition: console.c:58
#define STD_OUTPUT_HANDLE
Definition: winbase.h:301
#define STD_INPUT_HANDLE
Definition: winbase.h:300
#define STD_ERROR_HANDLE
Definition: winbase.h:302

Referenced by alloc_console(), AttachConsole(), cmd_ctty(), CONSOLE_Init(), RunUSetup(), and START_TEST().

◆ GenerateConsoleCtrlEvent()

BOOL WINAPI DECLSPEC_HOTPATCH GenerateConsoleCtrlEvent ( DWORD  event,
DWORD  group 
)

Definition at line 689 of file console.c.

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}
GLboolean GLuint group
Definition: glext.h:11120

◆ get_console_font_size()

static COORD get_console_font_size ( HANDLE  handle,
DWORD  index 
)
static

Definition at line 187 of file console.c.

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}
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 ERROR_INVALID_HANDLE
Definition: compat.h:98
const GLubyte * c
Definition: glext.h:8905
GLuint index
Definition: glext.h:6031
#define c
Definition: ke_i.h:80
Definition: bl.h:1338

Referenced by GetConsoleFontSize().

◆ get_console_title()

static DWORD get_console_title ( WCHAR title,
DWORD  size,
BOOL  current_title 
)
static

Definition at line 208 of file console.c.

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}
static INT max_size
Definition: history.c:51
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static char title[]
Definition: ps.c:92

Referenced by GetConsoleOriginalTitleW(), and GetConsoleTitleW().

◆ get_largest_console_window_size()

static COORD get_largest_console_window_size ( HANDLE  handle)
static

Definition at line 172 of file console.c.

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}

Referenced by GetLargestConsoleWindowSize().

◆ GetConsoleAliasA()

DWORD WINAPI GetConsoleAliasA ( LPSTR  source,
LPSTR  buffer,
DWORD  len,
LPSTR  exename 
)

Definition at line 711 of file console.c.

712{
713 FIXME( "(%s,%p,%ld,%s): stub\n", debugstr_a(source), buffer, len, debugstr_a(exename) );
715 return 0;
716}
GLenum GLsizei len
Definition: glext.h:6722

◆ GetConsoleAliasesLengthA()

DWORD WINAPI GetConsoleAliasesLengthA ( LPSTR  unknown)

Definition at line 755 of file console.c.

756{
757 FIXME( ": (%s) stub!\n", debugstr_a(unknown) );
759 return 0;
760}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605

◆ GetConsoleAliasesLengthW()

DWORD WINAPI GetConsoleAliasesLengthW ( LPWSTR  unknown)

Definition at line 766 of file console.c.

767{
768 FIXME( ": (%s) stub!\n", debugstr_w(unknown) );
770 return 0;
771}

◆ GetConsoleAliasExesLengthA()

DWORD WINAPI GetConsoleAliasExesLengthA ( void  )

Definition at line 733 of file console.c.

734{
735 FIXME( ": stub\n" );
737 return 0;
738}

◆ GetConsoleAliasExesLengthW()

DWORD WINAPI GetConsoleAliasExesLengthW ( void  )

Definition at line 744 of file console.c.

745{
746 FIXME( ": stub\n" );
748 return 0;
749}

◆ GetConsoleAliasW()

DWORD WINAPI GetConsoleAliasW ( LPWSTR  source,
LPWSTR  buffer,
DWORD  len,
LPWSTR  exename 
)

Definition at line 722 of file console.c.

723{
724 FIXME( "(%s,%p,%ld,%s): stub\n", debugstr_w(source), buffer, len, debugstr_w(exename) );
726 return 0;
727}

◆ GetConsoleCommandHistoryA()

DWORD WINAPI GetConsoleCommandHistoryA ( LPSTR  buffer,
DWORD  len,
LPCSTR  exename 
)

Definition at line 777 of file console.c.

778{
779 FIXME( ": (%p, 0x%lx, %s) stub\n", buffer, len, debugstr_a(exename) );
781 return 0;
782}

◆ GetConsoleCommandHistoryLengthA()

DWORD WINAPI GetConsoleCommandHistoryLengthA ( LPCSTR  exename)

Definition at line 799 of file console.c.

800{
801 FIXME( ": (%s) stub!\n", debugstr_a(exename) );
803 return 0;
804}

◆ GetConsoleCommandHistoryLengthW()

DWORD WINAPI GetConsoleCommandHistoryLengthW ( LPCWSTR  exename)

Definition at line 810 of file console.c.

811{
812 FIXME( ": (%s) stub!\n", debugstr_w(exename) );
814 return 0;
815}

◆ GetConsoleCommandHistoryW()

DWORD WINAPI GetConsoleCommandHistoryW ( LPWSTR  buffer,
DWORD  len,
LPCWSTR  exename 
)

Definition at line 788 of file console.c.

789{
790 FIXME( ": (%p, 0x%lx, %s) stub\n", buffer, len, debugstr_w(exename) );
792 return 0;
793}

◆ GetConsoleCP()

UINT WINAPI DECLSPEC_HOTPATCH GetConsoleCP ( void  )

Definition at line 821 of file console.c.

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}

Referenced by _getch_nolock(), _tmain(), cmd_start(), ConInString(), doChild(), Execute(), FileGetString(), input_records_AtoW(), input_records_WtoA(), SetConsoleCPState(), START_TEST(), test_Console(), and wmain().

◆ GetConsoleCursorInfo()

BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleCursorInfo ( HANDLE  handle,
CONSOLE_CURSOR_INFO info 
)

Definition at line 835 of file console.c.

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}

◆ GetConsoleDisplayMode()

BOOL WINAPI GetConsoleDisplayMode ( LPDWORD  flags)

Definition at line 858 of file console.c.

859{
860 TRACE( "semi-stub: %p\n", flags );
861 /* It is safe to successfully report windowed mode */
862 *flags = 0;
863 return TRUE;
864}

◆ GetConsoleFontSize()

COORD WINAPI GetConsoleFontSize ( HANDLE  handle,
DWORD  index 
)

Definition at line 883 of file console.c.

884{
886}
static COORD get_console_font_size(HANDLE handle, DWORD index)
Definition: console.c:187

◆ GetConsoleInputExeNameA()

BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleInputExeNameA ( DWORD  len,
LPSTR  buffer 
)

Definition at line 893 of file console.c.

894{
896 if (WideCharToMultiByte( CP_ACP, 0, input_exe, -1, NULL, 0, NULL, NULL ) <= len)
900 return TRUE;
901}
#define CP_ACP
Definition: compat.h:109
static WCHAR input_exe[MAX_PATH+1]
Definition: console.c:64
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185

◆ GetConsoleInputExeNameW()

BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleInputExeNameW ( DWORD  len,
LPWSTR  buffer 
)

Definition at line 907 of file console.c.

908{
913 return TRUE;
914}
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750

◆ GetConsoleMode()

BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleMode ( HANDLE  handle,
DWORD mode 
)

Definition at line 920 of file console.c.

921{
922 return console_ioctl( handle, IOCTL_CONDRV_GET_MODE, NULL, 0, mode, sizeof(*mode), NULL );
923}
GLenum mode
Definition: glext.h:6217

◆ GetConsoleOriginalTitleA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleA ( LPSTR  title,
DWORD  size 
)

Definition at line 929 of file console.c.

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}
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleW(LPWSTR title, DWORD size)
Definition: console.c:948
unsigned long DWORD
Definition: ntddk_ex.h:95
static PVOID ptr
Definition: dispmode.c:27

◆ GetConsoleOriginalTitleW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleW ( LPWSTR  title,
DWORD  size 
)

Definition at line 948 of file console.c.

949{
950 return get_console_title( title, size, FALSE );
951}
static DWORD get_console_title(WCHAR *title, DWORD size, BOOL current_title)
Definition: console.c:208

Referenced by GetConsoleOriginalTitleA().

◆ GetConsoleOutputCP()

◆ GetConsoleProcessList()

DWORD WINAPI GetConsoleProcessList ( DWORD list,
DWORD  count 
)

Definition at line 971 of file console.c.

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}
Definition: list.h:37
#define DWORD
Definition: nt_native.h:44
#define list
Definition: rosglue.h:35
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69

◆ GetConsoleScreenBufferInfo()

BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfo ( HANDLE  handle,
CONSOLE_SCREEN_BUFFER_INFO info 
)

Definition at line 1007 of file console.c.

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}
#define min(a, b)
Definition: monoChain.cc:55

◆ GetConsoleScreenBufferInfoEx()

BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfoEx ( HANDLE  handle,
CONSOLE_SCREEN_BUFFER_INFOEX info 
)

Definition at line 1038 of file console.c.

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}

◆ GetConsoleTitleA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA ( LPSTR  title,
DWORD  size 
)

Definition at line 1074 of file console.c.

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}
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleW(LPWSTR title, DWORD size)
Definition: console.c:1093

◆ GetConsoleTitleW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleW ( LPWSTR  title,
DWORD  size 
)

Definition at line 1093 of file console.c.

1094{
1095 return get_console_title( title, size, TRUE );
1096}

◆ GetConsoleWindow()

HWND WINAPI GetConsoleWindow ( void  )

Definition at line 1102 of file console.c.

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}
#define LongToHandle(h)
Definition: basetsd.h:82
static real win[4][36]

Referenced by ConsoleInitUI(), START_TEST(), test_GetConsoleFontSize(), and WaitWindows().

◆ GetCurrentConsoleFont()

BOOL WINAPI GetCurrentConsoleFont ( HANDLE  handle,
BOOL  maxwindow,
CONSOLE_FONT_INFO info 
)

Definition at line 1161 of file console.c.

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}
BOOL WINAPI GetCurrentConsoleFontEx(HANDLE handle, BOOL maxwindow, CONSOLE_FONT_INFOEX *info)
Definition: console.c:1116
struct _CONSOLE_FONT_INFOEX CONSOLE_FONT_INFOEX

◆ GetCurrentConsoleFontEx()

BOOL WINAPI GetCurrentConsoleFontEx ( HANDLE  handle,
BOOL  maxwindow,
CONSOLE_FONT_INFOEX info 
)

Definition at line 1116 of file console.c.

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}
#define LF_FACESIZE
Definition: dimm.idl:39

Referenced by GetCurrentConsoleFont().

◆ GetLargestConsoleWindowSize()

COORD WINAPI DECLSPEC_HOTPATCH GetLargestConsoleWindowSize ( HANDLE  handle)

Definition at line 1196 of file console.c.

1197{
1199}
static COORD get_largest_console_window_size(HANDLE handle)
Definition: console.c:172

◆ GetNumberOfConsoleInputEvents()

BOOL WINAPI DECLSPEC_HOTPATCH GetNumberOfConsoleInputEvents ( HANDLE  handle,
DWORD count 
)

Definition at line 1207 of file console.c.

1208{
1209 return console_ioctl( handle, IOCTL_CONDRV_GET_INPUT_COUNT, NULL, 0,
1210 count, sizeof(*count), NULL );
1211}

◆ GetNumberOfConsoleMouseButtons()

BOOL WINAPI GetNumberOfConsoleMouseButtons ( DWORD count)

Definition at line 1217 of file console.c.

1218{
1219 FIXME( "(%p): stub\n", count );
1220 *count = 2;
1221 return TRUE;
1222}

◆ init_console()

void init_console ( void  )

Definition at line 2339 of file console.c.

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
#define RtlImageNtHeader
Definition: compat.h:806
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
static BOOL is_tty_handle(HANDLE handle)
Definition: console.c:2334
#define IMAGE_SUBSYSTEM_WINDOWS_CUI
Definition: ntimage.h:438

Referenced by DllMain().

◆ init_console_std_handles()

static BOOL init_console_std_handles ( BOOL  override_all)
static

Definition at line 280 of file console.c.

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}
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI DECLSPEC_HOTPATCH SetStdHandle(DWORD nStdHandle, HANDLE hHandle)
Definition: console.c:1215
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649

Referenced by alloc_console(), AttachConsole(), and init_console().

◆ input_records_AtoW()

static void input_records_AtoW ( INPUT_RECORD buffer,
int  count 
)
static

Definition at line 130 of file console.c.

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}
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleCP(void)
Definition: console.c:821
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
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:167
#define KEY_EVENT
Definition: wincon.h:156

Referenced by WriteConsoleInputA().

◆ input_records_WtoA()

static void input_records_WtoA ( INPUT_RECORD buffer,
int  count 
)
static

Definition at line 115 of file console.c.

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}

Referenced by PeekConsoleInputA(), and ReadConsoleInputA().

◆ is_tty_handle()

static BOOL is_tty_handle ( HANDLE  handle)
static

Definition at line 2334 of file console.c.

2335{
2336 return ((UINT_PTR)handle & 3) == 1;
2337}
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274

Referenced by init_console().

◆ PeekConsoleInputA()

BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputA ( HANDLE  handle,
INPUT_RECORD buffer,
DWORD  length,
DWORD count 
)

Definition at line 1228 of file console.c.

1230{
1231 DWORD read;
1232
1233 if (!PeekConsoleInputW( handle, buffer, length, &read )) return FALSE;
1235 if (count) *count = read;
1236 return TRUE;
1237}
BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputW(HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
Definition: console.c:1243
static void input_records_WtoA(INPUT_RECORD *buffer, int count)
Definition: console.c:115

◆ PeekConsoleInputW()

BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputW ( HANDLE  handle,
INPUT_RECORD buffer,
DWORD  length,
DWORD count 
)

Definition at line 1243 of file console.c.

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}

Referenced by PeekConsoleInputA().

◆ ReadConsoleA()

BOOL WINAPI ReadConsoleA ( HANDLE  handle,
void buffer,
DWORD  length,
DWORD count,
void reserved 
)

Definition at line 2066 of file console.c.

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}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INT_MAX
Definition: intsafe.h:150

Referenced by test_ReadConsole().

◆ ReadConsoleInputA()

BOOL WINAPI ReadConsoleInputA ( HANDLE  handle,
INPUT_RECORD buffer,
DWORD  length,
DWORD count 
)

Definition at line 1801 of file console.c.

1802{
1803 DWORD read;
1804
1805 if (!ReadConsoleInputW( handle, buffer, length, &read )) return FALSE;
1807 if (count) *count = read;
1808 return TRUE;
1809}
BOOL WINAPI ReadConsoleInputW(HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
Definition: console.c:1815

◆ ReadConsoleInputW()

BOOL WINAPI ReadConsoleInputW ( HANDLE  handle,
INPUT_RECORD buffer,
DWORD  length,
DWORD count 
)

Definition at line 1815 of file console.c.

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}

Referenced by ReadConsoleInputA().

◆ ReadConsoleOutputA()

BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputA ( HANDLE  handle,
CHAR_INFO buffer,
COORD  size,
COORD  coord,
SMALL_RECT region 
)

Definition at line 1345 of file console.c.

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}
static void char_info_WtoA(UINT cp, CHAR_INFO *buffer, int count)
Definition: console.c:145
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputW(HANDLE handle, CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
Definition: console.c:1365
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
SHORT Top
Definition: tui.c:25
SHORT Right
Definition: tui.c:26
SHORT Left
Definition: tui.c:24
SHORT Bottom
Definition: tui.c:27

◆ ReadConsoleOutputAttribute()

BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputAttribute ( HANDLE  handle,
WORD attr,
DWORD  length,
COORD  coord,
DWORD count 
)

Definition at line 1257 of file console.c.

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}

Referenced by test_ReadConsoleOutputAttribute(), testWriteNotWrappedProcessed(), and testWriteWrappedProcessed().

◆ ReadConsoleOutputCharacterA()

BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputCharacterA ( HANDLE  handle,
LPSTR  buffer,
DWORD  length,
COORD  coord,
DWORD count 
)

Definition at line 1285 of file console.c.

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}
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputCharacterW(HANDLE handle, LPWSTR buffer, DWORD length, COORD coord, DWORD *count)
Definition: console.c:1317
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by test_ReadConsoleOutputCharacterA(), and testScreenBuffer().

◆ ReadConsoleOutputCharacterW()

BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputCharacterW ( HANDLE  handle,
LPWSTR  buffer,
DWORD  length,
COORD  coord,
DWORD count 
)

Definition at line 1317 of file console.c.

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}

Referenced by ReadConsoleOutputCharacterA(), test_ReadConsoleOutputCharacterW(), and testScreenBuffer().

◆ ReadConsoleOutputW()

BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleOutputW ( HANDLE  handle,
CHAR_INFO buffer,
COORD  size,
COORD  coord,
SMALL_RECT region 
)

Definition at line 1365 of file console.c.

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}
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint64EXT * result
Definition: glext.h:11304

Referenced by ReadConsoleOutputA().

◆ ReadConsoleW()

BOOL WINAPI ReadConsoleW ( HANDLE  handle,
void buffer,
DWORD  length,
DWORD count,
void reserved 
)

Definition at line 2081 of file console.c.

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}
r reserved
Definition: btrfs.c:3006

Referenced by test_ReadConsole().

◆ ResizePseudoConsole()

HRESULT WINAPI ResizePseudoConsole ( HPCON  handle,
COORD  size 
)

Definition at line 2328 of file console.c.

2329{
2330 FIXME( "%p (%u,%u)\n", handle, size.X, size.Y );
2331 return E_NOTIMPL;
2332}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ScrollConsoleScreenBufferA()

BOOL WINAPI DECLSPEC_HOTPATCH ScrollConsoleScreenBufferA ( HANDLE  handle,
const SMALL_RECT scroll,
const SMALL_RECT clip,
COORD  origin,
const CHAR_INFO fill 
)

Definition at line 1419 of file console.c.

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}
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
BOOL WINAPI DECLSPEC_HOTPATCH ScrollConsoleScreenBufferW(HANDLE handle, const SMALL_RECT *scroll, const SMALL_RECT *clip_rect, COORD origin, const CHAR_INFO *fill)
Definition: console.c:1434
voidpf uLong int origin
Definition: ioapi.h:144
WCHAR UnicodeChar
Definition: wincon.h:214
WORD Attributes
Definition: wincon.h:217
union _CHAR_INFO::@3472 Char

◆ ScrollConsoleScreenBufferW()

BOOL WINAPI DECLSPEC_HOTPATCH ScrollConsoleScreenBufferW ( HANDLE  handle,
const SMALL_RECT scroll,
const SMALL_RECT clip_rect,
COORD  origin,
const CHAR_INFO fill 
)

Definition at line 1434 of file console.c.

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}
#define SHRT_MAX
Definition: limits.h:37

◆ SetConsoleActiveScreenBuffer()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleActiveScreenBuffer ( HANDLE  handle)

Definition at line 1467 of file console.c.

1468{
1469 TRACE( "(%p)\n", handle );
1470 return console_ioctl( handle, IOCTL_CONDRV_ACTIVATE, NULL, 0, NULL, 0, NULL );
1471}

◆ SetConsoleCP()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCP ( UINT  cp)

Definition at line 1477 of file console.c.

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}

◆ SetConsoleCtrlHandler()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler ( PHANDLER_ROUTINE  func,
BOOL  add 
)

Definition at line 1490 of file console.c.

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}
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
static struct ctrl_handler default_handler
Definition: console.c:82
GLenum func
Definition: glext.h:6028
struct ctrl_handler * next
Definition: console.c:69

◆ SetConsoleCursorInfo()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCursorInfo ( HANDLE  handle,
CONSOLE_CURSOR_INFO info 
)

Definition at line 1541 of file console.c.

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}

◆ SetConsoleCursorPosition()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCursorPosition ( HANDLE  handle,
COORD  pos 
)

Definition at line 1557 of file console.c.

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}

◆ SetConsoleDisplayMode()

BOOL WINAPI SetConsoleDisplayMode ( HANDLE  handle,
DWORD  flags,
COORD size 
)

Definition at line 1572 of file console.c.

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}

◆ SetConsoleInputExeNameA()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleInputExeNameA ( LPCSTR  name)

Definition at line 1587 of file console.c.

1588{
1589 if (!name || !name[0])
1590 {
1592 return FALSE;
1593 }
1597 return TRUE;
1598}

◆ SetConsoleInputExeNameW()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleInputExeNameW ( LPCWSTR  name)

Definition at line 1604 of file console.c.

1605{
1606 if (!name || !name[0])
1607 {
1609 return FALSE;
1610 }
1614 return TRUE;
1615}
#define lstrcpynW
Definition: compat.h:738

◆ SetConsoleMode()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode ( HANDLE  handle,
DWORD  mode 
)

Definition at line 1621 of file console.c.

1622{
1623 TRACE( "(%p,%lx)\n", handle, mode );
1624 return console_ioctl( handle, IOCTL_CONDRV_SET_MODE, &mode, sizeof(mode), NULL, 0, NULL );
1625}

◆ SetConsoleOutputCP()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleOutputCP ( UINT  cp)

Definition at line 1631 of file console.c.

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}

◆ SetConsoleScreenBufferInfoEx()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferInfoEx ( HANDLE  handle,
CONSOLE_SCREEN_BUFFER_INFOEX info 
)

Definition at line 1644 of file console.c.

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}

◆ SetConsoleScreenBufferSize()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferSize ( HANDLE  handle,
COORD  size 
)

Definition at line 1679 of file console.c.

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}

◆ SetConsoleTextAttribute()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTextAttribute ( HANDLE  handle,
WORD  attr 
)

Definition at line 1694 of file console.c.

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}

◆ SetConsoleTitleA()

BOOL WINAPI SetConsoleTitleA ( LPCSTR  title)

Definition at line 1708 of file console.c.

1709{
1710 LPWSTR titleW;
1711 BOOL ret;
1713 if (!(titleW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE;
1717 return ret;
1718}
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTitleW(LPCWSTR title)
Definition: console.c:1724
static const WCHAR titleW[]
Definition: htmlelem.c:1067

◆ SetConsoleTitleW()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleTitleW ( LPCWSTR  title)

Definition at line 1724 of file console.c.

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}

◆ SetConsoleWindowInfo()

BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleWindowInfo ( HANDLE  handle,
BOOL  absolute,
SMALL_RECT window 
)

Definition at line 1736 of file console.c.

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}
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
Definition: console.c:595
static IHTMLWindow2 * window
Definition: events.c:77
& rect
Definition: startmenu.cpp:1413

◆ SetCurrentConsoleFontEx()

BOOL WINAPI SetCurrentConsoleFontEx ( HANDLE  handle,
BOOL  maxwindow,
CONSOLE_FONT_INFOEX info 
)

Definition at line 1765 of file console.c.

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}
size_t __cdecl wcsnlen(wchar_t const *const string, size_t const maximum_count)
Definition: strnlen.cpp:210

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( console  )

◆ WriteConsoleA()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA ( HANDLE  handle,
const void buffer,
DWORD  length,
DWORD written,
void reserved 
)

Definition at line 2135 of file console.c.

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}
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55

Referenced by testEmptyWrite(), testScreenBuffer(), testWriteNotWrappedNotProcessed(), testWriteNotWrappedProcessed(), testWriteSimple(), testWriteWrappedNotProcessed(), and testWriteWrappedProcessed().

◆ WriteConsoleInputA()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputA ( HANDLE  handle,
const INPUT_RECORD buffer,
DWORD  count,
DWORD written 
)

Definition at line 1828 of file console.c.

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}
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW(HANDLE handle, const INPUT_RECORD *buffer, DWORD count, DWORD *written)
Definition: console.c:1858
static void input_records_AtoW(INPUT_RECORD *buffer, int count)
Definition: console.c:130

Referenced by test_WriteConsoleInputA().

◆ WriteConsoleInputW()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW ( HANDLE  handle,
const INPUT_RECORD buffer,
DWORD  count,
DWORD written 
)

Definition at line 1858 of file console.c.

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}

Referenced by test_WriteConsoleInputW(), testWaitForConsoleInput(), and WriteConsoleInputA().

◆ WriteConsoleOutputA()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputA ( HANDLE  handle,
const CHAR_INFO buffer,
COORD  size,
COORD  coord,
SMALL_RECT region 
)

Definition at line 1885 of file console.c.

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}
static void char_info_AtoW(CHAR_INFO *buffer, int count)
Definition: console.c:158
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputW(HANDLE handle, const CHAR_INFO *buffer, COORD size, COORD coord, SMALL_RECT *region)
Definition: console.c:1920
size_t const new_size
Definition: expand.cpp:66
ULONG Y
Definition: bl.h:1340
ULONG X
Definition: bl.h:1339

◆ WriteConsoleOutputAttribute()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputAttribute ( HANDLE  handle,
const WORD attr,
DWORD  length,
COORD  coord,
DWORD written 
)

Definition at line 1967 of file console.c.

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}
unsigned short WORD
Definition: ntddk_ex.h:93

Referenced by resetContent(), and test_WriteConsoleOutputAttribute().

◆ WriteConsoleOutputCharacterA()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputCharacterA ( HANDLE  handle,
LPCSTR  str,
DWORD  length,
COORD  coord,
DWORD written 
)

Definition at line 1999 of file console.c.

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}
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputCharacterW(HANDLE handle, LPCWSTR str, DWORD length, COORD coord, DWORD *written)
Definition: console.c:2034
WCHAR strW[12]
Definition: clipboard.c:2025
const WCHAR * str

◆ WriteConsoleOutputCharacterW()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputCharacterW ( HANDLE  handle,
LPCWSTR  str,
DWORD  length,
COORD  coord,
DWORD written 
)

Definition at line 2034 of file console.c.

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}

◆ WriteConsoleOutputW()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleOutputW ( HANDLE  handle,
const CHAR_INFO buffer,
COORD  size,
COORD  coord,
SMALL_RECT region 
)

Definition at line 1920 of file console.c.

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}

Referenced by WriteConsoleOutputA().

◆ WriteConsoleW()

BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW ( HANDLE  handle,
const void buffer,
DWORD  length,
DWORD written,
void reserved 
)

Definition at line 2151 of file console.c.

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}

Variable Documentation

◆ console_connection

HANDLE console_connection
static

Definition at line 57 of file console.c.

Referenced by AttachConsole(), create_console_connection(), and FreeConsole().

◆ console_flags

unsigned int console_flags
static

Definition at line 58 of file console.c.

Referenced by FreeConsole(), and init_console_std_handles().

◆ console_section

◆ critsect_debug

CRITICAL_SECTION_DEBUG critsect_debug
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": console_section") }
}
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: console.c:49
LIST_ENTRY ProcessLocksList
Definition: winbase.h:918

Definition at line 49 of file console.c.

◆ ctrl_handlers

struct ctrl_handler* ctrl_handlers = &default_handler
static

Definition at line 83 of file console.c.

Referenced by CtrlRoutine(), and SetConsoleCtrlHandler().

◆ default_handler

struct ctrl_handler default_handler = { default_ctrl_handler, NULL }
static

Definition at line 82 of file console.c.

Referenced by SetConsoleCtrlHandler().

◆ input_exe