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