Implementation of custom dialog messages and notifications.
[wine.git] / win32 / console.c
blobbf04381a1467ddd4a2dbb3eda167a490a9d85470
1 /*
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
8 */
10 /* FIXME:
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.
22 #include "config.h"
24 #include <stdlib.h>
25 #include <unistd.h>
26 #include <termios.h>
27 #include <string.h>
28 #include <sys/ioctl.h>
29 #include <sys/types.h>
30 #include <sys/time.h>
31 #include <unistd.h>
32 #include <fcntl.h>
33 #include <errno.h>
34 #ifdef HAVE_SYS_ERRNO_H
35 #include <sys/errno.h>
36 #endif
37 #include <signal.h>
38 #include <assert.h>
40 #include "winbase.h"
41 #include "wine/winuser16.h"
42 #include "wine/keyboard16.h"
43 #include "thread.h"
44 #include "file.h"
45 #include "process.h"
46 #include "winerror.h"
47 #include "wincon.h"
48 #include "heap.h"
49 #include "server.h"
50 #include "debugtools.h"
52 DEFAULT_DEBUG_CHANNEL(console)
55 /* FIXME: Should be in an internal header file. OK, so which one?
56 Used by CONSOLE_makecomplex. */
57 int wine_openpty(int *master, int *slave, char *name,
58 struct termios *term, struct winsize *winsize);
60 /****************************************************************************
61 * CONSOLE_GetPid
63 static int CONSOLE_GetPid( HANDLE handle )
65 struct get_console_info_request *req = get_req_buffer();
66 req->handle = handle;
67 if (server_call( REQ_GET_CONSOLE_INFO )) return 0;
68 return req->pid;
71 /****************************************************************************
72 * XTERM_string_to_IR [internal]
74 * Transfers a string read from XTERM to INPUT_RECORDs and adds them to the
75 * queue. Does translation of vt100 style function keys and xterm-mouse clicks.
77 static void
78 CONSOLE_string_to_IR( HANDLE hConsoleInput,unsigned char *buf,int len) {
79 int j,k;
80 INPUT_RECORD ir;
81 DWORD junk;
83 for (j=0;j<len;j++) {
84 unsigned char inchar = buf[j];
86 if (inchar!=27) { /* no escape -> 'normal' keyboard event */
87 ir.EventType = 1; /* Key_event */
89 ir.Event.KeyEvent.bKeyDown = 1;
90 ir.Event.KeyEvent.wRepeatCount = 0;
92 ir.Event.KeyEvent.dwControlKeyState = 0;
93 if (inchar & 0x80) {
94 ir.Event.KeyEvent.dwControlKeyState|=LEFT_ALT_PRESSED;
95 inchar &= ~0x80;
97 ir.Event.KeyEvent.wVirtualKeyCode = VkKeyScan16(inchar);
98 if (ir.Event.KeyEvent.wVirtualKeyCode & 0x0100)
99 ir.Event.KeyEvent.dwControlKeyState|=SHIFT_PRESSED;
100 if (ir.Event.KeyEvent.wVirtualKeyCode & 0x0200)
101 ir.Event.KeyEvent.dwControlKeyState|=LEFT_CTRL_PRESSED;
102 if (ir.Event.KeyEvent.wVirtualKeyCode & 0x0400)
103 ir.Event.KeyEvent.dwControlKeyState|=LEFT_ALT_PRESSED;
104 ir.Event.KeyEvent.wVirtualScanCode = MapVirtualKey16(
105 ir.Event.KeyEvent.wVirtualKeyCode & 0x00ff,
106 0 /* VirtualKeyCodes to ScanCode */
108 ir.Event.KeyEvent.uChar.AsciiChar = inchar;
110 if (inchar==127) { /* backspace */
111 ir.Event.KeyEvent.uChar.AsciiChar = '\b'; /* FIXME: hmm */
112 ir.Event.KeyEvent.wVirtualScanCode = 0x0e;
113 ir.Event.KeyEvent.wVirtualKeyCode = VK_BACK;
114 } else {
115 if ((inchar=='\n')||(inchar=='\r')) {
116 ir.Event.KeyEvent.uChar.AsciiChar = '\r';
117 ir.Event.KeyEvent.wVirtualKeyCode = VK_RETURN;
118 ir.Event.KeyEvent.wVirtualScanCode = 0x1c;
119 ir.Event.KeyEvent.dwControlKeyState = 0;
120 } else {
121 if (inchar<' ') {
122 /* FIXME: find good values for ^X */
123 ir.Event.KeyEvent.wVirtualKeyCode = 0xdead;
124 ir.Event.KeyEvent.wVirtualScanCode = 0xbeef;
129 assert(WriteConsoleInputA( hConsoleInput, &ir, 1, &junk ));
130 ir.Event.KeyEvent.bKeyDown = 0;
131 assert(WriteConsoleInputA( hConsoleInput, &ir, 1, &junk ));
132 continue;
134 /* inchar is ESC */
135 if ((j==len-1) || (buf[j+1]!='[')) {/* add ESCape on its own */
136 ir.EventType = 1; /* Key_event */
137 ir.Event.KeyEvent.bKeyDown = 1;
138 ir.Event.KeyEvent.wRepeatCount = 0;
140 ir.Event.KeyEvent.wVirtualKeyCode = VkKeyScan16(27);
141 ir.Event.KeyEvent.wVirtualScanCode = MapVirtualKey16(
142 ir.Event.KeyEvent.wVirtualKeyCode,0
144 ir.Event.KeyEvent.dwControlKeyState = 0;
145 ir.Event.KeyEvent.uChar.AsciiChar = 27;
146 assert(WriteConsoleInputA( hConsoleInput, &ir, 1, &junk ));
147 ir.Event.KeyEvent.bKeyDown = 0;
148 assert(WriteConsoleInputA( hConsoleInput, &ir, 1, &junk ));
149 continue;
151 for (k=j;k<len;k++) {
152 if (((buf[k]>='A') && (buf[k]<='Z')) ||
153 ((buf[k]>='a') && (buf[k]<='z')) ||
154 (buf[k]=='~')
156 break;
158 if (k<len) {
159 int subid,scancode=0;
161 ir.EventType = 1; /* Key_event */
162 ir.Event.KeyEvent.bKeyDown = 1;
163 ir.Event.KeyEvent.wRepeatCount = 0;
164 ir.Event.KeyEvent.dwControlKeyState = 0;
166 ir.Event.KeyEvent.wVirtualKeyCode = 0xad; /* FIXME */
167 ir.Event.KeyEvent.wVirtualScanCode = 0xad; /* FIXME */
168 ir.Event.KeyEvent.uChar.AsciiChar = 0;
170 switch (buf[k]) {
171 case '~':
172 sscanf(&buf[j+2],"%d",&subid);
173 switch (subid) {
174 case 2:/*INS */scancode = 0xe052;break;
175 case 3:/*DEL */scancode = 0xe053;break;
176 case 6:/*PGDW*/scancode = 0xe051;break;
177 case 5:/*PGUP*/scancode = 0xe049;break;
178 case 11:/*F1 */scancode = 0x003b;break;
179 case 12:/*F2 */scancode = 0x003c;break;
180 case 13:/*F3 */scancode = 0x003d;break;
181 case 14:/*F4 */scancode = 0x003e;break;
182 case 15:/*F5 */scancode = 0x003f;break;
183 case 17:/*F6 */scancode = 0x0040;break;
184 case 18:/*F7 */scancode = 0x0041;break;
185 case 19:/*F8 */scancode = 0x0042;break;
186 case 20:/*F9 */scancode = 0x0043;break;
187 case 21:/*F10 */scancode = 0x0044;break;
188 case 23:/*F11 */scancode = 0x00d9;break;
189 case 24:/*F12 */scancode = 0x00da;break;
190 /* FIXME: Shift-Fx */
191 default:
192 FIXME("parse ESC[%d~\n",subid);
193 break;
195 break;
196 case 'A': /* Cursor Up */scancode = 0xe048;break;
197 case 'B': /* Cursor Down */scancode = 0xe050;break;
198 case 'D': /* Cursor Left */scancode = 0xe04b;break;
199 case 'C': /* Cursor Right */scancode = 0xe04d;break;
200 case 'F': /* End */scancode = 0xe04f;break;
201 case 'H': /* Home */scancode = 0xe047;break;
202 case 'M':
203 /* Mouse Button Press (ESCM<button+'!'><x+'!'><y+'!'>) or
204 * Release (ESCM#<x+'!'><y+'!'>
206 if (k<len-3) {
207 ir.EventType = MOUSE_EVENT;
208 ir.Event.MouseEvent.dwMousePosition.x = buf[k+2]-'!';
209 ir.Event.MouseEvent.dwMousePosition.y = buf[k+3]-'!';
210 if (buf[k+1]=='#')
211 ir.Event.MouseEvent.dwButtonState = 0;
212 else
213 ir.Event.MouseEvent.dwButtonState = 1<<(buf[k+1]-' ');
214 ir.Event.MouseEvent.dwEventFlags = 0; /* FIXME */
215 assert(WriteConsoleInputA( hConsoleInput, &ir, 1, &junk));
216 j=k+3;
218 break;
219 case 'c':
220 j=k;
221 break;
223 if (scancode) {
224 ir.Event.KeyEvent.wVirtualScanCode = scancode;
225 ir.Event.KeyEvent.wVirtualKeyCode = MapVirtualKey16(scancode,1);
226 assert(WriteConsoleInputA( hConsoleInput, &ir, 1, &junk ));
227 ir.Event.KeyEvent.bKeyDown = 0;
228 assert(WriteConsoleInputA( hConsoleInput, &ir, 1, &junk ));
229 j=k;
230 continue;
236 /****************************************************************************
237 * CONSOLE_get_input (internal)
239 * Reads (nonblocking) as much input events as possible and stores them
240 * in an internal queue.
242 static void
243 CONSOLE_get_input( HANDLE handle, BOOL blockwait )
245 char *buf = HeapAlloc(GetProcessHeap(),0,1);
246 int len = 0;
248 while (1)
250 DWORD res;
251 char inchar;
252 if (WaitForSingleObject( handle, 0 )) break;
253 if (!ReadFile( handle, &inchar, 1, &res, NULL )) break;
254 if (!res) /* res 0 but readable means EOF? Hmm. */
255 break;
256 buf = HeapReAlloc(GetProcessHeap(),0,buf,len+1);
257 buf[len++]=inchar;
259 CONSOLE_string_to_IR(handle,buf,len);
260 HeapFree(GetProcessHeap(),0,buf);
263 /******************************************************************************
264 * SetConsoleCtrlHandler [KERNEL32.459] Adds function to calling process list
266 * PARAMS
267 * func [I] Address of handler function
268 * add [I] Handler to add or remove
270 * RETURNS
271 * Success: TRUE
272 * Failure: FALSE
274 * CHANGED
275 * James Sutherland (JamesSutherland@gmx.de)
276 * Added global variables console_ignore_ctrl_c and handlers[]
277 * Does not yet do any error checking, or set LastError if failed.
278 * This doesn't yet matter, since these handlers are not yet called...!
280 static unsigned int console_ignore_ctrl_c = 0;
281 static HANDLER_ROUTINE *handlers[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
282 BOOL WINAPI SetConsoleCtrlHandler( HANDLER_ROUTINE *func, BOOL add )
284 unsigned int alloc_loop = sizeof(handlers)/sizeof(HANDLER_ROUTINE *);
285 unsigned int done = 0;
286 FIXME("(%p,%i) - no error checking or testing yet\n", func, add);
287 if (!func)
289 console_ignore_ctrl_c = add;
290 return TRUE;
292 if (add)
294 for (;alloc_loop--;)
295 if (!handlers[alloc_loop] && !done)
297 handlers[alloc_loop] = func;
298 done++;
300 if (!done)
301 FIXME("Out of space on CtrlHandler table\n");
302 return(done);
304 else
306 for (;alloc_loop--;)
307 if (handlers[alloc_loop] == func && !done)
309 handlers[alloc_loop] = 0;
310 done++;
312 if (!done)
313 WARN("Attempt to remove non-installed CtrlHandler %p\n",
314 func);
315 return (done);
317 return (done);
321 /******************************************************************************
322 * GenerateConsoleCtrlEvent [KERNEL32.275] Simulate a CTRL-C or CTRL-BREAK
324 * PARAMS
325 * dwCtrlEvent [I] Type of event
326 * dwProcessGroupID [I] Process group ID to send event to
328 * NOTES
329 * Doesn't yet work...!
331 * RETURNS
332 * Success: True
333 * Failure: False (and *should* [but doesn't] set LastError)
335 BOOL WINAPI GenerateConsoleCtrlEvent( DWORD dwCtrlEvent,
336 DWORD dwProcessGroupID )
338 if (dwCtrlEvent != CTRL_C_EVENT && dwCtrlEvent != CTRL_BREAK_EVENT)
340 ERR("invalid event %d for PGID %ld\n",
341 (unsigned short)dwCtrlEvent, dwProcessGroupID );
342 return FALSE;
344 if (dwProcessGroupID == GetCurrentProcessId() )
346 FIXME("Attempt to send event %d to self - stub\n",
347 (unsigned short)dwCtrlEvent );
348 return FALSE;
350 FIXME("event %d to external PGID %ld - not implemented yet\n",
351 (unsigned short)dwCtrlEvent, dwProcessGroupID );
352 return FALSE;
356 /******************************************************************************
357 * CreateConsoleScreenBuffer [KERNEL32.151] Creates a console screen buffer
359 * PARAMS
360 * dwDesiredAccess [I] Access flag
361 * dwShareMode [I] Buffer share mode
362 * sa [I] Security attributes
363 * dwFlags [I] Type of buffer to create
364 * lpScreenBufferData [I] Reserved
366 * NOTES
367 * Should call SetLastError
369 * RETURNS
370 * Success: Handle to new console screen buffer
371 * Failure: INVALID_HANDLE_VALUE
373 HANDLE WINAPI CreateConsoleScreenBuffer( DWORD dwDesiredAccess,
374 DWORD dwShareMode, LPSECURITY_ATTRIBUTES sa,
375 DWORD dwFlags, LPVOID lpScreenBufferData )
377 FIXME("(%ld,%ld,%p,%ld,%p): stub\n",dwDesiredAccess,
378 dwShareMode, sa, dwFlags, lpScreenBufferData);
379 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
380 return INVALID_HANDLE_VALUE;
384 /***********************************************************************
385 * GetConsoleScreenBufferInfo (KERNEL32.190)
387 BOOL WINAPI GetConsoleScreenBufferInfo( HANDLE hConsoleOutput,
388 LPCONSOLE_SCREEN_BUFFER_INFO csbi )
390 csbi->dwSize.x = 80;
391 csbi->dwSize.y = 24;
392 csbi->dwCursorPosition.x = 0;
393 csbi->dwCursorPosition.y = 0;
394 csbi->wAttributes = 0;
395 csbi->srWindow.Left = 0;
396 csbi->srWindow.Right = 79;
397 csbi->srWindow.Top = 0;
398 csbi->srWindow.Bottom = 23;
399 csbi->dwMaximumWindowSize.x = 80;
400 csbi->dwMaximumWindowSize.y = 24;
401 return TRUE;
405 /******************************************************************************
406 * SetConsoleActiveScreenBuffer [KERNEL32.623] Sets buffer to current console
408 * RETURNS
409 * Success: TRUE
410 * Failure: FALSE
412 BOOL WINAPI SetConsoleActiveScreenBuffer(
413 HANDLE hConsoleOutput) /* [in] Handle to console screen buffer */
415 FIXME("(%x): stub\n", hConsoleOutput);
416 return FALSE;
420 /***********************************************************************
421 * GetLargestConsoleWindowSize (KERNEL32.226)
423 DWORD WINAPI GetLargestConsoleWindowSize( HANDLE hConsoleOutput )
425 return (DWORD)MAKELONG(80,24);
428 /***********************************************************************
429 * FreeConsole (KERNEL32.267)
431 BOOL WINAPI FreeConsole(VOID)
433 return !server_call( REQ_FREE_CONSOLE );
437 /*************************************************************************
438 * CONSOLE_OpenHandle
440 * Open a handle to the current process console.
442 HANDLE CONSOLE_OpenHandle( BOOL output, DWORD access, LPSECURITY_ATTRIBUTES sa )
444 int ret = -1;
445 struct open_console_request *req = get_req_buffer();
447 req->output = output;
448 req->access = access;
449 req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
450 SetLastError(0);
451 if (!server_call( REQ_OPEN_CONSOLE )) ret = req->handle;
452 return ret;
456 /*************************************************************************
457 * CONSOLE_make_complex [internal]
459 * Turns a CONSOLE kernel object into a complex one.
460 * (switches from output/input using the terminal where WINE was started to
461 * its own xterm).
463 * This makes simple commandline tools pipeable, while complex commandline
464 * tools work without getting messed up by debugoutput.
466 * All other functions should work indedependend from this call.
468 * To test for complex console: pid == 0 -> simple, otherwise complex.
470 static BOOL CONSOLE_make_complex(HANDLE handle)
472 struct set_console_fd_request *req = get_req_buffer();
473 struct termios term;
474 char buf[256];
475 char c = '\0';
476 int i,xpid,master,slave,pty_handle;
478 if (CONSOLE_GetPid( handle )) return TRUE; /* already complex */
480 MESSAGE("Console: Making console complex (creating an xterm)...\n");
482 if (tcgetattr(0, &term) < 0) {
483 /* ignore failure, or we can't run from a script */
485 term.c_lflag = ~(ECHO|ICANON);
487 if (wine_openpty(&master, &slave, NULL, &term, NULL) < 0)
488 return FALSE;
490 if ((xpid=fork()) == 0) {
491 tcsetattr(slave, TCSADRAIN, &term);
492 close( slave );
493 sprintf(buf, "-Sxx%d", master);
494 /* "-fn vga" for VGA font. Harmless if vga is not present:
495 * xterm: unable to open font "vga", trying "fixed"....
497 execlp("xterm", "xterm", buf, "-fn","vga",NULL);
498 ERR("error creating AllocConsole xterm\n");
499 exit(1);
501 pty_handle = FILE_DupUnixHandle( slave, GENERIC_READ | GENERIC_WRITE );
502 close( master );
503 close( slave );
504 if (pty_handle == -1) return FALSE;
506 /* most xterms like to print their window ID when used with -S;
507 * read it and continue before the user has a chance...
509 for (i = 0; i < 10000; i++)
511 BOOL ok = ReadFile( pty_handle, &c, 1, NULL, NULL );
512 if (!ok && !c) usleep(100); /* wait for xterm to be created */
513 else if (c == '\n') break;
515 if (i == 10000)
517 ERR("can't read xterm WID\n");
518 CloseHandle( pty_handle );
519 return FALSE;
521 req->handle = handle;
522 req->file_handle = pty_handle;
523 req->pid = xpid;
524 server_call( REQ_SET_CONSOLE_FD );
525 CloseHandle( pty_handle );
527 /* enable mouseclicks */
528 strcpy( buf, "\033[?1001s\033[?1000h" );
529 WriteFile(handle,buf,strlen(buf),NULL,NULL);
531 strcpy( buf, "\033]2;" );
532 if (GetConsoleTitleA( buf + 4, sizeof(buf) - 5 ))
534 strcat( buf, "\a" );
535 WriteFile(handle,buf,strlen(buf),NULL,NULL);
537 return TRUE;
542 /***********************************************************************
543 * AllocConsole (KERNEL32.103)
545 * creates an xterm with a pty to our program
547 BOOL WINAPI AllocConsole(VOID)
549 struct alloc_console_request *req = get_req_buffer();
550 HANDLE hStderr;
551 int handle_in, handle_out;
553 TRACE("()\n");
554 req->access = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE;
555 req->inherit = FALSE;
556 if (server_call( REQ_ALLOC_CONSOLE )) return FALSE;
557 handle_in = req->handle_in;
558 handle_out = req->handle_out;
560 if (!DuplicateHandle( GetCurrentProcess(), req->handle_out, GetCurrentProcess(), &hStderr,
561 0, TRUE, DUPLICATE_SAME_ACCESS ))
563 CloseHandle( handle_in );
564 CloseHandle( handle_out );
565 FreeConsole();
566 return FALSE;
569 /* NT resets the STD_*_HANDLEs on console alloc */
570 SetStdHandle( STD_INPUT_HANDLE, handle_in );
571 SetStdHandle( STD_OUTPUT_HANDLE, handle_out );
572 SetStdHandle( STD_ERROR_HANDLE, hStderr );
574 SetLastError(ERROR_SUCCESS);
575 SetConsoleTitleA("Wine Console");
576 return TRUE;
580 /******************************************************************************
581 * GetConsoleCP [KERNEL32.295] Returns the OEM code page for the console
583 * RETURNS
584 * Code page code
586 UINT WINAPI GetConsoleCP(VOID)
588 return GetACP();
592 /***********************************************************************
593 * GetConsoleOutputCP (KERNEL32.189)
595 UINT WINAPI GetConsoleOutputCP(VOID)
597 return GetConsoleCP();
600 /***********************************************************************
601 * GetConsoleMode (KERNEL32.188)
603 BOOL WINAPI GetConsoleMode(HANDLE hcon,LPDWORD mode)
605 BOOL ret = FALSE;
606 struct get_console_mode_request *req = get_req_buffer();
607 req->handle = hcon;
608 if (!server_call( REQ_GET_CONSOLE_MODE ))
610 if (mode) *mode = req->mode;
611 ret = TRUE;
613 return ret;
617 /******************************************************************************
618 * SetConsoleMode [KERNEL32.628] Sets input mode of console's input buffer
620 * PARAMS
621 * hcon [I] Handle to console input or screen buffer
622 * mode [I] Input or output mode to set
624 * RETURNS
625 * Success: TRUE
626 * Failure: FALSE
628 BOOL WINAPI SetConsoleMode( HANDLE hcon, DWORD mode )
630 struct set_console_mode_request *req = get_req_buffer();
631 req->handle = hcon;
632 req->mode = mode;
633 return !server_call( REQ_SET_CONSOLE_MODE );
637 /***********************************************************************
638 * GetConsoleTitleA (KERNEL32.191)
640 DWORD WINAPI GetConsoleTitleA(LPSTR title,DWORD size)
642 struct get_console_info_request *req = get_req_buffer();
643 DWORD ret = 0;
644 HANDLE hcon;
646 if ((hcon = CreateFileA( "CONOUT$", GENERIC_READ, 0, NULL,
647 OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE)
648 return 0;
649 req->handle = hcon;
650 if (!server_call( REQ_GET_CONSOLE_INFO ))
652 lstrcpynA( title, req->title, size );
653 ret = strlen(req->title);
655 CloseHandle( hcon );
656 return ret;
660 /******************************************************************************
661 * GetConsoleTitle32W [KERNEL32.192] Retrieves title string for console
663 * PARAMS
664 * title [O] Address of buffer for title
665 * size [I] Size of buffer
667 * RETURNS
668 * Success: Length of string copied
669 * Failure: 0
671 DWORD WINAPI GetConsoleTitleW( LPWSTR title, DWORD size )
673 char *tmp;
674 DWORD ret;
676 if (!(tmp = HeapAlloc( GetProcessHeap(), 0, size ))) return 0;
677 ret = GetConsoleTitleA( tmp, size );
678 lstrcpyAtoW( title, tmp );
679 HeapFree( GetProcessHeap(), 0, tmp );
680 return ret;
684 /***********************************************************************
685 * WriteConsoleA (KERNEL32.729)
687 BOOL WINAPI WriteConsoleA( HANDLE hConsoleOutput,
688 LPCVOID lpBuffer,
689 DWORD nNumberOfCharsToWrite,
690 LPDWORD lpNumberOfCharsWritten,
691 LPVOID lpReserved )
693 /* FIXME: should I check if this is a console handle? */
694 return WriteFile(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
695 lpNumberOfCharsWritten, NULL);
699 #define CADD(c) \
700 if (bufused==curbufsize-1) \
701 buffer = HeapReAlloc(GetProcessHeap(),0,buffer,(curbufsize+=100));\
702 buffer[bufused++]=c;
703 #define SADD(s) { char *x=s;while (*x) {CADD(*x);x++;}}
705 /***********************************************************************
706 * WriteConsoleOutputA (KERNEL32.732)
708 BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput,
709 LPCHAR_INFO lpBuffer,
710 COORD dwBufferSize,
711 COORD dwBufferCoord,
712 LPSMALL_RECT lpWriteRegion)
714 int i,j,off=0,lastattr=-1;
715 int offbase;
716 char sbuf[20],*buffer=NULL;
717 int bufused=0,curbufsize = 100;
718 DWORD res;
719 CONSOLE_SCREEN_BUFFER_INFO csbi;
720 const int colormap[8] = {
721 0,4,2,6,
722 1,5,3,7,
724 CONSOLE_make_complex(hConsoleOutput);
725 buffer = HeapAlloc(GetProcessHeap(),0,curbufsize);
726 offbase = (dwBufferCoord.y - 1) * dwBufferSize.x +
727 (dwBufferCoord.x - lpWriteRegion->Left);
729 TRACE("orig rect top = %d, bottom=%d, left=%d, right=%d\n",
730 lpWriteRegion->Top,
731 lpWriteRegion->Bottom,
732 lpWriteRegion->Left,
733 lpWriteRegion->Right
736 GetConsoleScreenBufferInfo(hConsoleOutput, &csbi);
738 /* Step 1. Make (Bottom,Right) offset of intersection with
739 Screen Buffer */
740 lpWriteRegion->Bottom = min(lpWriteRegion->Bottom, csbi.dwSize.y-1) -
741 lpWriteRegion->Top;
742 lpWriteRegion->Right = min(lpWriteRegion->Right, csbi.dwSize.x-1) -
743 lpWriteRegion->Left;
745 /* Step 2. If either offset is negative, then no action
746 should be performed. (Implies that requested rectangle is
747 outside the current screen buffer rectangle.) */
748 if ((lpWriteRegion->Bottom < 0) ||
749 (lpWriteRegion->Right < 0)) {
750 /* readjust (Bottom Right) for rectangle */
751 lpWriteRegion->Bottom += lpWriteRegion->Top;
752 lpWriteRegion->Right += lpWriteRegion->Left;
754 TRACE("invisible rect top = %d, bottom=%d, left=%d, right=%d\n",
755 lpWriteRegion->Top,
756 lpWriteRegion->Bottom,
757 lpWriteRegion->Left,
758 lpWriteRegion->Right
761 HeapFree(GetProcessHeap(),0,buffer);
762 return TRUE;
765 /* Step 3. Intersect with source rectangle */
766 lpWriteRegion->Bottom = lpWriteRegion->Top - dwBufferCoord.y +
767 min(lpWriteRegion->Bottom + dwBufferCoord.y, dwBufferSize.y-1);
768 lpWriteRegion->Right = lpWriteRegion->Left - dwBufferCoord.x +
769 min(lpWriteRegion->Right + dwBufferCoord.x, dwBufferSize.x-1);
771 TRACE("clipped rect top = %d, bottom=%d, left=%d,right=%d\n",
772 lpWriteRegion->Top,
773 lpWriteRegion->Bottom,
774 lpWriteRegion->Left,
775 lpWriteRegion->Right
778 /* Validate above computations made sense, if not then issue
779 error and fudge to single character rectangle */
780 if ((lpWriteRegion->Bottom < lpWriteRegion->Top) ||
781 (lpWriteRegion->Right < lpWriteRegion->Left)) {
782 ERR("Invalid clipped rectangle top = %d, bottom=%d, left=%d,right=%d\n",
783 lpWriteRegion->Top,
784 lpWriteRegion->Bottom,
785 lpWriteRegion->Left,
786 lpWriteRegion->Right
788 lpWriteRegion->Bottom = lpWriteRegion->Top;
789 lpWriteRegion->Right = lpWriteRegion->Left;
792 /* Now do the real processing and move the characters */
793 for (i=lpWriteRegion->Top;i<=lpWriteRegion->Bottom;i++) {
794 offbase += dwBufferSize.x;
795 sprintf(sbuf,"%c[%d;%dH",27,i+1,lpWriteRegion->Left+1);
796 SADD(sbuf);
797 for (j=lpWriteRegion->Left;j<=lpWriteRegion->Right;j++) {
798 off = j + offbase;
799 if (lastattr!=lpBuffer[off].Attributes) {
800 lastattr = lpBuffer[off].Attributes;
801 sprintf(sbuf,"%c[0;%s3%d;4%dm",
803 (lastattr & FOREGROUND_INTENSITY)?"1;":"",
804 colormap[lastattr&7],
805 colormap[(lastattr&0x70)>>4]
807 /* FIXME: BACKGROUND_INTENSITY */
808 SADD(sbuf);
810 CADD(lpBuffer[off].Char.AsciiChar);
813 sprintf(sbuf,"%c[0m",27);SADD(sbuf);
814 WriteFile(hConsoleOutput,buffer,bufused,&res,NULL);
815 HeapFree(GetProcessHeap(),0,buffer);
816 return TRUE;
819 /***********************************************************************
820 * WriteConsoleW (KERNEL32.577)
822 BOOL WINAPI WriteConsoleW( HANDLE hConsoleOutput,
823 LPCVOID lpBuffer,
824 DWORD nNumberOfCharsToWrite,
825 LPDWORD lpNumberOfCharsWritten,
826 LPVOID lpReserved )
828 BOOL ret;
829 LPSTR xstring=HeapAlloc( GetProcessHeap(), 0, nNumberOfCharsToWrite );
831 lstrcpynWtoA( xstring, lpBuffer,nNumberOfCharsToWrite);
833 /* FIXME: should I check if this is a console handle? */
834 ret= WriteFile(hConsoleOutput, xstring, nNumberOfCharsToWrite,
835 lpNumberOfCharsWritten, NULL);
836 HeapFree( GetProcessHeap(), 0, xstring );
837 return ret;
841 /***********************************************************************
842 * ReadConsoleA (KERNEL32.419)
844 BOOL WINAPI ReadConsoleA( HANDLE hConsoleInput,
845 LPVOID lpBuffer,
846 DWORD nNumberOfCharsToRead,
847 LPDWORD lpNumberOfCharsRead,
848 LPVOID lpReserved )
850 int charsread = 0;
851 LPSTR xbuf = (LPSTR)lpBuffer;
852 LPINPUT_RECORD ir;
854 TRACE("(%d,%p,%ld,%p,%p)\n",
855 hConsoleInput,lpBuffer,nNumberOfCharsToRead,
856 lpNumberOfCharsRead,lpReserved
859 CONSOLE_get_input(hConsoleInput,FALSE);
861 /* FIXME: should we read at least 1 char? The SDK does not say */
862 while (charsread<nNumberOfCharsToRead)
864 struct read_console_input_request *req = get_req_buffer();
865 req->handle = hConsoleInput;
866 req->count = 1;
867 req->flush = 1;
868 if (server_call( REQ_READ_CONSOLE_INPUT )) return FALSE;
869 if (!req->read) break;
870 ir = (LPINPUT_RECORD)(req+1);
871 if (!ir->Event.KeyEvent.bKeyDown)
872 continue;
873 if (ir->EventType != KEY_EVENT)
874 continue;
875 *xbuf++ = ir->Event.KeyEvent.uChar.AsciiChar;
876 charsread++;
878 if (lpNumberOfCharsRead)
879 *lpNumberOfCharsRead = charsread;
880 return TRUE;
883 /***********************************************************************
884 * ReadConsoleW (KERNEL32.427)
886 BOOL WINAPI ReadConsoleW( HANDLE hConsoleInput,
887 LPVOID lpBuffer,
888 DWORD nNumberOfCharsToRead,
889 LPDWORD lpNumberOfCharsRead,
890 LPVOID lpReserved )
892 BOOL ret;
893 LPSTR buf = (LPSTR)HeapAlloc(GetProcessHeap(), 0, nNumberOfCharsToRead);
895 ret = ReadConsoleA(
896 hConsoleInput,
897 buf,
898 nNumberOfCharsToRead,
899 lpNumberOfCharsRead,
900 lpReserved
902 if (ret)
903 lstrcpynAtoW(lpBuffer,buf,nNumberOfCharsToRead);
904 HeapFree( GetProcessHeap(), 0, buf );
905 return ret;
909 /******************************************************************************
910 * ReadConsoleInput32A [KERNEL32.569] Reads data from a console
912 * PARAMS
913 * hConsoleInput [I] Handle to console input buffer
914 * lpBuffer [O] Address of buffer for read data
915 * nLength [I] Number of records to read
916 * lpNumberOfEventsRead [O] Address of number of records read
918 * RETURNS
919 * Success: TRUE
920 * Failure: FALSE
922 BOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput, LPINPUT_RECORD lpBuffer,
923 DWORD nLength, LPDWORD lpNumberOfEventsRead)
925 struct read_console_input_request *req = get_req_buffer();
927 /* loop until we get at least one event */
928 for (;;)
930 req->handle = hConsoleInput;
931 req->count = nLength;
932 req->flush = 1;
933 if (server_call( REQ_READ_CONSOLE_INPUT )) return FALSE;
934 if (req->read)
936 memcpy( lpBuffer, req + 1, req->read * sizeof(*lpBuffer) );
937 if (lpNumberOfEventsRead) *lpNumberOfEventsRead = req->read;
938 return TRUE;
940 CONSOLE_get_input(hConsoleInput,TRUE);
941 /*WaitForSingleObject( hConsoleInput, INFINITE32 );*/
946 /***********************************************************************
947 * ReadConsoleInput32W (KERNEL32.570)
949 BOOL WINAPI ReadConsoleInputW( HANDLE handle, LPINPUT_RECORD buffer,
950 DWORD count, LPDWORD read )
952 /* FIXME: Fix this if we get UNICODE input. */
953 return ReadConsoleInputA( handle, buffer, count, read );
957 /***********************************************************************
958 * FlushConsoleInputBuffer (KERNEL32.132)
960 BOOL WINAPI FlushConsoleInputBuffer( HANDLE handle )
962 struct read_console_input_request *req = get_req_buffer();
963 req->handle = handle;
964 req->count = -1; /* get all records */
965 req->flush = 1;
966 return !server_call( REQ_READ_CONSOLE_INPUT );
970 /***********************************************************************
971 * PeekConsoleInputA (KERNEL32.550)
973 * Gets 'count' first events (or less) from input queue.
975 * Does not need a complex console.
977 BOOL WINAPI PeekConsoleInputA( HANDLE handle, LPINPUT_RECORD buffer,
978 DWORD count, LPDWORD read )
980 struct read_console_input_request *req = get_req_buffer();
982 CONSOLE_get_input(handle,FALSE);
984 req->handle = handle;
985 req->count = count;
986 req->flush = 0;
987 if (server_call( REQ_READ_CONSOLE_INPUT )) return FALSE;
988 if (req->read) memcpy( buffer, req + 1, req->read * sizeof(*buffer) );
989 if (read) *read = req->read;
990 return TRUE;
994 /***********************************************************************
995 * PeekConsoleInputW (KERNEL32.551)
997 BOOL WINAPI PeekConsoleInputW(HANDLE hConsoleInput,
998 LPINPUT_RECORD pirBuffer,
999 DWORD cInRecords,
1000 LPDWORD lpcRead)
1002 /* FIXME: Hmm. Fix this if we get UNICODE input. */
1003 return PeekConsoleInputA(hConsoleInput,pirBuffer,cInRecords,lpcRead);
1007 /******************************************************************************
1008 * WriteConsoleInput32A [KERNEL32.730] Write data to a console input buffer
1011 BOOL WINAPI WriteConsoleInputA( HANDLE handle, INPUT_RECORD *buffer,
1012 DWORD count, LPDWORD written )
1014 struct write_console_input_request *req = get_req_buffer();
1015 const DWORD max = server_remaining( req + 1 ) / sizeof(INPUT_RECORD);
1017 if (written) *written = 0;
1018 while (count)
1020 DWORD len = count < max ? count : max;
1021 req->count = len;
1022 req->handle = handle;
1023 memcpy( req + 1, buffer, len * sizeof(*buffer) );
1024 if (server_call( REQ_WRITE_CONSOLE_INPUT )) return FALSE;
1025 if (written) *written += req->written;
1026 count -= len;
1027 buffer += len;
1029 return TRUE;
1033 /***********************************************************************
1034 * SetConsoleTitle32A (KERNEL32.476)
1036 * Sets the console title.
1038 * We do not necessarily need to create a complex console for that,
1039 * but should remember the title and set it on creation of the latter.
1040 * (not fixed at this time).
1042 BOOL WINAPI SetConsoleTitleA(LPCSTR title)
1044 struct set_console_info_request *req = get_req_buffer();
1045 HANDLE hcon;
1046 DWORD written;
1048 if ((hcon = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL,
1049 OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE)
1050 return FALSE;
1051 req->handle = hcon;
1052 req->mask = SET_CONSOLE_INFO_TITLE;
1053 lstrcpynA( req->title, title, server_remaining(req->title) );
1054 if (server_call( REQ_SET_CONSOLE_INFO )) goto error;
1055 if (CONSOLE_GetPid( hcon ))
1057 /* only set title for complex console (own xterm) */
1058 WriteFile( hcon, "\033]2;", 4, &written, NULL );
1059 WriteFile( hcon, title, strlen(title), &written, NULL );
1060 WriteFile( hcon, "\a", 1, &written, NULL );
1062 CloseHandle( hcon );
1063 return TRUE;
1064 error:
1065 CloseHandle( hcon );
1066 return FALSE;
1070 /******************************************************************************
1071 * SetConsoleTitle32W [KERNEL32.477] Sets title bar string for console
1073 * PARAMS
1074 * title [I] Address of new title
1076 * NOTES
1077 * This should not be calling the A version
1079 * RETURNS
1080 * Success: TRUE
1081 * Failure: FALSE
1083 BOOL WINAPI SetConsoleTitleW( LPCWSTR title )
1085 BOOL ret;
1087 LPSTR titleA = HEAP_strdupWtoA( GetProcessHeap(), 0, title );
1088 ret = SetConsoleTitleA(titleA);
1089 HeapFree( GetProcessHeap(), 0, titleA );
1090 return ret;
1093 /******************************************************************************
1094 * SetConsoleCursorPosition [KERNEL32.627]
1095 * Sets the cursor position in console
1097 * PARAMS
1098 * hConsoleOutput [I] Handle of console screen buffer
1099 * dwCursorPosition [I] New cursor position coordinates
1101 * RETURNS STD
1103 BOOL WINAPI SetConsoleCursorPosition( HANDLE hcon, COORD pos )
1105 char xbuf[20];
1106 DWORD xlen;
1108 /* make console complex only if we change lines, not just in the line */
1109 if (pos.y)
1110 CONSOLE_make_complex(hcon);
1112 TRACE("%d (%dx%d)\n", hcon, pos.x , pos.y );
1113 /* x are columns, y rows */
1114 if (pos.y)
1115 /* full screen cursor absolute positioning */
1116 sprintf(xbuf,"%c[%d;%dH", 0x1B, pos.y+1, pos.x+1);
1117 else
1118 /* relative cursor positioning in line (\r to go to 0) */
1119 sprintf(xbuf,"\r%c[%dC", 0x1B, pos.x);
1120 /* FIXME: store internal if we start using own console buffers */
1121 WriteFile(hcon,xbuf,strlen(xbuf),&xlen,NULL);
1122 return TRUE;
1125 /***********************************************************************
1126 * GetNumberOfConsoleInputEvents (KERNEL32.246)
1128 BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE hcon,LPDWORD nrofevents)
1130 struct read_console_input_request *req = get_req_buffer();
1132 CONSOLE_get_input(hcon,FALSE);
1134 req->handle = hcon;
1135 req->count = -1;
1136 req->flush = 0;
1137 if (server_call( REQ_READ_CONSOLE_INPUT )) return FALSE;
1138 if (nrofevents) *nrofevents = req->read;
1139 return TRUE;
1142 /***********************************************************************
1143 * GetNumberOfConsoleMouseButtons (KERNEL32.358)
1145 BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons)
1147 FIXME("(%p): stub\n", nrofbuttons);
1148 *nrofbuttons = 2;
1149 return TRUE;
1152 /******************************************************************************
1153 * GetConsoleCursorInfo32 [KERNEL32.296] Gets size and visibility of console
1155 * PARAMS
1156 * hcon [I] Handle to console screen buffer
1157 * cinfo [O] Address of cursor information
1159 * RETURNS
1160 * Success: TRUE
1161 * Failure: FALSE
1163 BOOL WINAPI GetConsoleCursorInfo( HANDLE hcon, LPCONSOLE_CURSOR_INFO cinfo )
1165 struct get_console_info_request *req = get_req_buffer();
1166 req->handle = hcon;
1167 if (server_call( REQ_GET_CONSOLE_INFO )) return FALSE;
1168 if (cinfo)
1170 cinfo->dwSize = req->cursor_size;
1171 cinfo->bVisible = req->cursor_visible;
1173 return TRUE;
1177 /******************************************************************************
1178 * SetConsoleCursorInfo32 [KERNEL32.626] Sets size and visibility of cursor
1180 * RETURNS
1181 * Success: TRUE
1182 * Failure: FALSE
1184 BOOL WINAPI SetConsoleCursorInfo(
1185 HANDLE hcon, /* [in] Handle to console screen buffer */
1186 LPCONSOLE_CURSOR_INFO cinfo) /* [in] Address of cursor information */
1188 struct set_console_info_request *req = get_req_buffer();
1189 char buf[8];
1190 DWORD xlen;
1192 CONSOLE_make_complex(hcon);
1193 sprintf(buf,"\033[?25%c",cinfo->bVisible?'h':'l');
1194 WriteFile(hcon,buf,strlen(buf),&xlen,NULL);
1196 req->handle = hcon;
1197 req->cursor_size = cinfo->dwSize;
1198 req->cursor_visible = cinfo->bVisible;
1199 req->mask = SET_CONSOLE_INFO_CURSOR;
1200 return !server_call( REQ_SET_CONSOLE_INFO );
1204 /******************************************************************************
1205 * SetConsoleWindowInfo [KERNEL32.634] Sets size and position of console
1207 * RETURNS
1208 * Success: TRUE
1209 * Failure: FALSE
1211 BOOL WINAPI SetConsoleWindowInfo(
1212 HANDLE hcon, /* [in] Handle to console screen buffer */
1213 BOOL bAbsolute, /* [in] Coordinate type flag */
1214 LPSMALL_RECT window) /* [in] Address of new window rectangle */
1216 FIXME("(%x,%d,%p): stub\n", hcon, bAbsolute, window);
1217 return TRUE;
1221 /******************************************************************************
1222 * SetConsoleTextAttribute32 [KERNEL32.631] Sets colors for text
1224 * Sets the foreground and background color attributes of characters
1225 * written to the screen buffer.
1227 * RETURNS
1228 * Success: TRUE
1229 * Failure: FALSE
1231 BOOL WINAPI SetConsoleTextAttribute(HANDLE hConsoleOutput,WORD wAttr)
1233 const int colormap[8] = {
1234 0,4,2,6,
1235 1,5,3,7,
1237 DWORD xlen;
1238 char buffer[20];
1240 TRACE("(%d,%d)\n",hConsoleOutput,wAttr);
1241 sprintf(buffer,"%c[0;%s3%d;4%dm",
1243 (wAttr & FOREGROUND_INTENSITY)?"1;":"",
1244 colormap[wAttr&7],
1245 colormap[(wAttr&0x70)>>4]
1247 WriteFile(hConsoleOutput,buffer,strlen(buffer),&xlen,NULL);
1248 return TRUE;
1252 /******************************************************************************
1253 * SetConsoleScreenBufferSize [KERNEL32.630] Changes size of console
1255 * PARAMS
1256 * hConsoleOutput [I] Handle to console screen buffer
1257 * dwSize [I] New size in character rows and cols
1259 * RETURNS
1260 * Success: TRUE
1261 * Failure: FALSE
1263 BOOL WINAPI SetConsoleScreenBufferSize( HANDLE hConsoleOutput,
1264 COORD dwSize )
1266 FIXME("(%d,%dx%d): stub\n",hConsoleOutput,dwSize.x,dwSize.y);
1267 return TRUE;
1271 /******************************************************************************
1272 * FillConsoleOutputCharacterA [KERNEL32.242]
1274 * PARAMS
1275 * hConsoleOutput [I] Handle to screen buffer
1276 * cCharacter [I] Character to write
1277 * nLength [I] Number of cells to write to
1278 * dwCoord [I] Coords of first cell
1279 * lpNumCharsWritten [O] Pointer to number of cells written
1281 * RETURNS
1282 * Success: TRUE
1283 * Failure: FALSE
1285 BOOL WINAPI FillConsoleOutputCharacterA(
1286 HANDLE hConsoleOutput,
1287 BYTE cCharacter,
1288 DWORD nLength,
1289 COORD dwCoord,
1290 LPDWORD lpNumCharsWritten)
1292 long count;
1293 DWORD xlen;
1295 SetConsoleCursorPosition(hConsoleOutput,dwCoord);
1296 for(count=0;count<nLength;count++)
1297 WriteFile(hConsoleOutput,&cCharacter,1,&xlen,NULL);
1298 *lpNumCharsWritten = nLength;
1299 return TRUE;
1303 /******************************************************************************
1304 * FillConsoleOutputCharacterW [KERNEL32.243] Writes characters to console
1306 * PARAMS
1307 * hConsoleOutput [I] Handle to screen buffer
1308 * cCharacter [I] Character to write
1309 * nLength [I] Number of cells to write to
1310 * dwCoord [I] Coords of first cell
1311 * lpNumCharsWritten [O] Pointer to number of cells written
1313 * RETURNS
1314 * Success: TRUE
1315 * Failure: FALSE
1317 BOOL WINAPI FillConsoleOutputCharacterW(HANDLE hConsoleOutput,
1318 WCHAR cCharacter,
1319 DWORD nLength,
1320 COORD dwCoord,
1321 LPDWORD lpNumCharsWritten)
1323 long count;
1324 DWORD xlen;
1326 SetConsoleCursorPosition(hConsoleOutput,dwCoord);
1327 /* FIXME: not quite correct ... but the lower part of UNICODE char comes
1328 * first
1330 for(count=0;count<nLength;count++)
1331 WriteFile(hConsoleOutput,&cCharacter,1,&xlen,NULL);
1332 *lpNumCharsWritten = nLength;
1333 return TRUE;
1337 /******************************************************************************
1338 * FillConsoleOutputAttribute [KERNEL32.241] Sets attributes for console
1340 * PARAMS
1341 * hConsoleOutput [I] Handle to screen buffer
1342 * wAttribute [I] Color attribute to write
1343 * nLength [I] Number of cells to write to
1344 * dwCoord [I] Coords of first cell
1345 * lpNumAttrsWritten [O] Pointer to number of cells written
1347 * RETURNS
1348 * Success: TRUE
1349 * Failure: FALSE
1351 BOOL WINAPI FillConsoleOutputAttribute( HANDLE hConsoleOutput,
1352 WORD wAttribute, DWORD nLength, COORD dwCoord,
1353 LPDWORD lpNumAttrsWritten)
1355 FIXME("(%d,%d,%ld,%dx%d,%p): stub\n", hConsoleOutput,
1356 wAttribute,nLength,dwCoord.x,dwCoord.y,lpNumAttrsWritten);
1357 *lpNumAttrsWritten = nLength;
1358 return TRUE;
1361 /******************************************************************************
1362 * ReadConsoleOutputCharacter32A [KERNEL32.573]
1364 * BUGS
1365 * Unimplemented
1367 BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE hConsoleOutput,
1368 LPSTR lpstr, DWORD dword, COORD coord, LPDWORD lpdword)
1370 FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput,lpstr,
1371 dword,coord.x,coord.y,lpdword);
1372 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1373 return FALSE;
1377 /******************************************************************************
1378 * ScrollConsoleScreenBuffer [KERNEL32.612]
1380 * BUGS
1381 * Unimplemented
1383 BOOL WINAPI ScrollConsoleScreenBuffer( HANDLE hConsoleOutput,
1384 LPSMALL_RECT lpScrollRect, LPSMALL_RECT lpClipRect,
1385 COORD dwDestOrigin, LPCHAR_INFO lpFill)
1387 FIXME("(%d,%p,%p,%dx%d,%p): stub\n", hConsoleOutput,lpScrollRect,
1388 lpClipRect,dwDestOrigin.x,dwDestOrigin.y,lpFill);
1389 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1390 return FALSE;