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 * - Key input translation shouldn't use VkKeyScan and MapVirtualKey, since
14 * they are window (USER) driver dependend.
15 * - Output sometimes is buffered (We switched off buffering by ~ICANON ?)
17 /* Reference applications:
18 * - IDA (interactive disassembler) full version 3.75. Works.
19 * - LYNX/W32. Works mostly, some keys crash it.
29 #include <sys/ioctl.h>
30 #include <sys/types.h>
34 #ifdef HAVE_SYS_ERRNO_H
35 #include <sys/errno.h>
43 #include "wine/winuser16.h"
44 #include "wine/keyboard16.h"
52 #include "debugtools.h"
55 DEFAULT_DEBUG_CHANNEL(console
)
58 /* FIXME: Should be in an internal header file. OK, so which one?
59 Used by CONSOLE_makecomplex. */
60 int wine_openpty(int *master
, int *slave
, char *name
,
61 struct termios
*term
, struct winsize
*winsize
);
63 /****************************************************************************
66 static int CONSOLE_GetPid( HANDLE handle
)
68 struct get_console_info_request
*req
= get_req_buffer();
70 if (server_call( REQ_GET_CONSOLE_INFO
)) return 0;
74 /****************************************************************************
75 * XTERM_string_to_IR [internal]
77 * Transfers a string read from XTERM to INPUT_RECORDs and adds them to the
78 * queue. Does translation of vt100 style function keys and xterm-mouse clicks.
81 CONSOLE_string_to_IR( HANDLE hConsoleInput
,unsigned char *buf
,int len
) {
87 unsigned char inchar
= buf
[j
];
89 if (inchar
!=27) { /* no escape -> 'normal' keyboard event */
90 ir
.EventType
= 1; /* Key_event */
92 ir
.Event
.KeyEvent
.bKeyDown
= 1;
93 ir
.Event
.KeyEvent
.wRepeatCount
= 0;
95 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
97 ir
.Event
.KeyEvent
.dwControlKeyState
|=LEFT_ALT_PRESSED
;
100 #if 0 /* FIXME: cannot call USER functions here */
101 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VkKeyScan16(inchar
);
102 if (ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x0100)
103 ir
.Event
.KeyEvent
.dwControlKeyState
|=SHIFT_PRESSED
;
104 if (ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x0200)
105 ir
.Event
.KeyEvent
.dwControlKeyState
|=LEFT_CTRL_PRESSED
;
106 if (ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x0400)
107 ir
.Event
.KeyEvent
.dwControlKeyState
|=LEFT_ALT_PRESSED
;
108 ir
.Event
.KeyEvent
.wVirtualScanCode
= MapVirtualKey16(
109 ir
.Event
.KeyEvent
.wVirtualKeyCode
& 0x00ff,
110 0 /* VirtualKeyCodes to ScanCode */
113 ir
.Event
.KeyEvent
.wVirtualKeyCode
= 0;
114 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0;
116 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= inchar
;
118 if ((inchar
==127)||(inchar
=='\b')) { /* backspace */
119 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= '\b'; /* FIXME: hmm */
120 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0x0e;
121 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VK_BACK
;
123 if ((inchar
=='\n')||(inchar
=='\r')) {
124 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= '\r';
125 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VK_RETURN
;
126 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0x1c;
127 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
130 /* FIXME: find good values for ^X */
131 ir
.Event
.KeyEvent
.wVirtualKeyCode
= 0xdead;
132 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0xbeef;
137 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
138 ir
.Event
.KeyEvent
.bKeyDown
= 0;
139 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
143 if ((j
==len
-1) || (buf
[j
+1]!='[')) {/* add ESCape on its own */
144 ir
.EventType
= 1; /* Key_event */
145 ir
.Event
.KeyEvent
.bKeyDown
= 1;
146 ir
.Event
.KeyEvent
.wRepeatCount
= 0;
148 #if 0 /* FIXME: cannot call USER functions here */
149 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VkKeyScan16(27);
150 ir
.Event
.KeyEvent
.wVirtualScanCode
= MapVirtualKey16(
151 ir
.Event
.KeyEvent
.wVirtualKeyCode
,0
154 ir
.Event
.KeyEvent
.wVirtualKeyCode
= VK_ESCAPE
;
155 ir
.Event
.KeyEvent
.wVirtualScanCode
= 1;
157 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
158 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= 27;
159 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
160 ir
.Event
.KeyEvent
.bKeyDown
= 0;
161 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
164 for (k
=j
;k
<len
;k
++) {
165 if (((buf
[k
]>='A') && (buf
[k
]<='Z')) ||
166 ((buf
[k
]>='a') && (buf
[k
]<='z')) ||
172 int subid
,scancode
=0;
174 ir
.EventType
= 1; /* Key_event */
175 ir
.Event
.KeyEvent
.bKeyDown
= 1;
176 ir
.Event
.KeyEvent
.wRepeatCount
= 0;
177 ir
.Event
.KeyEvent
.dwControlKeyState
= 0;
179 ir
.Event
.KeyEvent
.wVirtualKeyCode
= 0xad; /* FIXME */
180 ir
.Event
.KeyEvent
.wVirtualScanCode
= 0xad; /* FIXME */
181 ir
.Event
.KeyEvent
.uChar
.AsciiChar
= 0;
185 sscanf(&buf
[j
+2],"%d",&subid
);
187 case 2:/*INS */scancode
= 0xe052;break;
188 case 3:/*DEL */scancode
= 0xe053;break;
189 case 6:/*PGDW*/scancode
= 0xe051;break;
190 case 5:/*PGUP*/scancode
= 0xe049;break;
191 case 11:/*F1 */scancode
= 0x003b;break;
192 case 12:/*F2 */scancode
= 0x003c;break;
193 case 13:/*F3 */scancode
= 0x003d;break;
194 case 14:/*F4 */scancode
= 0x003e;break;
195 case 15:/*F5 */scancode
= 0x003f;break;
196 case 17:/*F6 */scancode
= 0x0040;break;
197 case 18:/*F7 */scancode
= 0x0041;break;
198 case 19:/*F8 */scancode
= 0x0042;break;
199 case 20:/*F9 */scancode
= 0x0043;break;
200 case 21:/*F10 */scancode
= 0x0044;break;
201 case 23:/*F11 */scancode
= 0x00d9;break;
202 case 24:/*F12 */scancode
= 0x00da;break;
203 /* FIXME: Shift-Fx */
205 FIXME("parse ESC[%d~\n",subid
);
209 case 'A': /* Cursor Up */scancode
= 0xe048;break;
210 case 'B': /* Cursor Down */scancode
= 0xe050;break;
211 case 'D': /* Cursor Left */scancode
= 0xe04b;break;
212 case 'C': /* Cursor Right */scancode
= 0xe04d;break;
213 case 'F': /* End */scancode
= 0xe04f;break;
214 case 'H': /* Home */scancode
= 0xe047;break;
216 /* Mouse Button Press (ESCM<button+'!'><x+'!'><y+'!'>) or
217 * Release (ESCM#<x+'!'><y+'!'>
220 ir
.EventType
= MOUSE_EVENT
;
221 ir
.Event
.MouseEvent
.dwMousePosition
.X
= buf
[k
+2]-'!';
222 ir
.Event
.MouseEvent
.dwMousePosition
.Y
= buf
[k
+3]-'!';
224 ir
.Event
.MouseEvent
.dwButtonState
= 0;
226 ir
.Event
.MouseEvent
.dwButtonState
= 1<<(buf
[k
+1]-' ');
227 ir
.Event
.MouseEvent
.dwEventFlags
= 0; /* FIXME */
228 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
237 ir
.Event
.KeyEvent
.wVirtualScanCode
= scancode
;
238 #if 0 /* FIXME: cannot call USER functions here */
239 ir
.Event
.KeyEvent
.wVirtualKeyCode
= MapVirtualKey16(scancode
,1);
241 ir
.Event
.KeyEvent
.wVirtualKeyCode
= 0;
243 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
244 ir
.Event
.KeyEvent
.bKeyDown
= 0;
245 assert(WriteConsoleInputA( hConsoleInput
, &ir
, 1, &junk
));
253 /****************************************************************************
254 * CONSOLE_get_input (internal)
256 * Reads (nonblocking) as much input events as possible and stores them
257 * in an internal queue.
260 CONSOLE_get_input( HANDLE handle
, BOOL blockwait
)
262 char *buf
= HeapAlloc(GetProcessHeap(),0,1);
263 int len
= 0, escape_seen
= 0;
270 /* If we have at one time seen escape in this loop, we are
271 * within an Escape sequence, so wait for a bit more input for the
274 if (WaitForSingleObject( handle
, escape_seen
*10 )) break;
275 if (!ReadFile( handle
, &inchar
, 1, &res
, NULL
)) break;
276 if (!res
) /* res 0 but readable means EOF? Hmm. */
278 buf
= HeapReAlloc(GetProcessHeap(),0,buf
,len
+1);
282 /* If we spot an ESC, we flush all up to it
283 * since we can be sure that we have a complete
286 CONSOLE_string_to_IR(handle
,buf
,len
-1);
287 buf
= HeapReAlloc(GetProcessHeap(),0,buf
,1);
294 CONSOLE_string_to_IR(handle
,buf
,len
);
295 HeapFree(GetProcessHeap(),0,buf
);
298 /******************************************************************************
299 * SetConsoleCtrlHandler [KERNEL32.459] Adds function to calling process list
302 * func [I] Address of handler function
303 * add [I] Handler to add or remove
310 * James Sutherland (JamesSutherland@gmx.de)
311 * Added global variables console_ignore_ctrl_c and handlers[]
312 * Does not yet do any error checking, or set LastError if failed.
313 * This doesn't yet matter, since these handlers are not yet called...!
315 static unsigned int console_ignore_ctrl_c
= 0;
316 static HANDLER_ROUTINE
*handlers
[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
317 BOOL WINAPI
SetConsoleCtrlHandler( HANDLER_ROUTINE
*func
, BOOL add
)
319 unsigned int alloc_loop
= sizeof(handlers
)/sizeof(HANDLER_ROUTINE
*);
320 unsigned int done
= 0;
321 FIXME("(%p,%i) - no error checking or testing yet\n", func
, add
);
324 console_ignore_ctrl_c
= add
;
330 if (!handlers
[alloc_loop
] && !done
)
332 handlers
[alloc_loop
] = func
;
336 FIXME("Out of space on CtrlHandler table\n");
342 if (handlers
[alloc_loop
] == func
&& !done
)
344 handlers
[alloc_loop
] = 0;
348 WARN("Attempt to remove non-installed CtrlHandler %p\n",
356 /******************************************************************************
357 * GenerateConsoleCtrlEvent [KERNEL32.275] Simulate a CTRL-C or CTRL-BREAK
360 * dwCtrlEvent [I] Type of event
361 * dwProcessGroupID [I] Process group ID to send event to
364 * Doesn't yet work...!
368 * Failure: False (and *should* [but doesn't] set LastError)
370 BOOL WINAPI
GenerateConsoleCtrlEvent( DWORD dwCtrlEvent
,
371 DWORD dwProcessGroupID
)
373 if (dwCtrlEvent
!= CTRL_C_EVENT
&& dwCtrlEvent
!= CTRL_BREAK_EVENT
)
375 ERR("invalid event %d for PGID %ld\n",
376 (unsigned short)dwCtrlEvent
, dwProcessGroupID
);
379 if (dwProcessGroupID
== GetCurrentProcessId() )
381 FIXME("Attempt to send event %d to self - stub\n",
382 (unsigned short)dwCtrlEvent
);
385 FIXME("event %d to external PGID %ld - not implemented yet\n",
386 (unsigned short)dwCtrlEvent
, dwProcessGroupID
);
391 /******************************************************************************
392 * CreateConsoleScreenBuffer [KERNEL32.151] Creates a console screen buffer
395 * dwDesiredAccess [I] Access flag
396 * dwShareMode [I] Buffer share mode
397 * sa [I] Security attributes
398 * dwFlags [I] Type of buffer to create
399 * lpScreenBufferData [I] Reserved
402 * Should call SetLastError
405 * Success: Handle to new console screen buffer
406 * Failure: INVALID_HANDLE_VALUE
408 HANDLE WINAPI
CreateConsoleScreenBuffer( DWORD dwDesiredAccess
,
409 DWORD dwShareMode
, LPSECURITY_ATTRIBUTES sa
,
410 DWORD dwFlags
, LPVOID lpScreenBufferData
)
412 FIXME("(%ld,%ld,%p,%ld,%p): stub\n",dwDesiredAccess
,
413 dwShareMode
, sa
, dwFlags
, lpScreenBufferData
);
414 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
415 return INVALID_HANDLE_VALUE
;
419 /***********************************************************************
420 * GetConsoleScreenBufferInfo (KERNEL32.190)
422 BOOL WINAPI
GetConsoleScreenBufferInfo( HANDLE hConsoleOutput
,
423 LPCONSOLE_SCREEN_BUFFER_INFO csbi
)
427 csbi
->dwCursorPosition
.X
= 0;
428 csbi
->dwCursorPosition
.Y
= 0;
429 csbi
->wAttributes
= 0;
430 csbi
->srWindow
.Left
= 0;
431 csbi
->srWindow
.Right
= 79;
432 csbi
->srWindow
.Top
= 0;
433 csbi
->srWindow
.Bottom
= 23;
434 csbi
->dwMaximumWindowSize
.X
= 80;
435 csbi
->dwMaximumWindowSize
.Y
= 24;
440 /******************************************************************************
441 * SetConsoleActiveScreenBuffer [KERNEL32.623] Sets buffer to current console
447 BOOL WINAPI
SetConsoleActiveScreenBuffer(
448 HANDLE hConsoleOutput
) /* [in] Handle to console screen buffer */
450 FIXME("(%x): stub\n", hConsoleOutput
);
455 /***********************************************************************
456 * GetLargestConsoleWindowSize (KERNEL32.226)
458 COORD WINAPI
GetLargestConsoleWindowSize( HANDLE hConsoleOutput
)
466 /* gcc doesn't return structures the same way as dwords */
467 DWORD WINAPI
WIN32_GetLargestConsoleWindowSize( HANDLE hConsoleOutput
)
469 COORD c
= GetLargestConsoleWindowSize( hConsoleOutput
);
473 /***********************************************************************
474 * FreeConsole (KERNEL32.267)
476 BOOL WINAPI
FreeConsole(VOID
)
478 return !server_call( REQ_FREE_CONSOLE
);
482 /*************************************************************************
485 * Open a handle to the current process console.
487 HANDLE
CONSOLE_OpenHandle( BOOL output
, DWORD access
, LPSECURITY_ATTRIBUTES sa
)
490 struct open_console_request
*req
= get_req_buffer();
492 req
->output
= output
;
493 req
->access
= access
;
494 req
->inherit
= (sa
&& (sa
->nLength
>=sizeof(*sa
)) && sa
->bInheritHandle
);
496 if (!server_call( REQ_OPEN_CONSOLE
)) ret
= req
->handle
;
501 /*************************************************************************
502 * CONSOLE_make_complex [internal]
504 * Turns a CONSOLE kernel object into a complex one.
505 * (switches from output/input using the terminal where WINE was started to
508 * This makes simple commandline tools pipeable, while complex commandline
509 * tools work without getting messed up by debugoutput.
511 * All other functions should work indedependend from this call.
513 * To test for complex console: pid == 0 -> simple, otherwise complex.
515 static BOOL
CONSOLE_make_complex(HANDLE handle
)
517 struct set_console_fd_request
*req
= get_req_buffer();
521 int i
,xpid
,master
,slave
,pty_handle
;
523 if (CONSOLE_GetPid( handle
)) return TRUE
; /* already complex */
525 MESSAGE("Console: Making console complex (creating an xterm)...\n");
527 if (tcgetattr(0, &term
) < 0) {
528 /* ignore failure, or we can't run from a script */
530 term
.c_lflag
= ~(ECHO
|ICANON
);
532 if (wine_openpty(&master
, &slave
, NULL
, &term
, NULL
) < 0)
535 if ((xpid
=fork()) == 0) {
536 tcsetattr(slave
, TCSADRAIN
, &term
);
538 sprintf(buf
, "-Sxx%d", master
);
539 /* "-fn vga" for VGA font. Harmless if vga is not present:
540 * xterm: unable to open font "vga", trying "fixed"....
542 execlp("xterm", "xterm", buf
, "-fn","vga",NULL
);
543 ERR("error creating AllocConsole xterm\n");
546 pty_handle
= FILE_DupUnixHandle( slave
, GENERIC_READ
| GENERIC_WRITE
);
549 if (pty_handle
== -1) return FALSE
;
551 /* most xterms like to print their window ID when used with -S;
552 * read it and continue before the user has a chance...
554 for (i
= 0; i
< 10000; i
++)
556 BOOL ok
= ReadFile( pty_handle
, &c
, 1, NULL
, NULL
);
557 if (!ok
&& !c
) usleep(100); /* wait for xterm to be created */
558 else if (c
== '\n') break;
562 ERR("can't read xterm WID\n");
563 CloseHandle( pty_handle
);
566 req
->handle
= handle
;
567 req
->file_handle
= pty_handle
;
569 server_call( REQ_SET_CONSOLE_FD
);
570 CloseHandle( pty_handle
);
572 /* enable mouseclicks */
573 strcpy( buf
, "\033[?1001s\033[?1000h" );
574 WriteFile(handle
,buf
,strlen(buf
),NULL
,NULL
);
576 strcpy( buf
, "\033]2;" );
577 if (GetConsoleTitleA( buf
+ 4, sizeof(buf
) - 5 ))
580 WriteFile(handle
,buf
,strlen(buf
),NULL
,NULL
);
587 /***********************************************************************
588 * AllocConsole (KERNEL32.103)
590 * creates an xterm with a pty to our program
592 BOOL WINAPI
AllocConsole(VOID
)
594 struct alloc_console_request
*req
= get_req_buffer();
596 int handle_in
, handle_out
;
599 req
->access
= GENERIC_READ
| GENERIC_WRITE
| SYNCHRONIZE
;
600 req
->inherit
= FALSE
;
601 if (server_call( REQ_ALLOC_CONSOLE
)) return FALSE
;
602 handle_in
= req
->handle_in
;
603 handle_out
= req
->handle_out
;
605 if (!DuplicateHandle( GetCurrentProcess(), req
->handle_out
, GetCurrentProcess(), &hStderr
,
606 0, TRUE
, DUPLICATE_SAME_ACCESS
))
608 CloseHandle( handle_in
);
609 CloseHandle( handle_out
);
614 /* NT resets the STD_*_HANDLEs on console alloc */
615 SetStdHandle( STD_INPUT_HANDLE
, handle_in
);
616 SetStdHandle( STD_OUTPUT_HANDLE
, handle_out
);
617 SetStdHandle( STD_ERROR_HANDLE
, hStderr
);
619 SetLastError(ERROR_SUCCESS
);
620 SetConsoleTitleA("Wine Console");
625 /******************************************************************************
626 * GetConsoleCP [KERNEL32.295] Returns the OEM code page for the console
631 UINT WINAPI
GetConsoleCP(VOID
)
637 /***********************************************************************
638 * GetConsoleOutputCP (KERNEL32.189)
640 UINT WINAPI
GetConsoleOutputCP(VOID
)
642 return GetConsoleCP();
645 /***********************************************************************
646 * GetConsoleMode (KERNEL32.188)
648 BOOL WINAPI
GetConsoleMode(HANDLE hcon
,LPDWORD mode
)
651 struct get_console_mode_request
*req
= get_req_buffer();
653 if (!server_call( REQ_GET_CONSOLE_MODE
))
655 if (mode
) *mode
= req
->mode
;
662 /******************************************************************************
663 * SetConsoleMode [KERNEL32.628] Sets input mode of console's input buffer
666 * hcon [I] Handle to console input or screen buffer
667 * mode [I] Input or output mode to set
673 BOOL WINAPI
SetConsoleMode( HANDLE hcon
, DWORD mode
)
675 struct set_console_mode_request
*req
= get_req_buffer();
678 return !server_call( REQ_SET_CONSOLE_MODE
);
682 /******************************************************************************
683 * SetConsoleOutputCP [KERNEL32.629] Set the output codepage used by the console
686 * cp [I] code page to set
692 BOOL WINAPI
SetConsoleOutputCP( UINT cp
)
699 /***********************************************************************
700 * GetConsoleTitleA (KERNEL32.191)
702 DWORD WINAPI
GetConsoleTitleA(LPSTR title
,DWORD size
)
704 struct get_console_info_request
*req
= get_req_buffer();
708 if ((hcon
= CreateFileA( "CONOUT$", GENERIC_READ
, 0, NULL
,
709 OPEN_EXISTING
, 0, 0 )) == INVALID_HANDLE_VALUE
)
712 if (!server_call( REQ_GET_CONSOLE_INFO
))
714 lstrcpynA( title
, req
->title
, size
);
715 ret
= strlen(req
->title
);
722 /******************************************************************************
723 * GetConsoleTitleW [KERNEL32.192] Retrieves title string for console
726 * title [O] Address of buffer for title
727 * size [I] Size of buffer
730 * Success: Length of string copied
733 DWORD WINAPI
GetConsoleTitleW( LPWSTR title
, DWORD size
)
738 if (!(tmp
= HeapAlloc( GetProcessHeap(), 0, size
))) return 0;
739 ret
= GetConsoleTitleA( tmp
, size
);
740 lstrcpyAtoW( title
, tmp
);
741 HeapFree( GetProcessHeap(), 0, tmp
);
746 /***********************************************************************
747 * WriteConsoleA (KERNEL32.729)
749 BOOL WINAPI
WriteConsoleA( HANDLE hConsoleOutput
,
751 DWORD nNumberOfCharsToWrite
,
752 LPDWORD lpNumberOfCharsWritten
,
755 /* FIXME: should I check if this is a console handle? */
756 return WriteFile(hConsoleOutput
, lpBuffer
, nNumberOfCharsToWrite
,
757 lpNumberOfCharsWritten
, NULL
);
762 if (bufused==curbufsize-1) \
763 buffer = HeapReAlloc(GetProcessHeap(),0,buffer,(curbufsize+=100));\
765 #define SADD(s) { char *x=s;while (*x) {CADD(*x);x++;}}
767 /***********************************************************************
768 * WriteConsoleOutputA (KERNEL32.732)
770 BOOL WINAPI
WriteConsoleOutputA( HANDLE hConsoleOutput
,
771 LPCHAR_INFO lpBuffer
,
774 LPSMALL_RECT lpWriteRegion
)
776 int i
,j
,off
=0,lastattr
=-1;
778 char sbuf
[20],*buffer
=NULL
;
779 int bufused
=0,curbufsize
= 100;
781 CONSOLE_SCREEN_BUFFER_INFO csbi
;
782 const int colormap
[8] = {
786 CONSOLE_make_complex(hConsoleOutput
);
787 buffer
= HeapAlloc(GetProcessHeap(),0,curbufsize
);
788 offbase
= (dwBufferCoord
.Y
- 1) * dwBufferSize
.X
+
789 (dwBufferCoord
.X
- lpWriteRegion
->Left
);
791 TRACE("orig rect top = %d, bottom=%d, left=%d, right=%d\n",
793 lpWriteRegion
->Bottom
,
798 GetConsoleScreenBufferInfo(hConsoleOutput
, &csbi
);
799 sprintf(sbuf
,"%c7",27);SADD(sbuf
);
801 /* Step 1. Make (Bottom,Right) offset of intersection with
803 lpWriteRegion
->Bottom
= min(lpWriteRegion
->Bottom
, csbi
.dwSize
.Y
-1) -
805 lpWriteRegion
->Right
= min(lpWriteRegion
->Right
, csbi
.dwSize
.X
-1) -
808 /* Step 2. If either offset is negative, then no action
809 should be performed. (Implies that requested rectangle is
810 outside the current screen buffer rectangle.) */
811 if ((lpWriteRegion
->Bottom
< 0) ||
812 (lpWriteRegion
->Right
< 0)) {
813 /* readjust (Bottom Right) for rectangle */
814 lpWriteRegion
->Bottom
+= lpWriteRegion
->Top
;
815 lpWriteRegion
->Right
+= lpWriteRegion
->Left
;
817 TRACE("invisible rect top = %d, bottom=%d, left=%d, right=%d\n",
819 lpWriteRegion
->Bottom
,
824 HeapFree(GetProcessHeap(),0,buffer
);
828 /* Step 3. Intersect with source rectangle */
829 lpWriteRegion
->Bottom
= lpWriteRegion
->Top
- dwBufferCoord
.Y
+
830 min(lpWriteRegion
->Bottom
+ dwBufferCoord
.Y
, dwBufferSize
.Y
-1);
831 lpWriteRegion
->Right
= lpWriteRegion
->Left
- dwBufferCoord
.X
+
832 min(lpWriteRegion
->Right
+ dwBufferCoord
.X
, dwBufferSize
.X
-1);
834 TRACE("clipped rect top = %d, bottom=%d, left=%d,right=%d\n",
836 lpWriteRegion
->Bottom
,
841 /* Validate above computations made sense, if not then issue
842 error and fudge to single character rectangle */
843 if ((lpWriteRegion
->Bottom
< lpWriteRegion
->Top
) ||
844 (lpWriteRegion
->Right
< lpWriteRegion
->Left
)) {
845 ERR("Invalid clipped rectangle top = %d, bottom=%d, left=%d,right=%d\n",
847 lpWriteRegion
->Bottom
,
851 lpWriteRegion
->Bottom
= lpWriteRegion
->Top
;
852 lpWriteRegion
->Right
= lpWriteRegion
->Left
;
855 /* Now do the real processing and move the characters */
856 for (i
=lpWriteRegion
->Top
;i
<=lpWriteRegion
->Bottom
;i
++) {
857 offbase
+= dwBufferSize
.X
;
858 sprintf(sbuf
,"%c[%d;%dH",27,i
+1,lpWriteRegion
->Left
+1);
860 for (j
=lpWriteRegion
->Left
;j
<=lpWriteRegion
->Right
;j
++) {
862 if (lastattr
!=lpBuffer
[off
].Attributes
) {
863 lastattr
= lpBuffer
[off
].Attributes
;
864 sprintf(sbuf
,"%c[0;%s3%d;4%dm",
866 (lastattr
& FOREGROUND_INTENSITY
)?"1;":"",
867 colormap
[lastattr
&7],
868 colormap
[(lastattr
&0x70)>>4]
870 /* FIXME: BACKGROUND_INTENSITY */
873 CADD(lpBuffer
[off
].Char
.AsciiChar
);
876 sprintf(sbuf
,"%c[0m%c8",27,27);SADD(sbuf
);
877 WriteFile(hConsoleOutput
,buffer
,bufused
,&res
,NULL
);
878 HeapFree(GetProcessHeap(),0,buffer
);
882 /***********************************************************************
883 * WriteConsoleOutputW (KERNEL32.734)
885 BOOL WINAPI
WriteConsoleOutputW( HANDLE hConsoleOutput
,
886 LPCHAR_INFO lpBuffer
,
889 LPSMALL_RECT lpWriteRegion
)
891 FIXME("(%d,%p,%dx%d,%dx%d,%p): stub\n", hConsoleOutput
, lpBuffer
,
892 dwBufferSize
.X
,dwBufferSize
.Y
,dwBufferCoord
.X
,dwBufferCoord
.Y
,lpWriteRegion
);
894 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
898 /***********************************************************************
899 * WriteConsoleW (KERNEL32.577)
901 BOOL WINAPI
WriteConsoleW( HANDLE hConsoleOutput
,
903 DWORD nNumberOfCharsToWrite
,
904 LPDWORD lpNumberOfCharsWritten
,
911 n
= WideCharToMultiByte(CP_ACP
,0,lpBuffer
,nNumberOfCharsToWrite
,NULL
,0,NULL
,NULL
);
912 xstring
=HeapAlloc( GetProcessHeap(), 0, n
);
914 n
= WideCharToMultiByte(CP_ACP
,0,lpBuffer
,nNumberOfCharsToWrite
,xstring
,n
,NULL
,NULL
);
916 /* FIXME: should I check if this is a console handle? */
917 ret
= WriteFile(hConsoleOutput
, xstring
, n
,
918 lpNumberOfCharsWritten
, NULL
);
919 /* FIXME: lpNumberOfCharsWritten should be converted to numofchars in UNICODE */
920 HeapFree( GetProcessHeap(), 0, xstring
);
925 /***********************************************************************
926 * ReadConsoleA (KERNEL32.419)
928 BOOL WINAPI
ReadConsoleA( HANDLE hConsoleInput
,
930 DWORD nNumberOfCharsToRead
,
931 LPDWORD lpNumberOfCharsRead
,
935 LPSTR xbuf
= (LPSTR
)lpBuffer
;
938 TRACE("(%d,%p,%ld,%p,%p)\n",
939 hConsoleInput
,lpBuffer
,nNumberOfCharsToRead
,
940 lpNumberOfCharsRead
,lpReserved
943 CONSOLE_get_input(hConsoleInput
,FALSE
);
945 /* FIXME: should we read at least 1 char? The SDK does not say */
946 while (charsread
<nNumberOfCharsToRead
)
948 struct read_console_input_request
*req
= get_req_buffer();
949 req
->handle
= hConsoleInput
;
952 if (server_call( REQ_READ_CONSOLE_INPUT
)) return FALSE
;
953 if (!req
->read
) break;
954 ir
= (LPINPUT_RECORD
)(req
+1);
955 if (!ir
->Event
.KeyEvent
.bKeyDown
)
957 if (ir
->EventType
!= KEY_EVENT
)
959 *xbuf
++ = ir
->Event
.KeyEvent
.uChar
.AsciiChar
;
962 if (lpNumberOfCharsRead
)
963 *lpNumberOfCharsRead
= charsread
;
967 /***********************************************************************
968 * ReadConsoleW (KERNEL32.427)
970 BOOL WINAPI
ReadConsoleW( HANDLE hConsoleInput
,
972 DWORD nNumberOfCharsToRead
,
973 LPDWORD lpNumberOfCharsRead
,
977 LPSTR buf
= (LPSTR
)HeapAlloc(GetProcessHeap(), 0, nNumberOfCharsToRead
);
982 nNumberOfCharsToRead
,
987 lstrcpynAtoW(lpBuffer
,buf
,nNumberOfCharsToRead
);
988 HeapFree( GetProcessHeap(), 0, buf
);
993 /******************************************************************************
994 * ReadConsoleInputA [KERNEL32.569] Reads data from a console
997 * hConsoleInput [I] Handle to console input buffer
998 * lpBuffer [O] Address of buffer for read data
999 * nLength [I] Number of records to read
1000 * lpNumberOfEventsRead [O] Address of number of records read
1006 BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput
, LPINPUT_RECORD lpBuffer
,
1007 DWORD nLength
, LPDWORD lpNumberOfEventsRead
)
1009 struct read_console_input_request
*req
= get_req_buffer();
1011 /* loop until we get at least one event */
1014 req
->handle
= hConsoleInput
;
1015 req
->count
= nLength
;
1017 if (server_call( REQ_READ_CONSOLE_INPUT
)) return FALSE
;
1020 memcpy( lpBuffer
, req
+ 1, req
->read
* sizeof(*lpBuffer
) );
1021 if (lpNumberOfEventsRead
) *lpNumberOfEventsRead
= req
->read
;
1024 CONSOLE_get_input(hConsoleInput
,TRUE
);
1025 /*WaitForSingleObject( hConsoleInput, INFINITE32 );*/
1030 /***********************************************************************
1031 * ReadConsoleInputW (KERNEL32.570)
1033 BOOL WINAPI
ReadConsoleInputW( HANDLE handle
, LPINPUT_RECORD buffer
,
1034 DWORD count
, LPDWORD read
)
1036 /* FIXME: Fix this if we get UNICODE input. */
1037 return ReadConsoleInputA( handle
, buffer
, count
, read
);
1041 /***********************************************************************
1042 * FlushConsoleInputBuffer (KERNEL32.132)
1044 BOOL WINAPI
FlushConsoleInputBuffer( HANDLE handle
)
1046 struct read_console_input_request
*req
= get_req_buffer();
1047 req
->handle
= handle
;
1048 req
->count
= -1; /* get all records */
1050 return !server_call( REQ_READ_CONSOLE_INPUT
);
1054 /***********************************************************************
1055 * PeekConsoleInputA (KERNEL32.550)
1057 * Gets 'count' first events (or less) from input queue.
1059 * Does not need a complex console.
1061 BOOL WINAPI
PeekConsoleInputA( HANDLE handle
, LPINPUT_RECORD buffer
,
1062 DWORD count
, LPDWORD read
)
1064 struct read_console_input_request
*req
= get_req_buffer();
1066 CONSOLE_get_input(handle
,FALSE
);
1068 req
->handle
= handle
;
1071 if (server_call( REQ_READ_CONSOLE_INPUT
)) return FALSE
;
1072 if (req
->read
) memcpy( buffer
, req
+ 1, req
->read
* sizeof(*buffer
) );
1073 if (read
) *read
= req
->read
;
1078 /***********************************************************************
1079 * PeekConsoleInputW (KERNEL32.551)
1081 BOOL WINAPI
PeekConsoleInputW(HANDLE hConsoleInput
,
1082 LPINPUT_RECORD pirBuffer
,
1086 /* FIXME: Hmm. Fix this if we get UNICODE input. */
1087 return PeekConsoleInputA(hConsoleInput
,pirBuffer
,cInRecords
,lpcRead
);
1091 /******************************************************************************
1092 * WriteConsoleInputA [KERNEL32.730] Write data to a console input buffer
1095 BOOL WINAPI
WriteConsoleInputA( HANDLE handle
, INPUT_RECORD
*buffer
,
1096 DWORD count
, LPDWORD written
)
1098 struct write_console_input_request
*req
= get_req_buffer();
1099 const DWORD max
= server_remaining( req
+ 1 ) / sizeof(INPUT_RECORD
);
1101 if (written
) *written
= 0;
1104 DWORD len
= count
< max
? count
: max
;
1106 req
->handle
= handle
;
1107 memcpy( req
+ 1, buffer
, len
* sizeof(*buffer
) );
1108 if (server_call( REQ_WRITE_CONSOLE_INPUT
)) return FALSE
;
1109 if (written
) *written
+= req
->written
;
1116 /******************************************************************************
1117 * WriteConsoleInputW [KERNEL32.731] Write data to a console input buffer
1120 BOOL WINAPI
WriteConsoleInputW( HANDLE handle
, INPUT_RECORD
*buffer
,
1121 DWORD count
, LPDWORD written
)
1123 FIXME("(%d,%p,%ld,%p): stub!\n", handle
, buffer
, count
, written
);
1125 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1130 /***********************************************************************
1131 * SetConsoleTitleA (KERNEL32.476)
1133 * Sets the console title.
1135 * We do not necessarily need to create a complex console for that,
1136 * but should remember the title and set it on creation of the latter.
1137 * (not fixed at this time).
1139 BOOL WINAPI
SetConsoleTitleA(LPCSTR title
)
1141 struct set_console_info_request
*req
= get_req_buffer();
1145 if ((hcon
= CreateFileA( "CONOUT$", GENERIC_READ
|GENERIC_WRITE
, 0, NULL
,
1146 OPEN_EXISTING
, 0, 0 )) == INVALID_HANDLE_VALUE
)
1149 req
->mask
= SET_CONSOLE_INFO_TITLE
;
1150 lstrcpynA( req
->title
, title
, server_remaining(req
->title
) );
1151 if (server_call( REQ_SET_CONSOLE_INFO
)) goto error
;
1152 if (CONSOLE_GetPid( hcon
))
1154 /* only set title for complex console (own xterm) */
1155 WriteFile( hcon
, "\033]2;", 4, &written
, NULL
);
1156 WriteFile( hcon
, title
, strlen(title
), &written
, NULL
);
1157 WriteFile( hcon
, "\a", 1, &written
, NULL
);
1159 CloseHandle( hcon
);
1162 CloseHandle( hcon
);
1167 /******************************************************************************
1168 * SetConsoleTitleW [KERNEL32.477] Sets title bar string for console
1171 * title [I] Address of new title
1174 * This should not be calling the A version
1180 BOOL WINAPI
SetConsoleTitleW( LPCWSTR title
)
1184 LPSTR titleA
= HEAP_strdupWtoA( GetProcessHeap(), 0, title
);
1185 ret
= SetConsoleTitleA(titleA
);
1186 HeapFree( GetProcessHeap(), 0, titleA
);
1190 /******************************************************************************
1191 * SetConsoleCursorPosition [KERNEL32.627]
1192 * Sets the cursor position in console
1195 * hConsoleOutput [I] Handle of console screen buffer
1196 * dwCursorPosition [I] New cursor position coordinates
1200 BOOL WINAPI
SetConsoleCursorPosition( HANDLE hcon
, COORD pos
)
1205 /* make console complex only if we change lines, not just in the line */
1207 CONSOLE_make_complex(hcon
);
1209 TRACE("%d (%dx%d)\n", hcon
, pos
.X
, pos
.Y
);
1210 /* x are columns, y rows */
1212 /* full screen cursor absolute positioning */
1213 sprintf(xbuf
,"%c[%d;%dH", 0x1B, pos
.Y
+1, pos
.X
+1);
1215 /* relative cursor positioning in line (\r to go to 0) */
1216 sprintf(xbuf
,"\r%c[%dC", 0x1B, pos
.X
);
1217 /* FIXME: store internal if we start using own console buffers */
1218 WriteFile(hcon
,xbuf
,strlen(xbuf
),&xlen
,NULL
);
1222 /***********************************************************************
1223 * GetNumberOfConsoleInputEvents (KERNEL32.246)
1225 BOOL WINAPI
GetNumberOfConsoleInputEvents(HANDLE hcon
,LPDWORD nrofevents
)
1227 struct read_console_input_request
*req
= get_req_buffer();
1229 CONSOLE_get_input(hcon
,FALSE
);
1234 if (server_call( REQ_READ_CONSOLE_INPUT
)) return FALSE
;
1235 if (nrofevents
) *nrofevents
= req
->read
;
1239 /***********************************************************************
1240 * GetNumberOfConsoleMouseButtons (KERNEL32.358)
1242 BOOL WINAPI
GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons
)
1244 FIXME("(%p): stub\n", nrofbuttons
);
1249 /******************************************************************************
1250 * GetConsoleCursorInfo [KERNEL32.296] Gets size and visibility of console
1253 * hcon [I] Handle to console screen buffer
1254 * cinfo [O] Address of cursor information
1260 BOOL WINAPI
GetConsoleCursorInfo( HANDLE hcon
, LPCONSOLE_CURSOR_INFO cinfo
)
1262 struct get_console_info_request
*req
= get_req_buffer();
1264 if (server_call( REQ_GET_CONSOLE_INFO
)) return FALSE
;
1267 cinfo
->dwSize
= req
->cursor_size
;
1268 cinfo
->bVisible
= req
->cursor_visible
;
1274 /******************************************************************************
1275 * SetConsoleCursorInfo [KERNEL32.626] Sets size and visibility of cursor
1281 BOOL WINAPI
SetConsoleCursorInfo(
1282 HANDLE hcon
, /* [in] Handle to console screen buffer */
1283 LPCONSOLE_CURSOR_INFO cinfo
) /* [in] Address of cursor information */
1285 struct set_console_info_request
*req
= get_req_buffer();
1289 CONSOLE_make_complex(hcon
);
1290 sprintf(buf
,"\033[?25%c",cinfo
->bVisible
?'h':'l');
1291 WriteFile(hcon
,buf
,strlen(buf
),&xlen
,NULL
);
1294 req
->cursor_size
= cinfo
->dwSize
;
1295 req
->cursor_visible
= cinfo
->bVisible
;
1296 req
->mask
= SET_CONSOLE_INFO_CURSOR
;
1297 return !server_call( REQ_SET_CONSOLE_INFO
);
1301 /******************************************************************************
1302 * SetConsoleWindowInfo [KERNEL32.634] Sets size and position of console
1308 BOOL WINAPI
SetConsoleWindowInfo(
1309 HANDLE hcon
, /* [in] Handle to console screen buffer */
1310 BOOL bAbsolute
, /* [in] Coordinate type flag */
1311 LPSMALL_RECT window
) /* [in] Address of new window rectangle */
1313 FIXME("(%x,%d,%p): stub\n", hcon
, bAbsolute
, window
);
1318 /******************************************************************************
1319 * SetConsoleTextAttribute [KERNEL32.631] Sets colors for text
1321 * Sets the foreground and background color attributes of characters
1322 * written to the screen buffer.
1328 BOOL WINAPI
SetConsoleTextAttribute(HANDLE hConsoleOutput
,WORD wAttr
)
1330 const int colormap
[8] = {
1337 TRACE("(%d,%d)\n",hConsoleOutput
,wAttr
);
1338 sprintf(buffer
,"%c[0;%s3%d;4%dm",
1340 (wAttr
& FOREGROUND_INTENSITY
)?"1;":"",
1342 colormap
[(wAttr
&0x70)>>4]
1344 WriteFile(hConsoleOutput
,buffer
,strlen(buffer
),&xlen
,NULL
);
1349 /******************************************************************************
1350 * SetConsoleScreenBufferSize [KERNEL32.630] Changes size of console
1353 * hConsoleOutput [I] Handle to console screen buffer
1354 * dwSize [I] New size in character rows and cols
1360 BOOL WINAPI
SetConsoleScreenBufferSize( HANDLE hConsoleOutput
,
1363 FIXME("(%d,%dx%d): stub\n",hConsoleOutput
,dwSize
.X
,dwSize
.Y
);
1368 /******************************************************************************
1369 * FillConsoleOutputCharacterA [KERNEL32.242]
1372 * hConsoleOutput [I] Handle to screen buffer
1373 * cCharacter [I] Character to write
1374 * nLength [I] Number of cells to write to
1375 * dwCoord [I] Coords of first cell
1376 * lpNumCharsWritten [O] Pointer to number of cells written
1382 BOOL WINAPI
FillConsoleOutputCharacterA(
1383 HANDLE hConsoleOutput
,
1387 LPDWORD lpNumCharsWritten
)
1392 SetConsoleCursorPosition(hConsoleOutput
,dwCoord
);
1393 for(count
=0;count
<nLength
;count
++)
1394 WriteFile(hConsoleOutput
,&cCharacter
,1,&xlen
,NULL
);
1395 *lpNumCharsWritten
= nLength
;
1400 /******************************************************************************
1401 * FillConsoleOutputCharacterW [KERNEL32.243] Writes characters to console
1404 * hConsoleOutput [I] Handle to screen buffer
1405 * cCharacter [I] Character to write
1406 * nLength [I] Number of cells to write to
1407 * dwCoord [I] Coords of first cell
1408 * lpNumCharsWritten [O] Pointer to number of cells written
1414 BOOL WINAPI
FillConsoleOutputCharacterW(HANDLE hConsoleOutput
,
1418 LPDWORD lpNumCharsWritten
)
1423 SetConsoleCursorPosition(hConsoleOutput
,dwCoord
);
1424 /* FIXME: not quite correct ... but the lower part of UNICODE char comes
1427 for(count
=0;count
<nLength
;count
++)
1428 WriteFile(hConsoleOutput
,&cCharacter
,1,&xlen
,NULL
);
1429 *lpNumCharsWritten
= nLength
;
1434 /******************************************************************************
1435 * FillConsoleOutputAttribute [KERNEL32.241] Sets attributes for console
1438 * hConsoleOutput [I] Handle to screen buffer
1439 * wAttribute [I] Color attribute to write
1440 * nLength [I] Number of cells to write to
1441 * dwCoord [I] Coords of first cell
1442 * lpNumAttrsWritten [O] Pointer to number of cells written
1448 BOOL WINAPI
FillConsoleOutputAttribute( HANDLE hConsoleOutput
,
1449 WORD wAttribute
, DWORD nLength
, COORD dwCoord
,
1450 LPDWORD lpNumAttrsWritten
)
1452 FIXME("(%d,%d,%ld,%dx%d,%p): stub\n", hConsoleOutput
,
1453 wAttribute
,nLength
,dwCoord
.X
,dwCoord
.Y
,lpNumAttrsWritten
);
1454 *lpNumAttrsWritten
= nLength
;
1458 /******************************************************************************
1459 * ReadConsoleOutputCharacterA [KERNEL32.573]
1464 BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE hConsoleOutput
,
1465 LPSTR lpstr
, DWORD dword
, COORD coord
, LPDWORD lpdword
)
1467 FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput
,lpstr
,
1468 dword
,coord
.X
,coord
.Y
,lpdword
);
1469 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1473 /******************************************************************************
1474 * ReadConsoleOutputCharacterW [KERNEL32.574]
1479 BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE hConsoleOutput
,
1480 LPWSTR lpstr
, DWORD dword
, COORD coord
, LPDWORD lpdword
)
1482 FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput
,lpstr
,
1483 dword
,coord
.X
,coord
.Y
,lpdword
);
1484 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1489 /******************************************************************************
1490 * ScrollConsoleScreenBufferA [KERNEL32.612]
1495 BOOL WINAPI
ScrollConsoleScreenBufferA( HANDLE hConsoleOutput
,
1496 LPSMALL_RECT lpScrollRect
, LPSMALL_RECT lpClipRect
,
1497 COORD dwDestOrigin
, LPCHAR_INFO lpFill
)
1499 FIXME("(%d,%p,%p,%dx%d,%p): stub\n", hConsoleOutput
,lpScrollRect
,
1500 lpClipRect
,dwDestOrigin
.X
,dwDestOrigin
.Y
,lpFill
);
1501 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1505 /******************************************************************************
1506 * ScrollConsoleScreenBufferW [KERNEL32.613]
1511 BOOL WINAPI
ScrollConsoleScreenBufferW( HANDLE hConsoleOutput
,
1512 LPSMALL_RECT lpScrollRect
, LPSMALL_RECT lpClipRect
,
1513 COORD dwDestOrigin
, LPCHAR_INFO lpFill
)
1515 FIXME("(%d,%p,%p,%dx%d,%p): stub\n", hConsoleOutput
,lpScrollRect
,
1516 lpClipRect
,dwDestOrigin
.X
,dwDestOrigin
.Y
,lpFill
);
1517 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1521 /******************************************************************************
1522 * ReadConsoleOutputA [KERNEL32.571]
1527 BOOL WINAPI
ReadConsoleOutputA( HANDLE hConsoleOutput
,
1528 LPCHAR_INFO lpBuffer
,
1530 COORD dwBufferCoord
,
1531 LPSMALL_RECT lpReadRegion
)
1533 FIXME("(%d,%p,%dx%d,%dx%d,%p): stub\n", hConsoleOutput
, lpBuffer
,
1534 dwBufferSize
.X
, dwBufferSize
.Y
, dwBufferSize
.X
, dwBufferSize
.Y
,
1537 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1541 /******************************************************************************
1542 * ReadConsoleOutputW [KERNEL32.575]
1547 BOOL WINAPI
ReadConsoleOutputW( HANDLE hConsoleOutput
,
1548 LPCHAR_INFO lpBuffer
,
1550 COORD dwBufferCoord
,
1551 LPSMALL_RECT lpReadRegion
)
1553 FIXME("(%d,%p,%dx%d,%dx%d,%p): stub\n", hConsoleOutput
, lpBuffer
,
1554 dwBufferSize
.X
, dwBufferSize
.Y
, dwBufferSize
.X
, dwBufferSize
.Y
,
1557 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1561 /******************************************************************************
1562 * ReadConsoleOutputAttribute [KERNEL32.572]
1567 BOOL WINAPI
ReadConsoleOutputAttribute( HANDLE hConsoleOutput
,
1571 LPDWORD lpNumberOfAttrsRead
)
1573 FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput
, lpAttribute
,
1574 nLength
, dwReadCoord
.X
, dwReadCoord
.Y
, lpNumberOfAttrsRead
);
1576 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1580 /******************************************************************************
1581 * SetConsoleCP [KERNEL32.572]
1586 BOOL WINAPI
SetConsoleCP( UINT cp
)
1588 FIXME("(%d): stub\n", cp
);
1590 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);