Changeset 46 for trunk/src/kernel32/console.cpp
- Timestamp:
- Jun 7, 1999, 10:58:22 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/console.cpp
r17 r46 4 4 * 1998/02/10 Patrick Haller (haller@zebra.fh-weingarten.de) 5 5 * 6 * @(#) console.cpp 1.0.0 1998/02/10 PH Start from scratch 6 * @(#) console.cpp 1.0.0 1998/02/10 PH Start from scratch 7 * 8 * Project Odin Software License can be found in LICENSE.TXT 9 * 7 10 */ 8 11 … … 20 23 * Remark * 21 24 ***************************************************************************** 22 25 23 26 - DWORD HandlerRoutine (DWORD dwCtrlType) 24 27 basically an exception handler routine. handles a few signals / excpts. 25 28 should be somewhere near the exception handling code ... :) 26 29 27 30 Hmm, however as PM applications don't really get a ctrl-c signal, 28 31 I'll have to do this on my own ... 29 32 30 33 - supply unicode<->ascii conversions for all the _A and _W function pairs. 31 34 32 35 - problem: we can't prevent thread1 from blocking the message queue ? 33 36 what will happen if a WinTerminate() is issued there ? 34 37 will the message queue be closed and provide smooth tasking ? 35 38 how will open32 react on this ? 36 39 37 40 - ECHO_LINE_INPUT / ReadFile blocks till CR 38 41 39 42 - scrollbars 40 43 * do some flowchart to exactly determine WHEN to use WHICH setting 41 44 and perform WHAT action 42 45 43 46 - clipboard support 44 47 */ 45 48 46 49 47 50 /***************************************************************************** … … 62 65 #include <stdlib.h> 63 66 #include <string.h> 64 #include <odin.h>65 66 67 #include "win32type.h" 67 #include "unicode.h"68 68 #include "misc.h" 69 #include "HandleManager.h"70 69 #include "console.h" 71 70 #include "console2.h" 72 71 #include "conprop.h" 72 #include "unicode.h" 73 #include "HandleManager.h" 73 74 74 75 … … 77 78 ***********************************/ 78 79 79 extern "C" 80 { 81 void _System SetLastError(DWORD dwError); 82 DWORD _System GetLastError(void); 83 LPSTR _System GetCommandLineA(void); 84 void _System ReplaceExceptionHandler(void); 85 void _System ExitProcess(UINT exitcode); 86 HANDLE _System GetStdHandle(DWORD dwDevice); 87 DWORD _System GetFileType(HANDLE hFile); 80 #include <os2sel.h> 81 82 extern "C" 83 { 84 void _System _O32_SetLastError(DWORD dwError); 85 DWORD _System _O32_GetLastError(void); 86 LPSTR _System _O32_GetCommandLine(void); 87 void _System _O32_ReplaceExceptionHandler(void); 88 void _System _O32_ExitProcess(UINT exitcode); 89 HANDLE _System _O32_GetStdHandle(DWORD dwDevice); 90 DWORD _System _O32_GetFileType(HANDLE hFile); 91 92 inline void SetLastError(DWORD a) 93 { 94 USHORT sel = GetFS(); 95 96 _O32_SetLastError(a); 97 SetFS(sel); 98 } 99 100 inline DWORD GetLastError() 101 { 102 DWORD yyrc; 103 USHORT sel = GetFS(); 104 105 yyrc = _O32_GetLastError(); 106 SetFS(sel); 107 108 return yyrc; 109 } 110 111 inline LPSTR GetCommandLine() 112 { 113 LPSTR yyrc; 114 USHORT sel = GetFS(); 115 116 yyrc = _O32_GetCommandLine(); 117 SetFS(sel); 118 119 return yyrc; 120 } 121 122 inline void ReplaceExceptionHandler() 123 { 124 USHORT sel = GetFS(); 125 126 _O32_ReplaceExceptionHandler(); 127 SetFS(sel); 128 } 129 130 inline void ExitProcess(UINT a) 131 { 132 USHORT sel = GetFS(); 133 134 _O32_ExitProcess(a); 135 SetFS(sel); 136 } 137 138 inline HANDLE GetStdHandle(DWORD a) 139 { 140 HANDLE yyrc; 141 USHORT sel = GetFS(); 142 143 yyrc = _O32_GetStdHandle(a); 144 SetFS(sel); 145 146 return yyrc; 147 } 148 149 inline DWORD GetFileType(HANDLE a) 150 { 151 DWORD yyrc; 152 USHORT sel = GetFS(); 153 154 yyrc = _O32_GetFileType(a); 155 SetFS(sel); 156 157 return yyrc; 158 } 159 88 160 } 89 161 … … 180 252 *****************************************************************************/ 181 253 182 254 183 255 static APIRET ConsoleTerminate(void);/* termination of the console subsystem */ 184 256 … … 243 315 HEV hevConsole; /* console event semaphore */ 244 316 APIRET rcConsole; /* initialization status of the console */ 245 HAB 246 HMQ 317 HAB hab; /* anchor block handle */ 318 HMQ hmq; /* message queue handle for the console window */ 247 319 QMSG qmsg; /* message for the console window */ 248 320 ULONG flFrameFlags; /* frame window creation flags */ … … 250 322 HWND hwndFrame; /* frame window handle */ 251 323 HWND hwndClient; /* client window handle */ 252 324 253 325 HWND hwndHorzScroll; /* handle of horizontal scroll bar */ 254 326 HWND hwndVertScroll; /* handle of vertical scroll bar */ 255 327 BOOL fHasVertScroll; /* indicates if scrollbars are visible */ 256 328 BOOL fHasHorzScroll; 257 329 258 330 HDC hdcConsole; /* console device context */ 259 331 PFNWP pfnwpFrameOriginal; /* original frame window procedure */ 260 332 261 333 HWND hwndMenuConsole; /* console popup menu */ 262 334 HMODULE hmodResource; /* resources are stored in KERNEL32.DLL */ 263 335 HPOINTER hPtrConsole; /* console icon */ 264 336 265 337 HANDLE hConsoleBuffer; /* handle of the active console buffer */ 266 338 HANDLE hConsoleBufferDefault; /* handle of the default console buffer */ 267 339 268 340 HVPS hvpsConsole; /* console AVIO presentation space */ 269 341 270 342 COORD coordMaxWindowPels; /* maximum window size in pixels */ 271 343 COORD coordWindowSize; /* current console window size */ 272 344 COORD coordWindowPos; /* scroller's positions */ 273 345 274 346 SHORT sCellCX; /* height and width of a avio cell with the current font */ 275 347 SHORT sCellCY; 276 348 277 349 BOOL fUpdateRequired; /* set to TRUE if next WM_TIMER shall update the */ 278 350 /* AVIO presentation space from the consolebuffer */ … … 281 353 ULONG ulTimerFrequency; /* cursor + blitter timer frequency */ 282 354 ULONG ulTimerCursor; /* cursor loop counter for divisor */ 283 355 284 356 CONSOLEOPTIONS Options; /* the console's options / properties */ 285 357 … … 307 379 308 380 /***************************************************************************** 309 * Name : 310 * Purpose : 311 * Parameters: 312 * Variables : 313 * Result : 314 * Remark : 315 * Status : 381 * Name : 382 * Purpose : 383 * Parameters: 384 * Variables : 385 * Result : 386 * Remark : 387 * Status : 316 388 * 317 389 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 318 390 *****************************************************************************/ 319 391 320 APIRET EXPORT ConsoleInit(void)/* creation of the console subsystem */392 APIRET ConsoleInit(void) /* creation of the console subsystem */ 321 393 { 322 394 APIRET rc; /* API return code */ 323 395 ULONG ulPostCount; /* semaphore post counter */ 324 325 326 396 397 398 327 399 if (ConsoleGlobals.hevConsole != NULLHANDLE) /* we're already initialized ?*/ 328 400 return (NO_ERROR); /* then abort immediately */ 329 401 330 402 /* create console synchronization semaphore */ 331 403 rc = DosCreateEventSem (NULL, … … 335 407 if (rc != NO_ERROR) /* other error ? */ 336 408 return (rc); /* raise error condition */ 337 338 409 410 339 411 /* create console input queue semaphore */ 340 412 rc = DosCreateEventSem (NULL, … … 347 419 return (rc); /* raise error condition */ 348 420 } 349 421 350 422 351 423 /*************************************************************************** 352 424 * Create pseudo-devices and initialize ConsoleGlobals * 353 425 ***************************************************************************/ 354 426 355 427 rc = ConsoleDevicesRegister(); /* ensure devices are there */ 356 428 if (rc != NO_ERROR) /* check for errors */ … … 360 432 return (rc); /* raise error condition */ 361 433 } 362 363 434 435 364 436 /*************************************************************************** 365 437 * Presentation Manager Initialization phase * 366 438 ***************************************************************************/ 367 439 368 440 /* OK, we're about to initialize the console subsystem for this process. */ 369 441 /* start message thread for console object window */ … … 373 445 NULL); 374 446 /* has the thread been created properly ? */ 375 if (ConsoleGlobals.tidConsole == -1) 447 if (ConsoleGlobals.tidConsole == -1) 376 448 { 377 449 DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */ … … 385 457 ConsoleGlobals.Options.ulConsoleThreadPriorityDelta, 386 458 ConsoleGlobals.tidConsole); 387 388 459 460 389 461 /* wait for the child thread to do it's initialization */ 390 462 /* timeout isn't really useful */ … … 398 470 return (rc); /* raise error condition */ 399 471 } 400 472 401 473 DosResetEventSem(ConsoleGlobals.hevConsole, /* reset event semaphore */ 402 474 &ulPostCount); 403 475 404 476 rc = ConsoleGlobals.rcConsole; /* pass thru console thread's return code */ 405 477 406 478 return (rc); /* OK */ 407 479 } … … 412 484 * Purpose : creates and registers console devices if the standard handles 413 485 * are not redirected to a file 414 * Parameters: 415 * Variables : 416 * Result : 417 * Remark : 418 * Status : 486 * Parameters: 487 * Variables : 488 * Result : 489 * Remark : 490 * Status : 419 491 * 420 492 * Author : Patrick Haller [Tue, 1998/03/17 01:55] 421 493 *****************************************************************************/ 422 494 423 APIRET EXPORTConsoleDevicesRegister(void)495 APIRET ConsoleDevicesRegister(void) 424 496 { 425 497 DWORD dwType; /* device handle type */ … … 427 499 HANDLE hStandardOut; /* stdout handle to CONOUT$ */ 428 500 HANDLE hStandardError; /* stderr handle to CONOUT$ */ 429 501 430 502 HMDeviceConsoleInClass *pHMDeviceConsoleIn; 431 503 HMDeviceConsoleOutClass *pHMDeviceConsoleOut; 432 504 HMDeviceConsoleBufferClass *pHMDeviceConsoleBuffer; 433 505 434 506 DWORD rc; 435 507 436 508 static fDevicesInitialized; /* have we been initialized already ? */ 437 509 438 510 if (fDevicesInitialized == TRUE) /* OK, we're already done */ 439 511 return (NO_ERROR); 440 512 else 441 513 fDevicesInitialized = TRUE; 442 514 443 515 dprintf(("KERNEL32:ConsoleDevicesRegister\n")); 444 445 516 517 446 518 /************************************* 447 519 * Initialize Console Window Options * … … 450 522 ConsoleGlobals.Options.fTerminateAutomatically = FALSE; 451 523 ConsoleGlobals.Options.fSpeakerEnabled = TRUE; 452 524 453 525 ConsoleGlobals.Options.fSetWindowPosition = FALSE; 454 526 ConsoleGlobals.Options.coordDefaultPosition.X = 0; … … 460 532 ConsoleGlobals.coordWindowPos.X = 0; 461 533 ConsoleGlobals.coordWindowPos.Y = 0; 462 534 463 535 ConsoleGlobals.Options.fQuickInsert = FALSE; 464 536 ConsoleGlobals.Options.fInsertMode = FALSE; 465 537 ConsoleGlobals.Options.fMouseActions = FALSE; 466 ConsoleGlobals.Options.fToolbarActive = FALSE; 538 ConsoleGlobals.Options.fToolbarActive = FALSE; 467 539 468 540 ConsoleGlobals.Options.ucDefaultAttribute = 0x0007; /* 07 = grey on black */ 469 541 470 542 ConsoleGlobals.Options.ulTabSize = 8; /* tabulator size */ 471 543 ConsoleGlobals.Options.ulUpdateLimit = 8; /* scroll max. n lines */ 472 544 473 545 /* priority settings for message thread */ 474 546 ConsoleGlobals.Options.ulConsoleThreadPriorityClass = PRTYC_REGULAR; 475 547 ConsoleGlobals.Options.ulConsoleThreadPriorityDelta = +10; 476 548 477 549 ConsoleGlobals.Options.ucCursorDivisor = 10; /* timer divisor for blinking */ 478 550 479 551 ConsoleGlobals.ulTimerFrequency = 10; /* cursor + blitter timer frequency */ 480 552 481 553 482 554 ConsoleGlobals.flFrameFlags = FCF_SIZEBORDER | /* frame creation flags */ 483 555 FCF_TITLEBAR | … … 489 561 FCF_VERTSCROLL | 490 562 FCF_MINMAX; 491 563 492 564 /* generate copy of title */ 493 ConsoleGlobals.pszWindowTitle = strdup(GetCommandLine A());494 565 ConsoleGlobals.pszWindowTitle = strdup(GetCommandLine()); 566 495 567 /* obtain module handle to our resources */ 496 568 rc = DosQueryModuleHandle("KERNEL32", … … 499 571 WriteLog("KERNEL32/CONSOLE: Can't get handle to KERNEL32 (%u).\n", 500 572 rc); 501 573 502 574 /* standard console input modes */ 503 575 ConsoleInput.dwConsoleMode = ENABLE_LINE_INPUT | 504 576 ENABLE_PROCESSED_INPUT; 505 577 /* @@@PH ENABLE_ECHO_INPUT || ENABLE_MOUSE_INPUT; */ 506 578 507 579 ConsoleGlobals.hConsoleBufferDefault = INVALID_HANDLE_VALUE; 508 580 ConsoleGlobals.hConsoleBuffer = INVALID_HANDLE_VALUE; 509 510 581 582 511 583 /*************************************************************************** 512 584 * Standard handles Initialization phase * 513 585 ***************************************************************************/ 514 586 515 587 /* create devices and register devices with handlemanager */ 516 588 517 589 pHMDeviceConsoleIn = new HMDeviceConsoleInClass("CONIN$"); 518 590 rc = HMDeviceRegister ("CONIN$", … … 521 593 dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONIN$ failed with %u.\n", 522 594 rc)); 523 524 595 596 525 597 pHMDeviceConsoleOut = new HMDeviceConsoleOutClass("CONOUT$"); 526 598 rc = HMDeviceRegister ("CONOUT$", … … 528 600 if (rc != NO_ERROR) /* check for errors */ 529 601 dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONOUT$ failed with %u.\n", 530 rc)); 531 532 602 rc)); 603 604 533 605 pHMDeviceConsoleBuffer = new HMDeviceConsoleBufferClass("CONBUFFER$"); 534 606 rc = HMDeviceRegister ("CONBUFFER$", … … 536 608 if (rc != NO_ERROR) /* check for errors */ 537 609 dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONBUFFER$ failed with %u.\n", 538 rc)); 539 540 610 rc)); 611 612 541 613 /*********************************************************************** 542 614 * initialize stdin handle * … … 552 624 CONSOLE_TEXTMODE_BUFFER, 553 625 0); 554 626 555 627 HMSetStdHandle(STD_INPUT_HANDLE, 556 628 hStandardIn); 557 629 558 630 /*********************************************************************** 559 631 * initialize stdout handle * … … 568 640 0, 569 641 CONSOLE_TEXTMODE_BUFFER, 570 0); 571 642 0); 643 572 644 HMSetStdHandle(STD_OUTPUT_HANDLE, 573 645 hStandardOut); 574 575 646 647 576 648 /*********************************************************************** 577 649 * initialize stderr handle * … … 587 659 CONSOLE_TEXTMODE_BUFFER, 588 660 0); 589 661 590 662 HMSetStdHandle(STD_ERROR_HANDLE, 591 663 hStandardError); … … 605 677 * leak if an application keeps opening and closing the console 606 678 * frequently. 607 * Status : 679 * Status : 608 680 * 609 681 * Author : Patrick Haller [Tue, 1998/02/10 01:55] … … 613 685 { 614 686 APIRET rc; 615 687 616 688 WinPostMsg (ConsoleGlobals.hwndFrame, /* force thread to terminate */ 617 689 WM_CLOSE, … … 621 693 rc = DosWaitThread(&ConsoleGlobals.tidConsole,/* wait until thd terminates */ 622 694 DCWW_WAIT); 623 695 624 696 /* close the consolebuffer handle */ 625 HMCloseHandle(ConsoleGlobals.hConsoleBufferDefault); 697 HMCloseHandle(ConsoleGlobals.hConsoleBufferDefault); 626 698 free(ConsoleGlobals.pszWindowTitle); /* free previously allocated memory */ 627 699 … … 635 707 * Parameters: VOID 636 708 * Variables : 637 * Result : 638 * Remark : 639 * Status : 709 * Result : 710 * Remark : 711 * Status : 640 712 * 641 713 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 642 714 *****************************************************************************/ 643 715 644 void EXPORTConsoleWaitClose(void)716 void ConsoleWaitClose(void) 645 717 { 646 718 CHAR szBuffer[128]; /* buffer for the title */ 647 719 BOOL fResult; /* result from subsequent calls to Win32 APIs */ 648 720 649 721 /* check if there is a console window at all */ 650 722 if (ConsoleIsActive() == FALSE) 651 723 return; /* nope */ 652 724 653 725 strcpy (szBuffer, /* indicate console process has terminated */ 654 726 "Completed: "); 655 656 fResult = OS2GetConsoleTitleA(szBuffer + 11,/* 11 is length of Completed:_ */727 728 fResult = GetConsoleTitleA(szBuffer + 11,/* 11 is length of Completed:_ */ 657 729 sizeof(szBuffer) - 11); 658 730 659 731 660 732 /* Set new title: Win32 Console - Terminated */ 661 fResult = OS2SetConsoleTitleA(szBuffer);662 733 fResult = SetConsoleTitleA(szBuffer); 734 663 735 /* terminate console immediately ? */ 664 736 if (ConsoleGlobals.Options.fTerminateAutomatically == FALSE) … … 673 745 * Parameters: VOID 674 746 * Variables : 675 * Result : 676 * Remark : 677 * Status : 747 * Result : 748 * Remark : 749 * Status : 678 750 * 679 751 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 680 752 *****************************************************************************/ 681 753 682 BOOL EXPORTConsoleIsActive(void)754 BOOL ConsoleIsActive(void) 683 755 { 684 756 return (NULLHANDLE != ConsoleGlobals.hevConsole); … … 693 765 * Result : is placed in Globals.rcConsole 694 766 * Remark : the main thread has to wait for this thread 695 * Status : 767 * Status : 696 768 * 697 769 * Author : Patrick Haller [Tue, 1998/02/10 02:49] … … 701 773 { 702 774 APIRET rc; /* API return code */ 703 704 775 776 705 777 ConsoleGlobals.rcConsole = NO_ERROR; /* initialization */ 706 778 707 779 ConsoleGlobals.hab = WinInitialize(0); /* enable thread for PM */ 708 780 if (ConsoleGlobals.hab == NULLHANDLE) /* if anchor block allocation failed */ 709 ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY; 781 ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY; 710 782 else 711 783 { 712 784 /* create message queue */ 713 ConsoleGlobals.hmq = WinCreateMsgQueue(ConsoleGlobals.hab, 785 ConsoleGlobals.hmq = WinCreateMsgQueue(ConsoleGlobals.hab, 714 786 0); 715 787 if (ConsoleGlobals.hmq == NULLHANDLE) /* if msg queue allocation failed */ 716 788 { 717 789 WinTerminate(ConsoleGlobals.hab); /* stop thread from accessing PM */ 718 ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY; 790 ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY; 719 791 } 720 792 else … … 724 796 ConsoleWindowProc, 725 797 CS_SIZEREDRAW, 726 0) 798 0) 727 799 == FALSE) 728 800 { … … 751 823 } /* WinCreateMsgQueue */ 752 824 } /* WinInitialize */ 753 754 825 826 755 827 DosPostEventSem(ConsoleGlobals.hevConsole); /* signal the main thread */ 756 757 828 829 758 830 if (ConsoleGlobals.rcConsole != NO_ERROR) /* if we ran into a problem */ 759 831 { … … 763 835 return; /* abort the message queue thread immediately */ 764 836 } 765 766 837 838 767 839 while( WinGetMsg(ConsoleGlobals.hab, /* message loop */ 768 840 &ConsoleGlobals.qmsg, 769 841 NULLHANDLE, 770 842 0, 771 0) ) 843 0) ) 772 844 WinDispatchMsg(ConsoleGlobals.hab, /* dispatch the message */ 773 845 &ConsoleGlobals.qmsg); 774 846 775 847 /* do the cleanup, destroy window, queue */ 776 848 /* and stop thread from using PM */ 777 WinDestroyWindow (ConsoleGlobals.hwndFrame); 778 WinDestroyMsgQueue(ConsoleGlobals.hmq); 849 WinDestroyWindow (ConsoleGlobals.hwndFrame); 850 WinDestroyMsgQueue(ConsoleGlobals.hmq); 779 851 WinTerminate (ConsoleGlobals.hab); 780 852 781 853 /* destruction of semaphore indicates console is shutdown */ 782 854 DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */ 783 DosCloseEventSem(ConsoleGlobals.hevConsole); 855 DosCloseEventSem(ConsoleGlobals.hevConsole); 784 856 ConsoleGlobals.hevConsole = NULLHANDLE; /* for ConsoleIsActive() */ 785 857 ConsoleInput.hevInputQueue = NULLHANDLE; 786 858 787 859 /* @@@PH we've got to exit the process here ! */ 788 860 ExitProcess(1); … … 799 871 * Variables : 800 872 * Result : MRESULT for PM 801 * Remark : 802 * Status : 873 * Remark : 874 * Status : 803 875 * 804 876 * Author : Patrick Haller [Tue, 1998/02/10 03:24] … … 813 885 static HPS hps; 814 886 815 switch(msg) 887 switch(msg) 816 888 { 817 889 /************************************************************************* 818 890 * WM_CREATE window creation * 819 891 *************************************************************************/ 820 892 821 893 case WM_CREATE: 822 894 WinPostMsg(hwnd, /* deferred initialization */ … … 825 897 (MPARAM)NULL); 826 898 break; 827 828 899 900 829 901 case UM_CONSOLE_CREATE: 830 902 { … … 835 907 hwndFrame = ConsoleGlobals.hwndFrame; 836 908 ConsoleGlobals.pfnwpFrameOriginal = WinSubclassWindow(hwndFrame, 837 ConsoleFrameWindowProc); 909 ConsoleFrameWindowProc); 838 910 839 911 ConsoleGlobals.hwndMenuConsole … … 850 922 (MPARAM)ConsoleGlobals.hPtrConsole, 851 923 0L ); 852 924 853 925 /* determine handles of the horizontal / vertical scroll bars */ 854 926 ConsoleGlobals.hwndVertScroll = WinWindowFromID(ConsoleGlobals.hwndFrame, 855 927 FID_VERTSCROLL); 856 928 857 929 ConsoleGlobals.hwndHorzScroll = WinWindowFromID(ConsoleGlobals.hwndFrame, 858 930 FID_HORZSCROLL); 859 931 860 932 /* the initial state of the controls is DETACHED */ 861 933 WinSetParent(ConsoleGlobals.hwndHorzScroll, /* detach control */ 862 934 HWND_OBJECT, 863 935 FALSE); 864 936 865 937 WinSetParent(ConsoleGlobals.hwndVertScroll, /* detach control */ 866 938 HWND_OBJECT, 867 FALSE); 868 869 939 FALSE); 940 941 870 942 /* create AVIO presentation space */ 871 943 rc = VioCreatePS(&ConsoleGlobals.hvpsConsole, … … 878 950 WriteLog("KERNEL32/CONSOLE:VioCreatePS=%u\n", 879 951 rc); 880 952 881 953 /* PH 1998/02/12 this seems to be an OS/2 PM bug: 882 954 when doing a WinOpenWindowDC here, PM hangs. Seems it never gets back into 883 955 the message loop. To investigate and report to IBM 884 956 */ 885 957 886 958 /* get a device context for the client window */ 887 959 ConsoleGlobals.hdcConsole = WinOpenWindowDC(hwnd); … … 891 963 if (rc != NO_ERROR) /* check errors */ 892 964 WriteLog("KERNEL32/CONSOLE:VioAssociate=%u\n", 893 rc); 965 rc); 894 966 895 967 ConsoleFontQuery(); /* query current cell sizes */ 896 968 897 969 /* adjust window size and position */ 898 970 HMDeviceRequest(ConsoleGlobals.hConsoleBuffer, … … 901 973 0, 902 974 0, 903 0); 904 975 0); 976 905 977 /* @@@PH if console is maximized - now switched on per default ! */ 906 WinSetWindowPos (ConsoleGlobals.hwndFrame, 978 WinSetWindowPos (ConsoleGlobals.hwndFrame, 907 979 HWND_DESKTOP, 908 980 0, … … 916 988 2 * WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER), 917 989 SWP_SIZE); 918 990 919 991 /* do we have to set the window position also ? */ 920 992 if (ConsoleGlobals.Options.fSetWindowPosition == TRUE) 921 WinSetWindowPos (ConsoleGlobals.hwndFrame, 993 WinSetWindowPos (ConsoleGlobals.hwndFrame, 922 994 HWND_DESKTOP, 923 995 ConsoleGlobals.Options.coordDefaultPosition.X, … … 926 998 0, 927 999 SWP_MOVE); 928 1000 929 1001 /* start timer service for blitting and cursor blinking */ 930 1002 ConsoleGlobals.idTimer = WinStartTimer (ConsoleGlobals.hab, 931 hwnd, 1003 hwnd, 932 1004 CONSOLE_TIMER_ID, /* timer id */ 933 1005 ConsoleGlobals.ulTimerFrequency); … … 939 1011 } 940 1012 break; 941 942 1013 1014 943 1015 /************************************************************************* 944 1016 * WM_DESTROY window destruction * 945 1017 *************************************************************************/ 946 1018 947 1019 case WM_DESTROY: 948 1020 WinStopTimer (ConsoleGlobals.hab, /* anchor block */ 949 1021 hwnd, 950 1022 ConsoleGlobals.idTimer); /* timer ID */ 951 1023 952 1024 VioAssociate(NULL, 953 1025 ConsoleGlobals.hvpsConsole); /* disassociates the AVIO PS */ 954 1026 VioDestroyPS(ConsoleGlobals.hvpsConsole); /* destroys the AVIO PS */ 955 1027 956 1028 WinDestroyWindow(ConsoleGlobals.hwndMenuConsole); 957 1029 WinDestroyPointer(ConsoleGlobals.hPtrConsole); 958 1030 break; 959 960 1031 1032 961 1033 /************************************************************************* 962 1034 * WM_TIMER display cursor and update AVIO PS if required * 963 1035 *************************************************************************/ 964 1036 965 1037 case WM_TIMER: 966 1038 /* check if console has to be updated */ … … 968 1040 { 969 1041 ConsoleGlobals.fUpdateRequired = FALSE; /* as soon as possible ! */ 970 1042 971 1043 /* as device to map itself to the VIO buffer */ 972 1044 HMDeviceRequest(ConsoleGlobals.hConsoleBuffer, … … 976 1048 0, 977 1049 0); 978 1050 979 1051 { /* DEBUG */ 980 1052 APIRET rc; … … 984 1056 0, 985 1057 ConsoleGlobals.hvpsConsole); 986 1058 987 1059 dprintf(("KERNEL32::Console::1 VioShowPS(%u,%u,%u)=%u\n", 988 1060 ConsoleGlobals.coordWindowSize.Y, … … 991 1063 rc)); 992 1064 } 993 1065 994 1066 /* cursor is overwritten here ! */ 995 1067 HMDeviceRequest(ConsoleGlobals.hConsoleBuffer, … … 998 1070 0, 999 1071 0, 1000 0); 1072 0); 1001 1073 } 1002 1074 else … … 1017 1089 break; 1018 1090 1019 1091 1020 1092 /************************************************************************* 1021 1093 * WM_MINMAXFRAME handle window repaint in case of iconized window * 1022 1094 *************************************************************************/ 1023 1095 1024 1096 case WM_MINMAXFRAME : 1025 1097 { 1026 1098 BOOL fShow = ! (((PSWP) mp1)->fl & SWP_MINIMIZE); 1027 HENUM henum; 1099 HENUM henum; 1028 1100 HWND hwndChild; 1029 1101 … … 1038 1110 } 1039 1111 break; 1040 1041 1112 1113 1042 1114 /************************************************************************* 1043 1115 * WM_PAINT repaint the window * … … 1055 1127 0, 1056 1128 ConsoleGlobals.hvpsConsole); 1057 1129 1058 1130 dprintf(("KERNEL32::Console::2 VioShowPS(%u,%u,%u)=%u\n", 1059 1131 ConsoleGlobals.coordWindowSize.Y, … … 1062 1134 rc)); 1063 1135 } 1064 1136 1065 1137 WinEndPaint(hps); 1066 1138 break; 1067 1068 1139 1140 1069 1141 /************************************************************************* 1070 1142 * WM_SIZE resize the window * … … 1078 1150 0, 1079 1151 0, 1080 0); 1081 1152 0); 1153 1082 1154 return WinDefAVioWindowProc(hwnd, 1083 1155 (USHORT)msg, … … 1085 1157 (ULONG)mp2); 1086 1158 } 1087 1088 1159 1160 1089 1161 /************************************************************************* 1090 1162 * context menue * … … 1098 1170 SHORT2FROMMP(mp1), 1099 1171 CM_CONSOLE_PROPERTIES, /* item id */ 1100 PU_HCONSTRAIN | 1172 PU_HCONSTRAIN | 1101 1173 PU_VCONSTRAIN | 1102 1174 PU_KEYBOARD | … … 1106 1178 } 1107 1179 return (MPARAM)FALSE; 1108 1109 1180 1181 1110 1182 /************************************************************************* 1111 1183 * WM_COMMAND command processing * … … 1117 1189 /* close console window, however we can't call ConsoleTerminate here!*/ 1118 1190 case CM_CONSOLE_EXIT: 1119 WinPostMsg (ConsoleGlobals.hwndFrame, 1191 WinPostMsg (ConsoleGlobals.hwndFrame, 1120 1192 WM_CLOSE, 1121 1193 (MPARAM)NULL, … … 1123 1195 1124 1196 return (MPARAM)FALSE; 1125 1126 1197 1198 1127 1199 case CM_CONSOLE_REPAINT: 1128 1200 WinInvalidateRect(ConsoleGlobals.hwndClient,/* redraw frame window */ … … 1135 1207 { 1136 1208 ULONG ulResult; /* response from user */ 1137 1209 1138 1210 ConsoleGlobals.Options.hmodResources = /* save module handle */ 1139 1211 ConsoleGlobals.hmodResource; 1140 1212 1141 1213 ulResult = WinDlgBox(HWND_DESKTOP, 1142 1214 ConsoleGlobals.hwndClient, … … 1145 1217 DLG_CONSOLE_PROPERTIES, 1146 1218 (PVOID)&ConsoleGlobals.Options); 1147 /* @@@PH update settings if necessary */1148 1149 1219 return (MPARAM) FALSE; 1150 1220 } … … 1153 1223 break; 1154 1224 1155 1225 1156 1226 /************************************************************************* 1157 1227 * WM_CHAR keyboard char processing * 1158 1228 *************************************************************************/ 1159 1229 1160 1230 case WM_CHAR: 1161 1231 ConsoleInputEventPushKey(mp1, /* push event into queue */ 1162 1232 mp2); 1163 1233 break; /* enable further processing ! */ 1164 1165 1234 1235 1166 1236 /************************************************************************* 1167 1237 * WM_SETFOCUS focus changing processing * 1168 1238 *************************************************************************/ 1169 1239 1170 1240 case WM_SETFOCUS: 1171 1241 ConsoleInputEventPushFocus((BOOL)mp2); /* push event into queue */ 1172 1242 break; /* enable further processing ! */ 1173 1174 1243 1244 1175 1245 /************************************************************************* 1176 1246 * WM_MOUSEMOVE mouse event processing * 1177 1247 *************************************************************************/ 1178 1248 1179 1249 case WM_MOUSEMOVE: 1180 1250 case WM_BUTTON1UP: … … 1192 1262 break; /* enable further processing ! */ 1193 1263 } 1194 1264 1195 1265 return WinDefWindowProc(hwnd, /* to default processing */ 1196 1266 msg, … … 1209 1279 * Variables : 1210 1280 * Result : MRESULT for PM 1211 * Remark : 1212 * Status : 1281 * Remark : 1282 * Status : 1213 1283 * 1214 1284 * Author : Patrick Haller [Tue, 1998/02/10 03:24] … … 1220 1290 MPARAM mp2) 1221 1291 { 1222 switch(msg) 1292 switch(msg) 1223 1293 { 1224 1294 /************************************************************************* 1225 1295 * WM_QUERYTRACKINFO handling * 1226 1296 *************************************************************************/ 1227 case WM_QUERYTRACKINFO: 1297 case WM_QUERYTRACKINFO: 1228 1298 { 1229 1299 MRESULT mr; /* message result */ … … 1234 1304 msg, 1235 1305 mp1, 1236 mp2); 1306 mp2); 1237 1307 1238 1308 pTrackInfo = (PTRACKINFO)mp2; /* get track information */ … … 1262 1332 * Variables : 1263 1333 * Result : none 1264 * Remark : 1265 * Status : 1334 * Remark : 1335 * Status : 1266 1336 * 1267 1337 * Author : Patrick Haller [Tue, 1998/02/17 12:57] … … 1271 1341 { 1272 1342 ULONG ulLine; 1273 1343 1274 1344 ULONG ulSizeX; /* blitting length and height */ 1275 1345 ULONG ulSizeY; 1276 1346 1277 1347 ulSizeX = 2 * min(ConsoleGlobals.coordWindowSize.X, 1278 1348 pConsoleBuffer->coordBufferSize.X - 1279 1349 ConsoleGlobals.coordWindowPos.X); 1280 1350 1281 1351 ulSizeY = min(ConsoleGlobals.coordWindowSize.Y, 1282 1352 pConsoleBuffer->coordBufferSize.Y - 1283 1353 ConsoleGlobals.coordWindowPos.Y); 1284 1354 1285 1355 /* check if we're called with non-existing line buffer */ 1286 1356 if (pConsoleBuffer->ppszLine == NULL) 1287 1357 return; 1288 1358 1289 1359 for (ulLine = ConsoleGlobals.coordWindowPos.Y; 1290 1360 ulLine < ulSizeY; 1291 1361 ulLine++) 1292 VioWrtCellStr(pConsoleBuffer->ppszLine[ulLine] + 1362 VioWrtCellStr(pConsoleBuffer->ppszLine[ulLine] + 1293 1363 ConsoleGlobals.coordWindowPos.X, 1294 1364 ulSizeX, … … 1305 1375 * Variables : 1306 1376 * Result : none 1307 * Remark : 1308 * Status : 1377 * Remark : 1378 * Status : 1309 1379 * 1310 1380 * Author : Patrick Haller [Tue, 1998/02/17 12:57] … … 1316 1386 { 1317 1387 ULONG ulCounter; 1318 1388 1319 1389 for (ulCounter = 0; 1320 1390 ulCounter < (ulSize >> 1); … … 1322 1392 pusTarget+=2) 1323 1393 *(PULONG)pusTarget = ulPattern; 1324 1394 1325 1395 if (ulSize & 0x00000001) 1326 1396 *pusTarget = (USHORT)ulPattern; … … 1336 1406 * Variables : 1337 1407 * Result : none 1338 * Remark : 1339 * Status : 1408 * Remark : 1409 * Status : 1340 1410 * 1341 1411 * Author : Patrick Haller [Tue, 1998/02/17 12:57] … … 1348 1418 ULONG ulPosition; 1349 1419 ULONG ulScrollLine; 1350 1420 1351 1421 static ULONG ulUpdateCounter; /* counter for jump-scrolling */ 1352 1422 1353 1423 /* calculate new line offset to the first line */ 1354 1424 pConsoleBuffer->ulScrollLineOffset += ulLines; 1355 1425 pConsoleBuffer->ulScrollLineOffset %= pConsoleBuffer->coordBufferSize.Y; 1356 1426 1357 1427 /* do we have to scroll ? */ 1358 1428 if (ulLines < pConsoleBuffer->coordBufferSize.Y) … … 1362 1432 ulLine++) 1363 1433 { 1364 ulScrollLine = (ulLine + pConsoleBuffer->ulScrollLineOffset) 1434 ulScrollLine = (ulLine + pConsoleBuffer->ulScrollLineOffset) 1365 1435 % pConsoleBuffer->coordBufferSize.Y; 1366 1436 1367 1437 ulPosition = (ULONG)pConsoleBuffer->ppszLine 1368 1438 + (pConsoleBuffer->coordBufferSize.Y * sizeof (PSZ) ) 1369 1439 + (pConsoleBuffer->coordBufferSize.X * 2 * ulScrollLine); 1370 1440 1371 1441 pConsoleBuffer->ppszLine[ulLine] = (PSZ)ulPosition; 1372 1442 } 1373 1443 } 1374 1444 1375 1445 /* enforce the upper limit */ 1376 1446 if (ulLines > pConsoleBuffer->coordBufferSize.Y) 1377 1447 ulLines = pConsoleBuffer->coordBufferSize.Y; 1378 1448 1379 1449 ulPosition = ( ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 8) + 1380 1450 ((ULONG)' ') + 1381 1451 ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 24) + 1382 1452 ((ULONG)' ' << 16) ); 1383 1453 1384 1454 /* scroll the line index */ 1385 for (ulLine = pConsoleBuffer->coordBufferSize.Y - ulLines; 1455 for (ulLine = pConsoleBuffer->coordBufferSize.Y - ulLines; 1386 1456 ulLine < pConsoleBuffer->coordBufferSize.Y; 1387 1457 ulLine++) … … 1389 1459 (PUSHORT)(pConsoleBuffer->ppszLine[ulLine]), 1390 1460 pConsoleBuffer->coordBufferSize.X); 1391 1461 1392 1462 /* this code ensures frequent screen updating, even if the timer prooves */ 1393 1463 /* to be to slow */ … … 1413 1483 * Result : API returncode 1414 1484 * Remark : 1415 * Status : 1485 * Status : 1416 1486 * 1417 1487 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 1422 1492 PINPUT_RECORD pirFree; /* pointer to free record */ 1423 1493 APIRET rc; /* API-returncode */ 1424 1494 1425 1495 #ifdef DEBUG_LOCAL2 1426 1496 dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPush(%08x).\n", … … 1431 1501 if (pirFree->EventType != 0x0000) 1432 1502 return (ERROR_QUE_NO_MEMORY); /* queue is full ! */ 1433 1503 1434 1504 /* put event in queue */ 1435 1505 memcpy(pirFree, /* copy data */ 1436 1506 pInputRecord, 1437 1507 sizeof (INPUT_RECORD) ); 1438 1508 1439 1509 ConsoleInput.ulIndexFree++; /* update index counter */ 1440 1510 if (ConsoleInput.ulIndexFree >= CONSOLE_INPUTQUEUESIZE) 1441 1511 ConsoleInput.ulIndexFree = 0; 1442 1512 1443 1513 ConsoleInput.ulEvents++; /* increate queue event counter */ 1444 1514 1445 1515 /* unblock reading threads */ 1446 1516 rc = DosPostEventSem(ConsoleInput.hevInputQueue); … … 1456 1526 * Result : API returncode 1457 1527 * Remark : 1458 * Status : 1528 * Status : 1459 1529 * 1460 1530 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 1465 1535 PINPUT_RECORD pirEvent; /* pointer to event record */ 1466 1536 APIRET rc; /* API-returncode */ 1467 1537 1468 1538 #ifdef DEBUG_LOCAL2 1469 1539 dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPop(%08x).\n", 1470 1540 pInputRecord)); 1471 1541 #endif 1472 1542 1473 1543 if (ConsoleInput.ulEvents == 0) /* empty console ? */ 1474 1544 return (ERROR_QUE_EMPTY); /* queue is empty ! */ 1475 1545 1476 1546 /* get first event */ 1477 1547 pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent]; 1478 1548 if (pirEvent->EventType == 0x0000) 1479 1549 return (ERROR_QUE_EMPTY); /* queue is empty ! */ 1480 1550 1481 1551 /* put event in queue */ 1482 1552 memcpy(pInputRecord, /* copy data */ 1483 1553 pirEvent, 1484 1554 sizeof (INPUT_RECORD) ); 1485 1555 1486 1556 pirEvent->EventType = 0x0000; /* mark event as read = free */ 1487 1557 1488 1558 if (ConsoleInput.ulEvents >= 0) /* decrease number of console events */ 1489 1559 ConsoleInput.ulEvents--; 1490 1560 1491 1561 ConsoleInput.ulIndexEvent++; /* update index counter */ 1492 1562 if (ConsoleInput.ulIndexEvent >= CONSOLE_INPUTQUEUESIZE) 1493 1563 ConsoleInput.ulIndexEvent = 0; 1494 1564 1495 1565 return (NO_ERROR); /* OK */ 1496 1566 } … … 1505 1575 * Remark : @@@PH: 2nd table that learns codes automatically from "down" 1506 1576 * messages from PM. With Alt-a, etc. it is 0 for "up" ? 1507 * Status : 1577 * Status : 1508 1578 * 1509 1579 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 1624 1694 /* VK_M_BUTTONRELEASE 0x006B */ 0, 1625 1695 /* VK_M_DOUBLECLICK 0x006C */ 0, 1626 1696 1627 1697 #if 0 1628 1698 0xA4, /* WIN_VK_LMENU ??? */ … … 1673 1743 USHORT usVk = ((ULONG)mp2 & 0xffff0000) >> 16; 1674 1744 UCHAR ucChar = usCh & 0x00ff; 1675 1745 1676 1746 #ifdef DEBUG_LOCAL2 1677 1747 dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushKey(%08x,%08x).\n", … … 1680 1750 #endif 1681 1751 1682 1752 1683 1753 InputRecord.EventType = KEY_EVENT; /* fill event structure */ 1684 1754 InputRecord.Event.KeyEvent.dwControlKeyState = 0; 1685 1755 1686 1756 if (fsFlags & KC_SHIFT) InputRecord.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED; 1687 1757 if (fsFlags & KC_ALT) InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED; 1688 1758 if (fsFlags & KC_CTRL) InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; 1689 1690 /* @@@PH no support for RIGHT_ALT_PRESSED, 1759 1760 /* @@@PH no support for RIGHT_ALT_PRESSED, 1691 1761 RIGHT_CTRL_PRESSED, 1692 NUMLOCK_ON, 1693 SCROLLLOCK_ON, 1694 CAPSLOCK_ON, 1695 ENHANCED_KEY 1762 NUMLOCK_ON, 1763 SCROLLLOCK_ON, 1764 CAPSLOCK_ON, 1765 ENHANCED_KEY 1696 1766 */ 1697 1767 … … 1700 1770 InputRecord.Event.KeyEvent.wVirtualKeyCode = usVk; 1701 1771 InputRecord.Event.KeyEvent.wVirtualScanCode = ucScanCode; 1702 1772 1703 1773 /* check if ascii is valid, if so then wVirtualKeyCode = ascii, */ 1704 1774 /* else go through the table */ … … 1712 1782 InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF; 1713 1783 else 1714 InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh; 1784 InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh; 1715 1785 } 1716 1786 else … … 1721 1791 tabVirtualKeyCodes[usVk]; /* translate keycode */ 1722 1792 } 1723 1793 1724 1794 /* this is a workaround for empty / invalid wVirtualKeyCodes */ 1725 1795 if (InputRecord.Event.KeyEvent.wVirtualKeyCode == 0x0000) … … 1730 1800 InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF; 1731 1801 else 1732 InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh; 1733 } 1734 1735 1802 InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh; 1803 } 1804 1805 1736 1806 /* @@@PH handle special keys */ 1737 1807 if ( (ucChar != 0xe0) && (ucChar != 0x00) ) … … 1743 1813 InputRecord.Event.KeyEvent.uChar.AsciiChar = (ucChar >> 8); 1744 1814 } 1745 1815 1746 1816 /* further processing according the current input console mode */ 1747 1817 if (ConsoleInput.dwConsoleMode & ENABLE_PROCESSED_INPUT) … … 1749 1819 /* filter ctrl-c, etc. */ 1750 1820 } 1751 1821 1752 1822 #if 0 1753 1823 /* DEBUG */ … … 1762 1832 SHORT1FROMMP(mp2), 1763 1833 SHORT2FROMMP(mp2))); 1764 1834 1765 1835 dprintf(("DEBUG: ascii=[%c] (%02x)", 1766 1836 InputRecord.Event.KeyEvent.uChar.AsciiChar, 1767 1837 InputRecord.Event.KeyEvent.uChar.AsciiChar)); 1768 1838 #endif 1769 1839 1770 1840 rc = ConsoleInputEventPush(&InputRecord); /* add it to the queue */ 1771 1841 return (rc); /* OK */ … … 1780 1850 * Result : API returncode 1781 1851 * Remark : 1782 * Status : 1852 * Status : 1783 1853 * 1784 1854 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 1793 1863 USHORT fsFlags = SHORT2FROMMP(mp2); /* get key flags */ 1794 1864 static USHORT usButtonState; /* keeps track of mouse button state */ 1795 1865 1796 1866 /* do we have to process mouse input ? */ 1797 1867 if ( !(ConsoleInput.dwConsoleMode & ENABLE_MOUSE_INPUT)) 1798 1868 return (NO_ERROR); /* return immediately */ 1799 1869 1800 1870 dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMouse(%08x,%08x,%08x).\n", 1801 1871 ulMessage, 1802 1872 mp1, 1803 1873 mp2)); 1804 1874 1805 1875 memset(&InputRecord, /* zero the structure */ 1806 1876 0, 1807 1877 sizeof (INPUT_RECORD) ); 1808 1878 1809 1879 InputRecord.EventType = MOUSE_EVENT; /* fill event structure */ 1810 1880 1811 1881 switch (ulMessage) 1812 1882 { 1813 case WM_MOUSEMOVE: 1883 case WM_MOUSEMOVE: 1814 1884 InputRecord.Event.MouseEvent.dwEventFlags = MOUSE_MOVED; 1815 1885 InputRecord.Event.MouseEvent.dwMousePosition.X = SHORT1FROMMP(mp1); 1816 1886 InputRecord.Event.MouseEvent.dwMousePosition.Y = SHORT2FROMMP(mp1); 1817 1887 1818 1888 InputRecord.Event.MouseEvent.dwButtonState = usButtonState; 1819 1889 1820 1890 if (fsFlags & KC_SHIFT) InputRecord.Event.MouseEvent.dwControlKeyState |= SHIFT_PRESSED; 1821 1891 if (fsFlags & KC_ALT) InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_ALT_PRESSED; 1822 1892 if (fsFlags & KC_CTRL) InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; 1823 1824 /* @@@PH no support for RIGHT_ALT_PRESSED, 1893 1894 /* @@@PH no support for RIGHT_ALT_PRESSED, 1825 1895 RIGHT_CTRL_PRESSED, 1826 NUMLOCK_ON, 1827 SCROLLLOCK_ON, 1828 CAPSLOCK_ON, 1829 ENHANCED_KEY 1896 NUMLOCK_ON, 1897 SCROLLLOCK_ON, 1898 CAPSLOCK_ON, 1899 ENHANCED_KEY 1830 1900 */ 1831 1901 break; 1832 1902 1833 1903 case WM_BUTTON1UP: 1834 1904 usButtonState &= ~FROM_LEFT_1ST_BUTTON_PRESSED; 1835 1905 InputRecord.Event.MouseEvent.dwButtonState = usButtonState; 1836 1906 break; 1837 1907 1838 1908 case WM_BUTTON1DOWN: 1839 1909 usButtonState |= FROM_LEFT_1ST_BUTTON_PRESSED; 1840 1910 InputRecord.Event.MouseEvent.dwButtonState = usButtonState; 1841 1911 break; 1842 1912 1843 1913 case WM_BUTTON2UP: 1844 1914 usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED; 1845 1915 InputRecord.Event.MouseEvent.dwButtonState = usButtonState; 1846 1916 break; 1847 1917 1848 1918 case WM_BUTTON2DOWN: 1849 1919 usButtonState |= FROM_LEFT_2ND_BUTTON_PRESSED; 1850 1920 InputRecord.Event.MouseEvent.dwButtonState = usButtonState; 1851 1921 break; 1852 1922 1853 1923 case WM_BUTTON3UP: 1854 1924 usButtonState &= ~FROM_LEFT_3RD_BUTTON_PRESSED; 1855 1925 InputRecord.Event.MouseEvent.dwButtonState = usButtonState; 1856 1926 break; 1857 1927 1858 1928 case WM_BUTTON3DOWN: 1859 1929 usButtonState |= FROM_LEFT_3RD_BUTTON_PRESSED; … … 1866 1936 usButtonState &= ~FROM_LEFT_1ST_BUTTON_PRESSED; 1867 1937 break; 1868 1938 1869 1939 case WM_BUTTON2DBLCLK: 1870 1940 InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK; … … 1872 1942 usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED; 1873 1943 break; 1874 1944 1875 1945 case WM_BUTTON3DBLCLK: 1876 1946 InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK; … … 1879 1949 break; 1880 1950 } 1881 1951 1882 1952 /* @@@PH pseudo-support for RIGHTMOST_BUTTON_PRESSED */ 1883 1953 if (InputRecord.Event.MouseEvent.dwButtonState & FROM_LEFT_3RD_BUTTON_PRESSED) 1884 1954 InputRecord.Event.MouseEvent.dwButtonState |= RIGHTMOST_BUTTON_PRESSED; 1885 1955 1886 1956 rc = ConsoleInputEventPush(&InputRecord); /* add it to the queue */ 1887 1957 return (rc); /* OK */ … … 1896 1966 * Result : API returncode 1897 1967 * Remark : 1898 * Status : 1968 * Status : 1899 1969 * 1900 1970 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 1909 1979 if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT)) 1910 1980 return (NO_ERROR); /* return immediately */ 1911 1981 1912 1982 dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushWindow(x = %u, y = %u).\n", 1913 1983 coordWindowSize.X, 1914 1984 coordWindowSize.Y)); 1915 1985 1916 1986 InputRecord.EventType = WINDOW_BUFFER_SIZE_EVENT; /* fill event structure */ 1917 1987 1918 1988 InputRecord.Event.WindowBufferSizeEvent.dwSize = coordWindowSize; 1919 1989 1920 1990 rc = ConsoleInputEventPush(&InputRecord); /* add it to the queue */ 1921 1991 return (rc); /* OK */ … … 1930 2000 * Result : API returncode 1931 2001 * Remark : 1932 * Status : 2002 * Status : 1933 2003 * 1934 2004 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 1939 2009 INPUT_RECORD InputRecord; /* the input record structure */ 1940 2010 APIRET rc; /* API-returncode */ 1941 2011 1942 2012 /* @@@PH this is unknown to me - there's no separate bit for menu events ? */ 1943 2013 /* do we have to process window input ? */ 1944 2014 if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT)) 1945 2015 return (NO_ERROR); /* return immediately */ 1946 2016 1947 2017 dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMenu(%08x).\n", 1948 2018 dwCommandId)); 1949 2019 1950 2020 InputRecord.EventType = MENU_EVENT; /* fill event structure */ 1951 2021 1952 2022 InputRecord.Event.MenuEvent.dwCommandId = dwCommandId; 1953 2023 1954 2024 rc = ConsoleInputEventPush(&InputRecord); /* add it to the queue */ 1955 2025 return (rc); /* OK */ … … 1964 2034 * Result : API returncode 1965 2035 * Remark : 1966 * Status : 2036 * Status : 1967 2037 * 1968 2038 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 1973 2043 INPUT_RECORD InputRecord; /* the input record structure */ 1974 2044 APIRET rc; /* API-returncode */ 1975 2045 1976 2046 /* @@@PH this is unknown to me - there's no separate bit for menu events ? */ 1977 2047 /* do we have to process window input ? */ 1978 2048 if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT)) 1979 2049 return (NO_ERROR); /* return immediately */ 1980 2050 1981 2051 dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushFocus(%08x).\n", 1982 2052 bSetFocus)); 1983 2053 1984 2054 InputRecord.EventType = FOCUS_EVENT; /* fill event structure */ 1985 2055 1986 2056 InputRecord.Event.FocusEvent.bSetFocus = bSetFocus; 1987 2057 1988 2058 rc = ConsoleInputEventPush(&InputRecord); /* add it to the queue */ 1989 2059 return (rc); /* OK */ … … 1994 2064 * Name : static ULONG ConsoleInputQueueEvents 1995 2065 * Purpose : query number of events in the queue 1996 * Parameters: 2066 * Parameters: 1997 2067 * Variables : 1998 2068 * Result : number of events 1999 2069 * Remark : 2000 * Status : 2070 * Status : 2001 2071 * 2002 2072 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 2012 2082 * Name : static void ConsoleCursorShow 2013 2083 * Purpose : query number of events in the queue 2014 * Parameters: 2084 * Parameters: 2015 2085 * Variables : 2016 2086 * Result : number of events 2017 2087 * Remark : 2018 * Status : 2088 * Status : 2019 2089 * 2020 2090 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 2028 2098 static BOOL fState; /* current cursor state */ 2029 2099 RECTL rclWindow; /* current window size */ 2030 2100 2031 2101 #ifdef DEBUG_LOCAL2 2032 2102 dprintf(("KERNEL32:Console:ConsoleCursorShow(%u)\n", 2033 2103 ulCursorMode)); 2034 2104 #endif 2035 2105 2036 2106 if (pConsoleBuffer->CursorInfo.bVisible == FALSE)/* cursor is switched off */ 2037 2107 return; /* return immediately */ 2038 2108 2039 2109 switch (ulCursorMode) 2040 2110 { … … 2045 2115 fState = FALSE; /* set to invisible and invert our cursor rect */ 2046 2116 break; 2047 2117 2048 2118 case CONSOLECURSOR_SHOW: 2049 2119 if (fState == TRUE) /* cursor currently shown ? */ … … 2052 2122 fState = TRUE; /* set to visible and invert our cursor rect */ 2053 2123 break; 2054 2124 2055 2125 case CONSOLECURSOR_BLINK: 2056 2126 fState = !fState; /* let there be on off on off on off on off ... */ 2057 2127 break; 2058 2128 2059 2129 case CONSOLECURSOR_OVERWRITTEN: /* our cursor has been overwritten */ 2060 2130 fState = TRUE; /* so show the cursor immediately */ 2061 2131 break; 2062 2132 } 2063 2064 2133 2134 2065 2135 /* query current window's size */ 2066 2136 WinQueryWindowRect(ConsoleGlobals.hwndClient, 2067 2137 &rclWindow); 2068 2138 2069 2139 /* calculate coordinates of the cursor */ 2070 2140 rclCursor.xLeft = ConsoleGlobals.sCellCX * pConsoleBuffer->coordCursorPosition.X; … … 2076 2146 pConsoleBuffer->CursorInfo.dwSize / 2077 2147 100); 2078 2148 2079 2149 hps = WinGetPS(ConsoleGlobals.hwndClient); /* get HPS */ 2080 2150 2081 2151 /* @@@PH invert coordinates here ... */ 2082 2152 WinInvertRect(hps, /* our cursor is an inverted rectangle */ 2083 2153 &rclCursor); 2084 2154 2085 2155 WinReleasePS(hps); /* release the hps again */ 2086 2156 } … … 2090 2160 * Name : static APIRET ConsoleFontQuery 2091 2161 * Purpose : queries the current font cell sizes 2092 * Parameters: 2162 * Parameters: 2093 2163 * Variables : 2094 2164 * Result : API returncode 2095 2165 * Remark : 2096 * Status : 2166 * Status : 2097 2167 * 2098 2168 * Author : Patrick Haller [Tue, 1998/03/07 16:55] … … 2110 2180 * Name : static void ConsoleCursorShow 2111 2181 * Purpose : query number of events in the queue 2112 * Parameters: 2182 * Parameters: 2113 2183 * Variables : 2114 2184 * Result : number of events 2115 2185 * Remark : called during INIT, FONTCHANGE, RESIZE, BUFFERCHANGE 2116 * Status : 2186 * Status : 2117 2187 * 2118 2188 * Author : Patrick Haller [Wed, 1998/04/29 16:55] … … 2125 2195 PRECTL pRcl = &rcl; 2126 2196 ULONG flStyle; /* window frame control style */ 2127 2197 2128 2198 BOOL fNeedVertScroll; /* indicates need of scrollbars */ 2129 2199 BOOL fNeedHorzScroll; 2130 2200 2131 2201 LONG lScrollX; /* width and height of scrollbars */ 2132 2202 LONG lScrollY; 2133 2203 2134 2204 /* now calculate actual window size */ 2135 2205 lX = ConsoleGlobals.sCellCX * ConsoleGlobals.coordWindowSize.X; 2136 2206 lY = ConsoleGlobals.sCellCY * ConsoleGlobals.coordWindowSize.Y; 2137 2207 2138 2208 if ( (ConsoleGlobals.sCellCX == 0) || /* prevent division by zero */ 2139 2209 (ConsoleGlobals.sCellCY == 0) ) 2140 return; 2141 2210 return; 2211 2142 2212 /* calculate maximum console window size in pixels for the tracking */ 2143 2213 ConsoleGlobals.coordMaxWindowPels.X = ConsoleGlobals.sCellCX * pConsoleBuffer->coordWindowSize.X 2144 2214 + WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) * 2; 2145 2215 2146 2216 ConsoleGlobals.coordMaxWindowPels.Y = ConsoleGlobals.sCellCY * pConsoleBuffer->coordWindowSize.Y 2147 2217 + WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) * 2 2148 2218 + WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR); 2149 2219 2150 2220 /***************************/ 2151 2221 /* @@@PH broken code below */ 2152 2222 /***************************/ 2153 2223 return; 2154 2224 2155 2225 /* add the window border height and width, etc. */ 2156 2226 WinQueryWindowRect (ConsoleGlobals.hwndClient, 2157 2227 pRcl); 2158 2228 2159 2229 /* calculate visible area */ 2160 2230 /* calculate real client window rectangle and take care of the scrollbars */ 2161 2231 lScrollX = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL); 2162 2232 lScrollY = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL); 2163 if (ConsoleGlobals.fHasHorzScroll) 2233 if (ConsoleGlobals.fHasHorzScroll) 2164 2234 { 2165 2235 lY += lScrollY; 2166 2236 ConsoleGlobals.coordMaxWindowPels.Y += lScrollY; 2167 2237 } 2168 2169 if (ConsoleGlobals.fHasVertScroll) 2238 2239 if (ConsoleGlobals.fHasVertScroll) 2170 2240 { 2171 2241 lX += lScrollX; 2172 2242 ConsoleGlobals.coordMaxWindowPels.X += lScrollX; 2173 2243 } 2174 2244 2175 2245 /* @@@PH might NOT exceed maximum VioPS size ! */ 2176 ConsoleGlobals.coordWindowSize.X = (pRcl->xRight - pRcl->xLeft) 2246 ConsoleGlobals.coordWindowSize.X = (pRcl->xRight - pRcl->xLeft) 2177 2247 / ConsoleGlobals.sCellCX; 2178 2179 ConsoleGlobals.coordWindowSize.Y = (pRcl->yTop - pRcl->yBottom) 2248 2249 ConsoleGlobals.coordWindowSize.Y = (pRcl->yTop - pRcl->yBottom) 2180 2250 / ConsoleGlobals.sCellCY; 2181 2251 2182 2252 /* do we have to enable the scrollbars ? */ 2183 2253 fNeedHorzScroll = lX < pConsoleBuffer->coordWindowSize.X * ConsoleGlobals.sCellCX; 2184 2254 fNeedVertScroll = lY < pConsoleBuffer->coordWindowSize.Y * ConsoleGlobals.sCellCY; 2185 2255 2186 2256 2187 2257 if ( (ConsoleGlobals.fHasVertScroll != fNeedVertScroll) || … … 2190 2260 flStyle = WinQueryWindowULong(ConsoleGlobals.hwndFrame, 2191 2261 QWL_STYLE); 2192 2262 2193 2263 /* now set or remove the controls */ 2194 2264 if (ConsoleGlobals.fHasHorzScroll != fNeedHorzScroll) … … 2208 2278 ConsoleGlobals.coordWindowPos.X = 0; /* we can see the whole buffer */ 2209 2279 } 2210 2280 2211 2281 if (ConsoleGlobals.fHasVertScroll != fNeedVertScroll) 2212 2282 if (fNeedVertScroll) … … 2222 2292 WinSetParent(ConsoleGlobals.hwndVertScroll, /* detach control */ 2223 2293 HWND_OBJECT, 2224 FALSE); 2294 FALSE); 2225 2295 ConsoleGlobals.coordWindowPos.Y = 0; /* we can see the whole buffer */ 2226 2296 } 2227 2228 2297 2298 2229 2299 WinSendMsg(ConsoleGlobals.hwndFrame, /* update frame */ 2230 2300 WM_UPDATEFRAME, 2231 2301 MPFROMLONG(flStyle), 2232 2302 MPVOID); 2233 2303 2234 2304 WinInvalidateRect(ConsoleGlobals.hwndFrame, /* redraw frame window */ 2235 2305 NULL, 2236 2306 TRUE); 2237 2307 2238 2308 ConsoleGlobals.fHasVertScroll = fNeedVertScroll; /* update globals */ 2239 2309 ConsoleGlobals.fHasHorzScroll = fNeedHorzScroll; /* update globals */ 2240 2310 } 2241 2242 2311 2312 2243 2313 /* setup the scrollbars and scrollranges */ 2244 2314 if (ConsoleGlobals.fHasVertScroll) … … 2246 2316 /* setup vertical scrollbar */ 2247 2317 } 2248 2249 2318 2319 2250 2320 if (ConsoleGlobals.fHasHorzScroll) 2251 2321 { 2252 2322 /* setup horizonal scrollbar */ 2253 2323 } 2254 2255 2324 2325 2256 2326 WinCalcFrameRect(ConsoleGlobals.hwndFrame, /* calculate frame rectangle */ 2257 2327 pRcl, 2258 2328 FALSE); 2259 2329 2260 2330 /* @@@PH client may not overlap frame ! */ 2261 2331 /* @@@PH write values to TRACKINFO */ 2262 2332 2263 2333 #if 0 2264 2334 /* @@@PH this results in recursion */ … … 2270 2340 lY, 2271 2341 SWP_SIZE); 2272 2342 2273 2343 WinSetWindowPos (ConsoleGlobals.hwndFrame, /* adjust client window size */ 2274 2344 HWND_DESKTOP, … … 2283 2353 2284 2354 /***************************************************************************** 2285 * Name : BOOL WIN32API OS2AllocConsole2286 * Purpose : The AllocConsole function allocates a new console 2355 * Name : BOOL WIN32API AllocConsole 2356 * Purpose : The AllocConsole function allocates a new console 2287 2357 * for the calling process 2288 2358 * Parameters: VOID … … 2297 2367 *****************************************************************************/ 2298 2368 2299 BOOL WIN32API OS2AllocConsole(VOID)2369 BOOL WIN32API AllocConsole(VOID) 2300 2370 { 2301 2371 APIRET rc; /* API returncode */ 2302 2372 2303 2373 #ifdef DEBUG_LOCAL2 2304 2374 WriteLog("KERNEL32/CONSOLE: OS2AllocConsole() called.\n"); 2305 2375 #endif 2306 2376 2307 2377 rc = ConsoleInit(); /* initialize subsystem if required */ 2308 2378 if (rc != NO_ERROR) /* check for errors */ … … 2317 2387 2318 2388 /***************************************************************************** 2319 * Name : HANDLE WIN32API OS2CreateConsoleScreenBuffer2389 * Name : HANDLE WIN32API CreateConsoleScreenBuffer 2320 2390 * Purpose : The CreateConsoleScreenBuffer function creates a console 2321 2391 * screen buffer and returns a handle of it. … … 2326 2396 * LPVOID lpScreenBufferData - reserved 2327 2397 * Variables : 2328 * Result : 2398 * Result : 2329 2399 * Remark : a console buffer is a kernel heap object equipped with 2330 2400 * share modes, access rights, etc. … … 2332 2402 * console device driver for it ... maybe this turns out to 2333 2403 * be necessary since we've got to handle CONIN$ and CONOUT$, too. 2334 * Status : 2404 * Status : 2335 2405 * 2336 2406 * Author : Patrick Haller [Tue, 1998/02/10 03:55] 2337 2407 *****************************************************************************/ 2338 2408 2339 HANDLE WIN32API OS2CreateConsoleScreenBuffer(DWORD dwDesiredAccess,2409 HANDLE WIN32API CreateConsoleScreenBuffer(DWORD dwDesiredAccess, 2340 2410 DWORD dwShareMode, 2341 2411 LPVOID lpSecurityAttributes, … … 2344 2414 { 2345 2415 HANDLE hResult; 2346 2416 2347 2417 #ifdef DEBUG_LOCAL2 2348 2418 WriteLog("KERNEL32/CONSOLE:OS2CreateConsoleScreenBuffer(%08x,%08x,%08x,%08x,%08x).\n", … … 2361 2431 dwFlags, 2362 2432 INVALID_HANDLE_VALUE); 2363 2433 2364 2434 return hResult; 2365 2435 } … … 2367 2437 2368 2438 /***************************************************************************** 2369 * Name : 2370 * Purpose : 2371 * Parameters: 2372 * Variables : 2373 * Result : 2374 * Remark : 2375 * Status : 2439 * Name : 2440 * Purpose : 2441 * Parameters: 2442 * Variables : 2443 * Result : 2444 * Remark : 2445 * Status : 2376 2446 * 2377 2447 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2378 2448 *****************************************************************************/ 2379 2449 2380 BOOL WIN32API OS2FillConsoleOutputAttribute(HANDLE hConsoleOutput,2450 BOOL WIN32API FillConsoleOutputAttribute(HANDLE hConsoleOutput, 2381 2451 WORD wAttribute, 2382 2452 DWORD nLength, … … 2385 2455 { 2386 2456 BOOL fResult; 2387 2457 2388 2458 #ifdef DEBUG_LOCAL2 2389 2459 WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputAttribute(%08x,%04x,%08x,%08x,%08x).\n", … … 2394 2464 lpNumberOfAttrsWritten); 2395 2465 #endif 2396 2466 2397 2467 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 2398 2468 DRQ_FILLCONSOLEOUTPUTATTRIBUTE, … … 2400 2470 (ULONG)nLength, 2401 2471 COORD2ULONG(dwWriteCoord), 2402 (ULONG)lpNumberOfAttrsWritten); 2403 2472 (ULONG)lpNumberOfAttrsWritten); 2473 2404 2474 return fResult; 2405 2475 } … … 2407 2477 2408 2478 /***************************************************************************** 2409 * Name : 2410 * Purpose : 2411 * Parameters: 2412 * Variables : 2413 * Result : 2414 * Remark : 2415 * Status : 2479 * Name : 2480 * Purpose : 2481 * Parameters: 2482 * Variables : 2483 * Result : 2484 * Remark : 2485 * Status : 2416 2486 * 2417 2487 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2418 2488 *****************************************************************************/ 2419 2489 2420 BOOL WIN32API OS2FillConsoleOutputCharacterA(HANDLE hConsoleOutput,2490 BOOL WIN32API FillConsoleOutputCharacterA(HANDLE hConsoleOutput, 2421 2491 UCHAR cCharacter, 2422 2492 DWORD nLength, … … 2425 2495 { 2426 2496 BOOL fResult; 2427 2497 2428 2498 #ifdef DEBUG_LOCAL2 2429 2499 WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterA(%08x,%c,%08x,%08x,%08x).\n", … … 2434 2504 lpNumberOfCharsWritten); 2435 2505 #endif 2436 2506 2437 2507 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 2438 2508 DRQ_FILLCONSOLEOUTPUTCHARACTERA, … … 2440 2510 (ULONG)nLength, 2441 2511 COORD2ULONG(dwWriteCoord), 2442 (ULONG)lpNumberOfCharsWritten); 2443 2444 return fResult; 2445 } 2446 2447 2448 /***************************************************************************** 2449 * Name : 2450 * Purpose : 2451 * Parameters: 2452 * Variables : 2453 * Result : 2454 * Remark : 2455 * Status : 2512 (ULONG)lpNumberOfCharsWritten); 2513 2514 return fResult; 2515 } 2516 2517 2518 /***************************************************************************** 2519 * Name : 2520 * Purpose : 2521 * Parameters: 2522 * Variables : 2523 * Result : 2524 * Remark : 2525 * Status : 2456 2526 * 2457 2527 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2458 2528 *****************************************************************************/ 2459 2529 2460 BOOL WIN32API OS2FillConsoleOutputCharacterW(HANDLE hConsoleOutput,2530 BOOL WIN32API FillConsoleOutputCharacterW(HANDLE hConsoleOutput, 2461 2531 WCHAR cCharacter, 2462 2532 DWORD nLength, … … 2465 2535 { 2466 2536 BOOL fResult; 2467 2537 2468 2538 #ifdef DEBUG_LOCAL2 2469 2539 WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterW(%08x,%c,%08x,%08x,%08x) .\n", … … 2474 2544 lpNumberOfCharsWritten); 2475 2545 #endif 2476 2546 2477 2547 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 2478 2548 DRQ_FILLCONSOLEOUTPUTCHARACTERW, … … 2487 2557 2488 2558 /***************************************************************************** 2489 * Name : 2490 * Purpose : 2491 * Parameters: 2492 * Variables : 2493 * Result : 2494 * Remark : 2495 * Status : 2559 * Name : 2560 * Purpose : 2561 * Parameters: 2562 * Variables : 2563 * Result : 2564 * Remark : 2565 * Status : 2496 2566 * 2497 2567 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2498 2568 *****************************************************************************/ 2499 2569 2500 BOOL WIN32API OS2FlushConsoleInputBuffer( HANDLE hConsoleInput )2570 BOOL WIN32API FlushConsoleInputBuffer( HANDLE hConsoleInput ) 2501 2571 { 2502 2572 BOOL fResult; 2503 2573 2504 2574 #ifdef DEBUG_LOCAL2 2505 2575 WriteLog("KERNEL32/CONSOLE: OS2FlushConsoleInputBuffer(%08x).\n", 2506 2576 hConsoleInput); 2507 2577 #endif 2508 2578 2509 2579 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 2510 2580 DRQ_FLUSHCONSOLEINPUTBUFFER, … … 2519 2589 2520 2590 /***************************************************************************** 2521 * Name : BOOL WIN32API OS2FreeConsole2591 * Name : BOOL WIN32API FreeConsole 2522 2592 * Purpose : The FreeConsole function detaches the calling process 2523 2593 * from its console. … … 2533 2603 *****************************************************************************/ 2534 2604 2535 BOOL WIN32API OS2FreeConsole( VOID )2605 BOOL WIN32API FreeConsole( VOID ) 2536 2606 { 2537 2607 APIRET rc; /* API returncode */ 2538 2608 2539 2609 #ifdef DEBUG_LOCAL2 2540 2610 WriteLog("KERNEL32/CONSOLE: OS2FreeConsole() called.\n"); 2541 2611 #endif 2542 2612 2543 2613 rc = ConsoleTerminate(); /* terminate subsystem if required */ 2544 2614 if (rc != NO_ERROR) /* check for errors */ … … 2549 2619 else 2550 2620 return TRUE; /* Fine ! :) */ 2551 2552 return TRUE; 2553 } 2554 2555 2556 /***************************************************************************** 2557 * Name : 2558 * Purpose : 2559 * Parameters: 2560 * Variables : 2561 * Result : 2562 * Remark : 2563 * Status : 2621 2622 return TRUE; 2623 } 2624 2625 2626 /***************************************************************************** 2627 * Name : 2628 * Purpose : 2629 * Parameters: 2630 * Variables : 2631 * Result : 2632 * Remark : 2633 * Status : 2564 2634 * 2565 2635 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2566 2636 *****************************************************************************/ 2567 2637 2568 BOOL WIN32API OS2GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,2638 BOOL WIN32API GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, 2569 2639 DWORD dwProcessGroupId) 2570 2640 { … … 2574 2644 dwProcessGroupId); 2575 2645 #endif 2576 2646 2577 2647 return TRUE; 2578 2648 } … … 2580 2650 2581 2651 /***************************************************************************** 2582 * Name : 2583 * Purpose : 2584 * Parameters: 2585 * Variables : 2586 * Result : 2587 * Remark : 2588 * Status : 2652 * Name : 2653 * Purpose : 2654 * Parameters: 2655 * Variables : 2656 * Result : 2657 * Remark : 2658 * Status : 2589 2659 * 2590 2660 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2591 2661 *****************************************************************************/ 2592 2662 2593 UINT WIN32API OS2GetConsoleCP(VOID)2663 UINT WIN32API GetConsoleCP(VOID) 2594 2664 { 2595 2665 #ifdef DEBUG_LOCAL2 2596 2666 WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCP not implemented.\n"); 2597 2667 #endif 2598 2668 2599 2669 return 1; 2600 2670 } … … 2602 2672 2603 2673 /***************************************************************************** 2604 * Name : 2605 * Purpose : 2606 * Parameters: 2607 * Variables : 2608 * Result : 2609 * Remark : 2610 * Status : 2674 * Name : 2675 * Purpose : 2676 * Parameters: 2677 * Variables : 2678 * Result : 2679 * Remark : 2680 * Status : 2611 2681 * 2612 2682 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2613 2683 *****************************************************************************/ 2614 2684 2615 BOOL WIN32API OS2GetConsoleCursorInfo(HANDLE hConsoleOutput,2685 BOOL WIN32API GetConsoleCursorInfo(HANDLE hConsoleOutput, 2616 2686 PCONSOLE_CURSOR_INFO lpConsoleCursorInfo) 2617 2687 { 2618 2688 BOOL fResult; 2619 2689 2620 2690 #ifdef DEBUG_LOCAL2 2621 2691 WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCursorInfo(%08x,%08x).\n", … … 2623 2693 lpConsoleCursorInfo); 2624 2694 #endif 2625 2695 2626 2696 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 2627 2697 DRQ_GETCONSOLECURSORINFO, … … 2636 2706 2637 2707 /***************************************************************************** 2638 * Name : 2639 * Purpose : 2640 * Parameters: 2641 * Variables : 2642 * Result : 2643 * Remark : 2644 * Status : 2708 * Name : 2709 * Purpose : 2710 * Parameters: 2711 * Variables : 2712 * Result : 2713 * Remark : 2714 * Status : 2645 2715 * 2646 2716 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2647 2717 *****************************************************************************/ 2648 2718 2649 BOOL WIN32API OS2GetConsoleMode(HANDLE hConsole,2719 BOOL WIN32API GetConsoleMode(HANDLE hConsole, 2650 2720 LPDWORD lpMode) 2651 2721 { 2652 2722 BOOL fResult; 2653 2723 2654 2724 #ifdef DEBUG_LOCAL2 2655 2725 WriteLog("KERNEL32/CONSOLE: OS2GetConsoleMode(%08x,%08x).\n", … … 2657 2727 lpMode); 2658 2728 #endif 2659 2729 2660 2730 fResult = (BOOL)HMDeviceRequest(hConsole, 2661 2731 DRQ_GETCONSOLEMODE, … … 2664 2734 0, 2665 2735 0); 2666 2736 2667 2737 return fResult; 2668 2738 } … … 2670 2740 2671 2741 /***************************************************************************** 2672 * Name : 2673 * Purpose : 2674 * Parameters: 2675 * Variables : 2676 * Result : 2677 * Remark : 2678 * Status : 2742 * Name : 2743 * Purpose : 2744 * Parameters: 2745 * Variables : 2746 * Result : 2747 * Remark : 2748 * Status : 2679 2749 * 2680 2750 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2681 2751 *****************************************************************************/ 2682 2752 2683 UINT WIN32API OS2GetConsoleOutputCP(VOID)2753 UINT WIN32API GetConsoleOutputCP(VOID) 2684 2754 { 2685 2755 #ifdef DEBUG_LOCAL2 2686 2756 WriteLog("KERNEL32/CONSOLE: OS2GetConsoleOutputCP not implemented.\n"); 2687 2757 #endif 2688 2758 2689 2759 return 1; 2690 2760 } … … 2692 2762 2693 2763 /***************************************************************************** 2694 * Name : 2695 * Purpose : 2696 * Parameters: 2697 * Variables : 2698 * Result : 2699 * Remark : 2700 * Status : 2764 * Name : 2765 * Purpose : 2766 * Parameters: 2767 * Variables : 2768 * Result : 2769 * Remark : 2770 * Status : 2701 2771 * 2702 2772 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2703 2773 *****************************************************************************/ 2704 2774 2705 BOOL WIN32API OS2GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,2775 BOOL WIN32API GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, 2706 2776 PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) 2707 2777 { … … 2713 2783 lpConsoleScreenBufferInfo); 2714 2784 #endif 2715 2785 2716 2786 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 2717 2787 DRQ_GETCONSOLESCREENBUFFERINFO, … … 2726 2796 2727 2797 /***************************************************************************** 2728 * Name : DWORD WIN32API OS2GetConsoleTitle2798 * Name : DWORD WIN32API GetConsoleTitle 2729 2799 * Purpose : Query the current console window title 2730 2800 * Parameters: LPTSTR lpConsoleTitle … … 2738 2808 *****************************************************************************/ 2739 2809 2740 DWORD WIN32API OS2GetConsoleTitleA(LPTSTR lpConsoleTitle,2810 DWORD WIN32API GetConsoleTitleA(LPTSTR lpConsoleTitle, 2741 2811 DWORD nSize) 2742 2812 { … … 2748 2818 nSize); 2749 2819 #endif 2750 2820 2751 2821 if (ConsoleGlobals.pszWindowTitle == NULL) /* is there a window title ? */ 2752 2822 return 0; /* abort immediately */ 2753 2823 2754 2824 ulLength = strlen(ConsoleGlobals.pszWindowTitle); /* length of text */ 2755 2825 2756 2826 strncpy(lpConsoleTitle, 2757 2827 ConsoleGlobals.pszWindowTitle, 2758 2828 nSize); 2759 2829 2760 2830 return (nSize < ulLength) ? nSize : ulLength; 2761 2831 } … … 2763 2833 2764 2834 /***************************************************************************** 2765 * Name : DWORD WIN32API OS2GetConsoleTitle2835 * Name : DWORD WIN32API GetConsoleTitle 2766 2836 * Purpose : Query the current console window title 2767 2837 * Parameters: LPTSTR lpConsoleTitle … … 2775 2845 *****************************************************************************/ 2776 2846 2777 DWORD WIN32API OS2GetConsoleTitleW(LPTSTR lpConsoleTitle,2847 DWORD WIN32API GetConsoleTitleW(LPTSTR lpConsoleTitle, 2778 2848 DWORD nSize) 2779 2849 { … … 2785 2855 nSize); 2786 2856 #endif 2787 2857 2788 2858 if (ConsoleGlobals.pszWindowTitle == NULL) /* is there a window title ? */ 2789 2859 return 0; /* abort immediately */ 2790 2860 2791 2861 ulLength = strlen(ConsoleGlobals.pszWindowTitle); /* length of text */ 2792 2862 2793 2863 strncpy(lpConsoleTitle, 2794 2864 ConsoleGlobals.pszWindowTitle, 2795 2865 nSize); 2796 2866 2797 2867 /* @@@PH Ascii2Unicode */ 2798 2868 2799 2869 return (nSize < ulLength) ? nSize : ulLength; 2800 2870 } … … 2802 2872 2803 2873 /***************************************************************************** 2804 * Name : COORD WIN32API OS2GetLargestConsoleWindowSize2874 * Name : COORD WIN32API GetLargestConsoleWindowSize 2805 2875 * Purpose : Determine maximum AVIO size 2806 * Parameters: 2807 * Variables : 2808 * Result : 2809 * Remark : 2810 * Status : 2876 * Parameters: 2877 * Variables : 2878 * Result : 2879 * Remark : 2880 * Status : 2811 2881 * 2812 2882 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2813 2883 *****************************************************************************/ 2814 2884 2815 COORD WIN32API OS2GetLargestConsoleWindowSize(HANDLE hConsoleOutput)2885 COORD WIN32API GetLargestConsoleWindowSize(HANDLE hConsoleOutput) 2816 2886 { 2817 2887 DWORD dwResult; 2818 2888 COORD coordResult; 2819 2889 2820 2890 #ifdef DEBUG_LOCAL2 2821 2891 WriteLog("KERNEL32/CONSOLE: OS2GetLargestConsoleWindowSize(%08x).\n", 2822 2892 hConsoleOutput); 2823 2893 #endif 2824 2894 2825 2895 dwResult = HMDeviceRequest(hConsoleOutput, 2826 2896 DRQ_GETLARGESTCONSOLEWINDOWSIZE, … … 2828 2898 0, 2829 2899 0, 2830 0); 2831 2900 0); 2901 2832 2902 ULONG2COORD(coordResult,dwResult) 2833 2903 return ( coordResult ); … … 2836 2906 2837 2907 /***************************************************************************** 2838 * Name : 2839 * Purpose : 2840 * Parameters: 2841 * Variables : 2842 * Result : 2843 * Remark : 2844 * Status : 2908 * Name : 2909 * Purpose : 2910 * Parameters: 2911 * Variables : 2912 * Result : 2913 * Remark : 2914 * Status : 2845 2915 * 2846 2916 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2847 2917 *****************************************************************************/ 2848 2918 2849 BOOL WIN32API OS2GetNumberOfConsoleInputEvents(HANDLE hConsoleInput,2919 BOOL WIN32API GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, 2850 2920 LPDWORD lpNumberOfEvents) 2851 2921 { … … 2857 2927 lpNumberOfEvents); 2858 2928 #endif 2859 2929 2860 2930 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 2861 2931 DRQ_GETNUMBEROFCONSOLEINPUTEVENTS, … … 2864 2934 0, 2865 2935 0); 2866 2936 2867 2937 return fResult; 2868 2938 } … … 2870 2940 2871 2941 /***************************************************************************** 2872 * Name : 2873 * Purpose : 2874 * Parameters: 2875 * Variables : 2876 * Result : 2877 * Remark : 2878 * Status : 2942 * Name : 2943 * Purpose : 2944 * Parameters: 2945 * Variables : 2946 * Result : 2947 * Remark : 2948 * Status : 2879 2949 * 2880 2950 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2881 2951 *****************************************************************************/ 2882 2952 2883 BOOL WIN32API OS2GetNumberOfConsoleMouseButtons(LPDWORD lpcNumberOfMouseButtons)2953 BOOL WIN32API GetNumberOfConsoleMouseButtons(LPDWORD lpcNumberOfMouseButtons) 2884 2954 { 2885 2955 LONG lMouseButtons; 2886 2956 2887 2957 #ifdef DEBUG_LOCAL2 2888 2958 WriteLog("KERNEL32/CONSOLE: OS2GetNumberOfConsoleMouseButtons(%08x).\n", 2889 2959 lpcNumberOfMouseButtons); 2890 2960 #endif 2891 2961 2892 2962 lMouseButtons = WinQuerySysValue(HWND_DESKTOP, /* query PM for that */ 2893 2963 SV_CMOUSEBUTTONS); 2894 2964 2895 2965 *lpcNumberOfMouseButtons = (DWORD)lMouseButtons; 2896 2966 2897 2967 return TRUE; 2898 2968 } … … 2900 2970 2901 2971 /***************************************************************************** 2902 * Name : 2903 * Purpose : 2904 * Parameters: 2905 * Variables : 2906 * Result : 2907 * Remark : 2908 * Status : 2972 * Name : 2973 * Purpose : 2974 * Parameters: 2975 * Variables : 2976 * Result : 2977 * Remark : 2978 * Status : 2909 2979 * 2910 2980 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2911 2981 *****************************************************************************/ 2912 2982 2913 BOOL WIN32API OS2PeekConsoleInputW(HANDLE hConsoleInput,2983 BOOL WIN32API PeekConsoleInputW(HANDLE hConsoleInput, 2914 2984 PINPUT_RECORD pirBuffer, 2915 2985 DWORD cInRecords, … … 2925 2995 lpcRead); 2926 2996 #endif 2927 2997 2928 2998 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 2929 2999 DRQ_PEEKCONSOLEINPUTW, … … 2932 3002 (ULONG)lpcRead, 2933 3003 0); 2934 3004 2935 3005 return fResult; 2936 3006 } … … 2938 3008 2939 3009 /***************************************************************************** 2940 * Name : 2941 * Purpose : 2942 * Parameters: 2943 * Variables : 2944 * Result : 2945 * Remark : 2946 * Status : 3010 * Name : 3011 * Purpose : 3012 * Parameters: 3013 * Variables : 3014 * Result : 3015 * Remark : 3016 * Status : 2947 3017 * 2948 3018 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2949 3019 *****************************************************************************/ 2950 3020 2951 BOOL WIN32API OS2PeekConsoleInputA(HANDLE hConsoleInput,3021 BOOL WIN32API PeekConsoleInputA(HANDLE hConsoleInput, 2952 3022 PINPUT_RECORD pirBuffer, 2953 3023 DWORD cInRecords, … … 2955 3025 { 2956 3026 BOOL fResult; 2957 3027 2958 3028 #ifdef DEBUG_LOCAL2 2959 3029 WriteLog("KERNEL32/CONSOLE: OS2PeekConsoleInputA(%08x,%08x,%08x,%08x).\n", … … 2963 3033 lpcRead); 2964 3034 #endif 2965 3035 2966 3036 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 2967 3037 DRQ_PEEKCONSOLEINPUTA, … … 2970 3040 (ULONG)lpcRead, 2971 3041 0); 2972 2973 return fResult; 2974 } 2975 2976 2977 /***************************************************************************** 2978 * Name : 2979 * Purpose : 2980 * Parameters: 2981 * Variables : 2982 * Result : 2983 * Remark : 2984 * Status : 3042 3043 return fResult; 3044 } 3045 3046 3047 /***************************************************************************** 3048 * Name : 3049 * Purpose : 3050 * Parameters: 3051 * Variables : 3052 * Result : 3053 * Remark : 3054 * Status : 2985 3055 * 2986 3056 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 2987 3057 *****************************************************************************/ 2988 3058 2989 BOOL WIN32API OS2ReadConsoleA(HANDLE hConsoleInput,3059 BOOL WIN32API ReadConsoleA(HANDLE hConsoleInput, 2990 3060 LPVOID lpvBuffer, 2991 3061 DWORD cchToRead, … … 2994 3064 { 2995 3065 BOOL fResult; 2996 3066 2997 3067 #ifdef DEBUG_LOCAL2 2998 3068 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleA(%08x,%08x,%08x,%08x,%08x).\n", … … 3003 3073 lpvReserved); 3004 3074 #endif 3005 3075 3006 3076 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 3007 3077 DRQ_READCONSOLEA, … … 3010 3080 (ULONG)lpcchRead, 3011 3081 (ULONG)lpvReserved); 3012 3013 return fResult; 3014 } 3015 3016 3017 /***************************************************************************** 3018 * Name : 3019 * Purpose : 3020 * Parameters: 3021 * Variables : 3022 * Result : 3023 * Remark : 3024 * Status : 3082 3083 return fResult; 3084 } 3085 3086 3087 /***************************************************************************** 3088 * Name : 3089 * Purpose : 3090 * Parameters: 3091 * Variables : 3092 * Result : 3093 * Remark : 3094 * Status : 3025 3095 * 3026 3096 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3027 3097 *****************************************************************************/ 3028 3098 3029 BOOL WIN32API OS2ReadConsoleW(HANDLE hConsoleInput,3099 BOOL WIN32API ReadConsoleW(HANDLE hConsoleInput, 3030 3100 LPVOID lpvBuffer, 3031 3101 DWORD cchToRead, … … 3034 3104 { 3035 3105 BOOL fResult; 3036 3106 3037 3107 #ifdef DEBUG_LOCAL2 3038 3108 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleW(%08x,%08x,%08x,%08x,%08x).\n", … … 3043 3113 lpvReserved); 3044 3114 #endif 3045 3115 3046 3116 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 3047 3117 DRQ_READCONSOLEW, … … 3050 3120 (ULONG)lpcchRead, 3051 3121 (ULONG)lpvReserved); 3052 3053 return fResult; 3054 } 3055 3056 3057 /***************************************************************************** 3058 * Name : 3059 * Purpose : 3060 * Parameters: 3061 * Variables : 3062 * Result : 3063 * Remark : 3064 * Status : 3122 3123 return fResult; 3124 } 3125 3126 3127 /***************************************************************************** 3128 * Name : 3129 * Purpose : 3130 * Parameters: 3131 * Variables : 3132 * Result : 3133 * Remark : 3134 * Status : 3065 3135 * 3066 3136 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3067 3137 *****************************************************************************/ 3068 3138 3069 BOOL WIN32API OS2ReadConsoleInputA(HANDLE hConsoleInput,3139 BOOL WIN32API ReadConsoleInputA(HANDLE hConsoleInput, 3070 3140 PINPUT_RECORD pirBuffer, 3071 3141 DWORD cInRecords, … … 3073 3143 { 3074 3144 BOOL fResult; 3075 3145 3076 3146 #ifdef DEBUG_LOCAL2 3077 3147 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputA(%08x,%08x,%08x,%08x).\n", … … 3081 3151 lpcRead); 3082 3152 #endif 3083 3153 3084 3154 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 3085 3155 DRQ_READCONSOLEINPUTA, … … 3088 3158 (ULONG)lpcRead, 3089 3159 0); 3090 3091 return fResult; 3092 } 3093 3094 3095 /***************************************************************************** 3096 * Name : 3097 * Purpose : 3098 * Parameters: 3099 * Variables : 3100 * Result : 3101 * Remark : 3102 * Status : 3160 3161 return fResult; 3162 } 3163 3164 3165 /***************************************************************************** 3166 * Name : 3167 * Purpose : 3168 * Parameters: 3169 * Variables : 3170 * Result : 3171 * Remark : 3172 * Status : 3103 3173 * 3104 3174 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3105 3175 *****************************************************************************/ 3106 3176 3107 BOOL WIN32API OS2ReadConsoleInputW(HANDLE hConsoleInput,3177 BOOL WIN32API ReadConsoleInputW(HANDLE hConsoleInput, 3108 3178 PINPUT_RECORD pirBuffer, 3109 3179 DWORD cInRecords, … … 3111 3181 { 3112 3182 BOOL fResult; 3113 3183 3114 3184 #ifdef DEBUG_LOCAL2 3115 3185 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputW(%08x,%08x,%08x,%08x).\n", … … 3119 3189 lpcRead); 3120 3190 #endif 3121 3191 3122 3192 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 3123 3193 DRQ_READCONSOLEINPUTW, … … 3126 3196 (ULONG)lpcRead, 3127 3197 0); 3128 3129 return fResult; 3130 } 3131 3132 3133 /***************************************************************************** 3134 * Name : 3135 * Purpose : 3136 * Parameters: 3137 * Variables : 3138 * Result : 3139 * Remark : 3140 * Status : 3198 3199 return fResult; 3200 } 3201 3202 3203 /***************************************************************************** 3204 * Name : 3205 * Purpose : 3206 * Parameters: 3207 * Variables : 3208 * Result : 3209 * Remark : 3210 * Status : 3141 3211 * 3142 3212 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3143 3213 *****************************************************************************/ 3144 3214 3145 BOOL WIN32API OS2ReadConsoleOutputA(HANDLE hConsoleOutput,3215 BOOL WIN32API ReadConsoleOutputA(HANDLE hConsoleOutput, 3146 3216 PCHAR_INFO pchiDestBuffer, 3147 3217 COORD coordDestBufferSize, … … 3150 3220 { 3151 3221 BOOL fResult; 3152 3222 3153 3223 #ifdef DEBUG_LOCAL2 3154 3224 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n", … … 3159 3229 psrctSourceRect); 3160 3230 #endif 3161 3231 3162 3232 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3163 3233 DRQ_READCONSOLEOUTPUTA, … … 3166 3236 COORD2ULONG(coordDestBufferCoord), 3167 3237 (ULONG)psrctSourceRect); 3168 3169 return fResult; 3170 } 3171 3172 3173 /***************************************************************************** 3174 * Name : 3175 * Purpose : 3176 * Parameters: 3177 * Variables : 3178 * Result : 3179 * Remark : 3180 * Status : 3238 3239 return fResult; 3240 } 3241 3242 3243 /***************************************************************************** 3244 * Name : 3245 * Purpose : 3246 * Parameters: 3247 * Variables : 3248 * Result : 3249 * Remark : 3250 * Status : 3181 3251 * 3182 3252 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3183 3253 *****************************************************************************/ 3184 3254 3185 BOOL WIN32API OS2ReadConsoleOutputW(HANDLE hConsoleOutput,3255 BOOL WIN32API ReadConsoleOutputW(HANDLE hConsoleOutput, 3186 3256 PCHAR_INFO pchiDestBuffer, 3187 3257 COORD coordDestBufferSize, … … 3190 3260 { 3191 3261 BOOL fResult; 3192 3262 3193 3263 #ifdef DEBUG_LOCAL2 3194 3264 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n", … … 3199 3269 psrctSourceRect); 3200 3270 #endif 3201 3271 3202 3272 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3203 3273 DRQ_READCONSOLEOUTPUTW, … … 3206 3276 COORD2ULONG(coordDestBufferCoord), 3207 3277 (ULONG)psrctSourceRect); 3208 3209 return fResult; 3210 } 3211 3212 3213 /***************************************************************************** 3214 * Name : 3215 * Purpose : 3216 * Parameters: 3217 * Variables : 3218 * Result : 3219 * Remark : 3220 * Status : 3278 3279 return fResult; 3280 } 3281 3282 3283 /***************************************************************************** 3284 * Name : 3285 * Purpose : 3286 * Parameters: 3287 * Variables : 3288 * Result : 3289 * Remark : 3290 * Status : 3221 3291 * 3222 3292 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3223 3293 *****************************************************************************/ 3224 3294 3225 BOOL WIN32API OS2ReadConsoleOutputAttribute(HANDLE hConsoleOutput,3295 BOOL WIN32API ReadConsoleOutputAttribute(HANDLE hConsoleOutput, 3226 3296 LPWORD lpwAttribute, 3227 3297 DWORD cReadCells, … … 3230 3300 { 3231 3301 BOOL fResult; 3232 3302 3233 3303 #ifdef DEBUG_LOCAL2 3234 3304 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n", … … 3239 3309 lpcNumberRead); 3240 3310 #endif 3241 3311 3242 3312 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3243 3313 DRQ_READCONSOLEOUTPUTATTRIBUTE, … … 3246 3316 COORD2ULONG(coordReadCoord), 3247 3317 (ULONG)lpcNumberRead); 3248 3249 return fResult; 3250 } 3251 3252 3253 /***************************************************************************** 3254 * Name : 3255 * Purpose : 3256 * Parameters: 3257 * Variables : 3258 * Result : 3259 * Remark : 3260 * Status : 3318 3319 return fResult; 3320 } 3321 3322 3323 /***************************************************************************** 3324 * Name : 3325 * Purpose : 3326 * Parameters: 3327 * Variables : 3328 * Result : 3329 * Remark : 3330 * Status : 3261 3331 * 3262 3332 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3263 3333 *****************************************************************************/ 3264 3334 3265 BOOL WIN32API OS2ReadConsoleOutputCharacterA(HANDLE hConsoleOutput,3335 BOOL WIN32API ReadConsoleOutputCharacterA(HANDLE hConsoleOutput, 3266 3336 LPTSTR lpReadBuffer, 3267 3337 DWORD cchRead, … … 3270 3340 { 3271 3341 BOOL fResult; 3272 3342 3273 3343 #ifdef DEBUG_LOCAL2 3274 3344 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n", … … 3279 3349 lpcNumberRead); 3280 3350 #endif 3281 3351 3282 3352 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3283 3353 DRQ_READCONSOLEOUTPUTCHARACTERA, … … 3286 3356 COORD2ULONG(coordReadCoord), 3287 3357 (ULONG)lpcNumberRead); 3288 3289 return fResult; 3290 } 3291 3292 3293 /***************************************************************************** 3294 * Name : 3295 * Purpose : 3296 * Parameters: 3297 * Variables : 3298 * Result : 3299 * Remark : 3300 * Status : 3358 3359 return fResult; 3360 } 3361 3362 3363 /***************************************************************************** 3364 * Name : 3365 * Purpose : 3366 * Parameters: 3367 * Variables : 3368 * Result : 3369 * Remark : 3370 * Status : 3301 3371 * 3302 3372 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3303 3373 *****************************************************************************/ 3304 3374 3305 BOOL WIN32API OS2ReadConsoleOutputCharacterW(HANDLE hConsoleOutput,3375 BOOL WIN32API ReadConsoleOutputCharacterW(HANDLE hConsoleOutput, 3306 3376 LPTSTR lpReadBuffer, 3307 3377 DWORD cchRead, … … 3310 3380 { 3311 3381 BOOL fResult; 3312 3382 3313 3383 #ifdef DEBUG_LOCAL2 3314 3384 WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n", … … 3319 3389 lpcNumberRead); 3320 3390 #endif 3321 3391 3322 3392 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3323 3393 DRQ_READCONSOLEOUTPUTCHARACTERW, … … 3326 3396 COORD2ULONG(coordReadCoord), 3327 3397 (ULONG)lpcNumberRead); 3328 3329 return fResult; 3330 } 3331 3332 3333 /***************************************************************************** 3334 * Name : 3335 * Purpose : 3336 * Parameters: 3337 * Variables : 3338 * Result : 3339 * Remark : 3340 * Status : 3398 3399 return fResult; 3400 } 3401 3402 3403 /***************************************************************************** 3404 * Name : 3405 * Purpose : 3406 * Parameters: 3407 * Variables : 3408 * Result : 3409 * Remark : 3410 * Status : 3341 3411 * 3342 3412 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3343 3413 *****************************************************************************/ 3344 3414 3345 BOOL WIN32API OS2ScrollConsoleScreenBufferA(HANDLE hConsoleOutput,3415 BOOL WIN32API ScrollConsoleScreenBufferA(HANDLE hConsoleOutput, 3346 3416 PSMALL_RECT psrctSourceRect, 3347 3417 PSMALL_RECT psrctClipRect, … … 3350 3420 { 3351 3421 BOOL fResult; 3352 3422 3353 3423 #ifdef DEBUG_LOCAL2 3354 3424 WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferA(%08x,%08x,%08x,%08x,%08x).\n", … … 3359 3429 pchiFill); 3360 3430 #endif 3361 3431 3362 3432 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3363 3433 DRQ_SCROLLCONSOLESCREENBUFFERA, … … 3366 3436 COORD2ULONG(coordDestOrigin), 3367 3437 (ULONG)pchiFill); 3368 3369 return fResult; 3370 } 3371 3372 3373 /***************************************************************************** 3374 * Name : 3375 * Purpose : 3376 * Parameters: 3377 * Variables : 3378 * Result : 3379 * Remark : 3380 * Status : 3438 3439 return fResult; 3440 } 3441 3442 3443 /***************************************************************************** 3444 * Name : 3445 * Purpose : 3446 * Parameters: 3447 * Variables : 3448 * Result : 3449 * Remark : 3450 * Status : 3381 3451 * 3382 3452 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3383 3453 *****************************************************************************/ 3384 3454 3385 BOOL WIN32API OS2ScrollConsoleScreenBufferW(HANDLE hConsoleOutput,3455 BOOL WIN32API ScrollConsoleScreenBufferW(HANDLE hConsoleOutput, 3386 3456 PSMALL_RECT psrctSourceRect, 3387 3457 PSMALL_RECT psrctClipRect, … … 3390 3460 { 3391 3461 BOOL fResult; 3392 3462 3393 3463 #ifdef DEBUG_LOCAL2 3394 3464 WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferW(%08x,%08x,%08x,%08x,%08x).\n", … … 3399 3469 pchiFill); 3400 3470 #endif 3401 3471 3402 3472 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3403 3473 DRQ_SCROLLCONSOLESCREENBUFFERW, … … 3406 3476 COORD2ULONG(coordDestOrigin), 3407 3477 (ULONG)pchiFill); 3408 3409 return fResult; 3410 } 3411 3412 /***************************************************************************** 3413 * Name : 3414 * Purpose : 3415 * Parameters: 3416 * Variables : 3417 * Result : 3418 * Remark : 3419 * Status : 3478 3479 return fResult; 3480 } 3481 3482 /***************************************************************************** 3483 * Name : 3484 * Purpose : 3485 * Parameters: 3486 * Variables : 3487 * Result : 3488 * Remark : 3489 * Status : 3420 3490 * 3421 3491 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3422 3492 *****************************************************************************/ 3423 3493 3424 BOOL WIN32API OS2SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)3494 BOOL WIN32API SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput) 3425 3495 { 3426 3496 BOOL fResult; 3427 3497 3428 3498 #ifdef DEBUG_LOCAL2 3429 3499 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleActiveScreenBuffer(%08x).\n", 3430 3500 hConsoleOutput); 3431 3501 #endif 3432 3502 3433 3503 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3434 3504 DRQ_SETCONSOLEACTIVESCREENBUFFER, … … 3437 3507 0, 3438 3508 0); 3439 3440 return fResult; 3441 } 3442 3443 3444 /***************************************************************************** 3445 * Name : 3446 * Purpose : 3447 * Parameters: 3448 * Variables : 3449 * Result : 3450 * Remark : 3451 * Status : 3509 3510 return fResult; 3511 } 3512 3513 3514 /***************************************************************************** 3515 * Name : 3516 * Purpose : 3517 * Parameters: 3518 * Variables : 3519 * Result : 3520 * Remark : 3521 * Status : 3452 3522 * 3453 3523 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3454 3524 *****************************************************************************/ 3455 3525 3456 BOOL WIN32API OS2SetConsoleCP(UINT IDCodePage)3526 BOOL WIN32API SetConsoleCP(UINT IDCodePage) 3457 3527 { 3458 3528 #ifdef DEBUG_LOCAL2 … … 3460 3530 IDCodePage); 3461 3531 #endif 3462 3532 3463 3533 return TRUE; 3464 3534 } … … 3466 3536 3467 3537 /***************************************************************************** 3468 * Name : 3469 * Purpose : 3470 * Parameters: 3471 * Variables : 3472 * Result : 3473 * Remark : 3474 * Status : 3538 * Name : 3539 * Purpose : 3540 * Parameters: 3541 * Variables : 3542 * Result : 3543 * Remark : 3544 * Status : 3475 3545 * 3476 3546 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3477 3547 *****************************************************************************/ 3478 3548 3479 BOOL WIN32API OS2SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine,3549 BOOL WIN32API SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine, 3480 3550 BOOL fAdd) 3481 3551 { … … 3485 3555 fAdd); 3486 3556 #endif 3487 3557 3488 3558 return TRUE; 3489 3559 } … … 3491 3561 3492 3562 /***************************************************************************** 3493 * Name : 3494 * Purpose : 3495 * Parameters: 3496 * Variables : 3497 * Result : 3498 * Remark : 3499 * Status : 3563 * Name : 3564 * Purpose : 3565 * Parameters: 3566 * Variables : 3567 * Result : 3568 * Remark : 3569 * Status : 3500 3570 * 3501 3571 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3502 3572 *****************************************************************************/ 3503 3573 3504 BOOL WIN32API OS2SetConsoleCursorInfo(HANDLE hConsoleOutput,3574 BOOL WIN32API SetConsoleCursorInfo(HANDLE hConsoleOutput, 3505 3575 PCONSOLE_CURSOR_INFO lpConsoleCursorInfo) 3506 3576 { 3507 3577 BOOL fResult; 3508 3578 3509 3579 #ifdef DEBUG_LOCAL2 3510 3580 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorInfo(%08x,%08x).\n", … … 3512 3582 lpConsoleCursorInfo); 3513 3583 #endif 3514 3584 3515 3585 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3516 3586 DRQ_SETCONSOLECURSORINFO, … … 3519 3589 0, 3520 3590 0); 3521 3522 return fResult; 3523 } 3524 3525 3526 /***************************************************************************** 3527 * Name : 3528 * Purpose : 3529 * Parameters: 3530 * Variables : 3531 * Result : 3532 * Remark : 3533 * Status : 3591 3592 return fResult; 3593 } 3594 3595 3596 /***************************************************************************** 3597 * Name : 3598 * Purpose : 3599 * Parameters: 3600 * Variables : 3601 * Result : 3602 * Remark : 3603 * Status : 3534 3604 * 3535 3605 * Author : Patrick Haller [Tue, 1998/02/10 01:55] … … 3537 3607 *****************************************************************************/ 3538 3608 3539 BOOL WIN32API OS2SetConsoleCursorPosition(HANDLE hConsoleOutput,3609 BOOL WIN32API SetConsoleCursorPosition(HANDLE hConsoleOutput, 3540 3610 COORD coordCursor) 3541 3611 { 3542 3612 BOOL fResult; 3543 3613 3544 3614 #ifdef DEBUG_LOCAL2 3545 3615 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorPosition(%08x,%08x).\n", … … 3547 3617 coordCursor); 3548 3618 #endif 3549 3619 3550 3620 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3551 3621 DRQ_SETCONSOLECURSORPOSITION, … … 3554 3624 0, 3555 3625 0); 3556 3557 return fResult; 3558 } 3559 3560 3561 /***************************************************************************** 3562 * Name : 3563 * Purpose : 3564 * Parameters: 3565 * Variables : 3566 * Result : 3567 * Remark : 3568 * Status : 3626 3627 return fResult; 3628 } 3629 3630 3631 /***************************************************************************** 3632 * Name : 3633 * Purpose : 3634 * Parameters: 3635 * Variables : 3636 * Result : 3637 * Remark : 3638 * Status : 3569 3639 * 3570 3640 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3571 3641 *****************************************************************************/ 3572 3642 3573 BOOL WIN32API OS2SetConsoleMode(HANDLE hConsole,3643 BOOL WIN32API SetConsoleMode(HANDLE hConsole, 3574 3644 DWORD fdwMode) 3575 3645 { 3576 3646 BOOL fResult; 3577 3647 3578 3648 #ifdef DEBUG_LOCAL2 3579 3649 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleMode(%08x,%08x).\n", … … 3581 3651 fdwMode); 3582 3652 #endif 3583 3653 3584 3654 fResult = (BOOL)HMDeviceRequest(hConsole, 3585 3655 DRQ_SETCONSOLEMODE, … … 3588 3658 0, 3589 3659 0); 3590 3660 3591 3661 return fResult; 3592 3662 } … … 3594 3664 3595 3665 /***************************************************************************** 3596 * Name : 3597 * Purpose : 3598 * Parameters: 3599 * Variables : 3600 * Result : 3601 * Remark : 3602 * Status : 3666 * Name : 3667 * Purpose : 3668 * Parameters: 3669 * Variables : 3670 * Result : 3671 * Remark : 3672 * Status : 3603 3673 * 3604 3674 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3605 3675 *****************************************************************************/ 3606 3676 3607 BOOL WIN32API OS2SetConsoleOutputCP(UINT IDCodePage)3677 BOOL WIN32API SetConsoleOutputCP(UINT IDCodePage) 3608 3678 { 3609 3679 #ifdef DEBUG_LOCAL2 … … 3611 3681 IDCodePage); 3612 3682 #endif 3613 3683 3614 3684 return TRUE; 3615 3685 } … … 3617 3687 3618 3688 /***************************************************************************** 3619 * Name : 3620 * Purpose : 3621 * Parameters: 3622 * Variables : 3623 * Result : 3624 * Remark : 3625 * Status : 3689 * Name : 3690 * Purpose : 3691 * Parameters: 3692 * Variables : 3693 * Result : 3694 * Remark : 3695 * Status : 3626 3696 * 3627 3697 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3628 3698 *****************************************************************************/ 3629 3699 3630 BOOL WIN32API OS2SetConsoleScreenBufferSize(HANDLE hConsoleOutput,3700 BOOL WIN32API SetConsoleScreenBufferSize(HANDLE hConsoleOutput, 3631 3701 COORD coordSize) 3632 3702 { 3633 3703 BOOL fResult; 3634 3704 3635 3705 #ifdef DEBUG_LOCAL2 3636 3706 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleScreenBufferSize(%08x,%08x).\n", … … 3638 3708 coordSize); 3639 3709 #endif 3640 3710 3641 3711 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3642 3712 DRQ_SETCONSOLESCREENBUFFERSIZE, … … 3645 3715 0, 3646 3716 0); 3647 3648 return fResult; 3649 } 3650 3651 3652 /***************************************************************************** 3653 * Name : 3654 * Purpose : 3655 * Parameters: 3656 * Variables : 3657 * Result : 3658 * Remark : 3659 * Status : 3717 3718 return fResult; 3719 } 3720 3721 3722 /***************************************************************************** 3723 * Name : 3724 * Purpose : 3725 * Parameters: 3726 * Variables : 3727 * Result : 3728 * Remark : 3729 * Status : 3660 3730 * 3661 3731 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3662 3732 *****************************************************************************/ 3663 3733 3664 BOOL WIN32API OS2SetConsoleTextAttribute(HANDLE hConsoleOutput,3734 BOOL WIN32API SetConsoleTextAttribute(HANDLE hConsoleOutput, 3665 3735 WORD wAttr) 3666 3736 { 3667 3737 BOOL fResult; 3668 3738 3669 3739 #ifdef DEBUG_LOCAL2 3670 3740 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleTextAttribute(%08x,%04x).\n", … … 3672 3742 wAttr); 3673 3743 #endif 3674 3744 3675 3745 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3676 3746 DRQ_SETCONSOLETEXTATTRIBUTE, … … 3679 3749 0, 3680 3750 0); 3681 3682 return fResult; 3683 } 3684 3685 3686 /***************************************************************************** 3687 * Name : BOOL WIN32API OS2SetConsoleTitleA3751 3752 return fResult; 3753 } 3754 3755 3756 /***************************************************************************** 3757 * Name : BOOL WIN32API SetConsoleTitleA 3688 3758 * Purpose : Set new title text for the console window 3689 3759 * Parameters: LPTSTR lpszTitle 3690 3760 * Variables : 3691 * Result : 3761 * Result : 3692 3762 * Remark : 3693 3763 * Status : REWRITTEN UNTESTED … … 3696 3766 *****************************************************************************/ 3697 3767 3698 BOOL WIN32API OS2SetConsoleTitleA(LPTSTR lpszTitle)3768 BOOL WIN32API SetConsoleTitleA(LPTSTR lpszTitle) 3699 3769 { 3700 3770 #ifdef DEBUG_LOCAL2 … … 3702 3772 lpszTitle); 3703 3773 #endif 3704 3774 3705 3775 if (ConsoleGlobals.pszWindowTitle != NULL) /* previously set name */ 3706 3776 free (ConsoleGlobals.pszWindowTitle); /* then free it */ 3707 3777 3708 3778 ConsoleGlobals.pszWindowTitle = strdup(lpszTitle); /* copy the new name */ 3709 3779 3710 3780 WinSetWindowText(ConsoleGlobals.hwndFrame, /* set new title text */ 3711 3781 ConsoleGlobals.pszWindowTitle); 3712 3782 3713 3783 return TRUE; 3714 3784 } … … 3716 3786 3717 3787 /***************************************************************************** 3718 * Name : BOOL WIN32API OS2SetConsoleTitleW3788 * Name : BOOL WIN32API SetConsoleTitleW 3719 3789 * Purpose : Set new title text for the console window 3720 3790 * Parameters: LPTSTR lpszTitle 3721 3791 * Variables : 3722 * Result : 3792 * Result : 3723 3793 * Remark : 3724 3794 * Status : REWRITTEN UNTESTED … … 3727 3797 *****************************************************************************/ 3728 3798 3729 BOOL WIN32API OS2SetConsoleTitleW(LPTSTR lpszTitle)3799 BOOL WIN32API SetConsoleTitleW(LPTSTR lpszTitle) 3730 3800 { 3731 3801 #ifdef DEBUG_LOCAL2 … … 3733 3803 lpszTitle); 3734 3804 #endif 3735 3805 3736 3806 /* @@@PH Unicode2Ascii */ 3737 3807 3738 3808 if (ConsoleGlobals.pszWindowTitle != NULL) /* previously set name */ 3739 3809 free (ConsoleGlobals.pszWindowTitle); /* then free it */ 3740 3810 3741 3811 ConsoleGlobals.pszWindowTitle = strdup(lpszTitle); /* copy the new name */ 3742 3812 3743 3813 WinSetWindowText(ConsoleGlobals.hwndFrame, /* set new title text */ 3744 3814 ConsoleGlobals.pszWindowTitle); 3745 3815 3746 3816 return TRUE; 3747 3817 } … … 3749 3819 3750 3820 /***************************************************************************** 3751 * Name : 3752 * Purpose : 3753 * Parameters: 3754 * Variables : 3755 * Result : 3756 * Remark : 3757 * Status : 3821 * Name : 3822 * Purpose : 3823 * Parameters: 3824 * Variables : 3825 * Result : 3826 * Remark : 3827 * Status : 3758 3828 * 3759 3829 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3760 3830 *****************************************************************************/ 3761 3831 3762 BOOL WIN32API OS2SetConsoleWindowInfo(HANDLE hConsoleOutput,3832 BOOL WIN32API SetConsoleWindowInfo(HANDLE hConsoleOutput, 3763 3833 BOOL fAbsolute, 3764 3834 PSMALL_RECT psrctWindowRect) 3765 3835 { 3766 3836 BOOL fResult; 3767 3837 3768 3838 #ifdef DEBUG_LOCAL2 3769 3839 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleWindowInfo(%08x,%08x,%08x).\n", … … 3772 3842 psrctWindowRect); 3773 3843 #endif 3774 3844 3775 3845 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3776 3846 DRQ_SETCONSOLEWINDOWINFO, … … 3779 3849 0, 3780 3850 0); 3781 3782 return fResult; 3783 } 3784 3785 3786 /***************************************************************************** 3787 * Name : 3788 * Purpose : 3789 * Parameters: 3790 * Variables : 3791 * Result : 3792 * Remark : 3793 * Status : 3851 3852 return fResult; 3853 } 3854 3855 3856 /***************************************************************************** 3857 * Name : 3858 * Purpose : 3859 * Parameters: 3860 * Variables : 3861 * Result : 3862 * Remark : 3863 * Status : 3794 3864 * 3795 3865 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3796 3866 *****************************************************************************/ 3797 3867 3798 BOOL WIN32API OS2WriteConsoleA(HANDLE hConsoleOutput,3868 BOOL WIN32API WriteConsoleA(HANDLE hConsoleOutput, 3799 3869 CONST VOID* lpvBuffer, 3800 3870 DWORD cchToWrite, … … 3803 3873 { 3804 3874 BOOL fResult; 3805 3875 3806 3876 #ifdef DEBUG_LOCAL2 3807 3877 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleA(%08x,%08x,%08x,%08x,%08x).\n", … … 3812 3882 lpvReserved); 3813 3883 #endif 3814 3884 3815 3885 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3816 3886 DRQ_WRITECONSOLEA, … … 3819 3889 (ULONG)lpcchWritten, 3820 3890 (ULONG)lpvReserved); 3821 3822 return fResult; 3823 } 3824 3825 3826 /***************************************************************************** 3827 * Name : 3828 * Purpose : 3829 * Parameters: 3830 * Variables : 3831 * Result : 3832 * Remark : 3833 * Status : 3891 3892 return fResult; 3893 } 3894 3895 3896 /***************************************************************************** 3897 * Name : 3898 * Purpose : 3899 * Parameters: 3900 * Variables : 3901 * Result : 3902 * Remark : 3903 * Status : 3834 3904 * 3835 3905 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3836 3906 *****************************************************************************/ 3837 3907 3838 BOOL WIN32API OS2WriteConsoleW(HANDLE hConsoleOutput,3908 BOOL WIN32API WriteConsoleW(HANDLE hConsoleOutput, 3839 3909 CONST VOID* lpvBuffer, 3840 3910 DWORD cchToWrite, … … 3843 3913 { 3844 3914 BOOL fResult; 3845 3915 3846 3916 #ifdef DEBUG_LOCAL2 3847 3917 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleW(%08x,%08x,%08x,%08x,%08x).\n", … … 3852 3922 lpvReserved); 3853 3923 #endif 3854 3924 3855 3925 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3856 3926 DRQ_WRITECONSOLEW, … … 3859 3929 (ULONG)lpcchWritten, 3860 3930 (ULONG)lpvReserved); 3861 3862 return fResult; 3863 } 3864 3865 3866 /***************************************************************************** 3867 * Name : 3868 * Purpose : 3869 * Parameters: 3870 * Variables : 3871 * Result : 3872 * Remark : 3873 * Status : 3931 3932 return fResult; 3933 } 3934 3935 3936 /***************************************************************************** 3937 * Name : 3938 * Purpose : 3939 * Parameters: 3940 * Variables : 3941 * Result : 3942 * Remark : 3943 * Status : 3874 3944 * 3875 3945 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3876 3946 *****************************************************************************/ 3877 3947 3878 BOOL WIN32API OS2WriteConsoleInputA(HANDLE hConsoleInput,3948 BOOL WIN32API WriteConsoleInputA(HANDLE hConsoleInput, 3879 3949 PINPUT_RECORD pirBuffer, 3880 3950 DWORD cInRecords, … … 3882 3952 { 3883 3953 BOOL fResult; 3884 3954 3885 3955 #ifdef DEBUG_LOCAL2 3886 3956 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputA(%08x,%08x,%08x,%08x).\n", … … 3890 3960 lpcWritten); 3891 3961 #endif 3892 3962 3893 3963 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 3894 3964 DRQ_WRITECONSOLEINPUTA, … … 3897 3967 (ULONG)lpcWritten, 3898 3968 0); 3899 3900 return fResult; 3901 } 3902 3903 3904 /***************************************************************************** 3905 * Name : 3906 * Purpose : 3907 * Parameters: 3908 * Variables : 3909 * Result : 3910 * Remark : 3911 * Status : 3969 3970 return fResult; 3971 } 3972 3973 3974 /***************************************************************************** 3975 * Name : 3976 * Purpose : 3977 * Parameters: 3978 * Variables : 3979 * Result : 3980 * Remark : 3981 * Status : 3912 3982 * 3913 3983 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3914 3984 *****************************************************************************/ 3915 3985 3916 BOOL WIN32API OS2WriteConsoleInputW(HANDLE hConsoleInput,3986 BOOL WIN32API WriteConsoleInputW(HANDLE hConsoleInput, 3917 3987 PINPUT_RECORD pirBuffer, 3918 3988 DWORD cInRecords, … … 3920 3990 { 3921 3991 BOOL fResult; 3922 3992 3923 3993 #ifdef DEBUG_LOCAL2 3924 3994 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputW(%08x,%08x,%08x,%08x).\n", … … 3928 3998 lpcWritten); 3929 3999 #endif 3930 4000 3931 4001 fResult = (BOOL)HMDeviceRequest(hConsoleInput, 3932 4002 DRQ_WRITECONSOLEINPUTW, … … 3935 4005 (ULONG)lpcWritten, 3936 4006 0); 3937 3938 return fResult; 3939 } 3940 3941 3942 /***************************************************************************** 3943 * Name : 3944 * Purpose : 3945 * Parameters: 3946 * Variables : 3947 * Result : 3948 * Remark : 3949 * Status : 4007 4008 return fResult; 4009 } 4010 4011 4012 /***************************************************************************** 4013 * Name : 4014 * Purpose : 4015 * Parameters: 4016 * Variables : 4017 * Result : 4018 * Remark : 4019 * Status : 3950 4020 * 3951 4021 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3952 4022 *****************************************************************************/ 3953 4023 3954 BOOL WIN32API OS2WriteConsoleOutputA(HANDLE hConsoleOutput,4024 BOOL WIN32API WriteConsoleOutputA(HANDLE hConsoleOutput, 3955 4025 PCHAR_INFO pchiSrcBuffer, 3956 4026 COORD coordSrcBufferSize, … … 3959 4029 { 3960 4030 BOOL fResult; 3961 4031 3962 4032 #ifdef DEBUG_LOCAL2 3963 4033 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n", … … 3968 4038 psrctDestRect); 3969 4039 #endif 3970 4040 3971 4041 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 3972 4042 DRQ_WRITECONSOLEOUTPUTA, … … 3975 4045 COORD2ULONG(coordSrcBufferCoord), 3976 4046 (ULONG)psrctDestRect); 3977 3978 return fResult; 3979 } 3980 3981 3982 /***************************************************************************** 3983 * Name : 3984 * Purpose : 3985 * Parameters: 3986 * Variables : 3987 * Result : 3988 * Remark : 3989 * Status : 4047 4048 return fResult; 4049 } 4050 4051 4052 /***************************************************************************** 4053 * Name : 4054 * Purpose : 4055 * Parameters: 4056 * Variables : 4057 * Result : 4058 * Remark : 4059 * Status : 3990 4060 * 3991 4061 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 3992 4062 *****************************************************************************/ 3993 4063 3994 BOOL WIN32API OS2WriteConsoleOutputW(HANDLE hConsoleOutput,4064 BOOL WIN32API WriteConsoleOutputW(HANDLE hConsoleOutput, 3995 4065 PCHAR_INFO pchiSrcBuffer, 3996 4066 COORD coordSrcBufferSize, … … 3999 4069 { 4000 4070 BOOL fResult; 4001 4071 4002 4072 #ifdef DEBUG_LOCAL2 4003 4073 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n", … … 4008 4078 psrctDestRect); 4009 4079 #endif 4010 4080 4011 4081 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 4012 4082 DRQ_WRITECONSOLEOUTPUTW, … … 4015 4085 COORD2ULONG(coordSrcBufferCoord), 4016 4086 (ULONG)psrctDestRect); 4017 4018 return fResult; 4019 } 4020 4021 /***************************************************************************** 4022 * Name : 4023 * Purpose : 4024 * Parameters: 4025 * Variables : 4026 * Result : 4027 * Remark : 4028 * Status : 4087 4088 return fResult; 4089 } 4090 4091 /***************************************************************************** 4092 * Name : 4093 * Purpose : 4094 * Parameters: 4095 * Variables : 4096 * Result : 4097 * Remark : 4098 * Status : 4029 4099 * 4030 4100 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 4031 4101 *****************************************************************************/ 4032 4102 4033 BOOL WIN32API OS2WriteConsoleOutputAttribute(HANDLE hConsoleOutput,4103 BOOL WIN32API WriteConsoleOutputAttribute(HANDLE hConsoleOutput, 4034 4104 LPWORD lpwAttribute, 4035 4105 DWORD cWriteCells, … … 4038 4108 { 4039 4109 BOOL fResult; 4040 4110 4041 4111 #ifdef DEBUG_LOCAL2 4042 4112 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n", … … 4047 4117 lpcNumberWritten); 4048 4118 #endif 4049 4119 4050 4120 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 4051 4121 DRQ_WRITECONSOLEOUTPUTATTRIBUTE, … … 4054 4124 COORD2ULONG(coordWriteCoord), 4055 4125 (ULONG)lpcNumberWritten); 4056 4057 return fResult; 4058 } 4059 4060 4061 /***************************************************************************** 4062 * Name : 4063 * Purpose : 4064 * Parameters: 4065 * Variables : 4066 * Result : 4067 * Remark : 4068 * Status : 4126 4127 return fResult; 4128 } 4129 4130 4131 /***************************************************************************** 4132 * Name : 4133 * Purpose : 4134 * Parameters: 4135 * Variables : 4136 * Result : 4137 * Remark : 4138 * Status : 4069 4139 * 4070 4140 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 4071 4141 *****************************************************************************/ 4072 4142 4073 BOOL WIN32API OS2WriteConsoleOutputCharacterA(HANDLE hConsoleOutput,4143 BOOL WIN32API WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, 4074 4144 LPTSTR lpWriteBuffer, 4075 4145 DWORD cchWrite, … … 4078 4148 { 4079 4149 BOOL fResult; 4080 4150 4081 4151 #ifdef DEBUG_LOCAL2 4082 4152 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n", … … 4087 4157 lpcWritten); 4088 4158 #endif 4089 4159 4090 4160 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 4091 4161 DRQ_WRITECONSOLEOUTPUTCHARACTERA, … … 4094 4164 COORD2ULONG(coordWriteCoord), 4095 4165 (ULONG)lpcWritten); 4096 4097 return fResult; 4098 } 4099 4100 4101 /***************************************************************************** 4102 * Name : 4103 * Purpose : 4104 * Parameters: 4105 * Variables : 4106 * Result : 4107 * Remark : 4108 * Status : 4166 4167 return fResult; 4168 } 4169 4170 4171 /***************************************************************************** 4172 * Name : 4173 * Purpose : 4174 * Parameters: 4175 * Variables : 4176 * Result : 4177 * Remark : 4178 * Status : 4109 4179 * 4110 4180 * Author : Patrick Haller [Tue, 1998/02/10 01:55] 4111 4181 *****************************************************************************/ 4112 4182 4113 BOOL WIN32API OS2WriteConsoleOutputCharacterW(HANDLE hConsoleOutput,4183 BOOL WIN32API WriteConsoleOutputCharacterW(HANDLE hConsoleOutput, 4114 4184 LPTSTR lpWriteBuffer, 4115 4185 DWORD cchWrite, … … 4118 4188 { 4119 4189 BOOL fResult; 4120 4190 4121 4191 #ifdef DEBUG_LOCAL2 4122 4192 WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n", … … 4127 4197 lpcWritten); 4128 4198 #endif 4129 4199 4130 4200 fResult = (BOOL)HMDeviceRequest(hConsoleOutput, 4131 4201 DRQ_WRITECONSOLEOUTPUTCHARACTERW, … … 4134 4204 COORD2ULONG(coordWriteCoord), 4135 4205 (ULONG)lpcWritten); 4136 4137 return fResult; 4206 4207 return fResult; 4138 4208 } 4139 4209 … … 4148 4218 * PHMHANDLEDATA pHMHandleDataTemplate data of the template handle 4149 4219 * Variables : 4150 * Result : 4220 * Result : 4151 4221 * Remark : @@@PH CONIN$ handles should be exclusive 4152 4222 * reject other requests to this device … … 4170 4240 pHMHandleDataTemplate); 4171 4241 #endif 4172 4242 4173 4243 pHMHandleData->dwType = FILE_TYPE_CHAR; /* we're a character device */ 4174 4244 4175 4245 return(NO_ERROR); 4176 4246 } … … 4178 4248 4179 4249 /***************************************************************************** 4180 * Name : 4181 * Purpose : 4182 * Parameters: 4183 * Variables : 4184 * Result : 4185 * Remark : 4186 * Status : 4250 * Name : 4251 * Purpose : 4252 * Parameters: 4253 * Variables : 4254 * Result : 4255 * Remark : 4256 * Status : 4187 4257 * 4188 4258 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 4200 4270 INPUT_RECORD InputRecord; /* buffer for the event to be read */ 4201 4271 ULONG ulPostCounter; /* semaphore post counter */ 4202 4272 4203 4273 #ifdef DEBUG_LOCAL 4204 4274 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n", … … 4210 4280 lpOverlapped); 4211 4281 #endif 4212 4282 4213 4283 ulCounter = 0; /* read ascii chars from queue */ 4214 4284 pszTarget = (PSZ)lpBuffer; 4215 4285 4216 4286 /* @@@PH: ConsoleMode: ENABLE_LINE_INPUT - blocks until CR is read */ 4217 4287 4218 4288 /* block if no key events are in the queue */ 4219 4289 for (;ulCounter==0;) /* until we got some characters */ … … 4226 4296 &ulPostCounter); /* post counter - ignored */ 4227 4297 } 4228 4298 4229 4299 do 4230 4300 { … … 4237 4307 pszTarget++; 4238 4308 ulCounter++; 4239 4309 4240 4310 /* local echo enabled ? */ 4241 4311 if (ConsoleInput.dwConsoleMode & ENABLE_ECHO_INPUT) … … 4245 4315 &ulPostCounter, /* dummy result */ 4246 4316 NULL); 4247 4317 4248 4318 if (ulCounter >= nNumberOfBytesToRead) /* at buffer's end ? */ 4249 4319 goto __readfile_exit; … … 4254 4324 while (rc == NO_ERROR); 4255 4325 } 4256 4326 4257 4327 __readfile_exit: 4258 4328 4259 4329 *lpNumberOfBytesRead = ulCounter; /* write result */ 4260 4330 … … 4264 4334 4265 4335 /***************************************************************************** 4266 * Name : 4267 * Purpose : 4268 * Parameters: 4269 * Variables : 4270 * Result : 4271 * Remark : 4272 * Status : 4336 * Name : 4337 * Purpose : 4338 * Parameters: 4339 * Variables : 4340 * Result : 4341 * Remark : 4342 * Status : 4273 4343 * 4274 4344 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 4291 4361 lpOverlapped); 4292 4362 #endif 4293 4363 4294 4364 return(ERROR_ACCESS_DENIED); 4295 4365 } … … 4297 4367 4298 4368 /***************************************************************************** 4299 * Name : 4300 * Purpose : 4301 * Parameters: 4302 * Variables : 4303 * Result : 4304 * Remark : 4305 * Status : 4369 * Name : 4370 * Purpose : 4371 * Parameters: 4372 * Variables : 4373 * Result : 4374 * Remark : 4375 * Status : 4306 4376 * 4307 4377 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 4320 4390 return (HMDeviceConsoleInClass:: 4321 4391 FlushConsoleInputBuffer(pHMHandleData)); 4322 4392 4323 4393 case DRQ_GETNUMBEROFCONSOLEINPUTEVENTS: 4324 4394 return (HMDeviceConsoleInClass:: 4325 4395 GetNumberOfConsoleInputEvents(pHMHandleData, 4326 4396 (LPDWORD)arg1)); 4327 4397 4328 4398 case DRQ_PEEKCONSOLEINPUTA: 4329 4399 return (HMDeviceConsoleInClass:: … … 4332 4402 (DWORD) arg2, 4333 4403 (LPDWORD) arg3)); 4334 4404 4335 4405 case DRQ_PEEKCONSOLEINPUTW: 4336 4406 return (HMDeviceConsoleInClass:: … … 4339 4409 (DWORD) arg2, 4340 4410 (LPDWORD) arg3)); 4341 4342 4411 4412 4343 4413 case DRQ_READCONSOLEA: 4344 4414 return (HMDeviceConsoleInClass:: … … 4348 4418 (LPDWORD) arg3, 4349 4419 (LPVOID) arg4)); 4350 4420 4351 4421 case DRQ_READCONSOLEW: 4352 4422 return (HMDeviceConsoleInClass:: … … 4356 4426 (LPDWORD) arg3, 4357 4427 (LPVOID) arg4)); 4358 4428 4359 4429 case DRQ_READCONSOLEINPUTA: 4360 4430 return (HMDeviceConsoleInClass:: … … 4362 4432 (PINPUT_RECORD)arg1, 4363 4433 (DWORD)arg2, 4364 (LPDWORD)arg3)); 4365 4434 (LPDWORD)arg3)); 4435 4366 4436 case DRQ_READCONSOLEINPUTW: 4367 4437 return (HMDeviceConsoleInClass:: … … 4377 4447 (DWORD)arg2, 4378 4448 (LPDWORD)arg3)); 4379 4449 4380 4450 case DRQ_WRITECONSOLEINPUTW: 4381 4451 return (HMDeviceConsoleInClass:: … … 4384 4454 (DWORD)arg2, 4385 4455 (LPDWORD)arg3)); 4386 4387 } 4388 4456 4457 } 4458 4389 4459 #ifdef DEBUG_LOCAL 4390 4460 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass:_DeviceRequest %s(%08x,%08x,%08x,%08x,%08x,%08x) unknown request\n", … … 4409 4479 * Variables : 4410 4480 * Result : 4411 * Remark : 4481 * Remark : 4412 4482 * Status : UNTESTED 4413 4483 * … … 4418 4488 { 4419 4489 ULONG ulCounter; /* loop counter */ 4420 4490 4421 4491 #ifdef DEBUG_LOCAL2 4422 4492 WriteLog("KERNEL32/CONSOLE: CONIN$::FlushConsoleInputBuffer(%08x).\n", 4423 4493 pHMHandleData); 4424 4494 #endif 4425 4495 4426 4496 ConsoleInput.ulIndexFree = 0; 4427 4497 ConsoleInput.ulIndexEvent = 0; 4428 4498 ConsoleInput.ulEvents = 0; 4429 4499 4430 4500 for (ulCounter = 0; 4431 4501 ulCounter < CONSOLE_INPUTQUEUESIZE; … … 4445 4515 * Result : 4446 4516 4447 * Remark : 4517 * Remark : 4448 4518 * Status : UNTESTED 4449 4519 * … … 4459 4529 lpMode); 4460 4530 #endif 4461 4531 4462 4532 *lpMode = ConsoleInput.dwConsoleMode; /* return current console mode */ 4463 4533 … … 4473 4543 * Variables : 4474 4544 * Result : 4475 * Remark : 4545 * Remark : 4476 4546 * Status : UNTESTED 4477 4547 * … … 4487 4557 lpNumberOfEvents); 4488 4558 #endif 4489 4559 4490 4560 *lpNumberOfEvents = ConsoleInput.ulEvents; /* return number of events */ 4491 4561 … … 4520 4590 ULONG ulCurrentEvent; /* index of current event in the queue */ 4521 4591 PINPUT_RECORD pirEvent; /* pointer to current queue element */ 4522 4592 4523 4593 #ifdef DEBUG_LOCAL2 4524 4594 WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputA(%08x,%08x,%08x,%08x).\n", … … 4528 4598 lpcRead); 4529 4599 #endif 4530 4600 4531 4601 if (ConsoleInputQueryEvents() == 0) /* if queue is currently empty */ 4532 4602 { … … 4534 4604 return (TRUE); /* OK, we're done */ 4535 4605 } 4536 4537 4606 4607 4538 4608 for (ulCounter = 0, 4539 4609 ulCurrentEvent = ConsoleInput.ulIndexEvent, 4540 4610 pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent]; 4541 4611 4542 4612 ulCounter < cInRecords; 4543 4613 4544 4614 ulCounter++, 4545 4615 ulCurrentEvent++, … … 4552 4622 pirEvent = ConsoleInput.arrInputRecord; 4553 4623 } 4554 4624 4555 4625 if (pirEvent->EventType == 0x0000) /* no more events ? */ 4556 4626 break; /* leave loop then */ 4557 4627 4558 4628 memcpy(pirEvent, /* copy event data */ 4559 4629 pirBuffer, … … 4592 4662 ULONG ulCurrentEvent; /* index of current event in the queue */ 4593 4663 PINPUT_RECORD pirEvent; /* pointer to current queue element */ 4594 4664 4595 4665 #ifdef DEBUG_LOCAL2 4596 4666 WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputW(%08x,%08x,%08x,%08x).\n", … … 4600 4670 lpcRead); 4601 4671 #endif 4602 4672 4603 4673 if (ConsoleInputQueryEvents() == 0) /* if queue is currently empty */ 4604 4674 { … … 4606 4676 return (TRUE); /* OK, we're done */ 4607 4677 } 4608 4609 4678 4679 4610 4680 for (ulCounter = 0, 4611 4681 ulCurrentEvent = ConsoleInput.ulIndexEvent, 4612 4682 pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent]; 4613 4683 4614 4684 ulCounter < cInRecords; 4615 4685 4616 4686 ulCounter++, 4617 4687 ulCurrentEvent++, … … 4624 4694 pirEvent = ConsoleInput.arrInputRecord; 4625 4695 } 4626 4696 4627 4697 if (pirEvent->EventType == 0x0000) /* no more events ? */ 4628 4698 break; /* leave loop then */ 4629 4699 4630 4700 memcpy(pirEvent, /* copy event data */ 4631 4701 pirBuffer, … … 4648 4718 * Variables : 4649 4719 * Result : 4650 * Remark : 4720 * Remark : 4651 4721 * Status : UNTESTED 4652 4722 * … … 4661 4731 { 4662 4732 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 4663 4733 4664 4734 #ifdef DEBUG_LOCAL2 4665 4735 WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleA(%08x,%08x,%u,%08x,%08x).\n", … … 4670 4740 lpvReserved); 4671 4741 #endif 4672 4742 4673 4743 /* simply forward the request to that routine */ 4674 4744 return (HMDeviceConsoleInClass::ReadFile(pHMHandleData, … … 4690 4760 * Variables : 4691 4761 * Result : 4692 * Remark : 4762 * Remark : 4693 4763 * Status : UNTESTED 4694 4764 * … … 4704 4774 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 4705 4775 DWORD dwResult; 4706 4776 4707 4777 #ifdef DEBUG_LOCAL2 4708 4778 WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleW(%08x,%08x,%u,%08x,%08x).\n", … … 4713 4783 lpvReserved); 4714 4784 #endif 4715 4785 4716 4786 /* simply forward the request to that routine */ 4717 4787 dwResult = HMDeviceConsoleInClass::ReadFile(pHMHandleData, … … 4721 4791 NULL); 4722 4792 /* @@@PH AScii -> unicode translation */ 4723 4793 4724 4794 return (dwResult); /* deliver return code */ 4725 4795 } … … 4748 4818 ULONG ulPostCounter; /* semaphore post counter - ignored */ 4749 4819 APIRET rc; /* API returncode */ 4750 4820 4751 4821 #ifdef DEBUG_LOCAL2 4752 4822 WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputA(%08x,%08x,%08x,%08x).\n", … … 4756 4826 lpcRead); 4757 4827 #endif 4758 4828 4759 4829 if (ConsoleInputQueryEvents() == 0) /* if queue is currently empty */ 4760 4830 { … … 4764 4834 &ulPostCounter); /* post counter - ignored */ 4765 4835 } 4766 4767 4836 4837 4768 4838 /* now read events into target buffer */ 4769 4839 for (ulPostCounter = 0; … … 4776 4846 break; 4777 4847 } 4778 4848 4779 4849 *lpcRead = ulPostCounter; /* return number of records read */ 4780 4850 return (TRUE); /* OK */ … … 4804 4874 ULONG ulPostCounter; /* semaphore post counter - ignored */ 4805 4875 APIRET rc; /* API returncode */ 4806 4876 4807 4877 #ifdef DEBUG_LOCAL2 4808 4878 WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputW(%08x,%08x,%08x,%08x).\n", … … 4812 4882 lpcRead); 4813 4883 #endif 4814 4884 4815 4885 if (ConsoleInputQueryEvents() == 0) /* if queue is currently empty */ 4816 4886 { … … 4820 4890 &ulPostCounter); /* post counter - ignored */ 4821 4891 } 4822 4823 4892 4893 4824 4894 /* now read events into target buffer */ 4825 4895 for (ulPostCounter = 0; … … 4832 4902 break; 4833 4903 } 4834 4904 4835 4905 *lpcRead = ulPostCounter; /* return number of records read */ 4836 4906 return (TRUE); /* OK */ … … 4845 4915 * Variables : 4846 4916 * Result : 4847 * Remark : 4917 * Remark : 4848 4918 * Status : UNTESTED 4849 4919 * … … 4855 4925 { 4856 4926 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 4857 4927 4858 4928 #ifdef DEBUG_LOCAL2 4859 4929 WriteLog("KERNEL32/CONSOLE: CONIN$::SetConsoleMode(%08x,%08x).\n", … … 4861 4931 dwMode); 4862 4932 #endif 4863 4933 4864 4934 ConsoleInput.dwConsoleMode = dwMode; /* set current console mode */ 4865 4935 4866 4936 return (TRUE); 4867 4937 } … … 4871 4941 * Name : DWORD HMDeviceConsoleInClass::WriteConsoleInputA 4872 4942 * Purpose : this writes event records directly into the queue 4873 * Parameters: PHMHANDLEDATA pHMHandleData 4943 * Parameters: PHMHANDLEDATA pHMHandleData 4874 4944 * PINPUT_RECORD pirBuffer 4875 4945 * DWORD cInRecords 4876 4946 * LPDWORD lpcWritten 4877 4947 * Variables : 4878 * Result : 4879 * Remark : 4948 * Result : 4949 * Remark : 4880 4950 * Status : NO_ERROR - API succeeded 4881 4951 * other - what is to be set in SetLastError … … 4892 4962 APIRET rc; /* API returncode */ 4893 4963 ULONG ulCounter; /* loop counter */ 4894 4964 4895 4965 #ifdef DEBUG_LOCAL2 4896 4966 WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputA(%08x,%08x,%u,%08x).\n", … … 4900 4970 lpcWritten); 4901 4971 #endif 4902 4972 4903 4973 for (ulCounter = 0; 4904 4974 ulCounter < cInRecords; … … 4910 4980 break; 4911 4981 } 4912 4982 4913 4983 *lpcWritten = ulCounter; /* return number of events written */ 4914 4984 return (TRUE); /* OK */ … … 4919 4989 * Name : DWORD HMDeviceConsoleInClass::WriteConsoleInputW 4920 4990 * Purpose : this writes event records directly into the queue 4921 * Parameters: PHMHANDLEDATA pHMHandleData 4991 * Parameters: PHMHANDLEDATA pHMHandleData 4922 4992 * PINPUT_RECORD pirBuffer 4923 4993 * DWORD cInRecords 4924 4994 * LPDWORD lpcWritten 4925 4995 * Variables : 4926 * Result : 4927 * Remark : 4996 * Result : 4997 * Remark : 4928 4998 * Status : NO_ERROR - API succeeded 4929 4999 * other - what is to be set in SetLastError … … 4940 5010 APIRET rc; /* API returncode */ 4941 5011 ULONG ulCounter; /* loop counter */ 4942 5012 4943 5013 #ifdef DEBUG_LOCAL2 4944 5014 WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputW(%08x,%08x,%u,%08x).\n", … … 4948 5018 lpcWritten); 4949 5019 #endif 4950 5020 4951 5021 for (ulCounter = 0; 4952 5022 ulCounter < cInRecords; … … 4958 5028 break; 4959 5029 } 4960 5030 4961 5031 *lpcWritten = ulCounter; /* return number of events written */ 4962 5032 return (TRUE); /* OK */ … … 4974 5044 * PHMHANDLEDATA pHMHandleDataTemplate data of the template handle 4975 5045 * Variables : 4976 * Result : 4977 * Remark : 5046 * Result : 5047 * Remark : 4978 5048 * Status : NO_ERROR - API succeeded 4979 5049 * other - what is to be set in SetLastError … … 4990 5060 BOOL fResult; 4991 5061 HANDLE hConsole; 4992 5062 4993 5063 #ifdef DEBUG_LOCAL2 4994 5064 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass %s(%s,%08x,%08x,%08x)\n", … … 4999 5069 pHMHandleDataTemplate); 5000 5070 #endif 5001 5071 5002 5072 pHMHandleData->dwType = FILE_TYPE_CHAR; /* we're a character device */ 5003 5004 5073 5074 5005 5075 /* if no default buffer is available, then do default setup */ 5006 5076 if (ConsoleGlobals.hConsoleBuffer == INVALID_HANDLE_VALUE) 5007 5077 { 5008 5078 /* now we need a default screen buffer with the default size */ 5009 hConsole = OS2CreateConsoleScreenBuffer(0,5079 hConsole = CreateConsoleScreenBuffer(0, 5010 5080 0, 5011 5081 NULL, … … 5020 5090 return INVALID_HANDLE_VALUE; /* abort further processing immediately */ 5021 5091 } 5022 5023 fResult = OS2SetConsoleTextAttribute(hConsole,5092 5093 fResult = SetConsoleTextAttribute(hConsole, 5024 5094 ConsoleGlobals.Options.ucDefaultAttribute); 5025 5095 #ifdef DEBUG_LOCAL … … 5028 5098 GetLastError()); 5029 5099 #endif 5030 5031 fResult = OS2SetConsoleScreenBufferSize(hConsole,5100 5101 fResult = SetConsoleScreenBufferSize(hConsole, 5032 5102 ConsoleGlobals.Options.coordDefaultSize); 5033 5103 if (fResult == FALSE) … … 5040 5110 return (INVALID_HANDLE_VALUE); /* abort further processing */ 5041 5111 } 5042 5043 fResult = OS2SetConsoleActiveScreenBuffer(hConsole);5112 5113 fResult = SetConsoleActiveScreenBuffer(hConsole); 5044 5114 if (fResult == FALSE) 5045 5115 { … … 5057 5127 } 5058 5128 } 5059 5129 5060 5130 return(NO_ERROR); 5061 5131 } … … 5063 5133 5064 5134 /***************************************************************************** 5065 * Name : 5066 * Purpose : 5067 * Parameters: 5068 * Variables : 5069 * Result : 5070 * Remark : 5071 * Status : 5135 * Name : 5136 * Purpose : 5137 * Parameters: 5138 * Variables : 5139 * Result : 5140 * Remark : 5141 * Status : 5072 5142 * 5073 5143 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 5080 5150 LPOVERLAPPED lpOverlapped) 5081 5151 { 5082 5152 5083 5153 #ifdef DEBUG_LOCAL 5084 5154 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n", … … 5090 5160 lpOverlapped); 5091 5161 #endif 5092 5162 5093 5163 return(ERROR_ACCESS_DENIED); 5094 5164 } … … 5096 5166 5097 5167 /***************************************************************************** 5098 * Name : 5099 * Purpose : 5100 * Parameters: 5101 * Variables : 5102 * Result : 5103 * Remark : 5104 * Status : 5168 * Name : 5169 * Purpose : 5170 * Parameters: 5171 * Variables : 5172 * Result : 5173 * Remark : 5174 * Status : 5105 5175 * 5106 5176 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 5114 5184 { 5115 5185 DWORD dwResult; /* result from subsequent WriteFile */ 5116 5186 5117 5187 #ifdef DEBUG_LOCAL2 5118 5188 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass:WriteFile %s(%08x,%08x,%08x,%08x,%08x)\n", … … 5124 5194 lpOverlapped); 5125 5195 #endif 5126 5196 5127 5197 /* just prevent an endless loop, although this condition might never */ 5128 5198 /* be true ! */ … … 5137 5207 0); 5138 5208 #endif 5139 5209 5140 5210 dwResult = HMWriteFile(ConsoleGlobals.hConsoleBuffer, 5141 5211 lpBuffer, … … 5143 5213 lpNumberOfBytesWritten, 5144 5214 lpOverlapped); 5145 5215 5146 5216 #if 0 5147 5217 HMDeviceRequest(ConsoleGlobals.hConsoleBuffer, /* show the cursor */ … … 5152 5222 0); 5153 5223 #endif 5154 5224 5155 5225 return (dwResult); /* return result code */ 5156 5226 } … … 5164 5234 * Purpose : we just forward those device requests to the console buffer 5165 5235 * currently associated with the console itself. 5166 * Parameters: 5167 * Variables : 5168 * Result : 5169 * Remark : 5236 * Parameters: 5237 * Variables : 5238 * Result : 5239 * Remark : 5170 5240 * Status : UNTESTED 5171 5241 * … … 5214 5284 * Variables : 5215 5285 * Result : 5216 * Remark : 5286 * Remark : 5217 5287 * Status : NO_ERROR - API succeeded 5218 5288 * other - what is to be set in SetLastError … … 5227 5297 { 5228 5298 PCONSOLEBUFFER pConsoleBuffer; /* console buffer structure */ 5229 5299 5230 5300 #ifdef DEBUG_LOCAL 5231 5301 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass %s(%s,%08x,%08x,%08x)\n", … … 5236 5306 pHMHandleDataTemplate); 5237 5307 #endif 5238 5308 5239 5309 pHMHandleData->dwType = FILE_TYPE_CHAR; /* we're a character device */ 5240 5310 5241 5311 pHMHandleData->lpHandlerData = malloc ( sizeof(CONSOLEBUFFER) ); 5242 5312 5243 5313 #ifdef DEBUG_LOCAL 5244 5314 WriteLog("KERNEL32/CONSOLE:CheckPoint1: %s pHMHandleData=%08xh, lpHandlerData=%08xh\n", … … 5247 5317 pHMHandleData->lpHandlerData); 5248 5318 #endif 5249 5250 5319 5320 5251 5321 if (pHMHandleData->lpHandlerData == NULL) /* check allocation */ 5252 5322 { … … 5257 5327 { 5258 5328 pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 5259 5329 5260 5330 memset(pHMHandleData->lpHandlerData, /* initialize structure */ 5261 5331 0, 5262 5332 sizeof (CONSOLEBUFFER) ); 5263 5333 5264 5334 /* set buffer defaults */ 5265 5335 pConsoleBuffer->dwConsoleMode = ENABLE_PROCESSED_OUTPUT | 5266 5336 ENABLE_WRAP_AT_EOL_OUTPUT; 5267 5337 5268 5338 pConsoleBuffer->CursorInfo.dwSize = 2; /* 2 scanlines */ 5269 5339 pConsoleBuffer->CursorInfo.bVisible = TRUE; 5270 5340 } 5271 5341 5272 5342 return(NO_ERROR); 5273 5343 } … … 5275 5345 5276 5346 /***************************************************************************** 5277 * Name : 5278 * Purpose : 5279 * Parameters: 5280 * Variables : 5281 * Result : 5282 * Remark : 5283 * Status : 5347 * Name : 5348 * Purpose : 5349 * Parameters: 5350 * Variables : 5351 * Result : 5352 * Remark : 5353 * Status : 5284 5354 * 5285 5355 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 5288 5358 DWORD HMDeviceConsoleBufferClass::CloseHandle(PHMHANDLEDATA pHMHandleData) 5289 5359 { 5290 5360 5291 5361 #ifdef DEBUG_LOCAL 5292 5362 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass::CloseHandle %s(%08x)\n", … … 5294 5364 pHMHandleData); 5295 5365 #endif 5296 5366 5297 5367 if (pHMHandleData->lpHandlerData != NULL) /* check pointer */ 5298 5368 { 5299 5369 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 5300 5370 5301 5371 5302 5372 if (pConsoleBuffer->ppszLine != NULL) /* free line buffer array ! */ 5303 5373 free (pConsoleBuffer->ppszLine); 5304 5374 5305 5375 free (pHMHandleData->lpHandlerData); /* free device object data */ 5306 5376 pHMHandleData->lpHandlerData = NULL; 5307 5377 } 5308 5378 5309 5379 return(NO_ERROR); 5310 5380 } … … 5312 5382 5313 5383 /***************************************************************************** 5314 * Name : 5315 * Purpose : 5316 * Parameters: 5317 * Variables : 5318 * Result : 5319 * Remark : 5320 * Status : 5384 * Name : 5385 * Purpose : 5386 * Parameters: 5387 * Variables : 5388 * Result : 5389 * Remark : 5390 * Status : 5321 5391 * 5322 5392 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 5329 5399 LPOVERLAPPED lpOverlapped) 5330 5400 { 5331 5401 5332 5402 #ifdef DEBUG_LOCAL 5333 5403 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n", … … 5339 5409 lpOverlapped); 5340 5410 #endif 5341 5411 5342 5412 return(ERROR_ACCESS_DENIED); 5343 5413 } … … 5345 5415 5346 5416 /***************************************************************************** 5347 * Name : 5348 * Purpose : 5349 * Parameters: 5350 * Variables : 5351 * Result : 5352 * Remark : 5353 * Status : 5417 * Name : 5418 * Purpose : 5419 * Parameters: 5420 * Variables : 5421 * Result : 5422 * Remark : 5423 * Status : 5354 5424 * 5355 5425 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 5366 5436 PSZ pszBuffer = (PSZ)lpBuffer; 5367 5437 register UCHAR ucChar; 5368 5438 5369 5439 #ifdef DEBUG_LOCAL2 5370 5440 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass:WriteFile %s(%08x,%08x,%08x,%08x,%08x)\n", … … 5376 5446 lpOverlapped); 5377 5447 #endif 5378 5448 5379 5449 /* check if we're called with non-existing line buffer */ 5380 5450 if (pConsoleBuffer->ppszLine == NULL) 5381 5451 return (ERROR_SYS_INTERNAL); 5382 5452 5383 5453 for (ulCounter = 0; 5384 5454 ulCounter < nNumberOfBytesToWrite; … … 5386 5456 { 5387 5457 ucChar = pszBuffer[ulCounter]; /* map to register */ 5388 5458 5389 5459 if ( (pConsoleBuffer->dwConsoleMode & ENABLE_PROCESSED_OUTPUT) && 5390 5460 (ucChar < 32) ) /* this is faster than a large switch statement */ … … 5397 5467 ConsoleGlobals.Options.ulSpeakerDuration); 5398 5468 break; 5399 5469 5400 5470 case 8: /* Backspace */ 5401 5471 if (pConsoleBuffer->coordCursorPosition.X > 0) 5402 5472 pConsoleBuffer->coordCursorPosition.X--; 5403 5473 break; 5404 5474 5405 5475 case 9: /* Tab */ 5406 5476 pConsoleBuffer->coordCursorPosition.X = 5407 (pConsoleBuffer->coordCursorPosition.X 5408 / ConsoleGlobals.Options.ulTabSize 5477 (pConsoleBuffer->coordCursorPosition.X 5478 / ConsoleGlobals.Options.ulTabSize 5409 5479 + 1) 5410 5480 * ConsoleGlobals.Options.ulTabSize; 5411 5481 5412 5482 if (pConsoleBuffer->coordCursorPosition.X >= 5413 5483 pConsoleBuffer->coordBufferSize.X) … … 5415 5485 pConsoleBuffer->coordCursorPosition.X = 0; 5416 5486 pConsoleBuffer->coordCursorPosition.Y++; 5417 5487 5418 5488 if (pConsoleBuffer->coordCursorPosition.Y >= 5419 5489 pConsoleBuffer->coordBufferSize.Y) … … 5428 5498 } 5429 5499 break; 5430 5500 5431 5501 case 10: /* LINEFEED */ 5432 5502 pConsoleBuffer->coordCursorPosition.Y++; 5433 5503 5434 5504 if (pConsoleBuffer->coordCursorPosition.Y >= 5435 5505 pConsoleBuffer->coordBufferSize.Y) … … 5440 5510 } 5441 5511 break; 5442 5512 5443 5513 case 13: /* CARRIAGE RETURN */ 5444 5514 pConsoleBuffer->coordCursorPosition.X = 0; 5445 5515 break; 5446 5516 5447 5517 default: 5448 5518 break; … … 5454 5524 *(pConsoleBuffer->ppszLine[pConsoleBuffer->coordCursorPosition.Y] + 5455 5525 pConsoleBuffer->coordCursorPosition.X * 2) = pszBuffer[ulCounter]; 5456 5526 5457 5527 pConsoleBuffer->coordCursorPosition.X++; 5458 5528 5459 5529 if (pConsoleBuffer->coordCursorPosition.X >= 5460 5530 pConsoleBuffer->coordBufferSize.X) … … 5462 5532 pConsoleBuffer->coordCursorPosition.X = 0; 5463 5533 pConsoleBuffer->coordCursorPosition.Y++; 5464 5534 5465 5535 if (pConsoleBuffer->coordCursorPosition.Y >= 5466 5536 pConsoleBuffer->coordBufferSize.Y) … … 5482 5552 } 5483 5553 } 5484 5554 5485 5555 /* update screen if active console */ 5486 5556 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 5487 5557 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 5488 5558 5489 5559 *lpNumberOfBytesWritten = ulCounter; 5490 5560 5491 5561 return(ulCounter); 5492 5562 } … … 5494 5564 5495 5565 /***************************************************************************** 5496 * Name : 5497 * Purpose : 5498 * Parameters: 5499 * Variables : 5500 * Result : 5501 * Remark : 5502 * Status : 5566 * Name : 5567 * Purpose : 5568 * Parameters: 5569 * Variables : 5570 * Result : 5571 * Remark : 5572 * Status : 5503 5573 * 5504 5574 * Author : Patrick Haller [Wed, 1998/02/11 20:44] … … 5517 5587 { 5518 5588 COORD coordWrite; 5519 5589 5520 5590 ULONG2COORD(coordWrite,arg3); 5521 5591 5522 5592 return (HMDeviceConsoleBufferClass 5523 5593 ::FillConsoleOutputAttribute(pHMHandleData, … … 5527 5597 (LPDWORD)arg4)); 5528 5598 } 5529 5599 5530 5600 5531 5601 case DRQ_FILLCONSOLEOUTPUTCHARACTERA: 5532 5602 { 5533 5603 COORD coordWrite; 5534 5604 5535 5605 ULONG2COORD(coordWrite,arg3); 5536 5606 5537 5607 return (HMDeviceConsoleBufferClass 5538 5608 ::FillConsoleOutputCharacterA(pHMHandleData, … … 5542 5612 (LPDWORD)arg4)); 5543 5613 } 5544 5545 5614 5615 5546 5616 case DRQ_FILLCONSOLEOUTPUTCHARACTERW: 5547 5617 { 5548 5618 COORD coordWrite; 5549 5619 5550 5620 ULONG2COORD(coordWrite,arg3); 5551 5621 5552 5622 return (HMDeviceConsoleBufferClass 5553 5623 ::FillConsoleOutputCharacterW(pHMHandleData, … … 5558 5628 } 5559 5629 5560 5630 5561 5631 case DRQ_GETCONSOLECURSORINFO: 5562 5632 return (HMDeviceConsoleBufferClass … … 5564 5634 (PCONSOLE_CURSOR_INFO)arg1)); 5565 5635 5566 5636 5567 5637 case DRQ_GETCONSOLEMODE: 5568 5638 return (HMDeviceConsoleBufferClass … … 5570 5640 (LPDWORD)arg1)); 5571 5641 5572 5642 5573 5643 case DRQ_GETCONSOLESCREENBUFFERINFO: 5574 5644 return (HMDeviceConsoleBufferClass 5575 5645 ::GetConsoleScreenBufferInfo(pHMHandleData, 5576 5646 (PCONSOLE_SCREEN_BUFFER_INFO)arg1)); 5577 5647 5578 5648 5579 5649 case DRQ_GETLARGESTCONSOLEWINDOWSIZE: 5580 5650 return (HMDeviceConsoleBufferClass 5581 5651 ::GetLargestConsoleWindowSize(pHMHandleData)); 5582 5652 5583 5653 5584 5654 case DRQ_READCONSOLEOUTPUTA: … … 5586 5656 COORD coordDestBufferSize; 5587 5657 COORD coordDestBufferCoord; 5588 5658 5589 5659 ULONG2COORD(coordDestBufferSize, arg2); 5590 5660 ULONG2COORD(coordDestBufferCoord, arg3); 5591 5661 5592 5662 return (HMDeviceConsoleBufferClass 5593 5663 ::ReadConsoleOutputA(pHMHandleData, … … 5597 5667 (PSMALL_RECT)arg4)); 5598 5668 } 5599 5600 5669 5670 5601 5671 case DRQ_READCONSOLEOUTPUTW: 5602 5672 { 5603 5673 COORD coordDestBufferSize; 5604 5674 COORD coordDestBufferCoord; 5605 5675 5606 5676 ULONG2COORD(coordDestBufferSize, arg2); 5607 5677 ULONG2COORD(coordDestBufferCoord, arg3); 5608 5678 5609 5679 return (HMDeviceConsoleBufferClass 5610 5680 ::ReadConsoleOutputW(pHMHandleData, … … 5614 5684 (PSMALL_RECT)arg4)); 5615 5685 } 5616 5686 5617 5687 5618 5688 case DRQ_READCONSOLEOUTPUTATTRIBUTE: 5619 5689 { 5620 5690 COORD coordReadCoord; 5621 5691 5622 5692 ULONG2COORD(coordReadCoord, arg3); 5623 5693 5624 5694 return (HMDeviceConsoleBufferClass 5625 5695 ::ReadConsoleOutputAttribute(pHMHandleData, … … 5629 5699 (LPDWORD)arg4)); 5630 5700 } 5631 5632 5701 5702 5633 5703 case DRQ_READCONSOLEOUTPUTCHARACTERA: 5634 5704 { 5635 5705 COORD coordReadCoord; 5636 5706 5637 5707 ULONG2COORD(coordReadCoord, arg3); 5638 5708 5639 5709 return (HMDeviceConsoleBufferClass 5640 5710 ::ReadConsoleOutputCharacterA(pHMHandleData, … … 5643 5713 coordReadCoord, 5644 5714 (LPDWORD)arg4)); 5645 } 5646 5647 5715 } 5716 5717 5648 5718 case DRQ_READCONSOLEOUTPUTCHARACTERW: 5649 5719 { 5650 5720 COORD coordReadCoord; 5651 5721 5652 5722 ULONG2COORD(coordReadCoord, arg3); 5653 5723 5654 5724 return (HMDeviceConsoleBufferClass 5655 5725 ::ReadConsoleOutputCharacterW(pHMHandleData, … … 5658 5728 coordReadCoord, 5659 5729 (LPDWORD)arg4)); 5660 } 5661 5730 } 5731 5662 5732 5663 5733 case DRQ_SCROLLCONSOLESCREENBUFFERA: 5664 5734 { 5665 5735 COORD coordDestOrigin; 5666 5736 5667 5737 ULONG2COORD(coordDestOrigin, arg3); 5668 5738 5669 5739 return (HMDeviceConsoleBufferClass 5670 5740 ::ScrollConsoleScreenBufferA(pHMHandleData, … … 5673 5743 coordDestOrigin, 5674 5744 (PCHAR_INFO)arg4)); 5675 } 5676 5677 5745 } 5746 5747 5678 5748 case DRQ_SCROLLCONSOLESCREENBUFFERW: 5679 5749 { 5680 5750 COORD coordDestOrigin; 5681 5751 5682 5752 ULONG2COORD(coordDestOrigin, arg3); 5683 5753 5684 5754 return (HMDeviceConsoleBufferClass 5685 5755 ::ScrollConsoleScreenBufferW(pHMHandleData, … … 5688 5758 coordDestOrigin, 5689 5759 (PCHAR_INFO)arg4)); 5690 } 5691 5692 5760 } 5761 5762 5693 5763 case DRQ_SETCONSOLEACTIVESCREENBUFFER: 5694 5764 return (HMDeviceConsoleBufferClass … … 5700 5770 ::SetConsoleCursorInfo(pHMHandleData, 5701 5771 (PCONSOLE_CURSOR_INFO)arg1)); 5702 5772 5703 5773 5704 5774 case DRQ_SETCONSOLECURSORPOSITION: 5705 5775 { 5706 5776 COORD coordCursor; 5707 5777 5708 5778 ULONG2COORD(coordCursor, arg1); 5709 5779 5710 5780 return (HMDeviceConsoleBufferClass 5711 5781 ::SetConsoleCursorPosition(pHMHandleData, 5712 5782 coordCursor)); 5713 5783 } 5714 5784 5715 5785 5716 5786 case DRQ_SETCONSOLEMODE: … … 5719 5789 (DWORD)arg1)); 5720 5790 5721 5791 5722 5792 case DRQ_SETCONSOLESCREENBUFFERSIZE: 5723 5793 { 5724 5794 COORD coordSize; 5725 5795 5726 5796 ULONG2COORD(coordSize,arg1); 5727 5797 5728 5798 return (HMDeviceConsoleBufferClass:: 5729 5799 SetConsoleScreenBufferSize(pHMHandleData, 5730 5800 coordSize)); 5731 5801 } 5732 5802 5733 5803 5734 5804 case DRQ_SETCONSOLETEXTATTRIBUTE: … … 5736 5806 SetConsoleTextAttribute(pHMHandleData, 5737 5807 (WORD)arg1)); 5738 5808 5739 5809 5740 5810 case DRQ_SETCONSOLEWINDOWINFO: … … 5744 5814 (PSMALL_RECT)arg2)); 5745 5815 5746 5816 5747 5817 case DRQ_WRITECONSOLEA: 5748 5818 return (HMDeviceConsoleBufferClass … … 5752 5822 (LPDWORD)arg3, 5753 5823 (LPVOID)arg4)); 5754 5755 5824 5825 5756 5826 case DRQ_WRITECONSOLEW: 5757 5827 return (HMDeviceConsoleBufferClass … … 5761 5831 (LPDWORD)arg3, 5762 5832 (LPVOID)arg4)); 5763 5833 5764 5834 5765 5835 case DRQ_WRITECONSOLEOUTPUTA: … … 5767 5837 COORD coordSrcBufferSize; 5768 5838 COORD coordSrcBufferCoord; 5769 5839 5770 5840 ULONG2COORD(coordSrcBufferSize, arg2); 5771 5841 ULONG2COORD(coordSrcBufferCoord, arg3); 5772 5842 5773 5843 return (HMDeviceConsoleBufferClass 5774 5844 ::WriteConsoleOutputA(pHMHandleData, … … 5778 5848 (PSMALL_RECT)arg4)); 5779 5849 } 5780 5781 5850 5851 5782 5852 case DRQ_WRITECONSOLEOUTPUTW: 5783 5853 { 5784 5854 COORD coordSrcBufferSize; 5785 5855 COORD coordSrcBufferCoord; 5786 5856 5787 5857 ULONG2COORD(coordSrcBufferSize, arg2); 5788 5858 ULONG2COORD(coordSrcBufferCoord, arg3); 5789 5859 5790 5860 return (HMDeviceConsoleBufferClass 5791 5861 ::WriteConsoleOutputA(pHMHandleData, … … 5794 5864 coordSrcBufferCoord, 5795 5865 (PSMALL_RECT)arg4)); 5796 } 5797 5798 5866 } 5867 5868 5799 5869 case DRQ_WRITECONSOLEOUTPUTATTRIBUTE: 5800 5870 { 5801 5871 COORD coordWriteCoord; 5802 5872 5803 5873 ULONG2COORD(coordWriteCoord, arg3); 5804 5874 5805 5875 return (HMDeviceConsoleBufferClass 5806 5876 ::WriteConsoleOutputAttribute(pHMHandleData, … … 5809 5879 coordWriteCoord, 5810 5880 (LPDWORD)arg4)); 5811 } 5812 5813 5881 } 5882 5883 5814 5884 case DRQ_WRITECONSOLEOUTPUTCHARACTERA: 5815 5885 { 5816 5886 COORD coordWriteCoord; 5817 5887 5818 5888 ULONG2COORD(coordWriteCoord, arg3); 5819 5889 5820 5890 return (HMDeviceConsoleBufferClass 5821 5891 ::WriteConsoleOutputCharacterA(pHMHandleData, … … 5824 5894 coordWriteCoord, 5825 5895 (LPDWORD)arg4)); 5826 } 5827 5828 5896 } 5897 5898 5829 5899 case DRQ_WRITECONSOLEOUTPUTCHARACTERW: 5830 5900 { 5831 5901 COORD coordWriteCoord; 5832 5902 5833 5903 ULONG2COORD(coordWriteCoord, arg3); 5834 5904 5835 5905 return (HMDeviceConsoleBufferClass 5836 5906 ::WriteConsoleOutputCharacterW(pHMHandleData, … … 5841 5911 } 5842 5912 5843 5913 5844 5914 case DRQ_INTERNAL_CONSOLEBUFFERMAP: 5845 5915 ConsoleBufferMap((PCONSOLEBUFFER)pHMHandleData->lpHandlerData); 5846 5916 return (NO_ERROR); 5847 5848 5917 5918 5849 5919 case DRQ_INTERNAL_CONSOLECURSORSHOW: 5850 5920 ConsoleCursorShow((PCONSOLEBUFFER)pHMHandleData->lpHandlerData, 5851 5921 (ULONG)arg1); 5852 5922 return (NO_ERROR); 5853 5854 5923 5924 5855 5925 case DRQ_INTERNAL_CONSOLEADJUSTWINDOW: 5856 5926 ConsoleAdjustWindow((PCONSOLEBUFFER)pHMHandleData->lpHandlerData); 5857 return (NO_ERROR); 5858 } 5859 5860 5927 return (NO_ERROR); 5928 } 5929 5930 5861 5931 #ifdef DEBUG_LOCAL 5862 5932 WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass:_DeviceRequest %s(%08x,%08x,%08x,%08x,%08x,%08x) unknown request\n", … … 5885 5955 * Variables : 5886 5956 * Result : 5887 * Remark : 5957 * Remark : 5888 5958 * Status : UNTESTED 5889 5959 * … … 5899 5969 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 5900 5970 ULONG ulCounter; /* current character counter */ 5901 5971 5902 5972 #ifdef DEBUG_LOCAL2 5903 5973 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputAttribute(%08x,attr=%04x,%u,x=%u y=%u,res=%08x).\n", … … 5909 5979 lpNumberOfAttrsWritten); 5910 5980 #endif 5911 5981 5912 5982 if ( (dwWriteCoord.X < 0) || 5913 5983 (dwWriteCoord.Y < 0) ) … … 5915 5985 if (lpNumberOfAttrsWritten != NULL) /* ensure pointer is valid */ 5916 5986 *lpNumberOfAttrsWritten = 0; /* complete error handling */ 5917 5987 5918 5988 SetLastError(ERROR_INVALID_PARAMETER); 5919 5989 return (FALSE); 5920 5990 } 5921 5991 5922 5992 /* check if dwWriteCoord is within specs */ 5923 5993 if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 5926 5996 if (lpNumberOfAttrsWritten != NULL) /* ensure pointer is valid */ 5927 5997 *lpNumberOfAttrsWritten = 0; /* complete error handling */ 5928 5998 5929 5999 SetLastError(ERROR_INVALID_PARAMETER); 5930 6000 return (FALSE); 5931 6001 } 5932 6002 5933 6003 5934 6004 /* OK, now write the attribute lines */ … … 5942 6012 ) = (UCHAR)(wAttribute & 0xFF); 5943 6013 /* write attribute, don't change characters */ 5944 6014 5945 6015 dwWriteCoord.X++; /* move write position */ 5946 6016 if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 5948 6018 dwWriteCoord.X = 0; /* skip to next line */ 5949 6019 dwWriteCoord.Y++; 5950 6020 5951 6021 /* oops, we're at the end of the buffer. Abort now. */ 5952 6022 if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 5954 6024 if (lpNumberOfAttrsWritten != NULL) /* ensure pointer is valid */ 5955 6025 *lpNumberOfAttrsWritten = ulCounter; 5956 6026 5957 6027 /* update screen if active console */ 5958 6028 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 5959 6029 ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */ 5960 6030 5961 6031 return (TRUE); 5962 6032 } 5963 6033 } 5964 6034 } 5965 6035 5966 6036 /* update screen if active console */ 5967 6037 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 5968 6038 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 5969 6039 5970 6040 if (lpNumberOfAttrsWritten != NULL) /* ensure pointer is valid */ 5971 6041 *lpNumberOfAttrsWritten = nLength; 5972 6042 5973 6043 return (TRUE); 5974 6044 } … … 5985 6055 * Variables : 5986 6056 * Result : 5987 * Remark : 6057 * Remark : 5988 6058 * Status : UNTESTED 5989 6059 * … … 5999 6069 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6000 6070 ULONG ulCounter; /* current character counter */ 6001 6071 6002 6072 #ifdef DEBUG_LOCAL2 6003 6073 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputCharacterA(%08x,char=%02x,%u,x=%u y=%u,res=%08x).\n", … … 6015 6085 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6016 6086 *lpNumberOfCharsWritten = 0; /* complete error handling */ 6017 6087 6018 6088 SetLastError(ERROR_INVALID_PARAMETER); 6019 6089 return (FALSE); 6020 6090 } 6021 6022 6091 6092 6023 6093 /* check if dwWriteCoord is within specs */ 6024 6094 if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 6027 6097 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6028 6098 *lpNumberOfCharsWritten = 0; /* complete error handling */ 6029 6099 6030 6100 SetLastError(ERROR_INVALID_PARAMETER); 6031 6101 return (FALSE); 6032 6102 } 6033 6103 6034 6104 6035 6105 /* OK, now write the attribute lines */ … … 6042 6112 (dwWriteCoord.X * 2) 6043 6113 ) = ucCharacter; 6044 6114 6045 6115 dwWriteCoord.X++; /* move write position */ 6046 6116 if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 6048 6118 dwWriteCoord.X = 0; /* skip to next line */ 6049 6119 dwWriteCoord.Y++; 6050 6120 6051 6121 /* oops, we're at the end of the buffer. Abort now. */ 6052 6122 if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 6054 6124 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6055 6125 *lpNumberOfCharsWritten = ulCounter; 6056 6126 6057 6127 /* update screen if active console */ 6058 6128 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 6059 6129 ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */ 6060 6130 6061 6131 return (TRUE); 6062 6132 } 6063 6133 } 6064 6134 } 6065 6135 6066 6136 /* update screen if active console */ 6067 6137 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 6068 6138 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 6069 6139 6070 6140 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6071 6141 *lpNumberOfCharsWritten = nLength; 6072 6142 6073 6143 return (TRUE); 6074 6144 } … … 6085 6155 * Variables : 6086 6156 * Result : 6087 * Remark : 6157 * Remark : 6088 6158 * Status : UNTESTED 6089 6159 * … … 6099 6169 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6100 6170 ULONG ulCounter; /* current character counter */ 6101 6171 6102 6172 #ifdef DEBUG_LOCAL2 6103 6173 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputCharacterW(%08x,char=%02x,%u,x=%u y=%u,res=%08x).\n", … … 6109 6179 lpNumberOfCharsWritten); 6110 6180 #endif 6111 6181 6112 6182 if ( (dwWriteCoord.X < 0) || 6113 6183 (dwWriteCoord.Y < 0) ) … … 6115 6185 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6116 6186 *lpNumberOfCharsWritten = 0; /* complete error handling */ 6117 6187 6118 6188 SetLastError(ERROR_INVALID_PARAMETER); 6119 6189 return (FALSE); 6120 6190 } 6121 6122 6191 6192 6123 6193 /* check if dwWriteCoord is within specs */ 6124 6194 if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 6127 6197 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6128 6198 *lpNumberOfCharsWritten = 0; /* complete error handling */ 6129 6199 6130 6200 SetLastError(ERROR_INVALID_PARAMETER); 6131 6201 return (FALSE); 6132 6202 } 6133 6203 6134 6204 6135 6205 /* OK, now write the attribute lines */ … … 6142 6212 (dwWriteCoord.X * 2) 6143 6213 ) = (UCHAR)wcCharacter; /* @@@PH unicode to ascii conversion ! */ 6144 6214 6145 6215 dwWriteCoord.X++; /* move write position */ 6146 6216 if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 6148 6218 dwWriteCoord.X = 0; /* skip to next line */ 6149 6219 dwWriteCoord.Y++; 6150 6220 6151 6221 /* oops, we're at the end of the buffer. Abort now. */ 6152 6222 if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 6154 6224 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6155 6225 *lpNumberOfCharsWritten = ulCounter; 6156 6226 6157 6227 /* update screen if active console */ 6158 6228 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 6159 6229 ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */ 6160 6230 6161 6231 return (TRUE); 6162 6232 } 6163 6233 } 6164 6234 } 6165 6235 6166 6236 /* update screen if active console */ 6167 6237 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 6168 6238 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 6169 6239 6170 6240 if (lpNumberOfCharsWritten != NULL) /* ensure pointer is valid */ 6171 6241 *lpNumberOfCharsWritten = nLength; 6172 6242 6173 6243 return (TRUE); 6174 6244 } … … 6183 6253 * Variables : 6184 6254 * Result : 6185 * Remark : 6255 * Remark : 6186 6256 * Status : UNTESTED 6187 6257 * … … 6193 6263 { 6194 6264 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6195 6265 6196 6266 #ifdef DEBUG_LOCAL2 6197 6267 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleMode(%08x,%08x).\n", … … 6199 6269 lpMode); 6200 6270 #endif 6201 6271 6202 6272 *lpMode = pConsoleBuffer->dwConsoleMode; /* return current console mode */ 6203 6273 6204 6274 return (TRUE); 6205 6275 } … … 6213 6283 * Variables : 6214 6284 * Result : 6215 * Remark : 6285 * Remark : 6216 6286 * Status : UNTESTED 6217 6287 * … … 6223 6293 { 6224 6294 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6225 6295 6226 6296 #ifdef DEBUG_LOCAL2 6227 6297 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleCursorInfo(%08x,%08x).\n", … … 6229 6299 pCCI); 6230 6300 #endif 6231 6301 6232 6302 memcpy(pCCI, /* just copy the whole information block */ 6233 6303 &pConsoleBuffer->CursorInfo, 6234 6304 sizeof (pConsoleBuffer->CursorInfo) ); 6235 6305 6236 6306 return (TRUE); 6237 6307 } … … 6245 6315 * Variables : 6246 6316 * Result : 6247 * Remark : 6317 * Remark : 6248 6318 * Status : UNTESTED 6249 6319 * … … 6255 6325 { 6256 6326 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6257 6327 6258 6328 #ifdef DEBUG_LOCAL2 6259 6329 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleScreenBufferInfo(%08x,%08x).\n", … … 6261 6331 pCSBI); 6262 6332 #endif 6263 6333 6264 6334 pCSBI->dwSize = pConsoleBuffer->coordBufferSize; 6265 6335 pCSBI->dwCursorPosition = pConsoleBuffer->coordCursorPosition; 6266 6336 pCSBI->wAttributes = (USHORT)pConsoleBuffer->ucDefaultAttribute; 6267 6337 6268 6338 /* @@@PH unsure, but should be OK */ 6269 6339 pCSBI->srWindow.Left = pConsoleBuffer->coordWindowPosition.X; … … 6273 6343 pCSBI->srWindow.Bottom = pConsoleBuffer->coordWindowPosition.Y + 6274 6344 pConsoleBuffer->coordWindowSize.Y - 1; 6275 6345 6276 6346 pCSBI->dwMaximumWindowSize = pConsoleBuffer->coordBufferSize; 6277 6347 6278 return (TRUE); 6348 return (TRUE); 6279 6349 } 6280 6350 … … 6283 6353 * Name : DWORD HMDeviceConsoleBufferClass::GetLargestConsoleWindowSize 6284 6354 * Purpose : Determine maximum AVIO size 6285 * Parameters: 6286 * Variables : 6287 * Result : 6288 * Remark : 6289 * Status : 6355 * Parameters: 6356 * Variables : 6357 * Result : 6358 * Remark : 6359 * Status : 6290 6360 * 6291 6361 * Author : Patrick Haller [Tue, 1998/02/10 01:55] … … 6299 6369 LONG lScreenCY; 6300 6370 APIRET rc; /* API returncode */ 6301 6302 6371 6372 6303 6373 #ifdef DEBUG_LOCAL 6304 6374 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetLargestConsoleWindowSize(%08x).\n", 6305 6375 pHMHandleData); 6306 6376 #endif 6307 6377 6308 6378 /* @@@PH determine maximum console window size in characters 6309 6379 based on display size and current avio font */ 6310 6380 6311 6381 lScreenCX = WinQuerySysValue(HWND_DESKTOP, /* query PM for that */ 6312 6382 SV_CXSCREEN); 6313 6383 6314 6384 lScreenCY = WinQuerySysValue(HWND_DESKTOP, /* query PM for that */ 6315 6385 SV_CYFULLSCREEN); 6316 6386 6317 6387 if (rc != NO_ERROR) 6318 6388 { 6319 6389 WriteLog("KERNEL32/CONSOLE: VioGetDeviceCellSize failed with #%u.\n", 6320 6390 rc); 6321 6391 6322 6392 return (FALSE); /* say API failed */ 6323 6393 } 6324 6394 6325 6395 if ( (ConsoleGlobals.sCellCX == 0) || /* prevent division by zero */ 6326 6396 (ConsoleGlobals.sCellCY == 0) ) 6327 6397 { 6328 6398 WriteLog("KERNEL32/CONSOLE: VioGetDeviceCellSize returned 0 value.\n"); 6329 6399 6330 6400 return (FALSE); /* say API failed */ 6331 6401 } 6332 6402 6333 6403 coordSize.X = lScreenCX / ConsoleGlobals.sCellCX; /* calculate */ 6334 6404 coordSize.Y = lScreenCY / ConsoleGlobals.sCellCY; 6335 6405 6336 6406 /* these limitations are due to OS/2's current VIO subsystem */ 6337 6407 coordSize.X = min(coordSize.X, MAX_OS2_COLUMNS); 6338 6408 coordSize.Y = min(coordSize.Y, MAX_OS2_ROWS); 6339 6409 6340 6410 return (COORD2ULONG(coordSize)); /* return value */ 6341 6411 } … … 6352 6422 * Variables : 6353 6423 * Result : 6354 * Remark : 6424 * Remark : 6355 6425 * Status : UNTESTED 6356 6426 * … … 6369 6439 ULONG ulReadX, ulReadY; /* position data is read from */ 6370 6440 WORD wCell; /* currently read data */ 6371 6441 6372 6442 PCHAR_INFO pchi; 6373 6443 6374 6444 #ifdef DEBUG_LOCAL2 6375 6445 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputA(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n", … … 6382 6452 psrctSourceRect); 6383 6453 #endif 6384 6385 6454 6455 6386 6456 /* verify psrctSourceRect first */ 6387 6457 psrctSourceRect->Left = max(psrctSourceRect->Left, 0); … … 6389 6459 psrctSourceRect->Right = min(psrctSourceRect->Right, pConsoleBuffer->coordBufferSize.X - 1); 6390 6460 psrctSourceRect->Bottom= min(psrctSourceRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1); 6391 6461 6392 6462 /* verify target buffer */ 6393 6463 if ( (coordDestBufferSize.X < coordDestBufferCoord.X) || … … 6397 6467 return (FALSE); /* API failed */ 6398 6468 } 6399 6469 6400 6470 ulCX = coordDestBufferSize.X - coordDestBufferCoord.X; 6401 6471 ulCY = coordDestBufferSize.Y - coordDestBufferCoord.Y; 6402 6472 6403 6473 ulCX = min(ulCX, (psrctSourceRect->Right - psrctSourceRect->Left)); 6404 6474 ulCY = min(ulCY, (psrctSourceRect->Bottom - psrctSourceRect->Top)); 6405 6475 6406 6476 /* final calculation of the copy rectangle */ 6407 6477 psrctSourceRect->Right = psrctSourceRect->Left + ulCX; 6408 6478 psrctSourceRect->Bottom = psrctSourceRect->Top + ulCY; 6409 6410 6479 6480 6411 6481 for (ulY = 0, 6412 6482 ulReadY = psrctSourceRect->Top; 6413 6483 6414 6484 ulY <= ulCY; 6415 6485 6416 6486 ulY++, 6417 6487 ulReadY++) … … 6422 6492 for (ulX = 0, 6423 6493 ulReadX = psrctSourceRect->Left; 6424 6494 6425 6495 ulX <= ulCX; 6426 6496 6427 6497 ulX++, 6428 6498 ulReadX++, … … 6431 6501 /* read character */ 6432 6502 wCell = *(pConsoleBuffer->ppszLine[ulReadY] + ulReadX * 2); 6433 6503 6434 6504 pchi->Char.AsciiChar = (UCHAR)(wCell & 0x00FF); 6435 6505 pchi->Attributes = wCell >> 8; 6436 6506 } 6437 6507 } 6438 6508 6439 6509 return (TRUE); /* OK, that's it */ 6440 6510 } … … 6451 6521 * Variables : 6452 6522 * Result : 6453 * Remark : 6523 * Remark : 6454 6524 * Status : UNTESTED 6455 6525 * … … 6468 6538 ULONG ulReadX, ulReadY; /* position data is read from */ 6469 6539 WORD wCell; /* currently read data */ 6470 6540 6471 6541 PCHAR_INFO pchi; 6472 6542 6473 6543 #ifdef DEBUG_LOCAL2 6474 6544 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputW(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n", … … 6481 6551 psrctSourceRect); 6482 6552 #endif 6483 6484 6553 6554 6485 6555 /* verify psrctSourceRect first */ 6486 6556 psrctSourceRect->Left = max(psrctSourceRect->Left, 0); … … 6488 6558 psrctSourceRect->Right = min(psrctSourceRect->Right, pConsoleBuffer->coordBufferSize.X - 1); 6489 6559 psrctSourceRect->Bottom= min(psrctSourceRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1); 6490 6560 6491 6561 /* verify target buffer */ 6492 6562 if ( (coordDestBufferSize.X < coordDestBufferCoord.X) || … … 6496 6566 return (FALSE); /* API failed */ 6497 6567 } 6498 6568 6499 6569 ulCX = coordDestBufferSize.X - coordDestBufferCoord.X; 6500 6570 ulCY = coordDestBufferSize.Y - coordDestBufferCoord.Y; 6501 6571 6502 6572 ulCX = min(ulCX, (psrctSourceRect->Right - psrctSourceRect->Left)); 6503 6573 ulCY = min(ulCY, (psrctSourceRect->Bottom - psrctSourceRect->Top)); 6504 6574 6505 6575 /* final calculation of the copy rectangle */ 6506 6576 psrctSourceRect->Right = psrctSourceRect->Left + ulCX; 6507 6577 psrctSourceRect->Bottom = psrctSourceRect->Top + ulCY; 6508 6509 6578 6579 6510 6580 for (ulY = 0, 6511 6581 ulReadY = psrctSourceRect->Top; 6512 6582 6513 6583 ulY <= ulCY; 6514 6584 6515 6585 ulY++, 6516 6586 ulReadY++) … … 6521 6591 for (ulX = 0, 6522 6592 ulReadX = psrctSourceRect->Left; 6523 6593 6524 6594 ulX <= ulCX; 6525 6595 6526 6596 ulX++, 6527 6597 ulReadX++, … … 6530 6600 /* read character */ 6531 6601 wCell = *(pConsoleBuffer->ppszLine[ulReadY] + ulReadX * 2); 6532 6602 6533 6603 /* @@@PH Ascii->Unicode */ 6534 6604 pchi->Char.UnicodeChar = (UCHAR)(wCell & 0x00FF); … … 6536 6606 } 6537 6607 } 6538 6608 6539 6609 return (TRUE); /* OK, that's it */ 6540 6610 } … … 6551 6621 * Variables : 6552 6622 * Result : 6553 * Remark : 6623 * Remark : 6554 6624 * Status : UNTESTED 6555 6625 * … … 6565 6635 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6566 6636 ULONG ulCounter; /* current character counter */ 6567 6637 6568 6638 #ifdef DEBUG_LOCAL2 6569 6639 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputAttribute(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n", … … 6575 6645 lpcNumberRead); 6576 6646 #endif 6577 6647 6578 6648 if ( (dwReadCoord.X < 0) || 6579 6649 (dwReadCoord.Y < 0) ) … … 6581 6651 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6582 6652 *lpcNumberRead = 0; /* complete error handling */ 6583 6653 6584 6654 SetLastError(ERROR_INVALID_PARAMETER); 6585 6655 return (FALSE); 6586 6656 } 6587 6657 6588 6658 /* check if dwReadCoord is within specs */ 6589 6659 if ( (dwReadCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 6592 6662 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6593 6663 *lpcNumberRead = 0; /* complete error handling */ 6594 6664 6595 6665 SetLastError(ERROR_INVALID_PARAMETER); 6596 6666 return (FALSE); 6597 6667 } 6598 6668 6599 6669 6600 6670 /* OK, now write the attribute lines */ … … 6608 6678 *(pConsoleBuffer->ppszLine[dwReadCoord.Y] + 6609 6679 (dwReadCoord.X * 2 + 1)); 6610 6680 6611 6681 dwReadCoord.X++; /* move write position */ 6612 6682 if (dwReadCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 6614 6684 dwReadCoord.X = 0; /* skip to next line */ 6615 6685 dwReadCoord.Y++; 6616 6686 6617 6687 /* oops, we're at the end of the buffer. Abort now. */ 6618 6688 if (dwReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 6620 6690 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6621 6691 *lpcNumberRead = ulCounter; 6622 6692 6623 6693 return (TRUE); 6624 6694 } 6625 6695 } 6626 6696 } 6627 6697 6628 6698 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6629 6699 *lpcNumberRead = cReadCells; 6630 6700 6631 6701 return (TRUE); 6632 6702 } … … 6643 6713 * Variables : 6644 6714 * Result : 6645 * Remark : 6715 * Remark : 6646 6716 * Status : UNTESTED 6647 6717 * … … 6657 6727 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6658 6728 ULONG ulCounter; /* current character counter */ 6659 6729 6660 6730 #ifdef DEBUG_LOCAL2 6661 6731 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputCharacterA(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n", … … 6667 6737 lpcNumberRead); 6668 6738 #endif 6669 6739 6670 6740 if ( (coordReadCoord.X < 0) || 6671 6741 (coordReadCoord.Y < 0) ) … … 6673 6743 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6674 6744 *lpcNumberRead = 0; /* complete error handling */ 6675 6745 6676 6746 SetLastError(ERROR_INVALID_PARAMETER); 6677 6747 return (FALSE); 6678 6748 } 6679 6749 6680 6750 /* check if coordReadCoord is within specs */ 6681 6751 if ( (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 6684 6754 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6685 6755 *lpcNumberRead = 0; /* complete error handling */ 6686 6756 6687 6757 SetLastError(ERROR_INVALID_PARAMETER); 6688 6758 return (FALSE); 6689 6759 } 6690 6760 6691 6761 6692 6762 /* OK, now write the attribute lines */ … … 6700 6770 *(pConsoleBuffer->ppszLine[coordReadCoord.Y] + 6701 6771 (coordReadCoord.X * 2)); 6702 6772 6703 6773 coordReadCoord.X++; /* move write position */ 6704 6774 if (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 6706 6776 coordReadCoord.X = 0; /* skip to next line */ 6707 6777 coordReadCoord.Y++; 6708 6778 6709 6779 /* oops, we're at the end of the buffer. Abort now. */ 6710 6780 if (coordReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 6712 6782 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6713 6783 *lpcNumberRead = ulCounter; 6714 6784 6715 6785 return (TRUE); 6716 6786 } 6717 6787 } 6718 6788 } 6719 6789 6720 6790 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6721 6791 *lpcNumberRead = cchRead; 6722 6792 6723 6793 return (TRUE); 6724 6794 } … … 6735 6805 * Variables : 6736 6806 * Result : 6737 * Remark : 6807 * Remark : 6738 6808 * Status : UNTESTED 6739 6809 * … … 6749 6819 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 6750 6820 ULONG ulCounter; /* current character counter */ 6751 6821 6752 6822 #ifdef DEBUG_LOCAL2 6753 6823 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputCharacterW(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n", … … 6759 6829 lpcNumberRead); 6760 6830 #endif 6761 6831 6762 6832 if ( (coordReadCoord.X < 0) || 6763 6833 (coordReadCoord.Y < 0) ) … … 6765 6835 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6766 6836 *lpcNumberRead = 0; /* complete error handling */ 6767 6837 6768 6838 SetLastError(ERROR_INVALID_PARAMETER); 6769 6839 return (FALSE); 6770 6840 } 6771 6841 6772 6842 /* check if coordReadCoord is within specs */ 6773 6843 if ( (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 6776 6846 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6777 6847 *lpcNumberRead = 0; /* complete error handling */ 6778 6848 6779 6849 SetLastError(ERROR_INVALID_PARAMETER); 6780 6850 return (FALSE); 6781 6851 } 6782 6852 6783 6853 6784 6854 /* OK, now write the attribute lines */ … … 6793 6863 *(pConsoleBuffer->ppszLine[coordReadCoord.Y] + 6794 6864 (coordReadCoord.X * 2)); 6795 6865 6796 6866 coordReadCoord.X++; /* move write position */ 6797 6867 if (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 6799 6869 coordReadCoord.X = 0; /* skip to next line */ 6800 6870 coordReadCoord.Y++; 6801 6871 6802 6872 /* oops, we're at the end of the buffer. Abort now. */ 6803 6873 if (coordReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 6805 6875 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6806 6876 *lpcNumberRead = ulCounter; 6807 6877 6808 6878 return (TRUE); 6809 6879 } 6810 6880 } 6811 6881 } 6812 6882 6813 6883 if (lpcNumberRead != NULL) /* ensure pointer is valid */ 6814 6884 *lpcNumberRead = cchRead; 6815 6885 6816 6886 return (TRUE); 6817 6887 } … … 6851 6921 WORD wAttr; /* fill character and attribute */ 6852 6922 int iBlitDirection; /* to handle overlapped buffers */ 6853 6923 6854 6924 #ifdef DEBUG_LOCAL2 6855 6925 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ScrollConsoleScreenBufferA(%08x,%08x,%08x,x=%u y=%u,%08x).\n", … … 6861 6931 pchiFill); 6862 6932 #endif 6863 6933 6864 6934 /* calculate effective clipping rectangle */ 6865 6935 if (psrctClipRect != NULL) /* if clipping rectangle was specified */ … … 6868 6938 psrctClipRect, 6869 6939 sizeof (SMALL_RECT) ); 6870 6940 6871 6941 /* check boundary with buffer size */ 6872 6942 srctView.Left = max(0, srctView.Left); … … 6882 6952 srctView.Bottom = pConsoleBuffer->coordBufferSize.Y; 6883 6953 } 6884 6954 6885 6955 memcpy(&srctSource, /* copy source rectangle */ 6886 6956 psrctSourceRect, … … 6891 6961 srctSource.Right = min(srctSource.Right, srctView.Right ); 6892 6962 srctSource.Bottom = min(srctSource.Bottom,srctView.Bottom); 6893 6963 6894 6964 srctDest.Left = max(srctView.Left, coordDestOrigin.X); 6895 6965 srctDest.Top = max(srctView.Top, coordDestOrigin.Y); 6896 6966 srctDest.Right = min(srctView.Right, srctDest.Left + srctSource.Right - srctSource.Left); 6897 6967 srctDest.Bottom= min(srctView.Bottom, srctDest.Top + srctSource.Bottom - srctSource.Top); 6898 6968 6899 6969 /**************************** 6900 6970 * first copy the rectangle * 6901 6971 ****************************/ 6902 6972 6903 6973 if (srctDest.Left > srctSource.Left) iBlitDirection = 0; 6904 6974 else iBlitDirection = 1; 6905 6975 if (srctDest.Top > srctSource.Top) iBlitDirection += 2; 6906 6976 6907 6977 /* this leaves us with three different cases: */ 6908 6978 /* */ … … 6923 6993 { 6924 6994 /* calculate pointer to start of target screen line */ 6925 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 6995 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 6926 6996 (srctDest.Left << 1) ); 6927 6997 6928 6998 /* calculate pointer to start of source screen line */ 6929 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 6999 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 6930 7000 (srctSource.Left << 1) ); 6931 7001 6932 7002 for (iX = srctDest.Left; 6933 7003 iX <= srctDest.Right; … … 6938 7008 } 6939 7009 break; 6940 7010 6941 7011 /*************** 6942 7012 * upper right * … … 6948 7018 { 6949 7019 /* calculate pointer to end of target screen line */ 6950 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 7020 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 6951 7021 ( srctDest.Right << 1) ); 6952 7022 6953 7023 /* calculate pointer to end of source screen line */ 6954 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 7024 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 6955 7025 ( srctSource.Right << 1) ); 6956 7026 6957 7027 for (iX = srctDest.Right; 6958 7028 iX >= srctDest.Left; … … 6963 7033 } 6964 7034 break; 6965 7035 6966 7036 /*************** 6967 7037 * lower left * … … 6973 7043 { 6974 7044 /* calculate pointer to start of target screen line */ 6975 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 7045 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 6976 7046 (srctDest.Left << 1) ); 6977 7047 6978 7048 /* calculate pointer to start of source screen line */ 6979 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 7049 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 6980 7050 (srctSource.Left << 1) ); 6981 7051 6982 7052 for (iX = srctDest.Left; 6983 7053 iX <= srctDest.Right; … … 6998 7068 { 6999 7069 /* calculate pointer to end of target screen line */ 7000 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 7070 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 7001 7071 ( srctDest.Right << 1) ); 7002 7072 7003 7073 /* calculate pointer to end of source screen line */ 7004 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 7074 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 7005 7075 (srctSource.Right << 1) ); 7006 7076 7007 7077 for (iX = srctDest.Right; 7008 7078 iX >= srctDest.Left; … … 7014 7084 break; 7015 7085 } 7016 7017 7086 7087 7018 7088 /* this is the character and attribute for the uncovered cells */ 7019 7089 wAttr = (pchiFill->Char.AsciiChar) + (pchiFill->Attributes << 8); … … 7024 7094 { 7025 7095 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY] + srctSource.Left); 7026 7096 7027 7097 for (iX = srctSource.Left; 7028 7098 iX < srctSource.Right; … … 7039 7109 *pusTarget = wAttr; /* write fill character and attribute */ 7040 7110 } 7041 7111 7042 7112 /* update screen if active console */ 7043 7113 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) … … 7079 7149 PUSHORT pusTarget, pusSource; /* pointer to source, dest cells */ 7080 7150 WORD wAttr; /* fill character and attribute */ 7081 7151 7082 7152 #ifdef DEBUG_LOCAL2 7083 7153 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ScrollConsoleScreenBufferW(%08x,%08x,%08x,x=%u y=%u,%08x).\n", … … 7089 7159 pchiFill); 7090 7160 #endif 7091 7161 7092 7162 /* calculate effective clipping rectangle */ 7093 7163 if (psrctClipRect != NULL) /* if clipping rectangle was specified */ … … 7096 7166 psrctClipRect, 7097 7167 sizeof (SMALL_RECT) ); 7098 7168 7099 7169 /* check boundary with buffer size */ 7100 7170 srctView.Left = max(0, srctView.Left); … … 7110 7180 srctView.Bottom = pConsoleBuffer->coordBufferSize.Y; 7111 7181 } 7112 7182 7113 7183 memcpy(&srctSource, /* copy source rectangle */ 7114 7184 psrctSourceRect, … … 7119 7189 srctSource.Right = min(srctSource.Right, srctView.Right ); 7120 7190 srctSource.Bottom = min(srctSource.Bottom,srctView.Bottom); 7121 7191 7122 7192 srctDest.Left = max(srctView.Left, coordDestOrigin.X); 7123 7193 srctDest.Top = max(srctView.Top, coordDestOrigin.Y); 7124 7194 srctDest.Right = min(srctView.Right, srctDest.Left + srctSource.Right - srctSource.Left); 7125 7195 srctDest.Bottom= min(srctView.Bottom, srctDest.Top + srctSource.Bottom - srctSource.Top); 7126 7196 7127 7197 /* first copy the rectangle */ 7128 7198 for (ulY = 0; … … 7131 7201 { 7132 7202 /* calculate pointer to start of target screen line */ 7133 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctDest.Top] + 7203 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctDest.Top] + 7134 7204 srctDest.Left); 7135 7205 7136 7206 /* calculate pointer to start of source screen line */ 7137 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctSource.Top] + 7207 pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctSource.Top] + 7138 7208 srctSource.Left); 7139 7209 7140 7210 for (ulX = srctDest.Left; 7141 7211 ulX < srctDest.Right; … … 7145 7215 *pusTarget = *pusSource; /* copy character */ 7146 7216 } 7147 7148 7217 7218 7149 7219 /* this is the character and attribute for the uncovered cells */ 7150 7220 /* @@@PH Unicode->Ascii translation */ … … 7156 7226 { 7157 7227 pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY] + srctSource.Left); 7158 7228 7159 7229 for (ulX = srctSource.Left; 7160 7230 ulX < srctSource.Right; … … 7163 7233 *pusTarget = wAttr; /* write fill character and attribute */ 7164 7234 } 7165 7235 7166 7236 /* update screen if active console */ 7167 7237 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 7168 7238 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 7169 7239 7170 7240 return (TRUE); 7171 7241 } … … 7179 7249 * Variables : 7180 7250 * Result : 7181 * Remark : 7251 * Remark : 7182 7252 * Status : UNTESTED 7183 7253 * … … 7189 7259 { 7190 7260 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7191 7261 7192 7262 #ifdef DEBUG_LOCAL2 7193 7263 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleCursorInfo(%08x,%08x).\n", … … 7195 7265 pCCI); 7196 7266 #endif 7197 7267 7198 7268 /* validate structure */ 7199 7269 if ( (pCCI->dwSize < 1) || … … 7203 7273 return (FALSE); /* API failed */ 7204 7274 } 7205 7275 7206 7276 /* if we're the active buffer, remove cursor from screen first */ 7207 7277 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 7208 7278 ConsoleCursorShow(pConsoleBuffer, 7209 7279 CONSOLECURSOR_HIDE); 7210 7280 7211 7281 memcpy(&pConsoleBuffer->CursorInfo, /* copy the whole information block */ 7212 7282 pCCI, 7213 7283 sizeof (pConsoleBuffer->CursorInfo) ); 7214 7284 7215 7285 return (TRUE); 7216 7286 } … … 7224 7294 * Variables : 7225 7295 * Result : 7226 * Remark : 7296 * Remark : 7227 7297 * Status : UNTESTED 7228 7298 * … … 7234 7304 { 7235 7305 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7236 7306 7237 7307 #ifdef DEBUG_LOCAL2 7238 7308 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleCursorPosition(%08x,x=%u.y=%u).\n", … … 7241 7311 coordCursorPosition.Y); 7242 7312 #endif 7243 7313 7244 7314 /* @@@PH remove cursor from screen first ! */ 7245 7315 pConsoleBuffer->coordCursorPosition = coordCursorPosition; 7246 7316 7247 7317 return (TRUE); 7248 7318 } … … 7256 7326 * Variables : 7257 7327 * Result : 7258 * Remark : 7328 * Remark : 7259 7329 * Status : UNTESTED 7260 7330 * … … 7266 7336 { 7267 7337 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7268 7338 7269 7339 #ifdef DEBUG_LOCAL2 7270 7340 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleMode(%08x,%08x).\n", … … 7272 7342 dwMode); 7273 7343 #endif 7274 7344 7275 7345 pConsoleBuffer->dwConsoleMode = dwMode; /* set current console mode */ 7276 7346 7277 7347 return (TRUE); 7278 7348 } … … 7287 7357 * Variables : 7288 7358 * Result : 7289 * Remark : 7359 * Remark : 7290 7360 * Status : UNTESTED 7291 7361 * … … 7300 7370 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7301 7371 ULONG ulLine; /* line index counter */ 7302 7372 7303 7373 #ifdef DEBUG_LOCAL2 7304 7374 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleScreenBufferSize(%u,%u).\n", … … 7306 7376 coordSize.Y); 7307 7377 #endif 7308 7309 7378 7379 7310 7380 /* re-allocate the whole line-pointer array */ 7311 7381 ulSize = coordSize.Y * (coordSize.X * 2 + sizeof (PSZ) ); … … 7314 7384 if (pConsoleBuffer->ppszLine != NULL) /* if old buffer is present */ 7315 7385 free (pConsoleBuffer->ppszLine); /* free old buffer */ 7316 7386 7317 7387 pConsoleBuffer->ppszLine = NULL; 7318 7388 pConsoleBuffer->coordBufferSize.X = 0; … … 7322 7392 pConsoleBuffer->coordWindowPosition.X = 0; 7323 7393 pConsoleBuffer->coordWindowPosition.Y = 0; 7324 7394 7325 7395 return (TRUE); /* OK */ 7326 7396 } 7327 7397 7328 7398 7329 7399 ppszNew = (PSZ *) malloc(ulSize); /* allocate array */ 7330 7400 if (ppszNew == NULL) /* check proper allocation */ … … 7333 7403 return (FALSE); /* raise error condition */ 7334 7404 } 7335 7405 7336 7406 7337 7407 for (ulLine = 0; /* setup line pointer array */ … … 7349 7419 ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 24) + 7350 7420 ((ULONG)' ' << 16) ); 7351 7421 7352 7422 /* scroll the line index */ 7353 7423 for (ulLine = 0; … … 7357 7427 (PUSHORT)(ppszNew[ulLine]), 7358 7428 coordSize.X); 7359 7360 7361 7429 7430 7431 7362 7432 /* copy lines as required */ 7363 7433 if (pConsoleBuffer->ppszLine != NULL) /* previous buffer present ? */ 7364 7434 { 7365 7435 ULONG x, y; 7366 7436 7367 7437 /* copy old characters as required */ 7368 7438 x = min(pConsoleBuffer->coordBufferSize.X, coordSize.X); 7369 7439 y = min(pConsoleBuffer->coordBufferSize.Y, coordSize.Y); 7370 7440 7371 7441 for (ulLine = 0; /* copy line by line */ 7372 7442 ulLine < y; … … 7375 7445 pConsoleBuffer->ppszLine[ulLine], 7376 7446 x * 2); 7377 7447 7378 7448 free (pConsoleBuffer->ppszLine); /* free previous screen buffer array */ 7379 7449 } 7380 7450 7381 7451 7382 7452 pConsoleBuffer->ppszLine = ppszNew; /* poke in the new values */ … … 7385 7455 pConsoleBuffer->coordCursorPosition.X = 0; 7386 7456 pConsoleBuffer->coordCursorPosition.Y = 0; 7387 7457 7388 7458 /* @@@PH to be changed ! */ 7389 7459 pConsoleBuffer->coordWindowSize.X = coordSize.X; /* default */ … … 7395 7465 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 7396 7466 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 7397 7467 7398 7468 return TRUE; 7399 7469 } … … 7401 7471 7402 7472 /***************************************************************************** 7403 * Name : 7404 * Purpose : 7405 * Parameters: 7406 * Variables : 7407 * Result : 7408 * Remark : 7409 * Status : 7473 * Name : 7474 * Purpose : 7475 * Parameters: 7476 * Variables : 7477 * Result : 7478 * Remark : 7479 * Status : 7410 7480 * 7411 7481 * Author : Patrick Haller [Tue, 1998/02/10 01:55] … … 7416 7486 { 7417 7487 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7418 7488 7419 7489 #ifdef DEBUG_LOCAL2 7420 7490 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleTextAttribute(%u).\n", 7421 7491 wAttr); 7422 7492 #endif 7423 7493 7424 7494 pConsoleBuffer->ucDefaultAttribute = (UCHAR)wAttr; 7425 7495 return (TRUE); … … 7428 7498 7429 7499 /***************************************************************************** 7430 * Name : 7431 * Purpose : 7432 * Parameters: 7433 * Variables : 7434 * Result : 7435 * Remark : 7436 * Status : 7500 * Name : 7501 * Purpose : 7502 * Parameters: 7503 * Variables : 7504 * Result : 7505 * Remark : 7506 * Status : 7437 7507 * 7438 7508 * Author : Patrick Haller [Tue, 1998/02/10 01:55] … … 7442 7512 { 7443 7513 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7444 7514 7445 7515 #ifdef DEBUG_LOCAL 7446 7516 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleActiveScreenBuffer().\n"); 7447 7517 #endif 7448 7518 7449 7519 /* set new buffer handle to the global console */ 7450 7520 ConsoleGlobals.hConsoleBuffer = pHMHandleData->hHandle; 7451 7521 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 7452 7522 7453 7523 return (TRUE); 7454 7524 } … … 7463 7533 * Variables : 7464 7534 * Result : 7465 * Remark : 7535 * Remark : 7466 7536 * Status : UNTESTED 7467 7537 * … … 7474 7544 { 7475 7545 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7476 7546 7477 7547 #ifdef DEBUG_LOCAL2 7478 7548 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleWindowInfo(%08x,%u,%08x).\n", … … 7481 7551 psrctWindowRect); 7482 7552 #endif 7483 7553 7484 7554 if (fAbsolute == TRUE) /* absolute coordinates provided ? */ 7485 7555 { … … 7495 7565 return (FALSE); /* error */ 7496 7566 } 7497 7567 7498 7568 /* check we don't go beyond screen buffer ! */ 7499 7569 if ( ((psrctWindowRect->Right - psrctWindowRect->Left) > pConsoleBuffer->coordBufferSize.X) || … … 7506 7576 return (FALSE); /* error */ 7507 7577 } 7508 7578 7509 7579 pConsoleBuffer->coordWindowSize.X = psrctWindowRect->Right - 7510 7580 psrctWindowRect->Left; 7511 7581 pConsoleBuffer->coordWindowSize.Y = psrctWindowRect->Bottom - 7512 7582 psrctWindowRect->Top; 7513 7583 7514 7584 pConsoleBuffer->coordWindowPosition.X = psrctWindowRect->Left; 7515 7585 pConsoleBuffer->coordWindowPosition.Y = psrctWindowRect->Top; … … 7521 7591 int iPosX; 7522 7592 int iPosY; 7523 7593 7524 7594 iSizeX = pConsoleBuffer->coordWindowSize.X + psrctWindowRect->Left + psrctWindowRect->Right; 7525 7595 iSizeY = pConsoleBuffer->coordWindowSize.Y + psrctWindowRect->Top + psrctWindowRect->Bottom; 7526 7596 iPosX = pConsoleBuffer->coordWindowPosition.X + psrctWindowRect->Left; 7527 7597 iPosY = pConsoleBuffer->coordWindowPosition.Y + psrctWindowRect->Top; 7528 7598 7529 7599 /* check we don't go beyond screen buffer ! */ 7530 7600 if ( (iSizeX > pConsoleBuffer->coordBufferSize.X) || … … 7541 7611 return (FALSE); /* error */ 7542 7612 } 7543 7613 7544 7614 /* Values are verified for being OK ! */ 7545 7615 pConsoleBuffer->coordWindowPosition.X = iPosX; … … 7548 7618 pConsoleBuffer->coordWindowSize.Y = iSizeY; 7549 7619 } 7550 7620 7551 7621 /* update window */ 7552 /* @@@PH 7553 7622 /* @@@PH 7623 7554 7624 ConsoleWindowResize(COORD coordWindowSize, 7555 7625 COORD coordWindowPos, 7556 7626 7557 7627 */ 7558 7628 7559 7629 /* update window contents (scroll) */ 7560 7630 /* update screen if active console */ … … 7576 7646 * Variables : 7577 7647 * Result : 7578 * Remark : 7648 * Remark : 7579 7649 * Status : UNTESTED 7580 7650 * … … 7589 7659 { 7590 7660 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7591 7661 7592 7662 #ifdef DEBUG_LOCAL2 7593 7663 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleA(%08x,%08x,%u,%08x,%08x).\n", … … 7598 7668 lpvReserved); 7599 7669 #endif 7600 7670 7601 7671 /* simply forward the request to that routine */ 7602 7672 return (HMDeviceConsoleBufferClass::WriteFile(pHMHandleData, … … 7618 7688 * Variables : 7619 7689 * Result : 7620 * Remark : 7690 * Remark : 7621 7691 * Status : UNTESTED 7622 7692 * … … 7631 7701 { 7632 7702 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7633 7703 7634 7704 #ifdef DEBUG_LOCAL2 7635 7705 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleW(%08x,%08x,%u,%08x,%08x).\n", … … 7640 7710 lpvReserved); 7641 7711 #endif 7642 7712 7643 7713 /* @@@PH AScii -> unicode translation */ 7644 7714 7645 7715 /* simply forward the request to that routine */ 7646 7716 return (HMDeviceConsoleBufferClass::WriteFile(pHMHandleData, … … 7662 7732 * Variables : 7663 7733 * Result : 7664 * Remark : 7734 * Remark : 7665 7735 * Status : UNTESTED 7666 7736 * … … 7679 7749 ULONG ulWriteX, ulWriteY; /* position data is read from */ 7680 7750 WORD wCell; /* currently read data */ 7681 7751 7682 7752 PCHAR_INFO pchi; 7683 7753 PSZ pszTarget; 7684 7754 7685 7755 #ifdef DEBUG_LOCAL2 7686 7756 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputA(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n", … … 7693 7763 psrctDestRect); 7694 7764 #endif 7695 7696 7765 7766 7697 7767 /* verify psrctDestRect first */ 7698 7768 psrctDestRect->Left = max(psrctDestRect->Left, 0); … … 7700 7770 psrctDestRect->Right = min(psrctDestRect->Right, pConsoleBuffer->coordBufferSize.X - 1); 7701 7771 psrctDestRect->Bottom= min(psrctDestRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1); 7702 7772 7703 7773 /* verify target buffer */ 7704 7774 if ( (coordSrcBufferSize.X < coordSrcBufferCoord.X) || … … 7708 7778 return (FALSE); /* API failed */ 7709 7779 } 7710 7780 7711 7781 ulCX = coordSrcBufferSize.X - coordSrcBufferCoord.X; 7712 7782 ulCY = coordSrcBufferSize.Y - coordSrcBufferCoord.Y; 7713 7783 7714 7784 ulCX = min(ulCX, (psrctDestRect->Right - psrctDestRect->Left)); 7715 7785 ulCY = min(ulCY, (psrctDestRect->Bottom - psrctDestRect->Top)); 7716 7786 7717 7787 /* final calculation of the copy rectangle */ 7718 7788 psrctDestRect->Right = psrctDestRect->Left + ulCX; 7719 7789 psrctDestRect->Bottom = psrctDestRect->Top + ulCY; 7720 7721 7790 7791 7722 7792 for (ulY = 0, 7723 7793 ulWriteY = psrctDestRect->Top; 7724 7794 7725 7795 ulY <= ulCY; 7726 7796 7727 7797 ulY++, 7728 7798 ulWriteY++) … … 7731 7801 + sizeof(CHAR_INFO) * (coordSrcBufferCoord.Y + ulY) 7732 7802 * coordSrcBufferSize.X; 7733 7803 7734 7804 /* calculate pointer to start of screen line */ 7735 7805 pszTarget = pConsoleBuffer->ppszLine[ulWriteY] + psrctDestRect->Left; 7736 7806 7737 7807 for (ulX = 0, 7738 7808 ulWriteX = psrctDestRect->Left; 7739 7809 7740 7810 ulX <= ulCX; 7741 7811 7742 7812 ulX++, 7743 7813 ulWriteX++, … … 7749 7819 } 7750 7820 } 7751 7821 7752 7822 /* update screen if active console */ 7753 7823 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 7754 7824 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 7755 7825 7756 7826 return (TRUE); /* OK, that's it */ 7757 7827 } … … 7768 7838 * Variables : 7769 7839 * Result : 7770 * Remark : 7840 * Remark : 7771 7841 * Status : UNTESTED 7772 7842 * … … 7785 7855 ULONG ulWriteX, ulWriteY; /* position data is read from */ 7786 7856 WORD wCell; /* currently read data */ 7787 7857 7788 7858 PCHAR_INFO pchi; 7789 7859 PSZ pszTarget; 7790 7860 7791 7861 #ifdef DEBUG_LOCAL2 7792 7862 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputW(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n", … … 7799 7869 psrctDestRect); 7800 7870 #endif 7801 7802 7871 7872 7803 7873 /* verify psrctDestRect first */ 7804 7874 psrctDestRect->Left = max(psrctDestRect->Left, 0); … … 7806 7876 psrctDestRect->Right = min(psrctDestRect->Right, pConsoleBuffer->coordBufferSize.X - 1); 7807 7877 psrctDestRect->Bottom= min(psrctDestRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1); 7808 7878 7809 7879 /* verify target buffer */ 7810 7880 if ( (coordSrcBufferSize.X < coordSrcBufferCoord.X) || … … 7814 7884 return (FALSE); /* API failed */ 7815 7885 } 7816 7886 7817 7887 ulCX = coordSrcBufferSize.X - coordSrcBufferCoord.X; 7818 7888 ulCY = coordSrcBufferSize.Y - coordSrcBufferCoord.Y; 7819 7889 7820 7890 ulCX = min(ulCX, (psrctDestRect->Right - psrctDestRect->Left)); 7821 7891 ulCY = min(ulCY, (psrctDestRect->Bottom - psrctDestRect->Top)); 7822 7892 7823 7893 /* final calculation of the copy rectangle */ 7824 7894 psrctDestRect->Right = psrctDestRect->Left + ulCX; 7825 7895 psrctDestRect->Bottom = psrctDestRect->Top + ulCY; 7826 7827 7896 7897 7828 7898 for (ulY = 0, 7829 7899 ulWriteY = psrctDestRect->Top; 7830 7900 7831 7901 ulY <= ulCY; 7832 7902 7833 7903 ulY++, 7834 7904 ulWriteY++) … … 7837 7907 + sizeof(CHAR_INFO) * (coordSrcBufferCoord.Y + ulY) 7838 7908 * coordSrcBufferSize.X; 7839 7909 7840 7910 /* calculate pointer to start of screen line */ 7841 7911 pszTarget = pConsoleBuffer->ppszLine[ulWriteY] + psrctDestRect->Left; 7842 7912 7843 7913 for (ulX = 0, 7844 7914 ulWriteX = psrctDestRect->Left; 7845 7915 7846 7916 ulX <= ulCX; 7847 7917 7848 7918 ulX++, 7849 7919 ulWriteX++, … … 7855 7925 } 7856 7926 } 7857 7927 7858 7928 /* update screen if active console */ 7859 7929 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 7860 7930 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 7861 7931 7862 7932 return (TRUE); /* OK, that's it */ 7863 7933 } … … 7874 7944 * Variables : 7875 7945 * Result : 7876 * Remark : 7946 * Remark : 7877 7947 * Status : UNTESTED 7878 7948 * … … 7888 7958 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7889 7959 ULONG ulCounter; /* current character counter */ 7890 7960 7891 7961 #ifdef DEBUG_LOCAL2 7892 7962 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputAttribute(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n", … … 7900 7970 lpcWritten); 7901 7971 #endif 7902 7972 7903 7973 if ( (dwWriteCoord.X < 0) || 7904 7974 (dwWriteCoord.Y < 0) ) … … 7906 7976 if (lpcWritten != NULL) /* ensure pointer is valid */ 7907 7977 *lpcWritten = 0; /* complete error handling */ 7908 7978 7909 7979 SetLastError(ERROR_INVALID_PARAMETER); 7910 7980 return (FALSE); 7911 7981 } 7912 7982 7913 7983 /* check if dwWriteCoord is within specs */ 7914 7984 if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 7917 7987 if (lpcWritten != NULL) /* ensure pointer is valid */ 7918 7988 *lpcWritten = 0; /* complete error handling */ 7919 7989 7920 7990 SetLastError(ERROR_INVALID_PARAMETER); 7921 7991 return (FALSE); 7922 7992 } 7923 7993 7924 7994 7925 7995 /* OK, now write the attribute lines */ … … 7933 8003 (dwWriteCoord.X * 2 + 1) 7934 8004 ) = (UCHAR)*lpwAttribute; /* write attribute and skip to next */ 7935 8005 7936 8006 dwWriteCoord.X++; /* move write position */ 7937 8007 if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 7939 8009 dwWriteCoord.X = 0; /* skip to next line */ 7940 8010 dwWriteCoord.Y++; 7941 8011 7942 8012 /* oops, we're at the end of the buffer. Abort now. */ 7943 8013 if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 7945 8015 if (lpcWritten != NULL) /* ensure pointer is valid */ 7946 8016 *lpcWritten = ulCounter; 7947 8017 7948 8018 /* update screen if active console */ 7949 8019 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 7950 8020 ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */ 7951 8021 7952 8022 return (TRUE); 7953 8023 } 7954 8024 } 7955 8025 } 7956 8026 7957 8027 /* update screen if active console */ 7958 8028 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 7959 8029 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 7960 8030 7961 8031 if (lpcWritten != NULL) /* ensure pointer is valid */ 7962 8032 *lpcWritten = cWriteCells; 7963 8033 7964 8034 return (TRUE); 7965 8035 } … … 7976 8046 * Variables : 7977 8047 * Result : 7978 * Remark : 8048 * Remark : 7979 8049 * Status : UNTESTED 7980 8050 * … … 7990 8060 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 7991 8061 ULONG ulCounter; /* current character counter */ 7992 8062 7993 8063 #ifdef DEBUG_LOCAL2 7994 8064 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputCharacterA(%08x,pstr=%08x,%u,x=%u y=%u,res=%08x).\n", … … 8000 8070 lpcWritten); 8001 8071 #endif 8002 8072 8003 8073 if ( (dwWriteCoord.X < 0) || 8004 8074 (dwWriteCoord.Y < 0) ) … … 8006 8076 if (lpcWritten != NULL) /* ensure pointer is valid */ 8007 8077 *lpcWritten = 0; /* complete error handling */ 8008 8078 8009 8079 SetLastError(ERROR_INVALID_PARAMETER); 8010 8080 return (FALSE); 8011 8081 } 8012 8082 8013 8083 /* check if dwWriteCoord is within specs */ 8014 8084 if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 8017 8087 if (lpcWritten != NULL) /* ensure pointer is valid */ 8018 8088 *lpcWritten = 0; /* complete error handling */ 8019 8089 8020 8090 SetLastError(ERROR_INVALID_PARAMETER); 8021 8091 return (FALSE); 8022 8092 } 8023 8093 8024 8094 8025 8095 /* OK, now write the character lines */ … … 8033 8103 (dwWriteCoord.X * 2) 8034 8104 ) = (UCHAR)*lpWriteBuffer; /* write character and skip to next */ 8035 8105 8036 8106 dwWriteCoord.X++; /* move write position */ 8037 8107 if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 8039 8109 dwWriteCoord.X = 0; /* skip to next line */ 8040 8110 dwWriteCoord.Y++; 8041 8111 8042 8112 /* oops, we're at the end of the buffer. Abort now. */ 8043 8113 if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 8045 8115 if (lpcWritten != NULL) /* ensure pointer is valid */ 8046 8116 *lpcWritten = ulCounter; 8047 8117 8048 8118 /* update screen if active console */ 8049 8119 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 8050 8120 ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */ 8051 8121 8052 8122 return (TRUE); 8053 8123 } 8054 8124 } 8055 8125 } 8056 8126 8057 8127 /* update screen if active console */ 8058 8128 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 8059 8129 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 8060 8130 8061 8131 if (lpcWritten != NULL) /* ensure pointer is valid */ 8062 8132 *lpcWritten = cchWrite; 8063 8133 8064 8134 return (TRUE); 8065 8135 } … … 8090 8160 PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData; 8091 8161 ULONG ulCounter; /* current character counter */ 8092 8162 8093 8163 #ifdef DEBUG_LOCAL2 8094 8164 WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputCharacterW(%08x,pstr=%08x,%u,x=%u y=%u,res=%08x).\n", … … 8100 8170 lpcWritten); 8101 8171 #endif 8102 8172 8103 8173 if ( (dwWriteCoord.X < 0) || 8104 8174 (dwWriteCoord.Y < 0) ) … … 8106 8176 if (lpcWritten != NULL) /* ensure pointer is valid */ 8107 8177 *lpcWritten = 0; /* complete error handling */ 8108 8178 8109 8179 SetLastError(ERROR_INVALID_PARAMETER); 8110 8180 return (FALSE); 8111 8181 } 8112 8182 8113 8183 /* check if dwWriteCoord is within specs */ 8114 8184 if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) || … … 8117 8187 if (lpcWritten != NULL) /* ensure pointer is valid */ 8118 8188 *lpcWritten = 0; /* complete error handling */ 8119 8189 8120 8190 SetLastError(ERROR_INVALID_PARAMETER); 8121 8191 return (FALSE); 8122 8192 } 8123 8193 8124 8194 8125 8195 /* OK, now write the character lines */ … … 8134 8204 ) = (UCHAR)*lpWriteBuffer; /* write character and skip to next */ 8135 8205 /* @@@PH unicode to ascii translation */ 8136 8206 8137 8207 dwWriteCoord.X++; /* move write position */ 8138 8208 if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) … … 8140 8210 dwWriteCoord.X = 0; /* skip to next line */ 8141 8211 dwWriteCoord.Y++; 8142 8212 8143 8213 /* oops, we're at the end of the buffer. Abort now. */ 8144 8214 if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y) … … 8146 8216 if (lpcWritten != NULL) /* ensure pointer is valid */ 8147 8217 *lpcWritten = ulCounter; 8148 8218 8149 8219 /* update screen if active console */ 8150 8220 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 8151 8221 ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */ 8152 8222 8153 8223 return (TRUE); 8154 8224 } 8155 8225 } 8156 8226 } 8157 8227 8158 8228 /* update screen if active console */ 8159 8229 if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer) 8160 8230 ConsoleGlobals.fUpdateRequired = TRUE; /* update with next WM_TIMER */ 8161 8231 8162 8232 if (lpcWritten != NULL) /* ensure pointer is valid */ 8163 8233 *lpcWritten = cchWrite; 8164 8234 8165 8235 return (TRUE); 8166 8236 }
Note:
See TracChangeset
for help on using the changeset viewer.