2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
5 * Copyright 1997 Karl Garrison
6 * Copyright 1998 John Richardson
7 * Copyright 1998 Marcus Meissner
11 * - Completely lacks SCREENBUFFER interface.
12 * - No abstraction for something other than xterm.
13 * - Output sometimes is buffered (We switched off buffering by ~ICANON ?)
15 /* Reference applications:
16 * - IDA (interactive disassembler) full version 3.75. Works.
17 * - LYNX/W32. Works mostly, some keys crash it.
27 #include <sys/ioctl.h>
28 #include <sys/types.h>
32 #ifdef HAVE_SYS_ERRNO_H
33 #include <sys/errno.h>
41 #include "wine/winuser16.h"
42 #include "wine/winestring.h"
43 #include "wine/keyboard16.h"
51 #include "debugtools.h"
54 DEFAULT_DEBUG_CHANNEL(console
)
56 /* Ascii -> VK, generated by calling VkKeyScanA(i) */
57 static int vkkeyscan_table
[256] = {
58 0,0,0,0,0,0,0,0,8,9,0,0,0,13,0,0,0,0,0,19,145,556,0,0,0,0,0,27,0,0,0,
59 0,32,305,478,307,308,309,311,222,313,304,312,443,188,189,190,191,48,
60 49,50,51,52,53,54,55,56,57,442,186,444,187,446,447,306,321,322,323,
61 324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,
62 341,342,343,344,345,346,219,220,221,310,445,192,65,66,67,68,69,70,71,
63 72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,475,476,477,
64 448,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
65 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
66 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
67 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,400,0,0,0,0,0,0
70 static int mapvkey_0
[256]={
71 0,0,0,0,0,0,0,0,14,15,0,0,0,28,0,0,42,29,56,69,58,0,0,0,0,0,0,1,0,0,
72 0,0,57,73,81,79,71,75,72,77,80,0,0,0,55,82,83,0,11,2,3,4,5,6,7,8,9,
73 10,0,0,0,0,0,0,0,30,48,46,32,18,33,34,35,23,36,37,38,50,49,24,25,16,
74 19,31,20,22,47,17,45,21,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,78,0,74,
75 0,53,59,60,61,62,63,64,65,66,67,68,87,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
76 0,0,0,0,0,0,69,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
77 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,13,51,12,52,53,41,0,0,0,0,0,0,0,0,0,
78 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,43,27,40,76,96,0,0,0,0,0,0,0,0,
79 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
82 static int mapvkey_1
[256]={
83 0,27,49,50,51,52,53,54,55,56,57,48,189,187,8,9,81,87,69,82,84,89,85,
84 73,79,80,219,221,13,17,65,83,68,70,71,72,74,75,76,186,222,192,16,220,
85 90,88,67,86,66,78,77,188,190,191,16,106,18,32,20,112,113,114,115,116,
86 117,118,119,120,121,144,145,36,38,33,109,37,223,39,107,35,40,34,45,
87 46,0,0,0,122,123,0,0,0,0,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
88 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
89 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
90 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
91 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
95 /* FIXME: Should be in an internal header file. OK, so which one?
96 Used by CONSOLE_makecomplex. */
97 int wine_openpty(int *master
, int *slave
, char *name
,
98 struct termios
*term
, struct winsize
*winsize
);
100 /****************************************************************************
103 static int CONSOLE_GetPid( HANDLE handle
)
108 struct get_console_info_request
*req
= server_alloc_req( sizeof(*req
), 0 );
109 req
->handle
= handle
;
110 if (!server_call( REQ_GET_CONSOLE_INFO
)) ret
= req
->pid
;
116 /****************************************************************************
117 * XTERM_string_to_IR [internal]
119 * Transfers a string read from XTERM to INPUT_RECORDs and adds them to the
120 * queue. Does translation of vt100 style function keys and xterm-mouse clicks.
123 CONSOLE_string_to_IR( HANDLE hConsoleInput
,unsigned char *buf
,int len
) {
128 for (j
=0;j
<len
;j
++) {
129 unsigned char inchar
= buf
[j
];
131 if (inchar
!=27) { /* no escape -> 'normal' keyboard event */
132 ir
.EventType
= 1; /* Key_event */
134 ir
.Event
.KeyEvent
.bKeyDown
= 1;
135 ir
.Event
.KeyEvent
.wRepeatCount
= 0;
137 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
139 ir
.Event
.KeyEvent
.dwControlKeyState
|=LEFT_ALT_PRESSED
;
142 ir
.Event
.KeyEvent
.wVirtualKeyCode
= vkkeyscan_table
[inchar
];
143 if (ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x0100)
144 ir
.Event
.KeyEvent
.dwControlKeyState
|=SHIFT_PRESSED
;
145 if (ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x0200)
146 ir
.Event
.KeyEvent
.dwControlKeyState
|=LEFT_CTRL_PRESSED
;
147 if (ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x0400)
148 ir
.Event
.KeyEvent
.dwControlKeyState
|=LEFT_ALT_PRESSED
;
149 ir
.Event
.KeyEvent
.wVirtualScanCode
= mapvkey_0
[
150 ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x00ff
151 ]; /* VirtualKeyCodes to ScanCode */
152 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= inchar
;
154 if ((inchar
==127)||(inchar
=='\b')) { /* backspace */
155 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= '\b'; /* FIXME: hmm */
156 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0x0e;
157 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VK_BACK
;
159 if ((inchar
=='\n')||(inchar
=='\r')) {
160 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= '\r';
161 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VK_RETURN
;
162 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0x1c;
163 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
166 /* FIXME: find good values for ^X */
167 ir
.Event
.KeyEvent
.wVirtualKeyCode
= 0xdead;
168 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0xbeef;
173 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
174 ir
.Event
.KeyEvent
.bKeyDown
= 0;
175 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
179 if ((j
==len
-1) || (buf
[j
+1]!='[')) {/* add ESCape on its own */
180 ir
.EventType
= 1; /* Key_event */
181 ir
.Event
.KeyEvent
.bKeyDown
= 1;
182 ir
.Event
.KeyEvent
.wRepeatCount
= 0;
184 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VK_ESCAPE
;
185 ir
.Event
.KeyEvent
.wVirtualScanCode
= mapvkey_0
[
186 ir
.Event
.KeyEvent
.wVirtualKeyCode
188 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
189 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= 27;
190 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
191 ir
.Event
.KeyEvent
.bKeyDown
= 0;
192 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
195 for (k
=j
;k
<len
;k
++) {
196 if (((buf
[k
]>='A') && (buf
[k
]<='Z')) ||
197 ((buf
[k
]>='a') && (buf
[k
]<='z')) ||
203 int subid
,scancode
=0;
205 ir
.EventType
= 1; /* Key_event */
206 ir
.Event
.KeyEvent
.bKeyDown
= 1;
207 ir
.Event
.KeyEvent
.wRepeatCount
= 0;
208 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
210 ir
.Event
.KeyEvent
.wVirtualKeyCode
= 0xad; /* FIXME */
211 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0xad; /* FIXME */
212 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= 0;
216 sscanf(&buf
[j
+2],"%d",&subid
);
218 case 2:/*INS */scancode
= 0xe052;break;
219 case 3:/*DEL */scancode
= 0xe053;break;
220 case 6:/*PGDW*/scancode
= 0xe051;break;
221 case 5:/*PGUP*/scancode
= 0xe049;break;
222 case 11:/*F1 */scancode
= 0x003b;break;
223 case 12:/*F2 */scancode
= 0x003c;break;
224 case 13:/*F3 */scancode
= 0x003d;break;
225 case 14:/*F4 */scancode
= 0x003e;break;
226 case 15:/*F5 */scancode
= 0x003f;break;
227 case 17:/*F6 */scancode
= 0x0040;break;
228 case 18:/*F7 */scancode
= 0x0041;break;
229 case 19:/*F8 */scancode
= 0x0042;break;
230 case 20:/*F9 */scancode
= 0x0043;break;
231 case 21:/*F10 */scancode
= 0x0044;break;
232 case 23:/*F11 */scancode
= 0x00d9;break;
233 case 24:/*F12 */scancode
= 0x00da;break;
234 /* FIXME: Shift-Fx */
236 FIXME("parse ESC[%d~\n",subid
);
240 case 'A': /* Cursor Up */scancode
= 0xe048;break;
241 case 'B': /* Cursor Down */scancode
= 0xe050;break;
242 case 'D': /* Cursor Left */scancode
= 0xe04b;break;
243 case 'C': /* Cursor Right */scancode
= 0xe04d;break;
244 case 'F': /* End */scancode
= 0xe04f;break;
245 case 'H': /* Home */scancode
= 0xe047;break;
247 /* Mouse Button Press (ESCM<button+'!'><x+'!'><y+'!'>) or
248 * Release (ESCM#<x+'!'><y+'!'>
251 ir
.EventType
= MOUSE_EVENT
;
252 ir
.Event
.MouseEvent
.dwMousePosition
.X
= buf
[k
+2]-'!';
253 ir
.Event
.MouseEvent
.dwMousePosition
.Y
= buf
[k
+3]-'!';
255 ir
.Event
.MouseEvent
.dwButtonState
= 0;
257 ir
.Event
.MouseEvent
.dwButtonState
= 1<<(buf
[k
+1]-' ');
258 ir
.Event
.MouseEvent
.dwEventFlags
= 0; /* FIXME */
259 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
268 ir
.Event
.KeyEvent
.wVirtualScanCode
= scancode
;
269 ir
.Event
.KeyEvent
.wVirtualKeyCode
= mapvkey_1
[scancode
];
270 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
271 ir
.Event
.KeyEvent
.bKeyDown
= 0;
272 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
280 /****************************************************************************
281 * CONSOLE_get_input (internal)
283 * Reads (nonblocking) as much input events as possible and stores them
284 * in an internal queue.
287 CONSOLE_get_input( HANDLE handle
, BOOL blockwait
)
289 char *buf
= HeapAlloc(GetProcessHeap(),0,1);
290 int len
= 0, escape_seen
= 0;
297 /* If we have at one time seen escape in this loop, we are
298 * within an Escape sequence, so wait for a bit more input for the
301 if (WaitForSingleObject( handle
, escape_seen
*10 )) break;
302 if (!ReadFile( handle
, &inchar
, 1, &res
, NULL
)) break;
303 if (!res
) /* res 0 but readable means EOF? Hmm. */
305 buf
= HeapReAlloc(GetProcessHeap(),0,buf
,len
+1);
309 /* If we spot an ESC, we flush all up to it
310 * since we can be sure that we have a complete
313 CONSOLE_string_to_IR(handle
,buf
,len
-1);
314 buf
= HeapReAlloc(GetProcessHeap(),0,buf
,1);
321 CONSOLE_string_to_IR(handle
,buf
,len
);
322 HeapFree(GetProcessHeap(),0,buf
);
326 /******************************************************************************
329 * Helper function for ReadConsole, ReadConsoleInput and PeekConsoleInput
331 static BOOL
read_console_input( HANDLE handle
, LPINPUT_RECORD buffer
, DWORD count
,
332 LPDWORD read
, BOOL flush
)
336 count
= min( count
, REQUEST_MAX_VAR_SIZE
/sizeof(INPUT_RECORD
) );
340 struct read_console_input_request
*req
= server_alloc_req( sizeof(*req
),
341 count
*sizeof(INPUT_RECORD
) );
342 req
->handle
= handle
;
344 if ((ret
= !server_call( REQ_READ_CONSOLE_INPUT
)))
346 if (count
) memcpy( buffer
, server_data_ptr(req
), server_data_size(req
) );
347 if (read
) *read
= req
->read
;
355 /******************************************************************************
356 * SetConsoleCtrlHandler [KERNEL32.459] Adds function to calling process list
359 * func [I] Address of handler function
360 * add [I] Handler to add or remove
367 * James Sutherland (JamesSutherland@gmx.de)
368 * Added global variables console_ignore_ctrl_c and handlers[]
369 * Does not yet do any error checking, or set LastError if failed.
370 * This doesn't yet matter, since these handlers are not yet called...!
372 static unsigned int console_ignore_ctrl_c
= 0;
373 static HANDLER_ROUTINE
*handlers
[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
374 BOOL WINAPI
SetConsoleCtrlHandler( HANDLER_ROUTINE
*func
, BOOL add
)
376 unsigned int alloc_loop
= sizeof(handlers
)/sizeof(HANDLER_ROUTINE
*);
377 unsigned int done
= 0;
378 FIXME("(%p,%i) - no error checking or testing yet\n", func
, add
);
381 console_ignore_ctrl_c
= add
;
387 if (!handlers
[alloc_loop
] && !done
)
389 handlers
[alloc_loop
] = func
;
393 FIXME("Out of space on CtrlHandler table\n");
399 if (handlers
[alloc_loop
] == func
&& !done
)
401 handlers
[alloc_loop
] = 0;
405 WARN("Attempt to remove non-installed CtrlHandler %p\n",
413 /******************************************************************************
414 * GenerateConsoleCtrlEvent [KERNEL32.275] Simulate a CTRL-C or CTRL-BREAK
417 * dwCtrlEvent [I] Type of event
418 * dwProcessGroupID [I] Process group ID to send event to
421 * Doesn't yet work...!
425 * Failure: False (and *should* [but doesn't] set LastError)
427 BOOL WINAPI
GenerateConsoleCtrlEvent( DWORD dwCtrlEvent
,
428 DWORD dwProcessGroupID
)
430 if (dwCtrlEvent
!= CTRL_C_EVENT
&& dwCtrlEvent
!= CTRL_BREAK_EVENT
)
432 ERR("invalid event %d for PGID %ld\n",
433 (unsigned short)dwCtrlEvent
, dwProcessGroupID
);
436 if (dwProcessGroupID
== GetCurrentProcessId() )
438 FIXME("Attempt to send event %d to self - stub\n",
439 (unsigned short)dwCtrlEvent
);
442 FIXME("event %d to external PGID %ld - not implemented yet\n",
443 (unsigned short)dwCtrlEvent
, dwProcessGroupID
);
448 /******************************************************************************
449 * CreateConsoleScreenBuffer [KERNEL32.151] Creates a console screen buffer
452 * dwDesiredAccess [I] Access flag
453 * dwShareMode [I] Buffer share mode
454 * sa [I] Security attributes
455 * dwFlags [I] Type of buffer to create
456 * lpScreenBufferData [I] Reserved
459 * Should call SetLastError
462 * Success: Handle to new console screen buffer
463 * Failure: INVALID_HANDLE_VALUE
465 HANDLE WINAPI
CreateConsoleScreenBuffer( DWORD dwDesiredAccess
,
466 DWORD dwShareMode
, LPSECURITY_ATTRIBUTES sa
,
467 DWORD dwFlags
, LPVOID lpScreenBufferData
)
469 FIXME("(%ld,%ld,%p,%ld,%p): stub\n",dwDesiredAccess
,
470 dwShareMode
, sa
, dwFlags
, lpScreenBufferData
);
471 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
472 return INVALID_HANDLE_VALUE
;
476 /***********************************************************************
477 * GetConsoleScreenBufferInfo (KERNEL32.190)
479 BOOL WINAPI
GetConsoleScreenBufferInfo( HANDLE hConsoleOutput
,
480 LPCONSOLE_SCREEN_BUFFER_INFO csbi
)
484 csbi
->dwCursorPosition
.X
= 0;
485 csbi
->dwCursorPosition
.Y
= 0;
486 csbi
->wAttributes
= 0;
487 csbi
->srWindow
.Left
= 0;
488 csbi
->srWindow
.Right
= 79;
489 csbi
->srWindow
.Top
= 0;
490 csbi
->srWindow
.Bottom
= 23;
491 csbi
->dwMaximumWindowSize
.X
= 80;
492 csbi
->dwMaximumWindowSize
.Y
= 24;
497 /******************************************************************************
498 * SetConsoleActiveScreenBuffer [KERNEL32.623] Sets buffer to current console
504 BOOL WINAPI
SetConsoleActiveScreenBuffer(
505 HANDLE hConsoleOutput
) /* [in] Handle to console screen buffer */
507 FIXME("(%x): stub\n", hConsoleOutput
);
512 /***********************************************************************
513 * GetLargestConsoleWindowSize (KERNEL32.226)
515 COORD WINAPI
GetLargestConsoleWindowSize( HANDLE hConsoleOutput
)
523 /* gcc doesn't return structures the same way as dwords */
524 DWORD WINAPI
WIN32_GetLargestConsoleWindowSize( HANDLE hConsoleOutput
)
526 COORD c
= GetLargestConsoleWindowSize( hConsoleOutput
);
530 /***********************************************************************
531 * FreeConsole (KERNEL32.267)
533 BOOL WINAPI
FreeConsole(VOID
)
538 struct free_console_request
*req
= server_alloc_req( sizeof(*req
), 0 );
539 ret
= !server_call( REQ_FREE_CONSOLE
);
546 /*************************************************************************
547 * CONSOLE_make_complex [internal]
549 * Turns a CONSOLE kernel object into a complex one.
550 * (switches from output/input using the terminal where WINE was started to
553 * This makes simple commandline tools pipeable, while complex commandline
554 * tools work without getting messed up by debugoutput.
556 * All other functions should work indedependend from this call.
558 * To test for complex console: pid == 0 -> simple, otherwise complex.
560 static BOOL
CONSOLE_make_complex(HANDLE handle
)
565 int i
,xpid
,master
,slave
,pty_handle
;
567 if (CONSOLE_GetPid( handle
)) return TRUE
; /* already complex */
569 MESSAGE("Console: Making console complex (creating an xterm)...\n");
571 if (tcgetattr(0, &term
) < 0) {
572 /* ignore failure, or we can't run from a script */
574 term
.c_lflag
= ~(ECHO
|ICANON
);
576 if (wine_openpty(&master
, &slave
, NULL
, &term
, NULL
) < 0)
579 if ((xpid
=fork()) == 0) {
580 tcsetattr(slave
, TCSADRAIN
, &term
);
582 sprintf(buf
, "-Sxx%d", master
);
583 /* "-fn vga" for VGA font. Harmless if vga is not present:
584 * xterm: unable to open font "vga", trying "fixed"....
586 execlp("xterm", "xterm", buf
, "-fn","vga",NULL
);
587 ERR("error creating AllocConsole xterm\n");
590 pty_handle
= FILE_DupUnixHandle( slave
, GENERIC_READ
| GENERIC_WRITE
);
593 if (pty_handle
== -1) return FALSE
;
595 /* most xterms like to print their window ID when used with -S;
596 * read it and continue before the user has a chance...
598 for (i
= 0; i
< 10000; i
++)
600 BOOL ok
= ReadFile( pty_handle
, &c
, 1, NULL
, NULL
);
601 if (!ok
&& !c
) usleep(100); /* wait for xterm to be created */
602 else if (c
== '\n') break;
606 ERR("can't read xterm WID\n");
607 CloseHandle( pty_handle
);
612 struct set_console_fd_request
*req
= server_alloc_req( sizeof(*req
), 0 );
613 req
->handle
= handle
;
614 req
->file_handle
= pty_handle
;
616 server_call( REQ_SET_CONSOLE_FD
);
619 CloseHandle( pty_handle
);
621 /* enable mouseclicks */
622 strcpy( buf
, "\033[?1002h" );
623 WriteFile(handle
,buf
,strlen(buf
),NULL
,NULL
);
625 strcpy( buf
, "\033]2;" );
626 if (GetConsoleTitleA( buf
+ 4, sizeof(buf
) - 5 ))
629 WriteFile(handle
,buf
,strlen(buf
),NULL
,NULL
);
636 /***********************************************************************
637 * AllocConsole (KERNEL32.103)
639 * creates an xterm with a pty to our program
641 BOOL WINAPI
AllocConsole(VOID
)
645 int handle_in
, handle_out
;
651 struct alloc_console_request
*req
= server_alloc_req( sizeof(*req
), 0 );
653 req
->access
= GENERIC_READ
| GENERIC_WRITE
| SYNCHRONIZE
;
654 req
->inherit
= FALSE
;
655 ret
= !server_call( REQ_ALLOC_CONSOLE
);
656 handle_in
= req
->handle_in
;
657 handle_out
= req
->handle_out
;
660 if (!ret
) return FALSE
;
662 if (!DuplicateHandle( GetCurrentProcess(), handle_out
, GetCurrentProcess(), &hStderr
,
663 0, TRUE
, DUPLICATE_SAME_ACCESS
))
665 CloseHandle( handle_in
);
666 CloseHandle( handle_out
);
671 /* NT resets the STD_*_HANDLEs on console alloc */
672 SetStdHandle( STD_INPUT_HANDLE
, handle_in
);
673 SetStdHandle( STD_OUTPUT_HANDLE
, handle_out
);
674 SetStdHandle( STD_ERROR_HANDLE
, hStderr
);
676 SetLastError(ERROR_SUCCESS
);
677 SetConsoleTitleA("Wine Console");
682 /******************************************************************************
683 * GetConsoleCP [KERNEL32.295] Returns the OEM code page for the console
688 UINT WINAPI
GetConsoleCP(VOID
)
694 /***********************************************************************
695 * GetConsoleOutputCP (KERNEL32.189)
697 UINT WINAPI
GetConsoleOutputCP(VOID
)
699 return GetConsoleCP();
702 /***********************************************************************
703 * GetConsoleMode (KERNEL32.188)
705 BOOL WINAPI
GetConsoleMode(HANDLE hcon
,LPDWORD mode
)
710 struct get_console_mode_request
*req
= server_alloc_req( sizeof(*req
), 0 );
712 ret
= !server_call( REQ_GET_CONSOLE_MODE
);
713 if (ret
&& mode
) *mode
= req
->mode
;
720 /******************************************************************************
721 * SetConsoleMode [KERNEL32.628] Sets input mode of console's input buffer
724 * hcon [I] Handle to console input or screen buffer
725 * mode [I] Input or output mode to set
731 BOOL WINAPI
SetConsoleMode( HANDLE hcon
, DWORD mode
)
736 struct set_console_mode_request
*req
= server_alloc_req( sizeof(*req
), 0 );
739 ret
= !server_call( REQ_SET_CONSOLE_MODE
);
746 /******************************************************************************
747 * SetConsoleOutputCP [KERNEL32.629] Set the output codepage used by the console
750 * cp [I] code page to set
756 BOOL WINAPI
SetConsoleOutputCP( UINT cp
)
763 /***********************************************************************
764 * GetConsoleTitleA (KERNEL32.191)
766 DWORD WINAPI
GetConsoleTitleA(LPSTR title
,DWORD size
)
771 if ((hcon
= CreateFileA( "CONOUT$", GENERIC_READ
, 0, NULL
,
772 OPEN_EXISTING
, 0, 0 )) == INVALID_HANDLE_VALUE
)
776 struct get_console_info_request
*req
= server_alloc_req( sizeof(*req
),
777 REQUEST_MAX_VAR_SIZE
);
779 if (!server_call( REQ_GET_CONSOLE_INFO
))
781 ret
= server_data_size(req
);
782 size
= min( size
-1, ret
);
783 memcpy( title
, server_data_ptr(req
), size
);
793 /******************************************************************************
794 * GetConsoleTitleW [KERNEL32.192] Retrieves title string for console
797 * title [O] Address of buffer for title
798 * size [I] Size of buffer
801 * Success: Length of string copied
804 DWORD WINAPI
GetConsoleTitleW( LPWSTR title
, DWORD size
)
809 if (!(tmp
= HeapAlloc( GetProcessHeap(), 0, size
))) return 0;
810 ret
= GetConsoleTitleA( tmp
, size
);
811 lstrcpyAtoW( title
, tmp
);
812 HeapFree( GetProcessHeap(), 0, tmp
);
817 /***********************************************************************
818 * WriteConsoleA (KERNEL32.729)
820 BOOL WINAPI
WriteConsoleA( HANDLE hConsoleOutput
,
822 DWORD nNumberOfCharsToWrite
,
823 LPDWORD lpNumberOfCharsWritten
,
826 /* FIXME: should I check if this is a console handle? */
827 return WriteFile(hConsoleOutput
, lpBuffer
, nNumberOfCharsToWrite
,
828 lpNumberOfCharsWritten
, NULL
);
833 if (bufused==curbufsize-1) \
834 buffer = HeapReAlloc(GetProcessHeap(),0,buffer,(curbufsize+=100));\
836 #define SADD(s) { char *x=s;while (*x) {CADD(*x);x++;}}
838 /***********************************************************************
839 * WriteConsoleOutputA (KERNEL32.732)
841 BOOL WINAPI
WriteConsoleOutputA( HANDLE hConsoleOutput
,
842 LPCHAR_INFO lpBuffer
,
845 LPSMALL_RECT lpWriteRegion
)
847 int i
,j
,off
=0,lastattr
=-1;
849 char sbuf
[20],*buffer
=NULL
;
850 int bufused
=0,curbufsize
= 100;
852 CONSOLE_SCREEN_BUFFER_INFO csbi
;
853 const int colormap
[8] = {
857 CONSOLE_make_complex(hConsoleOutput
);
858 buffer
= HeapAlloc(GetProcessHeap(),0,curbufsize
);
859 offbase
= (dwBufferCoord
.Y
- 1) * dwBufferSize
.X
+
860 (dwBufferCoord
.X
- lpWriteRegion
->Left
);
862 TRACE("orig rect top = %d, bottom=%d, left=%d, right=%d\n",
864 lpWriteRegion
->Bottom
,
869 GetConsoleScreenBufferInfo(hConsoleOutput
, &csbi
);
870 sprintf(sbuf
,"%c7",27);SADD(sbuf
);
872 /* Step 1. Make (Bottom,Right) offset of intersection with
874 lpWriteRegion
->Bottom
= min(lpWriteRegion
->Bottom
, csbi
.dwSize
.Y
-1) -
876 lpWriteRegion
->Right
= min(lpWriteRegion
->Right
, csbi
.dwSize
.X
-1) -
879 /* Step 2. If either offset is negative, then no action
880 should be performed. (Implies that requested rectangle is
881 outside the current screen buffer rectangle.) */
882 if ((lpWriteRegion
->Bottom
< 0) ||
883 (lpWriteRegion
->Right
< 0)) {
884 /* readjust (Bottom Right) for rectangle */
885 lpWriteRegion
->Bottom
+= lpWriteRegion
->Top
;
886 lpWriteRegion
->Right
+= lpWriteRegion
->Left
;
888 TRACE("invisible rect top = %d, bottom=%d, left=%d, right=%d\n",
890 lpWriteRegion
->Bottom
,
895 HeapFree(GetProcessHeap(),0,buffer
);
899 /* Step 3. Intersect with source rectangle */
900 lpWriteRegion
->Bottom
= lpWriteRegion
->Top
- dwBufferCoord
.Y
+
901 min(lpWriteRegion
->Bottom
+ dwBufferCoord
.Y
, dwBufferSize
.Y
-1);
902 lpWriteRegion
->Right
= lpWriteRegion
->Left
- dwBufferCoord
.X
+
903 min(lpWriteRegion
->Right
+ dwBufferCoord
.X
, dwBufferSize
.X
-1);
905 TRACE("clipped rect top = %d, bottom=%d, left=%d,right=%d\n",
907 lpWriteRegion
->Bottom
,
912 /* Validate above computations made sense, if not then issue
913 error and fudge to single character rectangle */
914 if ((lpWriteRegion
->Bottom
< lpWriteRegion
->Top
) ||
915 (lpWriteRegion
->Right
< lpWriteRegion
->Left
)) {
916 ERR("Invalid clipped rectangle top = %d, bottom=%d, left=%d,right=%d\n",
918 lpWriteRegion
->Bottom
,
922 lpWriteRegion
->Bottom
= lpWriteRegion
->Top
;
923 lpWriteRegion
->Right
= lpWriteRegion
->Left
;
926 /* Now do the real processing and move the characters */
927 for (i
=lpWriteRegion
->Top
;i
<=lpWriteRegion
->Bottom
;i
++) {
928 offbase
+= dwBufferSize
.X
;
929 sprintf(sbuf
,"%c[%d;%dH",27,i
+1,lpWriteRegion
->Left
+1);
931 for (j
=lpWriteRegion
->Left
;j
<=lpWriteRegion
->Right
;j
++) {
933 if (lastattr
!=lpBuffer
[off
].Attributes
) {
934 lastattr
= lpBuffer
[off
].Attributes
;
935 sprintf(sbuf
,"%c[0;%s3%d;4%dm",
937 (lastattr
& FOREGROUND_INTENSITY
)?"1;":"",
938 colormap
[lastattr
&7],
939 colormap
[(lastattr
&0x70)>>4]
941 /* FIXME: BACKGROUND_INTENSITY */
944 CADD(lpBuffer
[off
].Char
.AsciiChar
);
947 sprintf(sbuf
,"%c[0m%c8",27,27);SADD(sbuf
);
948 WriteFile(hConsoleOutput
,buffer
,bufused
,&res
,NULL
);
949 HeapFree(GetProcessHeap(),0,buffer
);
953 /***********************************************************************
954 * WriteConsoleOutputW (KERNEL32.734)
956 BOOL WINAPI
WriteConsoleOutputW( HANDLE hConsoleOutput
,
957 LPCHAR_INFO lpBuffer
,
960 LPSMALL_RECT lpWriteRegion
)
962 FIXME("(%d,%p,%dx%d,%dx%d,%p): stub\n", hConsoleOutput
, lpBuffer
,
963 dwBufferSize
.X
,dwBufferSize
.Y
,dwBufferCoord
.X
,dwBufferCoord
.Y
,lpWriteRegion
);
965 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
969 /***********************************************************************
970 * WriteConsoleW (KERNEL32.577)
972 BOOL WINAPI
WriteConsoleW( HANDLE hConsoleOutput
,
974 DWORD nNumberOfCharsToWrite
,
975 LPDWORD lpNumberOfCharsWritten
,
982 n
= WideCharToMultiByte(CP_ACP
,0,lpBuffer
,nNumberOfCharsToWrite
,NULL
,0,NULL
,NULL
);
983 xstring
=HeapAlloc( GetProcessHeap(), 0, n
);
985 n
= WideCharToMultiByte(CP_ACP
,0,lpBuffer
,nNumberOfCharsToWrite
,xstring
,n
,NULL
,NULL
);
987 /* FIXME: should I check if this is a console handle? */
988 ret
= WriteFile(hConsoleOutput
, xstring
, n
,
989 lpNumberOfCharsWritten
, NULL
);
990 /* FIXME: lpNumberOfCharsWritten should be converted to numofchars in UNICODE */
991 HeapFree( GetProcessHeap(), 0, xstring
);
996 /***********************************************************************
997 * ReadConsoleA (KERNEL32.419)
999 BOOL WINAPI
ReadConsoleA( HANDLE hConsoleInput
,
1001 DWORD nNumberOfCharsToRead
,
1002 LPDWORD lpNumberOfCharsRead
,
1006 LPSTR xbuf
= (LPSTR
)lpBuffer
;
1008 TRACE("(%d,%p,%ld,%p,%p)\n",
1009 hConsoleInput
,lpBuffer
,nNumberOfCharsToRead
,
1010 lpNumberOfCharsRead
,lpReserved
1013 CONSOLE_get_input(hConsoleInput
,FALSE
);
1015 /* FIXME: should we read at least 1 char? The SDK does not say */
1016 while (charsread
<nNumberOfCharsToRead
)
1020 if (!read_console_input( hConsoleInput
, &ir
, 1, &count
, TRUE
)) return FALSE
;
1022 if (ir
.EventType
!= KEY_EVENT
) continue;
1023 if (!ir
.Event
.KeyEvent
.bKeyDown
) continue;
1024 *xbuf
++ = ir
.Event
.KeyEvent
.uChar
.AsciiChar
;
1027 if (lpNumberOfCharsRead
)
1028 *lpNumberOfCharsRead
= charsread
;
1032 /***********************************************************************
1033 * ReadConsoleW (KERNEL32.427)
1035 BOOL WINAPI
ReadConsoleW( HANDLE hConsoleInput
,
1037 DWORD nNumberOfCharsToRead
,
1038 LPDWORD lpNumberOfCharsRead
,
1042 LPSTR buf
= (LPSTR
)HeapAlloc(GetProcessHeap(), 0, nNumberOfCharsToRead
);
1047 nNumberOfCharsToRead
,
1048 lpNumberOfCharsRead
,
1052 lstrcpynAtoW(lpBuffer
,buf
,nNumberOfCharsToRead
);
1053 HeapFree( GetProcessHeap(), 0, buf
);
1058 /******************************************************************************
1059 * ReadConsoleInputA [KERNEL32.569] Reads data from a console
1062 * hConsoleInput [I] Handle to console input buffer
1063 * lpBuffer [O] Address of buffer for read data
1064 * nLength [I] Number of records to read
1065 * lpNumberOfEventsRead [O] Address of number of records read
1071 BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput
, LPINPUT_RECORD lpBuffer
,
1072 DWORD nLength
, LPDWORD lpNumberOfEventsRead
)
1076 if (lpNumberOfEventsRead
) *lpNumberOfEventsRead
= 0;
1080 /* loop until we get at least one event */
1084 BOOL ret
= read_console_input( hConsoleInput
, lpBuffer
, nLength
, &count
, TRUE
);
1086 if (!ret
) return FALSE
;
1089 if (lpNumberOfEventsRead
) *lpNumberOfEventsRead
= count
;
1092 CONSOLE_get_input(hConsoleInput
,TRUE
);
1093 /*WaitForSingleObject( hConsoleInput, INFINITE32 );*/
1098 /***********************************************************************
1099 * ReadConsoleInputW (KERNEL32.570)
1101 BOOL WINAPI
ReadConsoleInputW( HANDLE handle
, LPINPUT_RECORD buffer
,
1102 DWORD count
, LPDWORD read
)
1104 /* FIXME: Fix this if we get UNICODE input. */
1105 return ReadConsoleInputA( handle
, buffer
, count
, read
);
1109 /***********************************************************************
1110 * FlushConsoleInputBuffer (KERNEL32.132)
1112 BOOL WINAPI
FlushConsoleInputBuffer( HANDLE handle
)
1114 return read_console_input( handle
, NULL
, 0, NULL
, TRUE
);
1118 /***********************************************************************
1119 * PeekConsoleInputA (KERNEL32.550)
1121 * Gets 'count' first events (or less) from input queue.
1123 * Does not need a complex console.
1125 BOOL WINAPI
PeekConsoleInputA( HANDLE handle
, LPINPUT_RECORD buffer
, DWORD count
, LPDWORD read
)
1127 CONSOLE_get_input(handle
,FALSE
);
1130 if (read
) *read
= 0;
1133 return read_console_input( handle
, buffer
, count
, read
, FALSE
);
1137 /***********************************************************************
1138 * PeekConsoleInputW (KERNEL32.551)
1140 BOOL WINAPI
PeekConsoleInputW(HANDLE hConsoleInput
,
1141 LPINPUT_RECORD pirBuffer
,
1145 /* FIXME: Hmm. Fix this if we get UNICODE input. */
1146 return PeekConsoleInputA(hConsoleInput
,pirBuffer
,cInRecords
,lpcRead
);
1150 /******************************************************************************
1151 * WriteConsoleInputA [KERNEL32.730] Write data to a console input buffer
1154 BOOL WINAPI
WriteConsoleInputA( HANDLE handle
, INPUT_RECORD
*buffer
,
1155 DWORD count
, LPDWORD written
)
1159 if (written
) *written
= 0;
1160 while (count
&& ret
)
1162 DWORD len
= min( count
, REQUEST_MAX_VAR_SIZE
/sizeof(INPUT_RECORD
) );
1165 struct write_console_input_request
*req
= server_alloc_req( sizeof(*req
),
1166 len
*sizeof(INPUT_RECORD
) );
1167 req
->handle
= handle
;
1168 memcpy( server_data_ptr(req
), buffer
, len
* sizeof(INPUT_RECORD
) );
1169 if ((ret
= !server_call( REQ_WRITE_CONSOLE_INPUT
)))
1171 if (written
) *written
+= req
->written
;
1181 /******************************************************************************
1182 * WriteConsoleInputW [KERNEL32.731] Write data to a console input buffer
1185 BOOL WINAPI
WriteConsoleInputW( HANDLE handle
, INPUT_RECORD
*buffer
,
1186 DWORD count
, LPDWORD written
)
1188 FIXME("(%d,%p,%ld,%p): stub!\n", handle
, buffer
, count
, written
);
1190 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1195 /***********************************************************************
1196 * SetConsoleTitleA (KERNEL32.476)
1198 * Sets the console title.
1200 * We do not necessarily need to create a complex console for that,
1201 * but should remember the title and set it on creation of the latter.
1202 * (not fixed at this time).
1204 BOOL WINAPI
SetConsoleTitleA(LPCSTR title
)
1206 size_t len
= strlen(title
);
1211 if ((hcon
= CreateFileA( "CONOUT$", GENERIC_READ
|GENERIC_WRITE
, 0, NULL
,
1212 OPEN_EXISTING
, 0, 0 )) == INVALID_HANDLE_VALUE
)
1215 len
= min( len
, REQUEST_MAX_VAR_SIZE
);
1218 struct set_console_info_request
*req
= server_alloc_req( sizeof(*req
), len
);
1220 req
->mask
= SET_CONSOLE_INFO_TITLE
;
1221 memcpy( server_data_ptr(req
), title
, len
);
1222 ret
= !server_call( REQ_SET_CONSOLE_INFO
);
1226 if (ret
&& CONSOLE_GetPid( hcon
))
1228 /* only set title for complex console (own xterm) */
1229 WriteFile( hcon
, "\033]2;", 4, &written
, NULL
);
1230 WriteFile( hcon
, title
, strlen(title
), &written
, NULL
);
1231 WriteFile( hcon
, "\a", 1, &written
, NULL
);
1233 CloseHandle( hcon
);
1238 /******************************************************************************
1239 * SetConsoleTitleW [KERNEL32.477] Sets title bar string for console
1242 * title [I] Address of new title
1245 * This should not be calling the A version
1251 BOOL WINAPI
SetConsoleTitleW( LPCWSTR title
)
1255 LPSTR titleA
= HEAP_strdupWtoA( GetProcessHeap(), 0, title
);
1256 ret
= SetConsoleTitleA(titleA
);
1257 HeapFree( GetProcessHeap(), 0, titleA
);
1261 /******************************************************************************
1262 * SetConsoleCursorPosition [KERNEL32.627]
1263 * Sets the cursor position in console
1266 * hConsoleOutput [I] Handle of console screen buffer
1267 * dwCursorPosition [I] New cursor position coordinates
1271 BOOL WINAPI
SetConsoleCursorPosition( HANDLE hcon
, COORD pos
)
1276 /* make console complex only if we change lines, not just in the line */
1278 CONSOLE_make_complex(hcon
);
1280 TRACE("%d (%dx%d)\n", hcon
, pos
.X
, pos
.Y
);
1281 /* x are columns, y rows */
1283 /* full screen cursor absolute positioning */
1284 sprintf(xbuf
,"%c[%d;%dH", 0x1B, pos
.Y
+1, pos
.X
+1);
1286 /* relative cursor positioning in line (\r to go to 0) */
1287 sprintf(xbuf
,"\r%c[%dC", 0x1B, pos
.X
);
1288 /* FIXME: store internal if we start using own console buffers */
1289 WriteFile(hcon
,xbuf
,strlen(xbuf
),&xlen
,NULL
);
1293 /***********************************************************************
1294 * GetNumberOfConsoleInputEvents (KERNEL32.246)
1296 BOOL WINAPI
GetNumberOfConsoleInputEvents(HANDLE hcon
,LPDWORD nrofevents
)
1298 return read_console_input( hcon
, NULL
, 0, nrofevents
, FALSE
);
1301 /***********************************************************************
1302 * GetNumberOfConsoleMouseButtons (KERNEL32.358)
1304 BOOL WINAPI
GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons
)
1306 FIXME("(%p): stub\n", nrofbuttons
);
1311 /******************************************************************************
1312 * GetConsoleCursorInfo [KERNEL32.296] Gets size and visibility of console
1315 * hcon [I] Handle to console screen buffer
1316 * cinfo [O] Address of cursor information
1322 BOOL WINAPI
GetConsoleCursorInfo( HANDLE hcon
, LPCONSOLE_CURSOR_INFO cinfo
)
1328 struct get_console_info_request
*req
= server_alloc_req( sizeof(*req
), 0 );
1330 ret
= !server_call( REQ_GET_CONSOLE_INFO
);
1333 cinfo
->dwSize
= req
->cursor_size
;
1334 cinfo
->bVisible
= req
->cursor_visible
;
1342 /******************************************************************************
1343 * SetConsoleCursorInfo [KERNEL32.626] Sets size and visibility of cursor
1349 BOOL WINAPI
SetConsoleCursorInfo(
1350 HANDLE hcon
, /* [in] Handle to console screen buffer */
1351 LPCONSOLE_CURSOR_INFO cinfo
) /* [in] Address of cursor information */
1357 CONSOLE_make_complex(hcon
);
1358 sprintf(buf
,"\033[?25%c",cinfo
->bVisible
?'h':'l');
1359 WriteFile(hcon
,buf
,strlen(buf
),&xlen
,NULL
);
1363 struct set_console_info_request
*req
= server_alloc_req( sizeof(*req
), 0 );
1365 req
->cursor_size
= cinfo
->dwSize
;
1366 req
->cursor_visible
= cinfo
->bVisible
;
1367 req
->mask
= SET_CONSOLE_INFO_CURSOR
;
1368 ret
= !server_call( REQ_SET_CONSOLE_INFO
);
1375 /******************************************************************************
1376 * SetConsoleWindowInfo [KERNEL32.634] Sets size and position of console
1382 BOOL WINAPI
SetConsoleWindowInfo(
1383 HANDLE hcon
, /* [in] Handle to console screen buffer */
1384 BOOL bAbsolute
, /* [in] Coordinate type flag */
1385 LPSMALL_RECT window
) /* [in] Address of new window rectangle */
1387 FIXME("(%x,%d,%p): stub\n", hcon
, bAbsolute
, window
);
1392 /******************************************************************************
1393 * SetConsoleTextAttribute [KERNEL32.631] Sets colors for text
1395 * Sets the foreground and background color attributes of characters
1396 * written to the screen buffer.
1402 BOOL WINAPI
SetConsoleTextAttribute(HANDLE hConsoleOutput
,WORD wAttr
)
1404 const int colormap
[8] = {
1411 TRACE("(%d,%d)\n",hConsoleOutput
,wAttr
);
1412 sprintf(buffer
,"%c[0;%s3%d;4%dm",
1414 (wAttr
& FOREGROUND_INTENSITY
)?"1;":"",
1416 colormap
[(wAttr
&0x70)>>4]
1418 WriteFile(hConsoleOutput
,buffer
,strlen(buffer
),&xlen
,NULL
);
1423 /******************************************************************************
1424 * SetConsoleScreenBufferSize [KERNEL32.630] Changes size of console
1427 * hConsoleOutput [I] Handle to console screen buffer
1428 * dwSize [I] New size in character rows and cols
1434 BOOL WINAPI
SetConsoleScreenBufferSize( HANDLE hConsoleOutput
,
1437 FIXME("(%d,%dx%d): stub\n",hConsoleOutput
,dwSize
.X
,dwSize
.Y
);
1442 /******************************************************************************
1443 * FillConsoleOutputCharacterA [KERNEL32.242]
1446 * hConsoleOutput [I] Handle to screen buffer
1447 * cCharacter [I] Character to write
1448 * nLength [I] Number of cells to write to
1449 * dwCoord [I] Coords of first cell
1450 * lpNumCharsWritten [O] Pointer to number of cells written
1456 BOOL WINAPI
FillConsoleOutputCharacterA(
1457 HANDLE hConsoleOutput
,
1461 LPDWORD lpNumCharsWritten
)
1466 SetConsoleCursorPosition(hConsoleOutput
,dwCoord
);
1467 for(count
=0;count
<nLength
;count
++)
1468 WriteFile(hConsoleOutput
,&cCharacter
,1,&xlen
,NULL
);
1469 *lpNumCharsWritten
= nLength
;
1474 /******************************************************************************
1475 * FillConsoleOutputCharacterW [KERNEL32.243] Writes characters to console
1478 * hConsoleOutput [I] Handle to screen buffer
1479 * cCharacter [I] Character to write
1480 * nLength [I] Number of cells to write to
1481 * dwCoord [I] Coords of first cell
1482 * lpNumCharsWritten [O] Pointer to number of cells written
1488 BOOL WINAPI
FillConsoleOutputCharacterW(HANDLE hConsoleOutput
,
1492 LPDWORD lpNumCharsWritten
)
1497 SetConsoleCursorPosition(hConsoleOutput
,dwCoord
);
1498 /* FIXME: not quite correct ... but the lower part of UNICODE char comes
1501 for(count
=0;count
<nLength
;count
++)
1502 WriteFile(hConsoleOutput
,&cCharacter
,1,&xlen
,NULL
);
1503 *lpNumCharsWritten
= nLength
;
1508 /******************************************************************************
1509 * FillConsoleOutputAttribute [KERNEL32.241] Sets attributes for console
1512 * hConsoleOutput [I] Handle to screen buffer
1513 * wAttribute [I] Color attribute to write
1514 * nLength [I] Number of cells to write to
1515 * dwCoord [I] Coords of first cell
1516 * lpNumAttrsWritten [O] Pointer to number of cells written
1522 BOOL WINAPI
FillConsoleOutputAttribute( HANDLE hConsoleOutput
,
1523 WORD wAttribute
, DWORD nLength
, COORD dwCoord
,
1524 LPDWORD lpNumAttrsWritten
)
1526 FIXME("(%d,%d,%ld,%dx%d,%p): stub\n", hConsoleOutput
,
1527 wAttribute
,nLength
,dwCoord
.X
,dwCoord
.Y
,lpNumAttrsWritten
);
1528 *lpNumAttrsWritten
= nLength
;
1532 /******************************************************************************
1533 * ReadConsoleOutputCharacterA [KERNEL32.573]
1538 BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE hConsoleOutput
,
1539 LPSTR lpstr
, DWORD dword
, COORD coord
, LPDWORD lpdword
)
1541 FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput
,lpstr
,
1542 dword
,coord
.X
,coord
.Y
,lpdword
);
1543 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1547 /******************************************************************************
1548 * ReadConsoleOutputCharacterW [KERNEL32.574]
1553 BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE hConsoleOutput
,
1554 LPWSTR lpstr
, DWORD dword
, COORD coord
, LPDWORD lpdword
)
1556 FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput
,lpstr
,
1557 dword
,coord
.X
,coord
.Y
,lpdword
);
1558 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1563 /******************************************************************************
1564 * ScrollConsoleScreenBufferA [KERNEL32.612]
1569 BOOL WINAPI
ScrollConsoleScreenBufferA( HANDLE hConsoleOutput
,
1570 LPSMALL_RECT lpScrollRect
, LPSMALL_RECT lpClipRect
,
1571 COORD dwDestOrigin
, LPCHAR_INFO lpFill
)
1573 FIXME("(%d,%p,%p,%dx%d,%p): stub\n", hConsoleOutput
,lpScrollRect
,
1574 lpClipRect
,dwDestOrigin
.X
,dwDestOrigin
.Y
,lpFill
);
1575 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1579 /******************************************************************************
1580 * ScrollConsoleScreenBufferW [KERNEL32.613]
1585 BOOL WINAPI
ScrollConsoleScreenBufferW( HANDLE hConsoleOutput
,
1586 LPSMALL_RECT lpScrollRect
, LPSMALL_RECT lpClipRect
,
1587 COORD dwDestOrigin
, LPCHAR_INFO lpFill
)
1589 FIXME("(%d,%p,%p,%dx%d,%p): stub\n", hConsoleOutput
,lpScrollRect
,
1590 lpClipRect
,dwDestOrigin
.X
,dwDestOrigin
.Y
,lpFill
);
1591 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1595 /******************************************************************************
1596 * ReadConsoleOutputA [KERNEL32.571]
1601 BOOL WINAPI
ReadConsoleOutputA( HANDLE hConsoleOutput
,
1602 LPCHAR_INFO lpBuffer
,
1604 COORD dwBufferCoord
,
1605 LPSMALL_RECT lpReadRegion
)
1607 FIXME("(%d,%p,%dx%d,%dx%d,%p): stub\n", hConsoleOutput
, lpBuffer
,
1608 dwBufferSize
.X
, dwBufferSize
.Y
, dwBufferSize
.X
, dwBufferSize
.Y
,
1611 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1615 /******************************************************************************
1616 * ReadConsoleOutputW [KERNEL32.575]
1621 BOOL WINAPI
ReadConsoleOutputW( HANDLE hConsoleOutput
,
1622 LPCHAR_INFO lpBuffer
,
1624 COORD dwBufferCoord
,
1625 LPSMALL_RECT lpReadRegion
)
1627 FIXME("(%d,%p,%dx%d,%dx%d,%p): stub\n", hConsoleOutput
, lpBuffer
,
1628 dwBufferSize
.X
, dwBufferSize
.Y
, dwBufferSize
.X
, dwBufferSize
.Y
,
1631 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1635 /******************************************************************************
1636 * ReadConsoleOutputAttribute [KERNEL32.572]
1641 BOOL WINAPI
ReadConsoleOutputAttribute( HANDLE hConsoleOutput
,
1645 LPDWORD lpNumberOfAttrsRead
)
1647 FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput
, lpAttribute
,
1648 nLength
, dwReadCoord
.X
, dwReadCoord
.Y
, lpNumberOfAttrsRead
);
1650 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1654 /******************************************************************************
1655 * SetConsoleCP [KERNEL32.572]
1660 BOOL WINAPI
SetConsoleCP( UINT cp
)
1662 FIXME("(%d): stub\n", cp
);
1664 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1668 /******************************************************************************
1669 * SetConsoleInputExeNameW [KERNEL32.889]
1674 BOOL WINAPI
SetConsoleInputExeNameW( LPCWSTR name
)
1676 FIXME("(%s): stub!\n", debugstr_w(name
));
1678 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1682 /******************************************************************************
1683 * SetConsoleInputExeNameA [KERNEL32.888]
1688 BOOL WINAPI
SetConsoleInputExeNameA( LPCSTR name
)
1690 FIXME("(%s): stub!\n", name
);
1692 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);