Ignore:
Timestamp:
Jun 7, 1999, 10:58:22 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/console.cpp

    r17 r46  
    44 * 1998/02/10 Patrick Haller (haller@zebra.fh-weingarten.de)
    55 *
    6  * @(#) console.cpp             1.0.0   1998/02/10 PH Start from scratch
     6 * @(#) console.cpp         1.0.0   1998/02/10 PH Start from scratch
     7 *
     8 * Project Odin Software License can be found in LICENSE.TXT
     9 *
    710 */
    811
     
    2023 * Remark                                                                    *
    2124 *****************************************************************************
    22  
     25
    2326 - DWORD HandlerRoutine (DWORD dwCtrlType)
    2427   basically an exception handler routine. handles a few signals / excpts.
    2528   should be somewhere near the exception handling code ... :)
    26    
     29
    2730   Hmm, however as PM applications don't really get a ctrl-c signal,
    2831   I'll have to do this on my own ...
    29  
     32
    3033 - supply unicode<->ascii conversions for all the _A and _W function pairs.
    31  
     34
    3235 - problem: we can't prevent thread1 from blocking the message queue ?
    3336            what will happen if a WinTerminate() is issued there ?
    3437            will the message queue be closed and provide smooth tasking ?
    3538            how will open32 react on this ?
    36  
     39
    3740 - ECHO_LINE_INPUT / ReadFile blocks till CR
    38  
     41
    3942 - scrollbars
    4043 * do some flowchart to exactly determine WHEN to use WHICH setting
    4144   and perform WHAT action
    42  
     45
    4346 - clipboard support
    4447*/
    45  
     48
    4649
    4750/*****************************************************************************
     
    6265#include <stdlib.h>
    6366#include <string.h>
    64 #include <odin.h>
    65 
    6667#include "win32type.h"
    67 #include "unicode.h"
    6868#include "misc.h"
    69 #include "HandleManager.h"
    7069#include "console.h"
    7170#include "console2.h"
    7271#include "conprop.h"
     72#include "unicode.h"
     73#include "HandleManager.h"
    7374
    7475
     
    7778 ***********************************/
    7879
    79 extern "C"
    80 {
    81   void   _System SetLastError(DWORD  dwError);
    82   DWORD  _System GetLastError(void);
    83   LPSTR  _System GetCommandLineA(void);
    84   void   _System ReplaceExceptionHandler(void);
    85   void   _System ExitProcess(UINT exitcode);
    86   HANDLE _System GetStdHandle(DWORD dwDevice);
    87   DWORD  _System GetFileType(HANDLE hFile);
     80#include <os2sel.h>
     81
     82extern "C"
     83{
     84  void   _System _O32_SetLastError(DWORD  dwError);
     85  DWORD  _System _O32_GetLastError(void);
     86  LPSTR  _System _O32_GetCommandLine(void);
     87  void   _System _O32_ReplaceExceptionHandler(void);
     88  void   _System _O32_ExitProcess(UINT exitcode);
     89  HANDLE _System _O32_GetStdHandle(DWORD dwDevice);
     90  DWORD  _System _O32_GetFileType(HANDLE hFile);
     91
     92inline void SetLastError(DWORD a)
     93{
     94 USHORT sel = GetFS();
     95
     96    _O32_SetLastError(a);
     97    SetFS(sel);
     98}
     99
     100inline DWORD GetLastError()
     101{
     102 DWORD yyrc;
     103 USHORT sel = GetFS();
     104
     105    yyrc = _O32_GetLastError();
     106    SetFS(sel);
     107
     108    return yyrc;
     109}
     110
     111inline LPSTR GetCommandLine()
     112{
     113 LPSTR yyrc;
     114 USHORT sel = GetFS();
     115
     116    yyrc = _O32_GetCommandLine();
     117    SetFS(sel);
     118
     119    return yyrc;
     120}
     121
     122inline void ReplaceExceptionHandler()
     123{
     124 USHORT sel = GetFS();
     125
     126    _O32_ReplaceExceptionHandler();
     127    SetFS(sel);
     128}
     129
     130inline void ExitProcess(UINT a)
     131{
     132 USHORT sel = GetFS();
     133
     134    _O32_ExitProcess(a);
     135    SetFS(sel);
     136}
     137
     138inline HANDLE GetStdHandle(DWORD a)
     139{
     140 HANDLE yyrc;
     141 USHORT sel = GetFS();
     142
     143    yyrc = _O32_GetStdHandle(a);
     144    SetFS(sel);
     145
     146    return yyrc;
     147}
     148
     149inline DWORD GetFileType(HANDLE a)
     150{
     151 DWORD yyrc;
     152 USHORT sel = GetFS();
     153
     154    yyrc = _O32_GetFileType(a);
     155    SetFS(sel);
     156
     157    return yyrc;
     158}
     159
    88160}
    89161
     
    180252 *****************************************************************************/
    181253
    182                                        
     254
    183255static APIRET ConsoleTerminate(void);/* termination of the console subsystem */
    184256
     
    243315    HEV    hevConsole;                            /* console event semaphore */
    244316    APIRET rcConsole;                /* initialization status of the console */
    245     HAB    hab;                                       /* anchor block handle */
    246     HMQ    hmq;               /* message queue handle for the console window */
     317    HAB    hab;                                       /* anchor block handle */
     318    HMQ    hmq;               /* message queue handle for the console window */
    247319    QMSG   qmsg;                           /* message for the console window */
    248320    ULONG  flFrameFlags;                      /* frame window creation flags */
     
    250322    HWND   hwndFrame;                                 /* frame window handle */
    251323    HWND   hwndClient;                               /* client window handle */
    252  
     324
    253325    HWND   hwndHorzScroll;                /* handle of horizontal scroll bar */
    254326    HWND   hwndVertScroll;                  /* handle of vertical scroll bar */
    255327    BOOL   fHasVertScroll;            /* indicates if scrollbars are visible */
    256328    BOOL   fHasHorzScroll;
    257  
     329
    258330    HDC    hdcConsole;                             /* console device context */
    259331    PFNWP  pfnwpFrameOriginal;            /* original frame window procedure */
    260  
     332
    261333    HWND     hwndMenuConsole;                          /* console popup menu */
    262334    HMODULE  hmodResource;           /* resources are stored in KERNEL32.DLL */
    263335    HPOINTER hPtrConsole;                                    /* console icon */
    264  
     336
    265337    HANDLE hConsoleBuffer;            /* handle of the active console buffer */
    266338    HANDLE hConsoleBufferDefault;    /* handle of the default console buffer */
    267  
     339
    268340    HVPS   hvpsConsole;                   /* console AVIO presentation space */
    269  
     341
    270342    COORD  coordMaxWindowPels;              /* maximum window size in pixels */
    271343    COORD  coordWindowSize;                   /* current console window size */
    272344    COORD  coordWindowPos;                           /* scroller's positions */
    273  
     345
    274346    SHORT  sCellCX; /* height and width of a avio cell with the current font */
    275347    SHORT  sCellCY;
    276  
     348
    277349    BOOL   fUpdateRequired; /* set to TRUE if next WM_TIMER shall update the */
    278350                           /* AVIO presentation space from the consolebuffer */
     
    281353    ULONG  ulTimerFrequency;             /* cursor + blitter timer frequency */
    282354    ULONG  ulTimerCursor;                 /* cursor loop counter for divisor */
    283  
     355
    284356    CONSOLEOPTIONS Options;            /* the console's options / properties */
    285357
     
    307379
    308380/*****************************************************************************
    309  * Name      : 
    310  * Purpose   : 
    311  * Parameters: 
    312  * Variables :
    313  * Result    : 
    314  * Remark    :
    315  * Status    : 
     381 * Name      :
     382 * Purpose   :
     383 * Parameters:
     384 * Variables :
     385 * Result    :
     386 * Remark    :
     387 * Status    :
    316388 *
    317389 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    318390 *****************************************************************************/
    319391
    320 APIRET EXPORT ConsoleInit(void)         /* creation of the console subsystem */
     392APIRET ConsoleInit(void)                /* creation of the console subsystem */
    321393{
    322394  APIRET rc;                                              /* API return code */
    323395  ULONG  ulPostCount;                              /* semaphore post counter */
    324  
    325  
    326  
     396
     397
     398
    327399  if (ConsoleGlobals.hevConsole != NULLHANDLE) /* we're already initialized ?*/
    328400    return (NO_ERROR);                             /* then abort immediately */
    329    
     401
    330402                                 /* create console synchronization semaphore */
    331403  rc = DosCreateEventSem (NULL,
     
    335407  if (rc != NO_ERROR)                                       /* other error ? */
    336408    return (rc);                                    /* raise error condition */
    337  
    338  
     409
     410
    339411                                     /* create console input queue semaphore */
    340412  rc = DosCreateEventSem (NULL,
     
    347419    return (rc);                                    /* raise error condition */
    348420  }
    349  
     421
    350422
    351423  /***************************************************************************
    352424   * Create pseudo-devices and initialize ConsoleGlobals                     *
    353425   ***************************************************************************/
    354  
     426
    355427  rc = ConsoleDevicesRegister();                 /* ensure devices are there */
    356428  if (rc != NO_ERROR)                                    /* check for errors */
     
    360432    return (rc);                                    /* raise error condition */
    361433  }
    362  
    363  
     434
     435
    364436  /***************************************************************************
    365437   * Presentation Manager Initialization phase                               *
    366438   ***************************************************************************/
    367  
     439
    368440    /* OK, we're about to initialize the console subsystem for this process. */
    369441                           /* start message thread for console object window */
     
    373445                                           NULL);
    374446                                   /* has the thread been created properly ? */
    375   if (ConsoleGlobals.tidConsole == -1) 
     447  if (ConsoleGlobals.tidConsole == -1)
    376448  {
    377449    DosCloseEventSem(ConsoleInput.hevInputQueue);   /* close other semaphore */
     
    385457                   ConsoleGlobals.Options.ulConsoleThreadPriorityDelta,
    386458                   ConsoleGlobals.tidConsole);
    387                    
    388  
     459
     460
    389461                      /* wait for the child thread to do it's initialization */
    390462                                              /* timeout isn't really useful */
     
    398470    return (rc);                                    /* raise error condition */
    399471  }
    400  
     472
    401473  DosResetEventSem(ConsoleGlobals.hevConsole,       /* reset event semaphore */
    402474                   &ulPostCount);
    403  
     475
    404476  rc = ConsoleGlobals.rcConsole;   /* pass thru console thread's return code */
    405  
     477
    406478  return (rc);                                                         /* OK */
    407479}
     
    412484 * Purpose   : creates and registers console devices if the standard handles
    413485 *             are not redirected to a file
    414  * Parameters: 
    415  * Variables :
    416  * Result    : 
    417  * Remark    :
    418  * Status    : 
     486 * Parameters:
     487 * Variables :
     488 * Result    :
     489 * Remark    :
     490 * Status    :
    419491 *
    420492 * Author    : Patrick Haller [Tue, 1998/03/17 01:55]
    421493 *****************************************************************************/
    422494
    423 APIRET EXPORT ConsoleDevicesRegister(void)
     495APIRET ConsoleDevicesRegister(void)
    424496{
    425497  DWORD  dwType;                                       /* device handle type */
     
    427499  HANDLE hStandardOut;                           /* stdout handle to CONOUT$ */
    428500  HANDLE hStandardError;                         /* stderr handle to CONOUT$ */
    429  
     501
    430502  HMDeviceConsoleInClass     *pHMDeviceConsoleIn;
    431503  HMDeviceConsoleOutClass    *pHMDeviceConsoleOut;
    432504  HMDeviceConsoleBufferClass *pHMDeviceConsoleBuffer;
    433  
     505
    434506  DWORD rc;
    435  
     507
    436508  static fDevicesInitialized;          /* have we been initialized already ? */
    437  
     509
    438510  if (fDevicesInitialized == TRUE)                 /* OK, we're already done */
    439511    return (NO_ERROR);
    440512  else
    441513    fDevicesInitialized = TRUE;
    442  
     514
    443515  dprintf(("KERNEL32:ConsoleDevicesRegister\n"));
    444  
    445  
     516
     517
    446518  /*************************************
    447519   * Initialize Console Window Options *
     
    450522  ConsoleGlobals.Options.fTerminateAutomatically = FALSE;
    451523  ConsoleGlobals.Options.fSpeakerEnabled         = TRUE;
    452  
     524
    453525  ConsoleGlobals.Options.fSetWindowPosition      = FALSE;
    454526  ConsoleGlobals.Options.coordDefaultPosition.X  = 0;
     
    460532  ConsoleGlobals.coordWindowPos.X                = 0;
    461533  ConsoleGlobals.coordWindowPos.Y                = 0;
    462  
     534
    463535  ConsoleGlobals.Options.fQuickInsert            = FALSE;
    464536  ConsoleGlobals.Options.fInsertMode             = FALSE;
    465537  ConsoleGlobals.Options.fMouseActions           = FALSE;
    466   ConsoleGlobals.Options.fToolbarActive          = FALSE;     
     538  ConsoleGlobals.Options.fToolbarActive          = FALSE;
    467539
    468540  ConsoleGlobals.Options.ucDefaultAttribute = 0x0007;  /* 07 = grey on black */
    469  
     541
    470542  ConsoleGlobals.Options.ulTabSize               = 8;      /* tabulator size */
    471543  ConsoleGlobals.Options.ulUpdateLimit           = 8; /* scroll max. n lines */
    472  
     544
    473545                                     /* priority settings for message thread */
    474546  ConsoleGlobals.Options.ulConsoleThreadPriorityClass = PRTYC_REGULAR;
    475547  ConsoleGlobals.Options.ulConsoleThreadPriorityDelta = +10;
    476  
     548
    477549  ConsoleGlobals.Options.ucCursorDivisor = 10; /* timer divisor for blinking */
    478  
     550
    479551  ConsoleGlobals.ulTimerFrequency = 10;  /* cursor + blitter timer frequency */
    480552
    481  
     553
    482554  ConsoleGlobals.flFrameFlags = FCF_SIZEBORDER   |   /* frame creation flags */
    483555                                FCF_TITLEBAR     |
     
    489561                                FCF_VERTSCROLL   |
    490562                                FCF_MINMAX;
    491  
     563
    492564                                                   /* generate copy of title */
    493   ConsoleGlobals.pszWindowTitle = strdup(GetCommandLineA());
    494  
     565  ConsoleGlobals.pszWindowTitle = strdup(GetCommandLine());
     566
    495567                                    /* obtain module handle to our resources */
    496568  rc = DosQueryModuleHandle("KERNEL32",
     
    499571    WriteLog("KERNEL32/CONSOLE: Can't get handle to KERNEL32 (%u).\n",
    500572             rc);
    501  
     573
    502574                                             /* standard console input modes */
    503575  ConsoleInput.dwConsoleMode = ENABLE_LINE_INPUT      |
    504576                               ENABLE_PROCESSED_INPUT;
    505577  /* @@@PH ENABLE_ECHO_INPUT || ENABLE_MOUSE_INPUT; */
    506    
     578
    507579  ConsoleGlobals.hConsoleBufferDefault = INVALID_HANDLE_VALUE;
    508580  ConsoleGlobals.hConsoleBuffer        = INVALID_HANDLE_VALUE;
    509  
    510  
     581
     582
    511583  /***************************************************************************
    512584   * Standard handles     Initialization phase                               *
    513585   ***************************************************************************/
    514    
     586
    515587                   /* create devices and register devices with handlemanager */
    516    
     588
    517589    pHMDeviceConsoleIn  = new HMDeviceConsoleInClass("CONIN$");
    518590    rc = HMDeviceRegister ("CONIN$",
     
    521593      dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONIN$ failed with %u.\n",
    522594               rc));
    523    
    524    
     595
     596
    525597    pHMDeviceConsoleOut = new HMDeviceConsoleOutClass("CONOUT$");
    526598    rc = HMDeviceRegister ("CONOUT$",
     
    528600    if (rc != NO_ERROR)                                  /* check for errors */
    529601      dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONOUT$ failed with %u.\n",
    530                rc));   
    531    
    532    
     602               rc));
     603
     604
    533605    pHMDeviceConsoleBuffer = new HMDeviceConsoleBufferClass("CONBUFFER$");
    534606    rc = HMDeviceRegister ("CONBUFFER$",
     
    536608    if (rc != NO_ERROR)                                  /* check for errors */
    537609      dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONBUFFER$ failed with %u.\n",
    538                rc));   
    539    
    540    
     610               rc));
     611
     612
    541613      /***********************************************************************
    542614       * initialize stdin handle                                             *
     
    552624                                   CONSOLE_TEXTMODE_BUFFER,
    553625                                   0);
    554    
     626
    555627      HMSetStdHandle(STD_INPUT_HANDLE,
    556628                     hStandardIn);
    557        
     629
    558630      /***********************************************************************
    559631       * initialize stdout handle                                            *
     
    568640                                   0,
    569641                                   CONSOLE_TEXTMODE_BUFFER,
    570                                    0);     
    571    
     642                                   0);
     643
    572644      HMSetStdHandle(STD_OUTPUT_HANDLE,
    573645                     hStandardOut);
    574    
    575  
     646
     647
    576648      /***********************************************************************
    577649       * initialize stderr handle                                            *
     
    587659                                   CONSOLE_TEXTMODE_BUFFER,
    588660                                   0);
    589    
     661
    590662      HMSetStdHandle(STD_ERROR_HANDLE,
    591663                     hStandardError);
     
    605677 *             leak if an application keeps opening and closing the console
    606678 *             frequently.
    607  * Status    : 
     679 * Status    :
    608680 *
    609681 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    613685{
    614686  APIRET rc;
    615  
     687
    616688  WinPostMsg (ConsoleGlobals.hwndFrame,         /* force thread to terminate */
    617689              WM_CLOSE,
     
    621693  rc = DosWaitThread(&ConsoleGlobals.tidConsole,/* wait until thd terminates */
    622694                     DCWW_WAIT);
    623  
     695
    624696                                           /* close the consolebuffer handle */
    625   HMCloseHandle(ConsoleGlobals.hConsoleBufferDefault); 
     697  HMCloseHandle(ConsoleGlobals.hConsoleBufferDefault);
    626698  free(ConsoleGlobals.pszWindowTitle);   /* free previously allocated memory */
    627699
     
    635707 * Parameters: VOID
    636708 * Variables :
    637  * Result    : 
    638  * Remark    : 
    639  * Status    : 
     709 * Result    :
     710 * Remark    :
     711 * Status    :
    640712 *
    641713 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    642714 *****************************************************************************/
    643715
    644 void EXPORT ConsoleWaitClose(void)
     716void ConsoleWaitClose(void)
    645717{
    646718  CHAR szBuffer[128];                                /* buffer for the title */
    647719  BOOL fResult;                /* result from subsequent calls to Win32 APIs */
    648  
     720
    649721                                /* check if there is a console window at all */
    650722  if (ConsoleIsActive() == FALSE)
    651723    return;                                                          /* nope */
    652  
     724
    653725  strcpy (szBuffer,               /* indicate console process has terminated */
    654726          "Completed: ");
    655  
    656   fResult = OS2GetConsoleTitleA(szBuffer + 11,/* 11 is length of Completed:_ */
     727
     728  fResult = GetConsoleTitleA(szBuffer + 11,/* 11 is length of Completed:_ */
    657729                                sizeof(szBuffer) - 11);
    658730
    659  
     731
    660732                                /* Set new title: Win32 Console - Terminated */
    661   fResult = OS2SetConsoleTitleA(szBuffer);
    662  
     733  fResult = SetConsoleTitleA(szBuffer);
     734
    663735                                          /* terminate console immediately ? */
    664736  if (ConsoleGlobals.Options.fTerminateAutomatically == FALSE)
     
    673745 * Parameters: VOID
    674746 * Variables :
    675  * Result    : 
    676  * Remark    : 
    677  * Status    : 
     747 * Result    :
     748 * Remark    :
     749 * Status    :
    678750 *
    679751 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    680752 *****************************************************************************/
    681753
    682 BOOL EXPORT ConsoleIsActive(void)
     754BOOL ConsoleIsActive(void)
    683755{
    684756  return (NULLHANDLE != ConsoleGlobals.hevConsole);
     
    693765 * Result    : is placed in Globals.rcConsole
    694766 * Remark    : the main thread has to wait for this thread
    695  * Status    : 
     767 * Status    :
    696768 *
    697769 * Author    : Patrick Haller [Tue, 1998/02/10 02:49]
     
    701773{
    702774  APIRET rc;                                              /* API return code */
    703  
    704  
     775
     776
    705777  ConsoleGlobals.rcConsole = NO_ERROR;                     /* initialization */
    706  
     778
    707779  ConsoleGlobals.hab = WinInitialize(0);             /* enable thread for PM */
    708780  if (ConsoleGlobals.hab == NULLHANDLE) /* if anchor block allocation failed */
    709     ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;   
     781    ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
    710782  else
    711783  {
    712784                                                     /* create message queue */
    713     ConsoleGlobals.hmq = WinCreateMsgQueue(ConsoleGlobals.hab, 
     785    ConsoleGlobals.hmq = WinCreateMsgQueue(ConsoleGlobals.hab,
    714786                                           0);
    715787    if (ConsoleGlobals.hmq == NULLHANDLE)  /* if msg queue allocation failed */
    716788    {
    717789      WinTerminate(ConsoleGlobals.hab);     /* stop thread from accessing PM */
    718       ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY; 
     790      ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
    719791    }
    720792    else
     
    724796                           ConsoleWindowProc,
    725797                           CS_SIZEREDRAW,
    726                            0) 
     798                           0)
    727799          == FALSE)
    728800      {
     
    751823    } /* WinCreateMsgQueue */
    752824  } /* WinInitialize */
    753  
    754  
     825
     826
    755827  DosPostEventSem(ConsoleGlobals.hevConsole);      /* signal the main thread */
    756  
    757  
     828
     829
    758830  if (ConsoleGlobals.rcConsole != NO_ERROR)      /* if we ran into a problem */
    759831  {
     
    763835    return;                    /* abort the message queue thread immediately */
    764836  }
    765  
    766  
     837
     838
    767839  while( WinGetMsg(ConsoleGlobals.hab,                       /* message loop */
    768840                   &ConsoleGlobals.qmsg,
    769841                   NULLHANDLE,
    770842                   0,
    771                    0) ) 
     843                   0) )
    772844    WinDispatchMsg(ConsoleGlobals.hab,               /* dispatch the message */
    773845                   &ConsoleGlobals.qmsg);
    774  
     846
    775847                                    /* do the cleanup, destroy window, queue */
    776848                                    /* and stop thread from using PM         */
    777   WinDestroyWindow  (ConsoleGlobals.hwndFrame);   
    778   WinDestroyMsgQueue(ConsoleGlobals.hmq);         
     849  WinDestroyWindow  (ConsoleGlobals.hwndFrame);
     850  WinDestroyMsgQueue(ConsoleGlobals.hmq);
    779851  WinTerminate      (ConsoleGlobals.hab);
    780  
     852
    781853                   /* destruction of semaphore indicates console is shutdown */
    782854  DosCloseEventSem(ConsoleInput.hevInputQueue);     /* close other semaphore */
    783   DosCloseEventSem(ConsoleGlobals.hevConsole); 
     855  DosCloseEventSem(ConsoleGlobals.hevConsole);
    784856  ConsoleGlobals.hevConsole  = NULLHANDLE;          /* for ConsoleIsActive() */
    785857  ConsoleInput.hevInputQueue = NULLHANDLE;
    786  
     858
    787859  /* @@@PH we've got to exit the process here ! */
    788860  ExitProcess(1);
     
    799871 * Variables :
    800872 * Result    : MRESULT for PM
    801  * Remark    : 
    802  * Status    : 
     873 * Remark    :
     874 * Status    :
    803875 *
    804876 * Author    : Patrick Haller [Tue, 1998/02/10 03:24]
     
    813885  static HPS   hps;
    814886
    815   switch(msg) 
     887  switch(msg)
    816888  {
    817889    /*************************************************************************
    818890     * WM_CREATE window creation                                             *
    819891     *************************************************************************/
    820    
     892
    821893    case WM_CREATE:
    822894      WinPostMsg(hwnd,                            /* deferred initialization */
     
    825897                 (MPARAM)NULL);
    826898      break;
    827    
    828    
     899
     900
    829901    case UM_CONSOLE_CREATE:
    830902    {
     
    835907      hwndFrame = ConsoleGlobals.hwndFrame;
    836908      ConsoleGlobals.pfnwpFrameOriginal = WinSubclassWindow(hwndFrame,
    837                                                             ConsoleFrameWindowProc);     
     909                                                            ConsoleFrameWindowProc);
    838910
    839911      ConsoleGlobals.hwndMenuConsole
     
    850922                 (MPARAM)ConsoleGlobals.hPtrConsole,
    851923                 0L );
    852      
     924
    853925               /* determine handles of the horizontal / vertical scroll bars */
    854926      ConsoleGlobals.hwndVertScroll = WinWindowFromID(ConsoleGlobals.hwndFrame,
    855927                                                      FID_VERTSCROLL);
    856      
     928
    857929      ConsoleGlobals.hwndHorzScroll = WinWindowFromID(ConsoleGlobals.hwndFrame,
    858930                                                      FID_HORZSCROLL);
    859      
     931
    860932                            /* the initial state of the controls is DETACHED */
    861933      WinSetParent(ConsoleGlobals.hwndHorzScroll,          /* detach control */
    862934                   HWND_OBJECT,
    863935                   FALSE);
    864      
     936
    865937      WinSetParent(ConsoleGlobals.hwndVertScroll,          /* detach control */
    866938                   HWND_OBJECT,
    867                    FALSE);   
    868      
    869      
     939                   FALSE);
     940
     941
    870942                                           /* create AVIO presentation space */
    871943      rc = VioCreatePS(&ConsoleGlobals.hvpsConsole,
     
    878950        WriteLog("KERNEL32/CONSOLE:VioCreatePS=%u\n",
    879951                 rc);
    880      
     952
    881953 /* PH 1998/02/12 this seems to be an OS/2 PM bug:
    882954    when doing a WinOpenWindowDC here, PM hangs. Seems it never gets back into
    883955    the message loop. To investigate and report to IBM
    884956  */
    885  
     957
    886958                               /* get a device context for the client window */
    887959      ConsoleGlobals.hdcConsole = WinOpenWindowDC(hwnd);
     
    891963      if (rc != NO_ERROR)                                    /* check errors */
    892964        WriteLog("KERNEL32/CONSOLE:VioAssociate=%u\n",
    893                  rc);   
     965                 rc);
    894966
    895967      ConsoleFontQuery();                        /* query current cell sizes */
    896      
     968
    897969                                          /* adjust window size and position */
    898970      HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
     
    901973                      0,
    902974                      0,
    903                       0);     
    904      
     975                      0);
     976
    905977            /* @@@PH if console is maximized - now switched on per default ! */
    906       WinSetWindowPos (ConsoleGlobals.hwndFrame, 
     978      WinSetWindowPos (ConsoleGlobals.hwndFrame,
    907979                       HWND_DESKTOP,
    908980                       0,
     
    916988                         2 * WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER),
    917989                       SWP_SIZE);
    918      
     990
    919991                             /* do we have to set the window position also ? */
    920992      if (ConsoleGlobals.Options.fSetWindowPosition == TRUE)
    921         WinSetWindowPos (ConsoleGlobals.hwndFrame,   
     993        WinSetWindowPos (ConsoleGlobals.hwndFrame,
    922994                         HWND_DESKTOP,
    923995                         ConsoleGlobals.Options.coordDefaultPosition.X,
     
    926998                         0,
    927999                         SWP_MOVE);
    928      
     1000
    9291001                     /* start timer service for blitting and cursor blinking */
    9301002      ConsoleGlobals.idTimer = WinStartTimer (ConsoleGlobals.hab,
    931                                               hwnd,     
     1003                                              hwnd,
    9321004                                              CONSOLE_TIMER_ID,  /* timer id */
    9331005                                              ConsoleGlobals.ulTimerFrequency);
     
    9391011    }
    9401012    break;
    941    
    942    
     1013
     1014
    9431015    /*************************************************************************
    9441016     * WM_DESTROY window destruction                                         *
    9451017     *************************************************************************/
    946    
     1018
    9471019    case WM_DESTROY:
    9481020      WinStopTimer (ConsoleGlobals.hab,                      /* anchor block */
    9491021                    hwnd,
    9501022                    ConsoleGlobals.idTimer);                     /* timer ID */
    951    
     1023
    9521024      VioAssociate(NULL,
    9531025                   ConsoleGlobals.hvpsConsole); /* disassociates the AVIO PS */
    9541026      VioDestroyPS(ConsoleGlobals.hvpsConsole); /* destroys the AVIO PS      */
    955    
     1027
    9561028      WinDestroyWindow(ConsoleGlobals.hwndMenuConsole);
    9571029      WinDestroyPointer(ConsoleGlobals.hPtrConsole);
    9581030      break;
    959    
    960    
     1031
     1032
    9611033    /*************************************************************************
    9621034     * WM_TIMER display cursor and update AVIO PS if required                *
    9631035     *************************************************************************/
    964    
     1036
    9651037    case WM_TIMER:
    9661038                                       /* check if console has to be updated */
     
    9681040      {
    9691041        ConsoleGlobals.fUpdateRequired = FALSE;     /* as soon as possible ! */
    970        
     1042
    9711043                                /* as device to map itself to the VIO buffer */
    9721044        HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
     
    9761048                        0,
    9771049                        0);
    978        
     1050
    9791051        { /* DEBUG */
    9801052          APIRET rc;
     
    9841056                       0,
    9851057                       ConsoleGlobals.hvpsConsole);
    986        
     1058
    9871059          dprintf(("KERNEL32::Console::1 VioShowPS(%u,%u,%u)=%u\n",
    9881060                   ConsoleGlobals.coordWindowSize.Y,
     
    9911063                   rc));
    9921064        }
    993          
     1065
    9941066                                             /* cursor is overwritten here ! */
    9951067        HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
     
    9981070                        0,
    9991071                        0,
    1000                         0);     
     1072                        0);
    10011073      }
    10021074      else
     
    10171089      break;
    10181090
    1019    
     1091
    10201092    /*************************************************************************
    10211093     * WM_MINMAXFRAME handle window repaint in case of iconized window       *
    10221094     *************************************************************************/
    1023    
     1095
    10241096    case WM_MINMAXFRAME :
    10251097    {
    10261098      BOOL  fShow = ! (((PSWP) mp1)->fl & SWP_MINIMIZE);
    1027       HENUM henum; 
     1099      HENUM henum;
    10281100      HWND  hwndChild;
    10291101
     
    10381110    }
    10391111    break;
    1040    
    1041    
     1112
     1113
    10421114    /*************************************************************************
    10431115     * WM_PAINT repaint the window                                           *
     
    10551127                       0,
    10561128                       ConsoleGlobals.hvpsConsole);
    1057        
     1129
    10581130        dprintf(("KERNEL32::Console::2 VioShowPS(%u,%u,%u)=%u\n",
    10591131                 ConsoleGlobals.coordWindowSize.Y,
     
    10621134                 rc));
    10631135      }
    1064    
     1136
    10651137      WinEndPaint(hps);
    10661138      break;
    1067    
    1068    
     1139
     1140
    10691141    /*************************************************************************
    10701142     * WM_SIZE resize the window                                             *
     
    10781150                      0,
    10791151                      0,
    1080                       0);     
    1081      
     1152                      0);
     1153
    10821154      return WinDefAVioWindowProc(hwnd,
    10831155                                  (USHORT)msg,
     
    10851157                                  (ULONG)mp2);
    10861158    }
    1087    
    1088    
     1159
     1160
    10891161    /*************************************************************************
    10901162     * context menue                                                         *
     
    10981170                    SHORT2FROMMP(mp1),
    10991171                    CM_CONSOLE_PROPERTIES,                        /* item id */
    1100                     PU_HCONSTRAIN | 
     1172                    PU_HCONSTRAIN |
    11011173                    PU_VCONSTRAIN |
    11021174                    PU_KEYBOARD   |
     
    11061178    }
    11071179    return (MPARAM)FALSE;
    1108    
    1109    
     1180
     1181
    11101182    /*************************************************************************
    11111183     * WM_COMMAND command processing                                         *
     
    11171189        /* close console window, however we can't call ConsoleTerminate here!*/
    11181190        case CM_CONSOLE_EXIT:
    1119           WinPostMsg (ConsoleGlobals.hwndFrame,     
     1191          WinPostMsg (ConsoleGlobals.hwndFrame,
    11201192                      WM_CLOSE,
    11211193                      (MPARAM)NULL,
     
    11231195
    11241196          return (MPARAM)FALSE;
    1125        
    1126        
     1197
     1198
    11271199        case CM_CONSOLE_REPAINT:
    11281200          WinInvalidateRect(ConsoleGlobals.hwndClient,/* redraw frame window */
     
    11351207        {
    11361208          ULONG ulResult;                              /* response from user */
    1137          
     1209
    11381210          ConsoleGlobals.Options.hmodResources =       /* save module handle */
    11391211            ConsoleGlobals.hmodResource;
    1140          
     1212
    11411213          ulResult = WinDlgBox(HWND_DESKTOP,
    11421214                               ConsoleGlobals.hwndClient,
     
    11451217                               DLG_CONSOLE_PROPERTIES,
    11461218                               (PVOID)&ConsoleGlobals.Options);
    1147           /* @@@PH update settings if necessary */
    1148          
    11491219          return (MPARAM) FALSE;
    11501220        }
     
    11531223    break;
    11541224
    1155    
     1225
    11561226    /*************************************************************************
    11571227     * WM_CHAR keyboard char processing                                      *
    11581228     *************************************************************************/
    1159    
     1229
    11601230    case WM_CHAR:
    11611231      ConsoleInputEventPushKey(mp1,                 /* push event into queue */
    11621232                               mp2);
    11631233      break;                                  /* enable further processing ! */
    1164    
    1165    
     1234
     1235
    11661236    /*************************************************************************
    11671237     * WM_SETFOCUS focus changing processing                                 *
    11681238     *************************************************************************/
    1169    
     1239
    11701240    case WM_SETFOCUS:
    11711241      ConsoleInputEventPushFocus((BOOL)mp2);        /* push event into queue */
    11721242      break;                                  /* enable further processing ! */
    1173    
    1174    
     1243
     1244
    11751245    /*************************************************************************
    11761246     * WM_MOUSEMOVE mouse event processing                                   *
    11771247     *************************************************************************/
    1178    
     1248
    11791249    case WM_MOUSEMOVE:
    11801250    case WM_BUTTON1UP:
     
    11921262      break;                                  /* enable further processing ! */
    11931263  }
    1194  
     1264
    11951265  return WinDefWindowProc(hwnd,                     /* to default processing */
    11961266                          msg,
     
    12091279 * Variables :
    12101280 * Result    : MRESULT for PM
    1211  * Remark    : 
    1212  * Status    : 
     1281 * Remark    :
     1282 * Status    :
    12131283 *
    12141284 * Author    : Patrick Haller [Tue, 1998/02/10 03:24]
     
    12201290                                               MPARAM mp2)
    12211291{
    1222   switch(msg) 
     1292  switch(msg)
    12231293  {
    12241294    /*************************************************************************
    12251295     * WM_QUERYTRACKINFO handling                                            *
    12261296     *************************************************************************/
    1227     case WM_QUERYTRACKINFO: 
     1297    case WM_QUERYTRACKINFO:
    12281298    {
    12291299       MRESULT    mr;                                      /* message result */
     
    12341304                                              msg,
    12351305                                              mp1,
    1236                                               mp2);       
     1306                                              mp2);
    12371307
    12381308       pTrackInfo = (PTRACKINFO)mp2;                /* get track information */
     
    12621332 * Variables :
    12631333 * Result    : none
    1264  * Remark    : 
    1265  * Status    : 
     1334 * Remark    :
     1335 * Status    :
    12661336 *
    12671337 * Author    : Patrick Haller [Tue, 1998/02/17 12:57]
     
    12711341{
    12721342  ULONG ulLine;
    1273  
     1343
    12741344  ULONG ulSizeX;                               /* blitting length and height */
    12751345  ULONG ulSizeY;
    1276  
     1346
    12771347  ulSizeX = 2 * min(ConsoleGlobals.coordWindowSize.X,
    12781348                    pConsoleBuffer->coordBufferSize.X -
    12791349                    ConsoleGlobals.coordWindowPos.X);
    1280  
     1350
    12811351  ulSizeY = min(ConsoleGlobals.coordWindowSize.Y,
    12821352                pConsoleBuffer->coordBufferSize.Y -
    12831353                ConsoleGlobals.coordWindowPos.Y);
    1284  
     1354
    12851355                      /* check if we're called with non-existing line buffer */
    12861356  if (pConsoleBuffer->ppszLine == NULL)
    12871357    return;
    1288  
     1358
    12891359  for (ulLine = ConsoleGlobals.coordWindowPos.Y;
    12901360       ulLine < ulSizeY;
    12911361       ulLine++)
    1292     VioWrtCellStr(pConsoleBuffer->ppszLine[ulLine] + 
     1362    VioWrtCellStr(pConsoleBuffer->ppszLine[ulLine] +
    12931363                    ConsoleGlobals.coordWindowPos.X,
    12941364                  ulSizeX,
     
    13051375 * Variables :
    13061376 * Result    : none
    1307  * Remark    : 
    1308  * Status    : 
     1377 * Remark    :
     1378 * Status    :
    13091379 *
    13101380 * Author    : Patrick Haller [Tue, 1998/02/17 12:57]
     
    13161386{
    13171387  ULONG  ulCounter;
    1318  
     1388
    13191389  for (ulCounter = 0;
    13201390       ulCounter < (ulSize >> 1);
     
    13221392       pusTarget+=2)
    13231393    *(PULONG)pusTarget = ulPattern;
    1324  
     1394
    13251395  if (ulSize & 0x00000001)
    13261396    *pusTarget = (USHORT)ulPattern;
     
    13361406 * Variables :
    13371407 * Result    : none
    1338  * Remark    : 
    1339  * Status    : 
     1408 * Remark    :
     1409 * Status    :
    13401410 *
    13411411 * Author    : Patrick Haller [Tue, 1998/02/17 12:57]
     
    13481418  ULONG ulPosition;
    13491419  ULONG ulScrollLine;
    1350  
     1420
    13511421  static ULONG ulUpdateCounter;                /* counter for jump-scrolling */
    1352  
     1422
    13531423                              /* calculate new line offset to the first line */
    13541424  pConsoleBuffer->ulScrollLineOffset += ulLines;
    13551425  pConsoleBuffer->ulScrollLineOffset %= pConsoleBuffer->coordBufferSize.Y;
    1356  
     1426
    13571427                                                   /* do we have to scroll ? */
    13581428  if (ulLines < pConsoleBuffer->coordBufferSize.Y)
     
    13621432         ulLine++)
    13631433    {
    1364       ulScrollLine = (ulLine + pConsoleBuffer->ulScrollLineOffset) 
     1434      ulScrollLine = (ulLine + pConsoleBuffer->ulScrollLineOffset)
    13651435                     % pConsoleBuffer->coordBufferSize.Y;
    1366      
     1436
    13671437      ulPosition = (ULONG)pConsoleBuffer->ppszLine
    13681438                   + (pConsoleBuffer->coordBufferSize.Y * sizeof (PSZ) )
    13691439                   + (pConsoleBuffer->coordBufferSize.X * 2 * ulScrollLine);
    1370      
     1440
    13711441      pConsoleBuffer->ppszLine[ulLine] = (PSZ)ulPosition;
    13721442    }
    13731443  }
    1374  
     1444
    13751445                                                  /* enforce the upper limit */
    13761446  if (ulLines > pConsoleBuffer->coordBufferSize.Y)
    13771447    ulLines = pConsoleBuffer->coordBufferSize.Y;
    1378  
     1448
    13791449  ulPosition = ( ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 8) +
    13801450                 ((ULONG)' ') +
    13811451                 ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 24) +
    13821452                 ((ULONG)' ' << 16) );
    1383  
     1453
    13841454                                                    /* scroll the line index */
    1385   for (ulLine = pConsoleBuffer->coordBufferSize.Y - ulLines; 
     1455  for (ulLine = pConsoleBuffer->coordBufferSize.Y - ulLines;
    13861456       ulLine < pConsoleBuffer->coordBufferSize.Y;
    13871457       ulLine++)
     
    13891459                          (PUSHORT)(pConsoleBuffer->ppszLine[ulLine]),
    13901460                          pConsoleBuffer->coordBufferSize.X);
    1391  
     1461
    13921462    /* this code ensures frequent screen updating, even if the timer prooves */
    13931463                                                            /* to be to slow */
     
    14131483 * Result    : API returncode
    14141484 * Remark    :
    1415  * Status    : 
     1485 * Status    :
    14161486 *
    14171487 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    14221492  PINPUT_RECORD pirFree;                           /* pointer to free record */
    14231493  APIRET        rc;                                        /* API-returncode */
    1424  
     1494
    14251495#ifdef DEBUG_LOCAL2
    14261496  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPush(%08x).\n",
     
    14311501  if (pirFree->EventType != 0x0000)
    14321502    return (ERROR_QUE_NO_MEMORY);                         /* queue is full ! */
    1433      
     1503
    14341504                                                       /* put event in queue */
    14351505  memcpy(pirFree,                                               /* copy data */
    14361506         pInputRecord,
    14371507         sizeof (INPUT_RECORD) );
    1438  
     1508
    14391509  ConsoleInput.ulIndexFree++;                        /* update index counter */
    14401510  if (ConsoleInput.ulIndexFree >= CONSOLE_INPUTQUEUESIZE)
    14411511    ConsoleInput.ulIndexFree = 0;
    1442  
     1512
    14431513  ConsoleInput.ulEvents++;                   /* increate queue event counter */
    1444  
     1514
    14451515                                                  /* unblock reading threads */
    14461516  rc = DosPostEventSem(ConsoleInput.hevInputQueue);
     
    14561526 * Result    : API returncode
    14571527 * Remark    :
    1458  * Status    : 
     1528 * Status    :
    14591529 *
    14601530 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    14651535  PINPUT_RECORD pirEvent;                         /* pointer to event record */
    14661536  APIRET        rc;                                        /* API-returncode */
    1467  
     1537
    14681538#ifdef DEBUG_LOCAL2
    14691539  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPop(%08x).\n",
    14701540           pInputRecord));
    14711541#endif
    1472  
     1542
    14731543  if (ConsoleInput.ulEvents == 0)                         /* empty console ? */
    14741544    return (ERROR_QUE_EMPTY);                            /* queue is empty ! */
    1475  
     1545
    14761546                                                          /* get first event */
    14771547  pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent];
    14781548  if (pirEvent->EventType == 0x0000)
    14791549    return (ERROR_QUE_EMPTY);                            /* queue is empty ! */
    1480      
     1550
    14811551                                                       /* put event in queue */
    14821552  memcpy(pInputRecord,                                          /* copy data */
    14831553         pirEvent,
    14841554         sizeof (INPUT_RECORD) );
    1485  
     1555
    14861556  pirEvent->EventType = 0x0000;                 /* mark event as read = free */
    1487  
     1557
    14881558  if (ConsoleInput.ulEvents >= 0)       /* decrease number of console events */
    14891559    ConsoleInput.ulEvents--;
    1490  
     1560
    14911561  ConsoleInput.ulIndexEvent++;                       /* update index counter */
    14921562  if (ConsoleInput.ulIndexEvent >= CONSOLE_INPUTQUEUESIZE)
    14931563    ConsoleInput.ulIndexEvent = 0;
    1494  
     1564
    14951565  return (NO_ERROR);                                                   /* OK */
    14961566}
     
    15051575 * Remark    : @@@PH: 2nd table that learns codes automatically from "down"
    15061576 *                    messages from PM. With Alt-a, etc. it is 0 for "up" ?
    1507  * Status    : 
     1577 * Status    :
    15081578 *
    15091579 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    16241694   /* VK_M_BUTTONRELEASE  0x006B */ 0,
    16251695   /* VK_M_DOUBLECLICK    0x006C */ 0,
    1626    
     1696
    16271697#if 0
    162816980xA4, /* WIN_VK_LMENU   ??? */
     
    16731743  USHORT       usVk       = ((ULONG)mp2 & 0xffff0000) >> 16;
    16741744  UCHAR        ucChar     = usCh & 0x00ff;
    1675  
     1745
    16761746#ifdef DEBUG_LOCAL2
    16771747  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushKey(%08x,%08x).\n",
     
    16801750#endif
    16811751
    1682  
     1752
    16831753  InputRecord.EventType = KEY_EVENT;                 /* fill event structure */
    16841754  InputRecord.Event.KeyEvent.dwControlKeyState = 0;
    1685  
     1755
    16861756  if (fsFlags & KC_SHIFT) InputRecord.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED;
    16871757  if (fsFlags & KC_ALT)   InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
    16881758  if (fsFlags & KC_CTRL)  InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
    1689  
    1690   /* @@@PH no support for RIGHT_ALT_PRESSED, 
     1759
     1760  /* @@@PH no support for RIGHT_ALT_PRESSED,
    16911761                          RIGHT_CTRL_PRESSED,
    1692                           NUMLOCK_ON, 
    1693                           SCROLLLOCK_ON, 
    1694                           CAPSLOCK_ON, 
    1695                           ENHANCED_KEY 
     1762                          NUMLOCK_ON,
     1763                          SCROLLLOCK_ON,
     1764                          CAPSLOCK_ON,
     1765                          ENHANCED_KEY
    16961766   */
    16971767
     
    17001770  InputRecord.Event.KeyEvent.wVirtualKeyCode  = usVk;
    17011771  InputRecord.Event.KeyEvent.wVirtualScanCode = ucScanCode;
    1702  
     1772
    17031773             /* check if ascii is valid, if so then wVirtualKeyCode = ascii, */
    17041774             /* else go through the table                                    */
     
    17121782      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF;
    17131783    else
    1714       InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;   
     1784      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;
    17151785  }
    17161786  else
     
    17211791          tabVirtualKeyCodes[usVk];                     /* translate keycode */
    17221792    }
    1723    
     1793
    17241794                /* this is a workaround for empty / invalid wVirtualKeyCodes */
    17251795  if (InputRecord.Event.KeyEvent.wVirtualKeyCode == 0x0000)
     
    17301800      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF;
    17311801    else
    1732       InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;   
    1733   }
    1734  
    1735    
     1802      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;
     1803  }
     1804
     1805
    17361806  /* @@@PH handle special keys */
    17371807  if ( (ucChar != 0xe0) && (ucChar != 0x00) )
     
    17431813    InputRecord.Event.KeyEvent.uChar.AsciiChar  = (ucChar >> 8);
    17441814  }
    1745  
     1815
    17461816              /* further processing according the current input console mode */
    17471817  if (ConsoleInput.dwConsoleMode & ENABLE_PROCESSED_INPUT)
     
    17491819    /* filter ctrl-c, etc. */
    17501820  }
    1751  
     1821
    17521822#if 0
    17531823  /* DEBUG */
     
    17621832           SHORT1FROMMP(mp2),
    17631833           SHORT2FROMMP(mp2)));
    1764  
     1834
    17651835  dprintf(("DEBUG: ascii=[%c] (%02x)",
    17661836           InputRecord.Event.KeyEvent.uChar.AsciiChar,
    17671837           InputRecord.Event.KeyEvent.uChar.AsciiChar));
    17681838#endif
    1769  
     1839
    17701840  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    17711841  return (rc);                                                         /* OK */
     
    17801850 * Result    : API returncode
    17811851 * Remark    :
    1782  * Status    : 
     1852 * Status    :
    17831853 *
    17841854 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    17931863  USHORT             fsFlags = SHORT2FROMMP(mp2);           /* get key flags */
    17941864  static USHORT      usButtonState;     /* keeps track of mouse button state */
    1795  
     1865
    17961866                                      /* do we have to process mouse input ? */
    17971867  if ( !(ConsoleInput.dwConsoleMode & ENABLE_MOUSE_INPUT))
    17981868    return (NO_ERROR);                                 /* return immediately */
    1799  
     1869
    18001870  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMouse(%08x,%08x,%08x).\n",
    18011871           ulMessage,
    18021872           mp1,
    18031873           mp2));
    1804  
     1874
    18051875  memset(&InputRecord,                                 /* zero the structure */
    18061876         0,
    18071877         sizeof (INPUT_RECORD) );
    1808  
     1878
    18091879  InputRecord.EventType = MOUSE_EVENT;               /* fill event structure */
    1810  
     1880
    18111881  switch (ulMessage)
    18121882  {
    1813     case WM_MOUSEMOVE: 
     1883    case WM_MOUSEMOVE:
    18141884      InputRecord.Event.MouseEvent.dwEventFlags      = MOUSE_MOVED;
    18151885      InputRecord.Event.MouseEvent.dwMousePosition.X = SHORT1FROMMP(mp1);
    18161886      InputRecord.Event.MouseEvent.dwMousePosition.Y = SHORT2FROMMP(mp1);
    1817      
     1887
    18181888      InputRecord.Event.MouseEvent.dwButtonState     = usButtonState;
    1819      
     1889
    18201890      if (fsFlags & KC_SHIFT) InputRecord.Event.MouseEvent.dwControlKeyState |= SHIFT_PRESSED;
    18211891      if (fsFlags & KC_ALT)   InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
    18221892      if (fsFlags & KC_CTRL)  InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
    1823      
    1824       /* @@@PH no support for RIGHT_ALT_PRESSED, 
     1893
     1894      /* @@@PH no support for RIGHT_ALT_PRESSED,
    18251895                              RIGHT_CTRL_PRESSED,
    1826                               NUMLOCK_ON, 
    1827                               SCROLLLOCK_ON, 
    1828                               CAPSLOCK_ON, 
    1829                               ENHANCED_KEY 
     1896                              NUMLOCK_ON,
     1897                              SCROLLLOCK_ON,
     1898                              CAPSLOCK_ON,
     1899                              ENHANCED_KEY
    18301900       */
    18311901      break;
    1832    
     1902
    18331903    case WM_BUTTON1UP:
    18341904      usButtonState            &= ~FROM_LEFT_1ST_BUTTON_PRESSED;
    18351905      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18361906      break;
    1837    
     1907
    18381908    case WM_BUTTON1DOWN:
    18391909      usButtonState            |=  FROM_LEFT_1ST_BUTTON_PRESSED;
    18401910      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18411911      break;
    1842  
     1912
    18431913    case WM_BUTTON2UP:
    18441914      usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED;
    18451915      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18461916      break;
    1847    
     1917
    18481918    case WM_BUTTON2DOWN:
    18491919      usButtonState |= FROM_LEFT_2ND_BUTTON_PRESSED;
    18501920      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18511921      break;
    1852    
     1922
    18531923    case WM_BUTTON3UP:
    18541924      usButtonState &= ~FROM_LEFT_3RD_BUTTON_PRESSED;
    18551925      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18561926      break;
    1857    
     1927
    18581928    case WM_BUTTON3DOWN:
    18591929      usButtonState |=  FROM_LEFT_3RD_BUTTON_PRESSED;
     
    18661936      usButtonState &= ~FROM_LEFT_1ST_BUTTON_PRESSED;
    18671937      break;
    1868  
     1938
    18691939    case WM_BUTTON2DBLCLK:
    18701940      InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK;
     
    18721942      usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED;
    18731943      break;
    1874      
     1944
    18751945    case WM_BUTTON3DBLCLK:
    18761946      InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK;
     
    18791949      break;
    18801950  }
    1881  
     1951
    18821952                        /* @@@PH pseudo-support for RIGHTMOST_BUTTON_PRESSED */
    18831953  if (InputRecord.Event.MouseEvent.dwButtonState & FROM_LEFT_3RD_BUTTON_PRESSED)
    18841954    InputRecord.Event.MouseEvent.dwButtonState |= RIGHTMOST_BUTTON_PRESSED;
    1885  
     1955
    18861956  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    18871957  return (rc);                                                         /* OK */
     
    18961966 * Result    : API returncode
    18971967 * Remark    :
    1898  * Status    : 
     1968 * Status    :
    18991969 *
    19001970 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    19091979  if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
    19101980    return (NO_ERROR);                                 /* return immediately */
    1911  
     1981
    19121982  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushWindow(x = %u, y = %u).\n",
    19131983           coordWindowSize.X,
    19141984           coordWindowSize.Y));
    1915  
     1985
    19161986  InputRecord.EventType = WINDOW_BUFFER_SIZE_EVENT;  /* fill event structure */
    1917  
     1987
    19181988  InputRecord.Event.WindowBufferSizeEvent.dwSize = coordWindowSize;
    1919  
     1989
    19201990  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    19211991  return (rc);                                                         /* OK */
     
    19302000 * Result    : API returncode
    19312001 * Remark    :
    1932  * Status    : 
     2002 * Status    :
    19332003 *
    19342004 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    19392009  INPUT_RECORD     InputRecord;                /* the input record structure */
    19402010  APIRET           rc;                                     /* API-returncode */
    1941  
     2011
    19422012  /* @@@PH this is unknown to me - there's no separate bit for menu events ? */
    19432013                                     /* do we have to process window input ? */
    19442014  if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
    19452015    return (NO_ERROR);                                 /* return immediately */
    1946  
     2016
    19472017  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMenu(%08x).\n",
    19482018           dwCommandId));
    1949  
     2019
    19502020  InputRecord.EventType = MENU_EVENT;                /* fill event structure */
    1951  
     2021
    19522022  InputRecord.Event.MenuEvent.dwCommandId = dwCommandId;
    1953  
     2023
    19542024  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    19552025  return (rc);                                                         /* OK */
     
    19642034 * Result    : API returncode
    19652035 * Remark    :
    1966  * Status    : 
     2036 * Status    :
    19672037 *
    19682038 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    19732043  INPUT_RECORD     InputRecord;                /* the input record structure */
    19742044  APIRET           rc;                                     /* API-returncode */
    1975  
     2045
    19762046  /* @@@PH this is unknown to me - there's no separate bit for menu events ? */
    19772047                                     /* do we have to process window input ? */
    19782048  if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
    19792049    return (NO_ERROR);                                 /* return immediately */
    1980  
     2050
    19812051  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushFocus(%08x).\n",
    19822052           bSetFocus));
    1983  
     2053
    19842054  InputRecord.EventType = FOCUS_EVENT;               /* fill event structure */
    1985  
     2055
    19862056  InputRecord.Event.FocusEvent.bSetFocus = bSetFocus;
    1987  
     2057
    19882058  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    19892059  return (rc);                                                         /* OK */
     
    19942064 * Name      : static ULONG ConsoleInputQueueEvents
    19952065 * Purpose   : query number of events in the queue
    1996  * Parameters: 
     2066 * Parameters:
    19972067 * Variables :
    19982068 * Result    : number of events
    19992069 * Remark    :
    2000  * Status    : 
     2070 * Status    :
    20012071 *
    20022072 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    20122082 * Name      : static void ConsoleCursorShow
    20132083 * Purpose   : query number of events in the queue
    2014  * Parameters: 
     2084 * Parameters:
    20152085 * Variables :
    20162086 * Result    : number of events
    20172087 * Remark    :
    2018  * Status    : 
     2088 * Status    :
    20192089 *
    20202090 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    20282098  static BOOL fState;                                /* current cursor state */
    20292099  RECTL rclWindow;                                    /* current window size */
    2030  
     2100
    20312101#ifdef DEBUG_LOCAL2
    20322102  dprintf(("KERNEL32:Console:ConsoleCursorShow(%u)\n",
    20332103           ulCursorMode));
    20342104#endif
    2035  
     2105
    20362106  if (pConsoleBuffer->CursorInfo.bVisible == FALSE)/* cursor is switched off */
    20372107    return;                                            /* return immediately */
    2038  
     2108
    20392109  switch (ulCursorMode)
    20402110  {
     
    20452115        fState = FALSE;       /* set to invisible and invert our cursor rect */
    20462116      break;
    2047    
     2117
    20482118    case CONSOLECURSOR_SHOW:
    20492119      if (fState == TRUE)                        /* cursor currently shown ? */
     
    20522122        fState = TRUE;          /* set to visible and invert our cursor rect */
    20532123      break;
    2054    
     2124
    20552125    case CONSOLECURSOR_BLINK:
    20562126      fState = !fState;      /* let there be on off on off on off on off ... */
    20572127      break;
    2058  
     2128
    20592129    case CONSOLECURSOR_OVERWRITTEN:       /* our cursor has been overwritten */
    20602130      fState = TRUE;                       /* so show the cursor immediately */
    20612131      break;
    20622132  }
    2063  
    2064  
     2133
     2134
    20652135                                              /* query current window's size */
    20662136  WinQueryWindowRect(ConsoleGlobals.hwndClient,
    20672137                     &rclWindow);
    2068  
     2138
    20692139                                      /* calculate coordinates of the cursor */
    20702140  rclCursor.xLeft   = ConsoleGlobals.sCellCX * pConsoleBuffer->coordCursorPosition.X;
     
    20762146                       pConsoleBuffer->CursorInfo.dwSize /
    20772147                       100);
    2078                        
     2148
    20792149  hps = WinGetPS(ConsoleGlobals.hwndClient);                      /* get HPS */
    2080  
     2150
    20812151  /* @@@PH invert coordinates here ... */
    20822152  WinInvertRect(hps,                  /* our cursor is an inverted rectangle */
    20832153                &rclCursor);
    2084  
     2154
    20852155  WinReleasePS(hps);                                /* release the hps again */
    20862156}
     
    20902160 * Name      : static APIRET ConsoleFontQuery
    20912161 * Purpose   : queries the current font cell sizes
    2092  * Parameters: 
     2162 * Parameters:
    20932163 * Variables :
    20942164 * Result    : API returncode
    20952165 * Remark    :
    2096  * Status    : 
     2166 * Status    :
    20972167 *
    20982168 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    21102180 * Name      : static void ConsoleCursorShow
    21112181 * Purpose   : query number of events in the queue
    2112  * Parameters: 
     2182 * Parameters:
    21132183 * Variables :
    21142184 * Result    : number of events
    21152185 * Remark    : called during INIT, FONTCHANGE, RESIZE, BUFFERCHANGE
    2116  * Status    : 
     2186 * Status    :
    21172187 *
    21182188 * Author    : Patrick Haller [Wed, 1998/04/29 16:55]
     
    21252195  PRECTL pRcl = &rcl;
    21262196  ULONG  flStyle;                              /* window frame control style */
    2127  
     2197
    21282198  BOOL fNeedVertScroll;                      /* indicates need of scrollbars */
    21292199  BOOL fNeedHorzScroll;
    2130  
     2200
    21312201  LONG lScrollX;                           /* width and height of scrollbars */
    21322202  LONG lScrollY;
    2133  
     2203
    21342204                                         /* now calculate actual window size */
    21352205  lX = ConsoleGlobals.sCellCX * ConsoleGlobals.coordWindowSize.X;
    21362206  lY = ConsoleGlobals.sCellCY * ConsoleGlobals.coordWindowSize.Y;
    2137  
     2207
    21382208  if ( (ConsoleGlobals.sCellCX == 0) ||          /* prevent division by zero */
    21392209       (ConsoleGlobals.sCellCY == 0) )
    2140     return;   
    2141  
     2210    return;
     2211
    21422212         /* calculate maximum console window size in pixels for the tracking */
    21432213  ConsoleGlobals.coordMaxWindowPels.X = ConsoleGlobals.sCellCX * pConsoleBuffer->coordWindowSize.X
    21442214                                        + WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) * 2;
    2145  
     2215
    21462216  ConsoleGlobals.coordMaxWindowPels.Y = ConsoleGlobals.sCellCY * pConsoleBuffer->coordWindowSize.Y
    21472217                                        + WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) * 2
    21482218                                        + WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
    2149  
     2219
    21502220  /***************************/
    21512221  /* @@@PH broken code below */
    21522222  /***************************/
    21532223  return;
    2154  
     2224
    21552225                             /* add the window border height and width, etc. */
    21562226  WinQueryWindowRect (ConsoleGlobals.hwndClient,
    21572227                      pRcl);
    2158  
     2228
    21592229                                                   /* calculate visible area */
    21602230   /* calculate real client window rectangle and take care of the scrollbars */
    21612231  lScrollX = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
    21622232  lScrollY = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
    2163   if (ConsoleGlobals.fHasHorzScroll) 
     2233  if (ConsoleGlobals.fHasHorzScroll)
    21642234  {
    21652235    lY += lScrollY;
    21662236    ConsoleGlobals.coordMaxWindowPels.Y += lScrollY;
    21672237  }
    2168  
    2169   if (ConsoleGlobals.fHasVertScroll) 
     2238
     2239  if (ConsoleGlobals.fHasVertScroll)
    21702240  {
    21712241    lX += lScrollX;
    21722242    ConsoleGlobals.coordMaxWindowPels.X += lScrollX;
    21732243  }
    2174  
     2244
    21752245  /* @@@PH might NOT exceed maximum VioPS size ! */
    2176   ConsoleGlobals.coordWindowSize.X = (pRcl->xRight - pRcl->xLeft)   
     2246  ConsoleGlobals.coordWindowSize.X = (pRcl->xRight - pRcl->xLeft)
    21772247                                     / ConsoleGlobals.sCellCX;
    2178  
    2179   ConsoleGlobals.coordWindowSize.Y = (pRcl->yTop   - pRcl->yBottom) 
     2248
     2249  ConsoleGlobals.coordWindowSize.Y = (pRcl->yTop   - pRcl->yBottom)
    21802250                                     / ConsoleGlobals.sCellCY;
    2181  
     2251
    21822252                                    /* do we have to enable the scrollbars ? */
    21832253  fNeedHorzScroll = lX < pConsoleBuffer->coordWindowSize.X * ConsoleGlobals.sCellCX;
    21842254  fNeedVertScroll = lY < pConsoleBuffer->coordWindowSize.Y * ConsoleGlobals.sCellCY;
    2185  
     2255
    21862256
    21872257  if ( (ConsoleGlobals.fHasVertScroll != fNeedVertScroll) ||
     
    21902260    flStyle = WinQueryWindowULong(ConsoleGlobals.hwndFrame,
    21912261                                  QWL_STYLE);
    2192  
     2262
    21932263                                           /* now set or remove the controls */
    21942264    if (ConsoleGlobals.fHasHorzScroll != fNeedHorzScroll)
     
    22082278        ConsoleGlobals.coordWindowPos.X = 0;    /* we can see the whole buffer */
    22092279      }
    2210  
     2280
    22112281    if (ConsoleGlobals.fHasVertScroll != fNeedVertScroll)
    22122282      if (fNeedVertScroll)
     
    22222292        WinSetParent(ConsoleGlobals.hwndVertScroll,        /* detach control */
    22232293                     HWND_OBJECT,
    2224                      FALSE);   
     2294                     FALSE);
    22252295        ConsoleGlobals.coordWindowPos.Y = 0;  /* we can see the whole buffer */
    22262296      }
    2227  
    2228  
     2297
     2298
    22292299    WinSendMsg(ConsoleGlobals.hwndFrame,                     /* update frame */
    22302300               WM_UPDATEFRAME,
    22312301               MPFROMLONG(flStyle),
    22322302               MPVOID);
    2233    
     2303
    22342304    WinInvalidateRect(ConsoleGlobals.hwndFrame,       /* redraw frame window */
    22352305                      NULL,
    22362306                      TRUE);
    2237    
     2307
    22382308    ConsoleGlobals.fHasVertScroll = fNeedVertScroll;       /* update globals */
    22392309    ConsoleGlobals.fHasHorzScroll = fNeedHorzScroll;       /* update globals */
    22402310  }
    2241    
    2242  
     2311
     2312
    22432313                                    /* setup the scrollbars and scrollranges */
    22442314  if (ConsoleGlobals.fHasVertScroll)
     
    22462316    /* setup vertical scrollbar */
    22472317  }
    2248  
    2249  
     2318
     2319
    22502320  if (ConsoleGlobals.fHasHorzScroll)
    22512321  {
    22522322    /* setup horizonal scrollbar */
    22532323  }
    2254    
    2255  
     2324
     2325
    22562326  WinCalcFrameRect(ConsoleGlobals.hwndFrame,    /* calculate frame rectangle */
    22572327                   pRcl,
    22582328                   FALSE);
    2259  
     2329
    22602330  /* @@@PH client may not overlap frame ! */
    22612331  /* @@@PH write values to TRACKINFO      */
    2262  
     2332
    22632333#if 0
    22642334  /* @@@PH this results in recursion */
     
    22702340                   lY,
    22712341                   SWP_SIZE);
    2272  
     2342
    22732343  WinSetWindowPos (ConsoleGlobals.hwndFrame,    /* adjust client window size */
    22742344                   HWND_DESKTOP,
     
    22832353
    22842354/*****************************************************************************
    2285  * Name      : BOOL WIN32API OS2AllocConsole
    2286  * Purpose   : The AllocConsole function allocates a new console 
     2355 * Name      : BOOL WIN32API AllocConsole
     2356 * Purpose   : The AllocConsole function allocates a new console
    22872357 *             for the calling process
    22882358 * Parameters: VOID
     
    22972367 *****************************************************************************/
    22982368
    2299 BOOL WIN32API OS2AllocConsole(VOID)
     2369BOOL WIN32API AllocConsole(VOID)
    23002370{
    23012371  APIRET rc;                                               /* API returncode */
    2302  
     2372
    23032373#ifdef DEBUG_LOCAL2
    23042374  WriteLog("KERNEL32/CONSOLE: OS2AllocConsole() called.\n");
    23052375#endif
    2306  
     2376
    23072377  rc = ConsoleInit();                    /* initialize subsystem if required */
    23082378  if (rc != NO_ERROR)                                    /* check for errors */
     
    23172387
    23182388/*****************************************************************************
    2319  * Name      : HANDLE WIN32API OS2CreateConsoleScreenBuffer
     2389 * Name      : HANDLE WIN32API CreateConsoleScreenBuffer
    23202390 * Purpose   : The CreateConsoleScreenBuffer function creates a console
    23212391 *             screen buffer and returns a handle of it.
     
    23262396 *             LPVOID lpScreenBufferData - reserved
    23272397 * Variables :
    2328  * Result    : 
     2398 * Result    :
    23292399 * Remark    : a console buffer is a kernel heap object equipped with
    23302400 *             share modes, access rights, etc.
     
    23322402 *             console device driver for it ... maybe this turns out to
    23332403 *             be necessary since we've got to handle CONIN$ and CONOUT$, too.
    2334  * Status    : 
     2404 * Status    :
    23352405 *
    23362406 * Author    : Patrick Haller [Tue, 1998/02/10 03:55]
    23372407 *****************************************************************************/
    23382408
    2339 HANDLE WIN32API OS2CreateConsoleScreenBuffer(DWORD  dwDesiredAccess,
     2409HANDLE WIN32API CreateConsoleScreenBuffer(DWORD  dwDesiredAccess,
    23402410                                             DWORD  dwShareMode,
    23412411                                             LPVOID lpSecurityAttributes,
     
    23442414{
    23452415  HANDLE hResult;
    2346  
     2416
    23472417#ifdef DEBUG_LOCAL2
    23482418  WriteLog("KERNEL32/CONSOLE:OS2CreateConsoleScreenBuffer(%08x,%08x,%08x,%08x,%08x).\n",
     
    23612431                         dwFlags,
    23622432                         INVALID_HANDLE_VALUE);
    2363  
     2433
    23642434  return hResult;
    23652435}
     
    23672437
    23682438/*****************************************************************************
    2369  * Name      : 
    2370  * Purpose   : 
    2371  * Parameters: 
    2372  * Variables :
    2373  * Result    : 
    2374  * Remark    :
    2375  * Status    : 
     2439 * Name      :
     2440 * Purpose   :
     2441 * Parameters:
     2442 * Variables :
     2443 * Result    :
     2444 * Remark    :
     2445 * Status    :
    23762446 *
    23772447 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    23782448 *****************************************************************************/
    23792449
    2380 BOOL WIN32API OS2FillConsoleOutputAttribute(HANDLE  hConsoleOutput,
     2450BOOL WIN32API FillConsoleOutputAttribute(HANDLE  hConsoleOutput,
    23812451                                            WORD    wAttribute,
    23822452                                            DWORD   nLength,
     
    23852455{
    23862456  BOOL fResult;
    2387  
     2457
    23882458#ifdef DEBUG_LOCAL2
    23892459  WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputAttribute(%08x,%04x,%08x,%08x,%08x).\n",
     
    23942464           lpNumberOfAttrsWritten);
    23952465#endif
    2396  
     2466
    23972467  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    23982468                                  DRQ_FILLCONSOLEOUTPUTATTRIBUTE,
     
    24002470                                  (ULONG)nLength,
    24012471                                  COORD2ULONG(dwWriteCoord),
    2402                                   (ULONG)lpNumberOfAttrsWritten); 
    2403  
     2472                                  (ULONG)lpNumberOfAttrsWritten);
     2473
    24042474  return fResult;
    24052475}
     
    24072477
    24082478/*****************************************************************************
    2409  * Name      : 
    2410  * Purpose   : 
    2411  * Parameters: 
    2412  * Variables :
    2413  * Result    : 
    2414  * Remark    :
    2415  * Status    : 
     2479 * Name      :
     2480 * Purpose   :
     2481 * Parameters:
     2482 * Variables :
     2483 * Result    :
     2484 * Remark    :
     2485 * Status    :
    24162486 *
    24172487 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    24182488 *****************************************************************************/
    24192489
    2420 BOOL WIN32API OS2FillConsoleOutputCharacterA(HANDLE  hConsoleOutput,
     2490BOOL WIN32API FillConsoleOutputCharacterA(HANDLE  hConsoleOutput,
    24212491                                             UCHAR   cCharacter,
    24222492                                             DWORD   nLength,
     
    24252495{
    24262496  BOOL fResult;
    2427  
     2497
    24282498#ifdef DEBUG_LOCAL2
    24292499  WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterA(%08x,%c,%08x,%08x,%08x).\n",
     
    24342504           lpNumberOfCharsWritten);
    24352505#endif
    2436  
     2506
    24372507  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    24382508                                  DRQ_FILLCONSOLEOUTPUTCHARACTERA,
     
    24402510                                  (ULONG)nLength,
    24412511                                  COORD2ULONG(dwWriteCoord),
    2442                                   (ULONG)lpNumberOfCharsWritten); 
    2443  
    2444   return fResult; 
    2445 }
    2446 
    2447 
    2448 /*****************************************************************************
    2449  * Name      : 
    2450  * Purpose   : 
    2451  * Parameters: 
    2452  * Variables :
    2453  * Result    : 
    2454  * Remark    :
    2455  * Status    : 
     2512                                  (ULONG)lpNumberOfCharsWritten);
     2513
     2514  return fResult;
     2515}
     2516
     2517
     2518/*****************************************************************************
     2519 * Name      :
     2520 * Purpose   :
     2521 * Parameters:
     2522 * Variables :
     2523 * Result    :
     2524 * Remark    :
     2525 * Status    :
    24562526 *
    24572527 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    24582528 *****************************************************************************/
    24592529
    2460 BOOL WIN32API OS2FillConsoleOutputCharacterW(HANDLE  hConsoleOutput,
     2530BOOL WIN32API FillConsoleOutputCharacterW(HANDLE  hConsoleOutput,
    24612531                                             WCHAR   cCharacter,
    24622532                                             DWORD   nLength,
     
    24652535{
    24662536  BOOL fResult;
    2467  
     2537
    24682538#ifdef DEBUG_LOCAL2
    24692539  WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterW(%08x,%c,%08x,%08x,%08x) .\n",
     
    24742544           lpNumberOfCharsWritten);
    24752545#endif
    2476  
     2546
    24772547  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    24782548                                  DRQ_FILLCONSOLEOUTPUTCHARACTERW,
     
    24872557
    24882558/*****************************************************************************
    2489  * Name      : 
    2490  * Purpose   : 
    2491  * Parameters: 
    2492  * Variables :
    2493  * Result    : 
    2494  * Remark    :
    2495  * Status    : 
     2559 * Name      :
     2560 * Purpose   :
     2561 * Parameters:
     2562 * Variables :
     2563 * Result    :
     2564 * Remark    :
     2565 * Status    :
    24962566 *
    24972567 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    24982568 *****************************************************************************/
    24992569
    2500 BOOL WIN32API OS2FlushConsoleInputBuffer( HANDLE hConsoleInput )
     2570BOOL WIN32API FlushConsoleInputBuffer( HANDLE hConsoleInput )
    25012571{
    25022572  BOOL fResult;
    2503  
     2573
    25042574#ifdef DEBUG_LOCAL2
    25052575  WriteLog("KERNEL32/CONSOLE: OS2FlushConsoleInputBuffer(%08x).\n",
    25062576           hConsoleInput);
    25072577#endif
    2508  
     2578
    25092579  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    25102580                                  DRQ_FLUSHCONSOLEINPUTBUFFER,
     
    25192589
    25202590/*****************************************************************************
    2521  * Name      : BOOL WIN32API OS2FreeConsole
     2591 * Name      : BOOL WIN32API FreeConsole
    25222592 * Purpose   : The FreeConsole function detaches the calling process
    25232593 *             from its console.
     
    25332603 *****************************************************************************/
    25342604
    2535 BOOL WIN32API OS2FreeConsole( VOID )
     2605BOOL WIN32API FreeConsole( VOID )
    25362606{
    25372607  APIRET rc;                                               /* API returncode */
    2538  
     2608
    25392609#ifdef DEBUG_LOCAL2
    25402610  WriteLog("KERNEL32/CONSOLE: OS2FreeConsole() called.\n");
    25412611#endif
    2542  
     2612
    25432613  rc = ConsoleTerminate();                /* terminate subsystem if required */
    25442614  if (rc != NO_ERROR)                                    /* check for errors */
     
    25492619  else
    25502620    return TRUE;                                                /* Fine ! :) */
    2551  
    2552   return TRUE; 
    2553 }
    2554 
    2555 
    2556 /*****************************************************************************
    2557  * Name      : 
    2558  * Purpose   : 
    2559  * Parameters: 
    2560  * Variables :
    2561  * Result    : 
    2562  * Remark    :
    2563  * Status    : 
     2621
     2622  return TRUE;
     2623}
     2624
     2625
     2626/*****************************************************************************
     2627 * Name      :
     2628 * Purpose   :
     2629 * Parameters:
     2630 * Variables :
     2631 * Result    :
     2632 * Remark    :
     2633 * Status    :
    25642634 *
    25652635 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    25662636 *****************************************************************************/
    25672637
    2568 BOOL WIN32API OS2GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
     2638BOOL WIN32API GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
    25692639                                          DWORD dwProcessGroupId)
    25702640{
     
    25742644           dwProcessGroupId);
    25752645#endif
    2576  
     2646
    25772647  return TRUE;
    25782648}
     
    25802650
    25812651/*****************************************************************************
    2582  * Name      : 
    2583  * Purpose   : 
    2584  * Parameters: 
    2585  * Variables :
    2586  * Result    : 
    2587  * Remark    :
    2588  * Status    : 
     2652 * Name      :
     2653 * Purpose   :
     2654 * Parameters:
     2655 * Variables :
     2656 * Result    :
     2657 * Remark    :
     2658 * Status    :
    25892659 *
    25902660 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    25912661 *****************************************************************************/
    25922662
    2593 UINT WIN32API OS2GetConsoleCP(VOID)
     2663UINT WIN32API GetConsoleCP(VOID)
    25942664{
    25952665#ifdef DEBUG_LOCAL2
    25962666  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCP not implemented.\n");
    25972667#endif
    2598  
     2668
    25992669  return 1;
    26002670}
     
    26022672
    26032673/*****************************************************************************
    2604  * Name      : 
    2605  * Purpose   : 
    2606  * Parameters: 
    2607  * Variables :
    2608  * Result    : 
    2609  * Remark    :
    2610  * Status    : 
     2674 * Name      :
     2675 * Purpose   :
     2676 * Parameters:
     2677 * Variables :
     2678 * Result    :
     2679 * Remark    :
     2680 * Status    :
    26112681 *
    26122682 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    26132683 *****************************************************************************/
    26142684
    2615 BOOL WIN32API OS2GetConsoleCursorInfo(HANDLE               hConsoleOutput,
     2685BOOL WIN32API GetConsoleCursorInfo(HANDLE               hConsoleOutput,
    26162686                                      PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
    26172687{
    26182688  BOOL fResult;
    2619  
     2689
    26202690#ifdef DEBUG_LOCAL2
    26212691  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCursorInfo(%08x,%08x).\n",
     
    26232693           lpConsoleCursorInfo);
    26242694#endif
    2625  
     2695
    26262696  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    26272697                                  DRQ_GETCONSOLECURSORINFO,
     
    26362706
    26372707/*****************************************************************************
    2638  * Name      : 
    2639  * Purpose   : 
    2640  * Parameters: 
    2641  * Variables :
    2642  * Result    : 
    2643  * Remark    :
    2644  * Status    : 
     2708 * Name      :
     2709 * Purpose   :
     2710 * Parameters:
     2711 * Variables :
     2712 * Result    :
     2713 * Remark    :
     2714 * Status    :
    26452715 *
    26462716 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    26472717 *****************************************************************************/
    26482718
    2649 BOOL WIN32API OS2GetConsoleMode(HANDLE  hConsole,
     2719BOOL WIN32API GetConsoleMode(HANDLE  hConsole,
    26502720                                LPDWORD lpMode)
    26512721{
    26522722  BOOL fResult;
    2653  
     2723
    26542724#ifdef DEBUG_LOCAL2
    26552725  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleMode(%08x,%08x).\n",
     
    26572727           lpMode);
    26582728#endif
    2659  
     2729
    26602730  fResult = (BOOL)HMDeviceRequest(hConsole,
    26612731                                  DRQ_GETCONSOLEMODE,
     
    26642734                                  0,
    26652735                                  0);
    2666  
     2736
    26672737  return fResult;
    26682738}
     
    26702740
    26712741/*****************************************************************************
    2672  * Name      : 
    2673  * Purpose   : 
    2674  * Parameters: 
    2675  * Variables :
    2676  * Result    : 
    2677  * Remark    :
    2678  * Status    : 
     2742 * Name      :
     2743 * Purpose   :
     2744 * Parameters:
     2745 * Variables :
     2746 * Result    :
     2747 * Remark    :
     2748 * Status    :
    26792749 *
    26802750 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    26812751 *****************************************************************************/
    26822752
    2683 UINT WIN32API OS2GetConsoleOutputCP(VOID)
     2753UINT WIN32API GetConsoleOutputCP(VOID)
    26842754{
    26852755#ifdef DEBUG_LOCAL2
    26862756  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleOutputCP not implemented.\n");
    26872757#endif
    2688  
     2758
    26892759  return 1;
    26902760}
     
    26922762
    26932763/*****************************************************************************
    2694  * Name      : 
    2695  * Purpose   : 
    2696  * Parameters: 
    2697  * Variables :
    2698  * Result    : 
    2699  * Remark    :
    2700  * Status    : 
     2764 * Name      :
     2765 * Purpose   :
     2766 * Parameters:
     2767 * Variables :
     2768 * Result    :
     2769 * Remark    :
     2770 * Status    :
    27012771 *
    27022772 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    27032773 *****************************************************************************/
    27042774
    2705 BOOL WIN32API OS2GetConsoleScreenBufferInfo(HANDLE                      hConsoleOutput,
     2775BOOL WIN32API GetConsoleScreenBufferInfo(HANDLE                      hConsoleOutput,
    27062776                                            PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
    27072777{
     
    27132783           lpConsoleScreenBufferInfo);
    27142784#endif
    2715  
     2785
    27162786  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    27172787                                  DRQ_GETCONSOLESCREENBUFFERINFO,
     
    27262796
    27272797/*****************************************************************************
    2728  * Name      : DWORD WIN32API OS2GetConsoleTitle
     2798 * Name      : DWORD WIN32API GetConsoleTitle
    27292799 * Purpose   : Query the current console window title
    27302800 * Parameters: LPTSTR lpConsoleTitle
     
    27382808 *****************************************************************************/
    27392809
    2740 DWORD WIN32API OS2GetConsoleTitleA(LPTSTR lpConsoleTitle,
     2810DWORD WIN32API GetConsoleTitleA(LPTSTR lpConsoleTitle,
    27412811                                   DWORD  nSize)
    27422812{
     
    27482818           nSize);
    27492819#endif
    2750  
     2820
    27512821  if (ConsoleGlobals.pszWindowTitle == NULL)    /* is there a window title ? */
    27522822    return 0;                                           /* abort immediately */
    2753  
     2823
    27542824  ulLength = strlen(ConsoleGlobals.pszWindowTitle);        /* length of text */
    2755  
     2825
    27562826  strncpy(lpConsoleTitle,
    27572827          ConsoleGlobals.pszWindowTitle,
    27582828          nSize);
    2759  
     2829
    27602830  return (nSize < ulLength) ? nSize : ulLength;
    27612831}
     
    27632833
    27642834/*****************************************************************************
    2765  * Name      : DWORD WIN32API OS2GetConsoleTitle
     2835 * Name      : DWORD WIN32API GetConsoleTitle
    27662836 * Purpose   : Query the current console window title
    27672837 * Parameters: LPTSTR lpConsoleTitle
     
    27752845 *****************************************************************************/
    27762846
    2777 DWORD WIN32API OS2GetConsoleTitleW(LPTSTR lpConsoleTitle,
     2847DWORD WIN32API GetConsoleTitleW(LPTSTR lpConsoleTitle,
    27782848                                   DWORD  nSize)
    27792849{
     
    27852855           nSize);
    27862856#endif
    2787  
     2857
    27882858  if (ConsoleGlobals.pszWindowTitle == NULL)    /* is there a window title ? */
    27892859    return 0;                                           /* abort immediately */
    2790  
     2860
    27912861  ulLength = strlen(ConsoleGlobals.pszWindowTitle);        /* length of text */
    2792  
     2862
    27932863  strncpy(lpConsoleTitle,
    27942864          ConsoleGlobals.pszWindowTitle,
    27952865          nSize);
    2796  
     2866
    27972867  /* @@@PH Ascii2Unicode */
    2798  
     2868
    27992869  return (nSize < ulLength) ? nSize : ulLength;
    28002870}
     
    28022872
    28032873/*****************************************************************************
    2804  * Name      : COORD WIN32API OS2GetLargestConsoleWindowSize
     2874 * Name      : COORD WIN32API GetLargestConsoleWindowSize
    28052875 * Purpose   : Determine maximum AVIO size
    2806  * Parameters: 
    2807  * Variables :
    2808  * Result    : 
    2809  * Remark    :
    2810  * Status    : 
     2876 * Parameters:
     2877 * Variables :
     2878 * Result    :
     2879 * Remark    :
     2880 * Status    :
    28112881 *
    28122882 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    28132883 *****************************************************************************/
    28142884
    2815 COORD WIN32API OS2GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
     2885COORD WIN32API GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
    28162886{
    28172887  DWORD dwResult;
    28182888  COORD coordResult;
    2819  
     2889
    28202890#ifdef DEBUG_LOCAL2
    28212891  WriteLog("KERNEL32/CONSOLE: OS2GetLargestConsoleWindowSize(%08x).\n",
    28222892           hConsoleOutput);
    28232893#endif
    2824  
     2894
    28252895  dwResult = HMDeviceRequest(hConsoleOutput,
    28262896                             DRQ_GETLARGESTCONSOLEWINDOWSIZE,
     
    28282898                             0,
    28292899                             0,
    2830                              0); 
    2831  
     2900                             0);
     2901
    28322902  ULONG2COORD(coordResult,dwResult)
    28332903  return ( coordResult );
     
    28362906
    28372907/*****************************************************************************
    2838  * Name      : 
    2839  * Purpose   : 
    2840  * Parameters: 
    2841  * Variables :
    2842  * Result    : 
    2843  * Remark    :
    2844  * Status    : 
     2908 * Name      :
     2909 * Purpose   :
     2910 * Parameters:
     2911 * Variables :
     2912 * Result    :
     2913 * Remark    :
     2914 * Status    :
    28452915 *
    28462916 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    28472917 *****************************************************************************/
    28482918
    2849 BOOL WIN32API OS2GetNumberOfConsoleInputEvents(HANDLE  hConsoleInput,
     2919BOOL WIN32API GetNumberOfConsoleInputEvents(HANDLE  hConsoleInput,
    28502920                                               LPDWORD lpNumberOfEvents)
    28512921{
     
    28572927           lpNumberOfEvents);
    28582928#endif
    2859  
     2929
    28602930  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    28612931                                  DRQ_GETNUMBEROFCONSOLEINPUTEVENTS,
     
    28642934                                  0,
    28652935                                  0);
    2866  
     2936
    28672937  return fResult;
    28682938}
     
    28702940
    28712941/*****************************************************************************
    2872  * Name      : 
    2873  * Purpose   : 
    2874  * Parameters: 
    2875  * Variables :
    2876  * Result    : 
    2877  * Remark    :
    2878  * Status    : 
     2942 * Name      :
     2943 * Purpose   :
     2944 * Parameters:
     2945 * Variables :
     2946 * Result    :
     2947 * Remark    :
     2948 * Status    :
    28792949 *
    28802950 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    28812951 *****************************************************************************/
    28822952
    2883 BOOL WIN32API OS2GetNumberOfConsoleMouseButtons(LPDWORD lpcNumberOfMouseButtons)
     2953BOOL WIN32API GetNumberOfConsoleMouseButtons(LPDWORD lpcNumberOfMouseButtons)
    28842954{
    28852955  LONG lMouseButtons;
    2886  
     2956
    28872957#ifdef DEBUG_LOCAL2
    28882958  WriteLog("KERNEL32/CONSOLE: OS2GetNumberOfConsoleMouseButtons(%08x).\n",
    28892959           lpcNumberOfMouseButtons);
    28902960#endif
    2891  
     2961
    28922962  lMouseButtons = WinQuerySysValue(HWND_DESKTOP,        /* query PM for that */
    28932963                                   SV_CMOUSEBUTTONS);
    2894  
     2964
    28952965  *lpcNumberOfMouseButtons = (DWORD)lMouseButtons;
    2896  
     2966
    28972967  return TRUE;
    28982968}
     
    29002970
    29012971/*****************************************************************************
    2902  * Name      : 
    2903  * Purpose   : 
    2904  * Parameters: 
    2905  * Variables :
    2906  * Result    : 
    2907  * Remark    :
    2908  * Status    : 
     2972 * Name      :
     2973 * Purpose   :
     2974 * Parameters:
     2975 * Variables :
     2976 * Result    :
     2977 * Remark    :
     2978 * Status    :
    29092979 *
    29102980 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    29112981 *****************************************************************************/
    29122982
    2913 BOOL WIN32API OS2PeekConsoleInputW(HANDLE        hConsoleInput,
     2983BOOL WIN32API PeekConsoleInputW(HANDLE        hConsoleInput,
    29142984                                   PINPUT_RECORD pirBuffer,
    29152985                                   DWORD         cInRecords,
     
    29252995           lpcRead);
    29262996#endif
    2927  
     2997
    29282998  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    29292999                                  DRQ_PEEKCONSOLEINPUTW,
     
    29323002                                  (ULONG)lpcRead,
    29333003                                  0);
    2934  
     3004
    29353005  return fResult;
    29363006}
     
    29383008
    29393009/*****************************************************************************
    2940  * Name      : 
    2941  * Purpose   : 
    2942  * Parameters: 
    2943  * Variables :
    2944  * Result    : 
    2945  * Remark    :
    2946  * Status    : 
     3010 * Name      :
     3011 * Purpose   :
     3012 * Parameters:
     3013 * Variables :
     3014 * Result    :
     3015 * Remark    :
     3016 * Status    :
    29473017 *
    29483018 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    29493019 *****************************************************************************/
    29503020
    2951 BOOL WIN32API OS2PeekConsoleInputA(HANDLE        hConsoleInput,
     3021BOOL WIN32API PeekConsoleInputA(HANDLE        hConsoleInput,
    29523022                                   PINPUT_RECORD pirBuffer,
    29533023                                   DWORD         cInRecords,
     
    29553025{
    29563026  BOOL fResult;
    2957  
     3027
    29583028#ifdef DEBUG_LOCAL2
    29593029  WriteLog("KERNEL32/CONSOLE: OS2PeekConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    29633033           lpcRead);
    29643034#endif
    2965  
     3035
    29663036  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    29673037                                  DRQ_PEEKCONSOLEINPUTA,
     
    29703040                                  (ULONG)lpcRead,
    29713041                                  0);
    2972  
    2973   return fResult; 
    2974 }
    2975 
    2976 
    2977 /*****************************************************************************
    2978  * Name      : 
    2979  * Purpose   : 
    2980  * Parameters: 
    2981  * Variables :
    2982  * Result    : 
    2983  * Remark    :
    2984  * Status    : 
     3042
     3043  return fResult;
     3044}
     3045
     3046
     3047/*****************************************************************************
     3048 * Name      :
     3049 * Purpose   :
     3050 * Parameters:
     3051 * Variables :
     3052 * Result    :
     3053 * Remark    :
     3054 * Status    :
    29853055 *
    29863056 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    29873057 *****************************************************************************/
    29883058
    2989 BOOL WIN32API OS2ReadConsoleA(HANDLE  hConsoleInput,
     3059BOOL WIN32API ReadConsoleA(HANDLE  hConsoleInput,
    29903060                              LPVOID  lpvBuffer,
    29913061                              DWORD   cchToRead,
     
    29943064{
    29953065  BOOL fResult;
    2996  
     3066
    29973067#ifdef DEBUG_LOCAL2
    29983068  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleA(%08x,%08x,%08x,%08x,%08x).\n",
     
    30033073           lpvReserved);
    30043074#endif
    3005  
     3075
    30063076  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    30073077                                  DRQ_READCONSOLEA,
     
    30103080                                  (ULONG)lpcchRead,
    30113081                                  (ULONG)lpvReserved);
    3012  
    3013   return fResult; 
    3014 }
    3015 
    3016 
    3017 /*****************************************************************************
    3018  * Name      : 
    3019  * Purpose   : 
    3020  * Parameters: 
    3021  * Variables :
    3022  * Result    : 
    3023  * Remark    :
    3024  * Status    : 
     3082
     3083  return fResult;
     3084}
     3085
     3086
     3087/*****************************************************************************
     3088 * Name      :
     3089 * Purpose   :
     3090 * Parameters:
     3091 * Variables :
     3092 * Result    :
     3093 * Remark    :
     3094 * Status    :
    30253095 *
    30263096 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    30273097 *****************************************************************************/
    30283098
    3029 BOOL WIN32API OS2ReadConsoleW(HANDLE  hConsoleInput,
     3099BOOL WIN32API ReadConsoleW(HANDLE  hConsoleInput,
    30303100                              LPVOID  lpvBuffer,
    30313101                              DWORD   cchToRead,
     
    30343104{
    30353105  BOOL fResult;
    3036  
     3106
    30373107#ifdef DEBUG_LOCAL2
    30383108  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleW(%08x,%08x,%08x,%08x,%08x).\n",
     
    30433113           lpvReserved);
    30443114#endif
    3045  
     3115
    30463116  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    30473117                                  DRQ_READCONSOLEW,
     
    30503120                                  (ULONG)lpcchRead,
    30513121                                  (ULONG)lpvReserved);
    3052  
    3053   return fResult; 
    3054 }
    3055 
    3056 
    3057 /*****************************************************************************
    3058  * Name      : 
    3059  * Purpose   : 
    3060  * Parameters: 
    3061  * Variables :
    3062  * Result    : 
    3063  * Remark    :
    3064  * Status    : 
     3122
     3123  return fResult;
     3124}
     3125
     3126
     3127/*****************************************************************************
     3128 * Name      :
     3129 * Purpose   :
     3130 * Parameters:
     3131 * Variables :
     3132 * Result    :
     3133 * Remark    :
     3134 * Status    :
    30653135 *
    30663136 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    30673137 *****************************************************************************/
    30683138
    3069 BOOL WIN32API OS2ReadConsoleInputA(HANDLE        hConsoleInput,
     3139BOOL WIN32API ReadConsoleInputA(HANDLE        hConsoleInput,
    30703140                                   PINPUT_RECORD pirBuffer,
    30713141                                   DWORD         cInRecords,
     
    30733143{
    30743144  BOOL fResult;
    3075  
     3145
    30763146#ifdef DEBUG_LOCAL2
    30773147  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    30813151           lpcRead);
    30823152#endif
    3083  
     3153
    30843154  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    30853155                                  DRQ_READCONSOLEINPUTA,
     
    30883158                                  (ULONG)lpcRead,
    30893159                                  0);
    3090  
    3091   return fResult; 
    3092 }
    3093 
    3094 
    3095 /*****************************************************************************
    3096  * Name      : 
    3097  * Purpose   : 
    3098  * Parameters: 
    3099  * Variables :
    3100  * Result    : 
    3101  * Remark    :
    3102  * Status    : 
     3160
     3161  return fResult;
     3162}
     3163
     3164
     3165/*****************************************************************************
     3166 * Name      :
     3167 * Purpose   :
     3168 * Parameters:
     3169 * Variables :
     3170 * Result    :
     3171 * Remark    :
     3172 * Status    :
    31033173 *
    31043174 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    31053175 *****************************************************************************/
    31063176
    3107 BOOL WIN32API OS2ReadConsoleInputW(HANDLE        hConsoleInput,
     3177BOOL WIN32API ReadConsoleInputW(HANDLE        hConsoleInput,
    31083178                                   PINPUT_RECORD pirBuffer,
    31093179                                   DWORD         cInRecords,
     
    31113181{
    31123182  BOOL fResult;
    3113  
     3183
    31143184#ifdef DEBUG_LOCAL2
    31153185  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    31193189           lpcRead);
    31203190#endif
    3121  
     3191
    31223192  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    31233193                                  DRQ_READCONSOLEINPUTW,
     
    31263196                                  (ULONG)lpcRead,
    31273197                                  0);
    3128  
    3129   return fResult; 
    3130 }
    3131 
    3132 
    3133 /*****************************************************************************
    3134  * Name      : 
    3135  * Purpose   : 
    3136  * Parameters: 
    3137  * Variables :
    3138  * Result    : 
    3139  * Remark    :
    3140  * Status    : 
     3198
     3199  return fResult;
     3200}
     3201
     3202
     3203/*****************************************************************************
     3204 * Name      :
     3205 * Purpose   :
     3206 * Parameters:
     3207 * Variables :
     3208 * Result    :
     3209 * Remark    :
     3210 * Status    :
    31413211 *
    31423212 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    31433213 *****************************************************************************/
    31443214
    3145 BOOL WIN32API OS2ReadConsoleOutputA(HANDLE      hConsoleOutput,
     3215BOOL WIN32API ReadConsoleOutputA(HANDLE      hConsoleOutput,
    31463216                                    PCHAR_INFO  pchiDestBuffer,
    31473217                                    COORD       coordDestBufferSize,
     
    31503220{
    31513221  BOOL fResult;
    3152  
     3222
    31533223#ifdef DEBUG_LOCAL2
    31543224  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n",
     
    31593229           psrctSourceRect);
    31603230#endif
    3161  
     3231
    31623232  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    31633233                                  DRQ_READCONSOLEOUTPUTA,
     
    31663236                                  COORD2ULONG(coordDestBufferCoord),
    31673237                                  (ULONG)psrctSourceRect);
    3168  
    3169   return fResult; 
    3170 }
    3171 
    3172 
    3173 /*****************************************************************************
    3174  * Name      : 
    3175  * Purpose   : 
    3176  * Parameters: 
    3177  * Variables :
    3178  * Result    : 
    3179  * Remark    :
    3180  * Status    : 
     3238
     3239  return fResult;
     3240}
     3241
     3242
     3243/*****************************************************************************
     3244 * Name      :
     3245 * Purpose   :
     3246 * Parameters:
     3247 * Variables :
     3248 * Result    :
     3249 * Remark    :
     3250 * Status    :
    31813251 *
    31823252 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    31833253 *****************************************************************************/
    31843254
    3185 BOOL WIN32API OS2ReadConsoleOutputW(HANDLE      hConsoleOutput,
     3255BOOL WIN32API ReadConsoleOutputW(HANDLE      hConsoleOutput,
    31863256                                    PCHAR_INFO  pchiDestBuffer,
    31873257                                    COORD       coordDestBufferSize,
     
    31903260{
    31913261  BOOL fResult;
    3192  
     3262
    31933263#ifdef DEBUG_LOCAL2
    31943264  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n",
     
    31993269           psrctSourceRect);
    32003270#endif
    3201  
     3271
    32023272  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    32033273                                  DRQ_READCONSOLEOUTPUTW,
     
    32063276                                  COORD2ULONG(coordDestBufferCoord),
    32073277                                  (ULONG)psrctSourceRect);
    3208  
    3209   return fResult; 
    3210 }
    3211 
    3212 
    3213 /*****************************************************************************
    3214  * Name      : 
    3215  * Purpose   : 
    3216  * Parameters: 
    3217  * Variables :
    3218  * Result    : 
    3219  * Remark    :
    3220  * Status    : 
     3278
     3279  return fResult;
     3280}
     3281
     3282
     3283/*****************************************************************************
     3284 * Name      :
     3285 * Purpose   :
     3286 * Parameters:
     3287 * Variables :
     3288 * Result    :
     3289 * Remark    :
     3290 * Status    :
    32213291 *
    32223292 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    32233293 *****************************************************************************/
    32243294
    3225 BOOL WIN32API OS2ReadConsoleOutputAttribute(HANDLE  hConsoleOutput,
     3295BOOL WIN32API ReadConsoleOutputAttribute(HANDLE  hConsoleOutput,
    32263296                                            LPWORD  lpwAttribute,
    32273297                                            DWORD   cReadCells,
     
    32303300{
    32313301  BOOL fResult;
    3232  
     3302
    32333303#ifdef DEBUG_LOCAL2
    32343304  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n",
     
    32393309           lpcNumberRead);
    32403310#endif
    3241  
     3311
    32423312  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    32433313                                  DRQ_READCONSOLEOUTPUTATTRIBUTE,
     
    32463316                                  COORD2ULONG(coordReadCoord),
    32473317                                  (ULONG)lpcNumberRead);
    3248  
    3249   return fResult; 
    3250 }
    3251 
    3252 
    3253 /*****************************************************************************
    3254  * Name      : 
    3255  * Purpose   : 
    3256  * Parameters: 
    3257  * Variables :
    3258  * Result    : 
    3259  * Remark    :
    3260  * Status    : 
     3318
     3319  return fResult;
     3320}
     3321
     3322
     3323/*****************************************************************************
     3324 * Name      :
     3325 * Purpose   :
     3326 * Parameters:
     3327 * Variables :
     3328 * Result    :
     3329 * Remark    :
     3330 * Status    :
    32613331 *
    32623332 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    32633333 *****************************************************************************/
    32643334
    3265 BOOL WIN32API OS2ReadConsoleOutputCharacterA(HANDLE  hConsoleOutput,
     3335BOOL WIN32API ReadConsoleOutputCharacterA(HANDLE  hConsoleOutput,
    32663336                                             LPTSTR  lpReadBuffer,
    32673337                                             DWORD   cchRead,
     
    32703340{
    32713341  BOOL fResult;
    3272  
     3342
    32733343#ifdef DEBUG_LOCAL2
    32743344  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n",
     
    32793349           lpcNumberRead);
    32803350#endif
    3281  
     3351
    32823352  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    32833353                                  DRQ_READCONSOLEOUTPUTCHARACTERA,
     
    32863356                                  COORD2ULONG(coordReadCoord),
    32873357                                  (ULONG)lpcNumberRead);
    3288  
    3289   return fResult; 
    3290 }
    3291 
    3292 
    3293 /*****************************************************************************
    3294  * Name      : 
    3295  * Purpose   : 
    3296  * Parameters: 
    3297  * Variables :
    3298  * Result    : 
    3299  * Remark    :
    3300  * Status    : 
     3358
     3359  return fResult;
     3360}
     3361
     3362
     3363/*****************************************************************************
     3364 * Name      :
     3365 * Purpose   :
     3366 * Parameters:
     3367 * Variables :
     3368 * Result    :
     3369 * Remark    :
     3370 * Status    :
    33013371 *
    33023372 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    33033373 *****************************************************************************/
    33043374
    3305 BOOL WIN32API OS2ReadConsoleOutputCharacterW(HANDLE  hConsoleOutput,
     3375BOOL WIN32API ReadConsoleOutputCharacterW(HANDLE  hConsoleOutput,
    33063376                                             LPTSTR  lpReadBuffer,
    33073377                                             DWORD   cchRead,
     
    33103380{
    33113381  BOOL fResult;
    3312  
     3382
    33133383#ifdef DEBUG_LOCAL2
    33143384  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n",
     
    33193389           lpcNumberRead);
    33203390#endif
    3321  
     3391
    33223392  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    33233393                                  DRQ_READCONSOLEOUTPUTCHARACTERW,
     
    33263396                                  COORD2ULONG(coordReadCoord),
    33273397                                  (ULONG)lpcNumberRead);
    3328  
    3329   return fResult; 
    3330 }
    3331 
    3332 
    3333 /*****************************************************************************
    3334  * Name      : 
    3335  * Purpose   : 
    3336  * Parameters: 
    3337  * Variables :
    3338  * Result    : 
    3339  * Remark    :
    3340  * Status    : 
     3398
     3399  return fResult;
     3400}
     3401
     3402
     3403/*****************************************************************************
     3404 * Name      :
     3405 * Purpose   :
     3406 * Parameters:
     3407 * Variables :
     3408 * Result    :
     3409 * Remark    :
     3410 * Status    :
    33413411 *
    33423412 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    33433413 *****************************************************************************/
    33443414
    3345 BOOL WIN32API OS2ScrollConsoleScreenBufferA(HANDLE      hConsoleOutput,
     3415BOOL WIN32API ScrollConsoleScreenBufferA(HANDLE      hConsoleOutput,
    33463416                                            PSMALL_RECT psrctSourceRect,
    33473417                                            PSMALL_RECT psrctClipRect,
     
    33503420{
    33513421  BOOL fResult;
    3352  
     3422
    33533423#ifdef DEBUG_LOCAL2
    33543424  WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferA(%08x,%08x,%08x,%08x,%08x).\n",
     
    33593429           pchiFill);
    33603430#endif
    3361  
     3431
    33623432  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    33633433                                  DRQ_SCROLLCONSOLESCREENBUFFERA,
     
    33663436                                  COORD2ULONG(coordDestOrigin),
    33673437                                  (ULONG)pchiFill);
    3368  
    3369   return fResult; 
    3370 }
    3371 
    3372 
    3373 /*****************************************************************************
    3374  * Name      : 
    3375  * Purpose   : 
    3376  * Parameters: 
    3377  * Variables :
    3378  * Result    : 
    3379  * Remark    :
    3380  * Status    : 
     3438
     3439  return fResult;
     3440}
     3441
     3442
     3443/*****************************************************************************
     3444 * Name      :
     3445 * Purpose   :
     3446 * Parameters:
     3447 * Variables :
     3448 * Result    :
     3449 * Remark    :
     3450 * Status    :
    33813451 *
    33823452 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    33833453 *****************************************************************************/
    33843454
    3385 BOOL WIN32API OS2ScrollConsoleScreenBufferW(HANDLE      hConsoleOutput,
     3455BOOL WIN32API ScrollConsoleScreenBufferW(HANDLE      hConsoleOutput,
    33863456                                            PSMALL_RECT psrctSourceRect,
    33873457                                            PSMALL_RECT psrctClipRect,
     
    33903460{
    33913461  BOOL fResult;
    3392  
     3462
    33933463#ifdef DEBUG_LOCAL2
    33943464  WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferW(%08x,%08x,%08x,%08x,%08x).\n",
     
    33993469           pchiFill);
    34003470#endif
    3401  
     3471
    34023472  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    34033473                                  DRQ_SCROLLCONSOLESCREENBUFFERW,
     
    34063476                                  COORD2ULONG(coordDestOrigin),
    34073477                                  (ULONG)pchiFill);
    3408  
    3409   return fResult; 
    3410 }
    3411 
    3412 /*****************************************************************************
    3413  * Name      : 
    3414  * Purpose   : 
    3415  * Parameters: 
    3416  * Variables :
    3417  * Result    : 
    3418  * Remark    :
    3419  * Status    : 
     3478
     3479  return fResult;
     3480}
     3481
     3482/*****************************************************************************
     3483 * Name      :
     3484 * Purpose   :
     3485 * Parameters:
     3486 * Variables :
     3487 * Result    :
     3488 * Remark    :
     3489 * Status    :
    34203490 *
    34213491 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    34223492 *****************************************************************************/
    34233493
    3424 BOOL WIN32API OS2SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
     3494BOOL WIN32API SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
    34253495{
    34263496  BOOL fResult;
    3427  
     3497
    34283498#ifdef DEBUG_LOCAL2
    34293499  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleActiveScreenBuffer(%08x).\n",
    34303500           hConsoleOutput);
    34313501#endif
    3432  
     3502
    34333503  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    34343504                                  DRQ_SETCONSOLEACTIVESCREENBUFFER,
     
    34373507                                  0,
    34383508                                  0);
    3439  
    3440   return fResult; 
    3441 }
    3442 
    3443 
    3444 /*****************************************************************************
    3445  * Name      : 
    3446  * Purpose   : 
    3447  * Parameters: 
    3448  * Variables :
    3449  * Result    : 
    3450  * Remark    :
    3451  * Status    : 
     3509
     3510  return fResult;
     3511}
     3512
     3513
     3514/*****************************************************************************
     3515 * Name      :
     3516 * Purpose   :
     3517 * Parameters:
     3518 * Variables :
     3519 * Result    :
     3520 * Remark    :
     3521 * Status    :
    34523522 *
    34533523 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    34543524 *****************************************************************************/
    34553525
    3456 BOOL WIN32API OS2SetConsoleCP(UINT IDCodePage)
     3526BOOL WIN32API SetConsoleCP(UINT IDCodePage)
    34573527{
    34583528#ifdef DEBUG_LOCAL2
     
    34603530           IDCodePage);
    34613531#endif
    3462  
     3532
    34633533  return TRUE;
    34643534}
     
    34663536
    34673537/*****************************************************************************
    3468  * Name      : 
    3469  * Purpose   : 
    3470  * Parameters: 
    3471  * Variables :
    3472  * Result    : 
    3473  * Remark    :
    3474  * Status    : 
     3538 * Name      :
     3539 * Purpose   :
     3540 * Parameters:
     3541 * Variables :
     3542 * Result    :
     3543 * Remark    :
     3544 * Status    :
    34753545 *
    34763546 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    34773547 *****************************************************************************/
    34783548
    3479 BOOL WIN32API OS2SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine,
     3549BOOL WIN32API SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine,
    34803550                                       BOOL             fAdd)
    34813551{
     
    34853555           fAdd);
    34863556#endif
    3487  
     3557
    34883558  return TRUE;
    34893559}
     
    34913561
    34923562/*****************************************************************************
    3493  * Name      : 
    3494  * Purpose   : 
    3495  * Parameters: 
    3496  * Variables :
    3497  * Result    : 
    3498  * Remark    :
    3499  * Status    : 
     3563 * Name      :
     3564 * Purpose   :
     3565 * Parameters:
     3566 * Variables :
     3567 * Result    :
     3568 * Remark    :
     3569 * Status    :
    35003570 *
    35013571 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    35023572 *****************************************************************************/
    35033573
    3504 BOOL WIN32API OS2SetConsoleCursorInfo(HANDLE               hConsoleOutput,
     3574BOOL WIN32API SetConsoleCursorInfo(HANDLE               hConsoleOutput,
    35053575                                      PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
    35063576{
    35073577  BOOL fResult;
    3508  
     3578
    35093579#ifdef DEBUG_LOCAL2
    35103580  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorInfo(%08x,%08x).\n",
     
    35123582           lpConsoleCursorInfo);
    35133583#endif
    3514  
     3584
    35153585  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    35163586                                  DRQ_SETCONSOLECURSORINFO,
     
    35193589                                  0,
    35203590                                  0);
    3521  
    3522   return fResult; 
    3523 }
    3524 
    3525 
    3526 /*****************************************************************************
    3527  * Name      : 
    3528  * Purpose   : 
    3529  * Parameters: 
    3530  * Variables :
    3531  * Result    : 
    3532  * Remark    :
    3533  * Status    : 
     3591
     3592  return fResult;
     3593}
     3594
     3595
     3596/*****************************************************************************
     3597 * Name      :
     3598 * Purpose   :
     3599 * Parameters:
     3600 * Variables :
     3601 * Result    :
     3602 * Remark    :
     3603 * Status    :
    35343604 *
    35353605 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    35373607 *****************************************************************************/
    35383608
    3539 BOOL WIN32API OS2SetConsoleCursorPosition(HANDLE hConsoleOutput,
     3609BOOL WIN32API SetConsoleCursorPosition(HANDLE hConsoleOutput,
    35403610                                          COORD  coordCursor)
    35413611{
    35423612  BOOL fResult;
    3543  
     3613
    35443614#ifdef DEBUG_LOCAL2
    35453615  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorPosition(%08x,%08x).\n",
     
    35473617           coordCursor);
    35483618#endif
    3549  
     3619
    35503620  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    35513621                                  DRQ_SETCONSOLECURSORPOSITION,
     
    35543624                                  0,
    35553625                                  0);
    3556  
    3557   return fResult; 
    3558 }
    3559 
    3560 
    3561 /*****************************************************************************
    3562  * Name      : 
    3563  * Purpose   : 
    3564  * Parameters: 
    3565  * Variables :
    3566  * Result    : 
    3567  * Remark    :
    3568  * Status    : 
     3626
     3627  return fResult;
     3628}
     3629
     3630
     3631/*****************************************************************************
     3632 * Name      :
     3633 * Purpose   :
     3634 * Parameters:
     3635 * Variables :
     3636 * Result    :
     3637 * Remark    :
     3638 * Status    :
    35693639 *
    35703640 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    35713641 *****************************************************************************/
    35723642
    3573 BOOL WIN32API OS2SetConsoleMode(HANDLE hConsole,
     3643BOOL WIN32API SetConsoleMode(HANDLE hConsole,
    35743644                                DWORD  fdwMode)
    35753645{
    35763646 BOOL fResult;
    3577  
     3647
    35783648#ifdef DEBUG_LOCAL2
    35793649  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleMode(%08x,%08x).\n",
     
    35813651           fdwMode);
    35823652#endif
    3583  
     3653
    35843654  fResult = (BOOL)HMDeviceRequest(hConsole,
    35853655                                  DRQ_SETCONSOLEMODE,
     
    35883658                                  0,
    35893659                                  0);
    3590  
     3660
    35913661  return fResult;
    35923662}
     
    35943664
    35953665/*****************************************************************************
    3596  * Name      : 
    3597  * Purpose   : 
    3598  * Parameters: 
    3599  * Variables :
    3600  * Result    : 
    3601  * Remark    :
    3602  * Status    : 
     3666 * Name      :
     3667 * Purpose   :
     3668 * Parameters:
     3669 * Variables :
     3670 * Result    :
     3671 * Remark    :
     3672 * Status    :
    36033673 *
    36043674 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    36053675 *****************************************************************************/
    36063676
    3607 BOOL WIN32API OS2SetConsoleOutputCP(UINT IDCodePage)
     3677BOOL WIN32API SetConsoleOutputCP(UINT IDCodePage)
    36083678{
    36093679#ifdef DEBUG_LOCAL2
     
    36113681           IDCodePage);
    36123682#endif
    3613  
     3683
    36143684  return TRUE;
    36153685}
     
    36173687
    36183688/*****************************************************************************
    3619  * Name      : 
    3620  * Purpose   : 
    3621  * Parameters: 
    3622  * Variables :
    3623  * Result    : 
    3624  * Remark    :
    3625  * Status    : 
     3689 * Name      :
     3690 * Purpose   :
     3691 * Parameters:
     3692 * Variables :
     3693 * Result    :
     3694 * Remark    :
     3695 * Status    :
    36263696 *
    36273697 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    36283698 *****************************************************************************/
    36293699
    3630 BOOL WIN32API OS2SetConsoleScreenBufferSize(HANDLE hConsoleOutput,
     3700BOOL WIN32API SetConsoleScreenBufferSize(HANDLE hConsoleOutput,
    36313701                                            COORD  coordSize)
    36323702{
    36333703  BOOL fResult;
    3634  
     3704
    36353705#ifdef DEBUG_LOCAL2
    36363706  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleScreenBufferSize(%08x,%08x).\n",
     
    36383708           coordSize);
    36393709#endif
    3640  
     3710
    36413711  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    36423712                                  DRQ_SETCONSOLESCREENBUFFERSIZE,
     
    36453715                                  0,
    36463716                                  0);
    3647  
    3648   return fResult; 
    3649 }
    3650 
    3651 
    3652 /*****************************************************************************
    3653  * Name      : 
    3654  * Purpose   : 
    3655  * Parameters: 
    3656  * Variables :
    3657  * Result    : 
    3658  * Remark    :
    3659  * Status    : 
     3717
     3718  return fResult;
     3719}
     3720
     3721
     3722/*****************************************************************************
     3723 * Name      :
     3724 * Purpose   :
     3725 * Parameters:
     3726 * Variables :
     3727 * Result    :
     3728 * Remark    :
     3729 * Status    :
    36603730 *
    36613731 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    36623732 *****************************************************************************/
    36633733
    3664 BOOL WIN32API OS2SetConsoleTextAttribute(HANDLE hConsoleOutput,
     3734BOOL WIN32API SetConsoleTextAttribute(HANDLE hConsoleOutput,
    36653735                                         WORD   wAttr)
    36663736{
    36673737  BOOL fResult;
    3668  
     3738
    36693739#ifdef DEBUG_LOCAL2
    36703740  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleTextAttribute(%08x,%04x).\n",
     
    36723742           wAttr);
    36733743#endif
    3674  
     3744
    36753745  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    36763746                                  DRQ_SETCONSOLETEXTATTRIBUTE,
     
    36793749                                  0,
    36803750                                  0);
    3681  
    3682   return fResult; 
    3683 }
    3684 
    3685 
    3686 /*****************************************************************************
    3687  * Name      : BOOL WIN32API OS2SetConsoleTitleA
     3751
     3752  return fResult;
     3753}
     3754
     3755
     3756/*****************************************************************************
     3757 * Name      : BOOL WIN32API SetConsoleTitleA
    36883758 * Purpose   : Set new title text for the console window
    36893759 * Parameters: LPTSTR lpszTitle
    36903760 * Variables :
    3691  * Result    : 
     3761 * Result    :
    36923762 * Remark    :
    36933763 * Status    : REWRITTEN UNTESTED
     
    36963766 *****************************************************************************/
    36973767
    3698 BOOL WIN32API OS2SetConsoleTitleA(LPTSTR lpszTitle)
     3768BOOL WIN32API SetConsoleTitleA(LPTSTR lpszTitle)
    36993769{
    37003770#ifdef DEBUG_LOCAL2
     
    37023772           lpszTitle);
    37033773#endif
    3704  
     3774
    37053775  if (ConsoleGlobals.pszWindowTitle != NULL)           /* previously set name */
    37063776    free (ConsoleGlobals.pszWindowTitle);                     /* then free it */
    3707  
     3777
    37083778  ConsoleGlobals.pszWindowTitle = strdup(lpszTitle);     /* copy the new name */
    3709  
     3779
    37103780  WinSetWindowText(ConsoleGlobals.hwndFrame,           /* set new title text */
    37113781                   ConsoleGlobals.pszWindowTitle);
    3712  
     3782
    37133783  return TRUE;
    37143784}
     
    37163786
    37173787/*****************************************************************************
    3718  * Name      : BOOL WIN32API OS2SetConsoleTitleW
     3788 * Name      : BOOL WIN32API SetConsoleTitleW
    37193789 * Purpose   : Set new title text for the console window
    37203790 * Parameters: LPTSTR lpszTitle
    37213791 * Variables :
    3722  * Result    : 
     3792 * Result    :
    37233793 * Remark    :
    37243794 * Status    : REWRITTEN UNTESTED
     
    37273797 *****************************************************************************/
    37283798
    3729 BOOL WIN32API OS2SetConsoleTitleW(LPTSTR lpszTitle)
     3799BOOL WIN32API SetConsoleTitleW(LPTSTR lpszTitle)
    37303800{
    37313801#ifdef DEBUG_LOCAL2
     
    37333803           lpszTitle);
    37343804#endif
    3735  
     3805
    37363806  /* @@@PH Unicode2Ascii */
    3737  
     3807
    37383808  if (ConsoleGlobals.pszWindowTitle != NULL)           /* previously set name */
    37393809    free (ConsoleGlobals.pszWindowTitle);                     /* then free it */
    3740  
     3810
    37413811  ConsoleGlobals.pszWindowTitle = strdup(lpszTitle);     /* copy the new name */
    3742  
     3812
    37433813  WinSetWindowText(ConsoleGlobals.hwndFrame,           /* set new title text */
    37443814                   ConsoleGlobals.pszWindowTitle);
    3745  
     3815
    37463816  return TRUE;
    37473817}
     
    37493819
    37503820/*****************************************************************************
    3751  * Name      : 
    3752  * Purpose   : 
    3753  * Parameters: 
    3754  * Variables :
    3755  * Result    : 
    3756  * Remark    :
    3757  * Status    : 
     3821 * Name      :
     3822 * Purpose   :
     3823 * Parameters:
     3824 * Variables :
     3825 * Result    :
     3826 * Remark    :
     3827 * Status    :
    37583828 *
    37593829 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    37603830 *****************************************************************************/
    37613831
    3762 BOOL WIN32API OS2SetConsoleWindowInfo(HANDLE      hConsoleOutput,
     3832BOOL WIN32API SetConsoleWindowInfo(HANDLE      hConsoleOutput,
    37633833                                      BOOL        fAbsolute,
    37643834                                      PSMALL_RECT psrctWindowRect)
    37653835{
    37663836  BOOL fResult;
    3767  
     3837
    37683838#ifdef DEBUG_LOCAL2
    37693839  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleWindowInfo(%08x,%08x,%08x).\n",
     
    37723842           psrctWindowRect);
    37733843#endif
    3774  
     3844
    37753845  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    37763846                                  DRQ_SETCONSOLEWINDOWINFO,
     
    37793849                                  0,
    37803850                                  0);
    3781  
    3782   return fResult; 
    3783 }
    3784 
    3785 
    3786 /*****************************************************************************
    3787  * Name      : 
    3788  * Purpose   : 
    3789  * Parameters: 
    3790  * Variables :
    3791  * Result    : 
    3792  * Remark    :
    3793  * Status    : 
     3851
     3852  return fResult;
     3853}
     3854
     3855
     3856/*****************************************************************************
     3857 * Name      :
     3858 * Purpose   :
     3859 * Parameters:
     3860 * Variables :
     3861 * Result    :
     3862 * Remark    :
     3863 * Status    :
    37943864 *
    37953865 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    37963866 *****************************************************************************/
    37973867
    3798 BOOL WIN32API OS2WriteConsoleA(HANDLE      hConsoleOutput,
     3868BOOL WIN32API WriteConsoleA(HANDLE      hConsoleOutput,
    37993869                               CONST VOID* lpvBuffer,
    38003870                               DWORD       cchToWrite,
     
    38033873{
    38043874  BOOL fResult;
    3805  
     3875
    38063876#ifdef DEBUG_LOCAL2
    38073877  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleA(%08x,%08x,%08x,%08x,%08x).\n",
     
    38123882           lpvReserved);
    38133883#endif
    3814  
     3884
    38153885  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    38163886                                  DRQ_WRITECONSOLEA,
     
    38193889                                  (ULONG)lpcchWritten,
    38203890                                  (ULONG)lpvReserved);
    3821  
    3822   return fResult; 
    3823 }
    3824 
    3825 
    3826 /*****************************************************************************
    3827  * Name      : 
    3828  * Purpose   : 
    3829  * Parameters: 
    3830  * Variables :
    3831  * Result    : 
    3832  * Remark    :
    3833  * Status    : 
     3891
     3892  return fResult;
     3893}
     3894
     3895
     3896/*****************************************************************************
     3897 * Name      :
     3898 * Purpose   :
     3899 * Parameters:
     3900 * Variables :
     3901 * Result    :
     3902 * Remark    :
     3903 * Status    :
    38343904 *
    38353905 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    38363906 *****************************************************************************/
    38373907
    3838 BOOL WIN32API OS2WriteConsoleW(HANDLE      hConsoleOutput,
     3908BOOL WIN32API WriteConsoleW(HANDLE      hConsoleOutput,
    38393909                               CONST VOID* lpvBuffer,
    38403910                               DWORD       cchToWrite,
     
    38433913{
    38443914  BOOL fResult;
    3845  
     3915
    38463916#ifdef DEBUG_LOCAL2
    38473917  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleW(%08x,%08x,%08x,%08x,%08x).\n",
     
    38523922           lpvReserved);
    38533923#endif
    3854  
     3924
    38553925  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    38563926                                  DRQ_WRITECONSOLEW,
     
    38593929                                  (ULONG)lpcchWritten,
    38603930                                  (ULONG)lpvReserved);
    3861  
    3862   return fResult; 
    3863 }
    3864 
    3865 
    3866 /*****************************************************************************
    3867  * Name      : 
    3868  * Purpose   : 
    3869  * Parameters: 
    3870  * Variables :
    3871  * Result    : 
    3872  * Remark    :
    3873  * Status    : 
     3931
     3932  return fResult;
     3933}
     3934
     3935
     3936/*****************************************************************************
     3937 * Name      :
     3938 * Purpose   :
     3939 * Parameters:
     3940 * Variables :
     3941 * Result    :
     3942 * Remark    :
     3943 * Status    :
    38743944 *
    38753945 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    38763946 *****************************************************************************/
    38773947
    3878 BOOL WIN32API OS2WriteConsoleInputA(HANDLE        hConsoleInput,
     3948BOOL WIN32API WriteConsoleInputA(HANDLE        hConsoleInput,
    38793949                                    PINPUT_RECORD pirBuffer,
    38803950                                    DWORD         cInRecords,
     
    38823952{
    38833953  BOOL fResult;
    3884  
     3954
    38853955#ifdef DEBUG_LOCAL2
    38863956  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    38903960           lpcWritten);
    38913961#endif
    3892  
     3962
    38933963  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    38943964                                  DRQ_WRITECONSOLEINPUTA,
     
    38973967                                  (ULONG)lpcWritten,
    38983968                                  0);
    3899  
    3900   return fResult; 
    3901 }
    3902 
    3903 
    3904 /*****************************************************************************
    3905  * Name      : 
    3906  * Purpose   : 
    3907  * Parameters: 
    3908  * Variables :
    3909  * Result    : 
    3910  * Remark    :
    3911  * Status    : 
     3969
     3970  return fResult;
     3971}
     3972
     3973
     3974/*****************************************************************************
     3975 * Name      :
     3976 * Purpose   :
     3977 * Parameters:
     3978 * Variables :
     3979 * Result    :
     3980 * Remark    :
     3981 * Status    :
    39123982 *
    39133983 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    39143984 *****************************************************************************/
    39153985
    3916 BOOL WIN32API OS2WriteConsoleInputW(HANDLE        hConsoleInput,
     3986BOOL WIN32API WriteConsoleInputW(HANDLE        hConsoleInput,
    39173987                                    PINPUT_RECORD pirBuffer,
    39183988                                    DWORD         cInRecords,
     
    39203990{
    39213991  BOOL fResult;
    3922  
     3992
    39233993#ifdef DEBUG_LOCAL2
    39243994  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    39283998           lpcWritten);
    39293999#endif
    3930  
     4000
    39314001  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    39324002                                  DRQ_WRITECONSOLEINPUTW,
     
    39354005                                  (ULONG)lpcWritten,
    39364006                                  0);
    3937  
    3938   return fResult; 
    3939 }
    3940 
    3941 
    3942 /*****************************************************************************
    3943  * Name      : 
    3944  * Purpose   : 
    3945  * Parameters: 
    3946  * Variables :
    3947  * Result    : 
    3948  * Remark    :
    3949  * Status    : 
     4007
     4008  return fResult;
     4009}
     4010
     4011
     4012/*****************************************************************************
     4013 * Name      :
     4014 * Purpose   :
     4015 * Parameters:
     4016 * Variables :
     4017 * Result    :
     4018 * Remark    :
     4019 * Status    :
    39504020 *
    39514021 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    39524022 *****************************************************************************/
    39534023
    3954 BOOL WIN32API OS2WriteConsoleOutputA(HANDLE      hConsoleOutput,
     4024BOOL WIN32API WriteConsoleOutputA(HANDLE      hConsoleOutput,
    39554025                                     PCHAR_INFO  pchiSrcBuffer,
    39564026                                     COORD       coordSrcBufferSize,
     
    39594029{
    39604030  BOOL fResult;
    3961  
     4031
    39624032#ifdef DEBUG_LOCAL2
    39634033  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n",
     
    39684038           psrctDestRect);
    39694039#endif
    3970  
     4040
    39714041  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    39724042                                  DRQ_WRITECONSOLEOUTPUTA,
     
    39754045                                  COORD2ULONG(coordSrcBufferCoord),
    39764046                                  (ULONG)psrctDestRect);
    3977  
    3978   return fResult; 
    3979 }
    3980 
    3981 
    3982 /*****************************************************************************
    3983  * Name      : 
    3984  * Purpose   : 
    3985  * Parameters: 
    3986  * Variables :
    3987  * Result    : 
    3988  * Remark    :
    3989  * Status    : 
     4047
     4048  return fResult;
     4049}
     4050
     4051
     4052/*****************************************************************************
     4053 * Name      :
     4054 * Purpose   :
     4055 * Parameters:
     4056 * Variables :
     4057 * Result    :
     4058 * Remark    :
     4059 * Status    :
    39904060 *
    39914061 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    39924062 *****************************************************************************/
    39934063
    3994 BOOL WIN32API OS2WriteConsoleOutputW(HANDLE      hConsoleOutput,
     4064BOOL WIN32API WriteConsoleOutputW(HANDLE      hConsoleOutput,
    39954065                                     PCHAR_INFO  pchiSrcBuffer,
    39964066                                     COORD       coordSrcBufferSize,
     
    39994069{
    40004070  BOOL fResult;
    4001  
     4071
    40024072#ifdef DEBUG_LOCAL2
    40034073  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n",
     
    40084078           psrctDestRect);
    40094079#endif
    4010  
     4080
    40114081  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    40124082                                  DRQ_WRITECONSOLEOUTPUTW,
     
    40154085                                  COORD2ULONG(coordSrcBufferCoord),
    40164086                                  (ULONG)psrctDestRect);
    4017  
    4018   return fResult; 
    4019 }
    4020 
    4021 /*****************************************************************************
    4022  * Name      : 
    4023  * Purpose   : 
    4024  * Parameters: 
    4025  * Variables :
    4026  * Result    : 
    4027  * Remark    :
    4028  * Status    : 
     4087
     4088  return fResult;
     4089}
     4090
     4091/*****************************************************************************
     4092 * Name      :
     4093 * Purpose   :
     4094 * Parameters:
     4095 * Variables :
     4096 * Result    :
     4097 * Remark    :
     4098 * Status    :
    40294099 *
    40304100 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    40314101 *****************************************************************************/
    40324102
    4033 BOOL WIN32API OS2WriteConsoleOutputAttribute(HANDLE  hConsoleOutput,
     4103BOOL WIN32API WriteConsoleOutputAttribute(HANDLE  hConsoleOutput,
    40344104                                             LPWORD  lpwAttribute,
    40354105                                             DWORD   cWriteCells,
     
    40384108{
    40394109  BOOL fResult;
    4040  
     4110
    40414111#ifdef DEBUG_LOCAL2
    40424112  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n",
     
    40474117           lpcNumberWritten);
    40484118#endif
    4049  
     4119
    40504120  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    40514121                                  DRQ_WRITECONSOLEOUTPUTATTRIBUTE,
     
    40544124                                  COORD2ULONG(coordWriteCoord),
    40554125                                  (ULONG)lpcNumberWritten);
    4056  
    4057   return fResult; 
    4058 }
    4059 
    4060 
    4061 /*****************************************************************************
    4062  * Name      : 
    4063  * Purpose   : 
    4064  * Parameters: 
    4065  * Variables :
    4066  * Result    : 
    4067  * Remark    :
    4068  * Status    : 
     4126
     4127  return fResult;
     4128}
     4129
     4130
     4131/*****************************************************************************
     4132 * Name      :
     4133 * Purpose   :
     4134 * Parameters:
     4135 * Variables :
     4136 * Result    :
     4137 * Remark    :
     4138 * Status    :
    40694139 *
    40704140 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    40714141 *****************************************************************************/
    40724142
    4073 BOOL WIN32API OS2WriteConsoleOutputCharacterA(HANDLE  hConsoleOutput,
     4143BOOL WIN32API WriteConsoleOutputCharacterA(HANDLE  hConsoleOutput,
    40744144                                              LPTSTR  lpWriteBuffer,
    40754145                                              DWORD   cchWrite,
     
    40784148{
    40794149  BOOL fResult;
    4080  
     4150
    40814151#ifdef DEBUG_LOCAL2
    40824152  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n",
     
    40874157           lpcWritten);
    40884158#endif
    4089  
     4159
    40904160  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    40914161                                  DRQ_WRITECONSOLEOUTPUTCHARACTERA,
     
    40944164                                  COORD2ULONG(coordWriteCoord),
    40954165                                  (ULONG)lpcWritten);
    4096  
    4097   return fResult; 
    4098 }
    4099 
    4100 
    4101 /*****************************************************************************
    4102  * Name      : 
    4103  * Purpose   : 
    4104  * Parameters: 
    4105  * Variables :
    4106  * Result    : 
    4107  * Remark    :
    4108  * Status    : 
     4166
     4167  return fResult;
     4168}
     4169
     4170
     4171/*****************************************************************************
     4172 * Name      :
     4173 * Purpose   :
     4174 * Parameters:
     4175 * Variables :
     4176 * Result    :
     4177 * Remark    :
     4178 * Status    :
    41094179 *
    41104180 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    41114181 *****************************************************************************/
    41124182
    4113 BOOL WIN32API OS2WriteConsoleOutputCharacterW(HANDLE  hConsoleOutput,
     4183BOOL WIN32API WriteConsoleOutputCharacterW(HANDLE  hConsoleOutput,
    41144184                                              LPTSTR  lpWriteBuffer,
    41154185                                              DWORD   cchWrite,
     
    41184188{
    41194189  BOOL fResult;
    4120  
     4190
    41214191#ifdef DEBUG_LOCAL2
    41224192  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n",
     
    41274197           lpcWritten);
    41284198#endif
    4129  
     4199
    41304200  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    41314201                                  DRQ_WRITECONSOLEOUTPUTCHARACTERW,
     
    41344204                                  COORD2ULONG(coordWriteCoord),
    41354205                                  (ULONG)lpcWritten);
    4136  
    4137   return fResult; 
     4206
     4207  return fResult;
    41384208}
    41394209
     
    41484218 *             PHMHANDLEDATA pHMHandleDataTemplate data of the template handle
    41494219 * Variables :
    4150  * Result    : 
     4220 * Result    :
    41514221 * Remark    : @@@PH CONIN$ handles should be exclusive
    41524222 *                   reject other requests to this device
     
    41704240           pHMHandleDataTemplate);
    41714241#endif
    4172  
     4242
    41734243  pHMHandleData->dwType = FILE_TYPE_CHAR;        /* we're a character device */
    4174  
     4244
    41754245  return(NO_ERROR);
    41764246}
     
    41784248
    41794249/*****************************************************************************
    4180  * Name      : 
    4181  * Purpose   : 
    4182  * Parameters: 
    4183  * Variables :
    4184  * Result    : 
    4185  * Remark    : 
    4186  * Status    : 
     4250 * Name      :
     4251 * Purpose   :
     4252 * Parameters:
     4253 * Variables :
     4254 * Result    :
     4255 * Remark    :
     4256 * Status    :
    41874257 *
    41884258 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    42004270  INPUT_RECORD InputRecord;               /* buffer for the event to be read */
    42014271  ULONG  ulPostCounter;                            /* semaphore post counter */
    4202  
     4272
    42034273#ifdef DEBUG_LOCAL
    42044274  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    42104280           lpOverlapped);
    42114281#endif
    4212  
     4282
    42134283  ulCounter = 0;                              /* read ascii chars from queue */
    42144284  pszTarget = (PSZ)lpBuffer;
    4215  
     4285
    42164286  /* @@@PH: ConsoleMode: ENABLE_LINE_INPUT - blocks until CR is read */
    4217  
     4287
    42184288                                  /* block if no key events are in the queue */
    42194289  for (;ulCounter==0;)                       /* until we got some characters */
     
    42264296                       &ulPostCounter);            /* post counter - ignored */
    42274297    }
    4228    
     4298
    42294299    do
    42304300    {
     
    42374307          pszTarget++;
    42384308          ulCounter++;
    4239          
     4309
    42404310                                                     /* local echo enabled ? */
    42414311          if (ConsoleInput.dwConsoleMode & ENABLE_ECHO_INPUT)
     
    42454315                        &ulPostCounter,                      /* dummy result */
    42464316                        NULL);
    4247          
     4317
    42484318          if (ulCounter >= nNumberOfBytesToRead)        /* at buffer's end ? */
    42494319            goto __readfile_exit;
     
    42544324    while (rc == NO_ERROR);
    42554325  }
    4256  
     4326
    42574327__readfile_exit:
    4258  
     4328
    42594329  *lpNumberOfBytesRead = ulCounter;                          /* write result */
    42604330
     
    42644334
    42654335/*****************************************************************************
    4266  * Name      : 
    4267  * Purpose   : 
    4268  * Parameters: 
    4269  * Variables :
    4270  * Result    : 
    4271  * Remark    : 
    4272  * Status    : 
     4336 * Name      :
     4337 * Purpose   :
     4338 * Parameters:
     4339 * Variables :
     4340 * Result    :
     4341 * Remark    :
     4342 * Status    :
    42734343 *
    42744344 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    42914361           lpOverlapped);
    42924362#endif
    4293  
     4363
    42944364  return(ERROR_ACCESS_DENIED);
    42954365}
     
    42974367
    42984368/*****************************************************************************
    4299  * Name      : 
    4300  * Purpose   : 
    4301  * Parameters: 
    4302  * Variables :
    4303  * Result    : 
    4304  * Remark    : 
    4305  * Status    : 
     4369 * Name      :
     4370 * Purpose   :
     4371 * Parameters:
     4372 * Variables :
     4373 * Result    :
     4374 * Remark    :
     4375 * Status    :
    43064376 *
    43074377 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    43204390      return (HMDeviceConsoleInClass::
    43214391              FlushConsoleInputBuffer(pHMHandleData));
    4322    
     4392
    43234393    case DRQ_GETNUMBEROFCONSOLEINPUTEVENTS:
    43244394      return (HMDeviceConsoleInClass::
    43254395              GetNumberOfConsoleInputEvents(pHMHandleData,
    43264396                                            (LPDWORD)arg1));
    4327    
     4397
    43284398    case DRQ_PEEKCONSOLEINPUTA:
    43294399      return (HMDeviceConsoleInClass::
     
    43324402                                (DWORD)        arg2,
    43334403                                (LPDWORD)      arg3));
    4334    
     4404
    43354405    case DRQ_PEEKCONSOLEINPUTW:
    43364406      return (HMDeviceConsoleInClass::
     
    43394409                                (DWORD)        arg2,
    43404410                                (LPDWORD)      arg3));
    4341  
    4342  
     4411
     4412
    43434413    case DRQ_READCONSOLEA:
    43444414      return (HMDeviceConsoleInClass::
     
    43484418                           (LPDWORD)     arg3,
    43494419                           (LPVOID)      arg4));
    4350  
     4420
    43514421    case DRQ_READCONSOLEW:
    43524422      return (HMDeviceConsoleInClass::
     
    43564426                           (LPDWORD)     arg3,
    43574427                           (LPVOID)      arg4));
    4358    
     4428
    43594429    case DRQ_READCONSOLEINPUTA:
    43604430      return (HMDeviceConsoleInClass::
     
    43624432                                (PINPUT_RECORD)arg1,
    43634433                                (DWORD)arg2,
    4364                                 (LPDWORD)arg3));   
    4365    
     4434                                (LPDWORD)arg3));
     4435
    43664436    case DRQ_READCONSOLEINPUTW:
    43674437      return (HMDeviceConsoleInClass::
     
    43774447                                (DWORD)arg2,
    43784448                                (LPDWORD)arg3));
    4379    
     4449
    43804450    case DRQ_WRITECONSOLEINPUTW:
    43814451      return (HMDeviceConsoleInClass::
     
    43844454                                (DWORD)arg2,
    43854455                                (LPDWORD)arg3));
    4386  
    4387   }
    4388  
     4456
     4457  }
     4458
    43894459#ifdef DEBUG_LOCAL
    43904460  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass:_DeviceRequest %s(%08x,%08x,%08x,%08x,%08x,%08x) unknown request\n",
     
    44094479 * Variables :
    44104480 * Result    :
    4411  * Remark    : 
     4481 * Remark    :
    44124482 * Status    : UNTESTED
    44134483 *
     
    44184488{
    44194489  ULONG ulCounter;                                           /* loop counter */
    4420  
     4490
    44214491#ifdef DEBUG_LOCAL2
    44224492  WriteLog("KERNEL32/CONSOLE: CONIN$::FlushConsoleInputBuffer(%08x).\n",
    44234493           pHMHandleData);
    44244494#endif
    4425  
     4495
    44264496  ConsoleInput.ulIndexFree  = 0;
    44274497  ConsoleInput.ulIndexEvent = 0;
    44284498  ConsoleInput.ulEvents     = 0;
    4429  
     4499
    44304500  for (ulCounter = 0;
    44314501       ulCounter < CONSOLE_INPUTQUEUESIZE;
     
    44454515 * Result    :
    44464516
    4447  * Remark    : 
     4517 * Remark    :
    44484518 * Status    : UNTESTED
    44494519 *
     
    44594529           lpMode);
    44604530#endif
    4461  
     4531
    44624532  *lpMode = ConsoleInput.dwConsoleMode;       /* return current console mode */
    44634533
     
    44734543 * Variables :
    44744544 * Result    :
    4475  * Remark    : 
     4545 * Remark    :
    44764546 * Status    : UNTESTED
    44774547 *
     
    44874557           lpNumberOfEvents);
    44884558#endif
    4489  
     4559
    44904560  *lpNumberOfEvents = ConsoleInput.ulEvents;      /* return number of events */
    44914561
     
    45204590  ULONG         ulCurrentEvent;       /* index of current event in the queue */
    45214591  PINPUT_RECORD pirEvent;                /* pointer to current queue element */
    4522  
     4592
    45234593#ifdef DEBUG_LOCAL2
    45244594  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    45284598           lpcRead);
    45294599#endif
    4530  
     4600
    45314601  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    45324602  {
     
    45344604    return (TRUE);                                         /* OK, we're done */
    45354605  }
    4536  
    4537  
     4606
     4607
    45384608  for (ulCounter = 0,
    45394609       ulCurrentEvent = ConsoleInput.ulIndexEvent,
    45404610       pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent];
    4541        
     4611
    45424612       ulCounter < cInRecords;
    4543        
     4613
    45444614       ulCounter++,
    45454615       ulCurrentEvent++,
     
    45524622      pirEvent       = ConsoleInput.arrInputRecord;
    45534623    }
    4554    
     4624
    45554625    if (pirEvent->EventType == 0x0000)                   /* no more events ? */
    45564626      break;                                              /* leave loop then */
    4557    
     4627
    45584628    memcpy(pirEvent,                                      /* copy event data */
    45594629           pirBuffer,
     
    45924662  ULONG         ulCurrentEvent;       /* index of current event in the queue */
    45934663  PINPUT_RECORD pirEvent;                /* pointer to current queue element */
    4594  
     4664
    45954665#ifdef DEBUG_LOCAL2
    45964666  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    46004670           lpcRead);
    46014671#endif
    4602  
     4672
    46034673  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    46044674  {
     
    46064676    return (TRUE);                                         /* OK, we're done */
    46074677  }
    4608  
    4609  
     4678
     4679
    46104680  for (ulCounter = 0,
    46114681       ulCurrentEvent = ConsoleInput.ulIndexEvent,
    46124682       pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent];
    4613        
     4683
    46144684       ulCounter < cInRecords;
    4615        
     4685
    46164686       ulCounter++,
    46174687       ulCurrentEvent++,
     
    46244694      pirEvent       = ConsoleInput.arrInputRecord;
    46254695    }
    4626    
     4696
    46274697    if (pirEvent->EventType == 0x0000)                   /* no more events ? */
    46284698      break;                                              /* leave loop then */
    4629    
     4699
    46304700    memcpy(pirEvent,                                      /* copy event data */
    46314701           pirBuffer,
     
    46484718 * Variables :
    46494719 * Result    :
    4650  * Remark    : 
     4720 * Remark    :
    46514721 * Status    : UNTESTED
    46524722 *
     
    46614731{
    46624732  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    4663  
     4733
    46644734#ifdef DEBUG_LOCAL2
    46654735  WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleA(%08x,%08x,%u,%08x,%08x).\n",
     
    46704740           lpvReserved);
    46714741#endif
    4672  
     4742
    46734743                               /* simply forward the request to that routine */
    46744744  return (HMDeviceConsoleInClass::ReadFile(pHMHandleData,
     
    46904760 * Variables :
    46914761 * Result    :
    4692  * Remark    : 
     4762 * Remark    :
    46934763 * Status    : UNTESTED
    46944764 *
     
    47044774  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    47054775  DWORD          dwResult;
    4706  
     4776
    47074777#ifdef DEBUG_LOCAL2
    47084778  WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleW(%08x,%08x,%u,%08x,%08x).\n",
     
    47134783           lpvReserved);
    47144784#endif
    4715  
     4785
    47164786                               /* simply forward the request to that routine */
    47174787  dwResult = HMDeviceConsoleInClass::ReadFile(pHMHandleData,
     
    47214791                                              NULL);
    47224792  /* @@@PH AScii -> unicode translation */
    4723  
     4793
    47244794  return (dwResult);                                  /* deliver return code */
    47254795}
     
    47484818  ULONG  ulPostCounter;                  /* semaphore post counter - ignored */
    47494819  APIRET rc;                                               /* API returncode */
    4750  
     4820
    47514821#ifdef DEBUG_LOCAL2
    47524822  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    47564826           lpcRead);
    47574827#endif
    4758  
     4828
    47594829  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    47604830  {
     
    47644834                     &ulPostCounter);              /* post counter - ignored */
    47654835  }
    4766  
    4767  
     4836
     4837
    47684838  /* now read events into target buffer */
    47694839  for (ulPostCounter = 0;
     
    47764846      break;
    47774847  }
    4778  
     4848
    47794849  *lpcRead = ulPostCounter;                 /* return number of records read */
    47804850  return (TRUE);                                                       /* OK */
     
    48044874  ULONG ulPostCounter;                   /* semaphore post counter - ignored */
    48054875  APIRET rc;                                               /* API returncode */
    4806  
     4876
    48074877#ifdef DEBUG_LOCAL2
    48084878  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    48124882           lpcRead);
    48134883#endif
    4814  
     4884
    48154885  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    48164886  {
     
    48204890                     &ulPostCounter);              /* post counter - ignored */
    48214891  }
    4822  
    4823  
     4892
     4893
    48244894  /* now read events into target buffer */
    48254895  for (ulPostCounter = 0;
     
    48324902      break;
    48334903  }
    4834  
     4904
    48354905  *lpcRead = ulPostCounter;                 /* return number of records read */
    48364906  return (TRUE);                                                       /* OK */
     
    48454915 * Variables :
    48464916 * Result    :
    4847  * Remark    : 
     4917 * Remark    :
    48484918 * Status    : UNTESTED
    48494919 *
     
    48554925{
    48564926  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    4857  
     4927
    48584928#ifdef DEBUG_LOCAL2
    48594929  WriteLog("KERNEL32/CONSOLE: CONIN$::SetConsoleMode(%08x,%08x).\n",
     
    48614931           dwMode);
    48624932#endif
    4863  
     4933
    48644934  ConsoleInput.dwConsoleMode = dwMode;           /* set current console mode */
    4865  
     4935
    48664936  return (TRUE);
    48674937}
     
    48714941 * Name      : DWORD HMDeviceConsoleInClass::WriteConsoleInputA
    48724942 * Purpose   : this writes event records directly into the queue
    4873  * Parameters: PHMHANDLEDATA pHMHandleData         
     4943 * Parameters: PHMHANDLEDATA pHMHandleData
    48744944 *             PINPUT_RECORD pirBuffer
    48754945 *             DWORD         cInRecords
    48764946 *             LPDWORD       lpcWritten
    48774947 * Variables :
    4878  * Result    : 
    4879  * Remark    : 
     4948 * Result    :
     4949 * Remark    :
    48804950 * Status    : NO_ERROR - API succeeded
    48814951 *             other    - what is to be set in SetLastError
     
    48924962  APIRET         rc;                                       /* API returncode */
    48934963  ULONG          ulCounter;                                  /* loop counter */
    4894  
     4964
    48954965#ifdef DEBUG_LOCAL2
    48964966  WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputA(%08x,%08x,%u,%08x).\n",
     
    49004970           lpcWritten);
    49014971#endif
    4902  
     4972
    49034973  for (ulCounter = 0;
    49044974       ulCounter < cInRecords;
     
    49104980      break;
    49114981  }
    4912  
     4982
    49134983  *lpcWritten = ulCounter;                /* return number of events written */
    49144984  return (TRUE);                                                       /* OK */
     
    49194989 * Name      : DWORD HMDeviceConsoleInClass::WriteConsoleInputW
    49204990 * Purpose   : this writes event records directly into the queue
    4921  * Parameters: PHMHANDLEDATA pHMHandleData         
     4991 * Parameters: PHMHANDLEDATA pHMHandleData
    49224992 *             PINPUT_RECORD pirBuffer
    49234993 *             DWORD         cInRecords
    49244994 *             LPDWORD       lpcWritten
    49254995 * Variables :
    4926  * Result    : 
    4927  * Remark    : 
     4996 * Result    :
     4997 * Remark    :
    49284998 * Status    : NO_ERROR - API succeeded
    49294999 *             other    - what is to be set in SetLastError
     
    49405010  APIRET         rc;                                       /* API returncode */
    49415011  ULONG          ulCounter;                                  /* loop counter */
    4942  
     5012
    49435013#ifdef DEBUG_LOCAL2
    49445014  WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputW(%08x,%08x,%u,%08x).\n",
     
    49485018           lpcWritten);
    49495019#endif
    4950  
     5020
    49515021  for (ulCounter = 0;
    49525022       ulCounter < cInRecords;
     
    49585028      break;
    49595029  }
    4960  
     5030
    49615031  *lpcWritten = ulCounter;                /* return number of events written */
    49625032  return (TRUE);                                                       /* OK */
     
    49745044 *             PHMHANDLEDATA pHMHandleDataTemplate data of the template handle
    49755045 * Variables :
    4976  * Result    : 
    4977  * Remark    : 
     5046 * Result    :
     5047 * Remark    :
    49785048 * Status    : NO_ERROR - API succeeded
    49795049 *             other    - what is to be set in SetLastError
     
    49905060  BOOL   fResult;
    49915061  HANDLE hConsole;
    4992  
     5062
    49935063#ifdef DEBUG_LOCAL2
    49945064  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass %s(%s,%08x,%08x,%08x)\n",
     
    49995069           pHMHandleDataTemplate);
    50005070#endif
    5001  
     5071
    50025072  pHMHandleData->dwType = FILE_TYPE_CHAR;        /* we're a character device */
    5003  
    5004  
     5073
     5074
    50055075                 /* if no default buffer is available, then do default setup */
    50065076  if (ConsoleGlobals.hConsoleBuffer == INVALID_HANDLE_VALUE)
    50075077  {
    50085078                /* now we need a default screen buffer with the default size */
    5009     hConsole = OS2CreateConsoleScreenBuffer(0,
     5079    hConsole = CreateConsoleScreenBuffer(0,
    50105080                                            0,
    50115081                                            NULL,
     
    50205090      return INVALID_HANDLE_VALUE;   /* abort further processing immediately */
    50215091    }
    5022    
    5023     fResult = OS2SetConsoleTextAttribute(hConsole,
     5092
     5093    fResult = SetConsoleTextAttribute(hConsole,
    50245094                                         ConsoleGlobals.Options.ucDefaultAttribute);
    50255095#ifdef DEBUG_LOCAL
     
    50285098               GetLastError());
    50295099#endif
    5030    
    5031     fResult = OS2SetConsoleScreenBufferSize(hConsole,
     5100
     5101    fResult = SetConsoleScreenBufferSize(hConsole,
    50325102                                            ConsoleGlobals.Options.coordDefaultSize);
    50335103    if (fResult == FALSE)
     
    50405110      return (INVALID_HANDLE_VALUE);            /* abort further processing */
    50415111    }
    5042  
    5043     fResult = OS2SetConsoleActiveScreenBuffer(hConsole);
     5112
     5113    fResult = SetConsoleActiveScreenBuffer(hConsole);
    50445114    if (fResult == FALSE)
    50455115    {
     
    50575127    }
    50585128  }
    5059  
     5129
    50605130  return(NO_ERROR);
    50615131}
     
    50635133
    50645134/*****************************************************************************
    5065  * Name      : 
    5066  * Purpose   : 
    5067  * Parameters: 
    5068  * Variables :
    5069  * Result    : 
    5070  * Remark    : 
    5071  * Status    : 
     5135 * Name      :
     5136 * Purpose   :
     5137 * Parameters:
     5138 * Variables :
     5139 * Result    :
     5140 * Remark    :
     5141 * Status    :
    50725142 *
    50735143 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    50805150                                        LPOVERLAPPED  lpOverlapped)
    50815151{
    5082  
     5152
    50835153#ifdef DEBUG_LOCAL
    50845154  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    50905160           lpOverlapped);
    50915161#endif
    5092  
     5162
    50935163  return(ERROR_ACCESS_DENIED);
    50945164}
     
    50965166
    50975167/*****************************************************************************
    5098  * Name      : 
    5099  * Purpose   : 
    5100  * Parameters: 
    5101  * Variables :
    5102  * Result    : 
    5103  * Remark    : 
    5104  * Status    : 
     5168 * Name      :
     5169 * Purpose   :
     5170 * Parameters:
     5171 * Variables :
     5172 * Result    :
     5173 * Remark    :
     5174 * Status    :
    51055175 *
    51065176 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    51145184{
    51155185  DWORD dwResult;                        /* result from subsequent WriteFile */
    5116  
     5186
    51175187#ifdef DEBUG_LOCAL2
    51185188  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass:WriteFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    51245194           lpOverlapped);
    51255195#endif
    5126  
     5196
    51275197        /* just prevent an endless loop, although this condition might never */
    51285198                                                                /* be true ! */
     
    51375207                    0);
    51385208#endif
    5139    
     5209
    51405210    dwResult = HMWriteFile(ConsoleGlobals.hConsoleBuffer,
    51415211                           lpBuffer,
     
    51435213                           lpNumberOfBytesWritten,
    51445214                           lpOverlapped);
    5145    
     5215
    51465216#if 0
    51475217    HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,        /* show the cursor */
     
    51525222                    0);
    51535223#endif
    5154    
     5224
    51555225    return (dwResult);                                 /* return result code */
    51565226  }
     
    51645234 * Purpose   : we just forward those device requests to the console buffer
    51655235 *             currently associated with the console itself.
    5166  * Parameters: 
    5167  * Variables :
    5168  * Result    : 
    5169  * Remark    : 
     5236 * Parameters:
     5237 * Variables :
     5238 * Result    :
     5239 * Remark    :
    51705240 * Status    : UNTESTED
    51715241 *
     
    52145284 * Variables :
    52155285 * Result    :
    5216  * Remark    : 
     5286 * Remark    :
    52175287 * Status    : NO_ERROR - API succeeded
    52185288 *             other    - what is to be set in SetLastError
     
    52275297{
    52285298  PCONSOLEBUFFER pConsoleBuffer;                 /* console buffer structure */
    5229  
     5299
    52305300#ifdef DEBUG_LOCAL
    52315301  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass %s(%s,%08x,%08x,%08x)\n",
     
    52365306           pHMHandleDataTemplate);
    52375307#endif
    5238  
     5308
    52395309  pHMHandleData->dwType = FILE_TYPE_CHAR;        /* we're a character device */
    5240  
     5310
    52415311  pHMHandleData->lpHandlerData = malloc ( sizeof(CONSOLEBUFFER) );
    5242  
     5312
    52435313#ifdef DEBUG_LOCAL
    52445314  WriteLog("KERNEL32/CONSOLE:CheckPoint1: %s pHMHandleData=%08xh, lpHandlerData=%08xh\n",
     
    52475317           pHMHandleData->lpHandlerData);
    52485318#endif
    5249  
    5250  
     5319
     5320
    52515321  if (pHMHandleData->lpHandlerData == NULL)              /* check allocation */
    52525322  {
     
    52575327  {
    52585328    pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    5259    
     5329
    52605330    memset(pHMHandleData->lpHandlerData,             /* initialize structure */
    52615331           0,
    52625332           sizeof (CONSOLEBUFFER) );
    5263  
     5333
    52645334                                                      /* set buffer defaults */
    52655335    pConsoleBuffer->dwConsoleMode = ENABLE_PROCESSED_OUTPUT |
    52665336                                    ENABLE_WRAP_AT_EOL_OUTPUT;
    5267  
     5337
    52685338    pConsoleBuffer->CursorInfo.dwSize   = 2;                  /* 2 scanlines */
    52695339    pConsoleBuffer->CursorInfo.bVisible = TRUE;
    52705340  }
    5271  
     5341
    52725342  return(NO_ERROR);
    52735343}
     
    52755345
    52765346/*****************************************************************************
    5277  * Name      : 
    5278  * Purpose   : 
    5279  * Parameters: 
    5280  * Variables :
    5281  * Result    : 
    5282  * Remark    : 
    5283  * Status    : 
     5347 * Name      :
     5348 * Purpose   :
     5349 * Parameters:
     5350 * Variables :
     5351 * Result    :
     5352 * Remark    :
     5353 * Status    :
    52845354 *
    52855355 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    52885358DWORD HMDeviceConsoleBufferClass::CloseHandle(PHMHANDLEDATA pHMHandleData)
    52895359{
    5290  
     5360
    52915361#ifdef DEBUG_LOCAL
    52925362  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass::CloseHandle %s(%08x)\n",
     
    52945364           pHMHandleData);
    52955365#endif
    5296  
     5366
    52975367  if (pHMHandleData->lpHandlerData != NULL)                 /* check pointer */
    52985368  {
    52995369    PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    5300    
     5370
    53015371
    53025372    if (pConsoleBuffer->ppszLine != NULL)        /* free line buffer array ! */
    53035373      free (pConsoleBuffer->ppszLine);
    5304      
     5374
    53055375    free (pHMHandleData->lpHandlerData);          /* free device object data */
    53065376    pHMHandleData->lpHandlerData = NULL;
    53075377  }
    5308  
     5378
    53095379  return(NO_ERROR);
    53105380}
     
    53125382
    53135383/*****************************************************************************
    5314  * Name      : 
    5315  * Purpose   : 
    5316  * Parameters: 
    5317  * Variables :
    5318  * Result    : 
    5319  * Remark    : 
    5320  * Status    : 
     5384 * Name      :
     5385 * Purpose   :
     5386 * Parameters:
     5387 * Variables :
     5388 * Result    :
     5389 * Remark    :
     5390 * Status    :
    53215391 *
    53225392 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    53295399                                           LPOVERLAPPED  lpOverlapped)
    53305400{
    5331  
     5401
    53325402#ifdef DEBUG_LOCAL
    53335403  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    53395409           lpOverlapped);
    53405410#endif
    5341  
     5411
    53425412  return(ERROR_ACCESS_DENIED);
    53435413}
     
    53455415
    53465416/*****************************************************************************
    5347  * Name      : 
    5348  * Purpose   : 
    5349  * Parameters: 
    5350  * Variables :
    5351  * Result    : 
    5352  * Remark    : 
    5353  * Status    : 
     5417 * Name      :
     5418 * Purpose   :
     5419 * Parameters:
     5420 * Variables :
     5421 * Result    :
     5422 * Remark    :
     5423 * Status    :
    53545424 *
    53555425 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    53665436           PSZ   pszBuffer = (PSZ)lpBuffer;
    53675437  register UCHAR ucChar;
    5368  
     5438
    53695439#ifdef DEBUG_LOCAL2
    53705440  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass:WriteFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    53765446           lpOverlapped);
    53775447#endif
    5378  
     5448
    53795449                      /* check if we're called with non-existing line buffer */
    53805450  if (pConsoleBuffer->ppszLine == NULL)
    53815451    return (ERROR_SYS_INTERNAL);
    5382  
     5452
    53835453  for (ulCounter = 0;
    53845454       ulCounter < nNumberOfBytesToWrite;
     
    53865456  {
    53875457    ucChar = pszBuffer[ulCounter];                        /* map to register */
    5388    
     5458
    53895459    if ( (pConsoleBuffer->dwConsoleMode & ENABLE_PROCESSED_OUTPUT) &&
    53905460         (ucChar < 32) )     /* this is faster than a large switch statement */
     
    53975467                    ConsoleGlobals.Options.ulSpeakerDuration);
    53985468          break;
    5399      
     5469
    54005470        case 8: /* Backspace */
    54015471          if (pConsoleBuffer->coordCursorPosition.X > 0)
    54025472            pConsoleBuffer->coordCursorPosition.X--;
    54035473          break;
    5404  
     5474
    54055475        case 9: /* Tab */
    54065476          pConsoleBuffer->coordCursorPosition.X =
    5407             (pConsoleBuffer->coordCursorPosition.X 
    5408              / ConsoleGlobals.Options.ulTabSize 
     5477            (pConsoleBuffer->coordCursorPosition.X
     5478             / ConsoleGlobals.Options.ulTabSize
    54095479             + 1)
    54105480            * ConsoleGlobals.Options.ulTabSize;
    5411        
     5481
    54125482          if (pConsoleBuffer->coordCursorPosition.X >=
    54135483              pConsoleBuffer->coordBufferSize.X)
     
    54155485            pConsoleBuffer->coordCursorPosition.X = 0;
    54165486            pConsoleBuffer->coordCursorPosition.Y++;
    5417            
     5487
    54185488            if (pConsoleBuffer->coordCursorPosition.Y >=
    54195489                pConsoleBuffer->coordBufferSize.Y)
     
    54285498          }
    54295499          break;
    5430          
     5500
    54315501        case 10: /* LINEFEED */
    54325502          pConsoleBuffer->coordCursorPosition.Y++;
    5433          
     5503
    54345504          if (pConsoleBuffer->coordCursorPosition.Y >=
    54355505              pConsoleBuffer->coordBufferSize.Y)
     
    54405510          }
    54415511          break;
    5442          
     5512
    54435513        case 13: /* CARRIAGE RETURN */
    54445514          pConsoleBuffer->coordCursorPosition.X = 0;
    54455515          break;
    5446        
     5516
    54475517        default:
    54485518          break;
     
    54545524      *(pConsoleBuffer->ppszLine[pConsoleBuffer->coordCursorPosition.Y] +
    54555525        pConsoleBuffer->coordCursorPosition.X * 2) = pszBuffer[ulCounter];
    5456        
     5526
    54575527      pConsoleBuffer->coordCursorPosition.X++;
    5458    
     5528
    54595529      if (pConsoleBuffer->coordCursorPosition.X >=
    54605530          pConsoleBuffer->coordBufferSize.X)
     
    54625532        pConsoleBuffer->coordCursorPosition.X = 0;
    54635533        pConsoleBuffer->coordCursorPosition.Y++;
    5464        
     5534
    54655535        if (pConsoleBuffer->coordCursorPosition.Y >=
    54665536            pConsoleBuffer->coordBufferSize.Y)
     
    54825552    }
    54835553  }
    5484  
     5554
    54855555                                          /* update screen if active console */
    54865556  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    54875557    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    5488  
     5558
    54895559  *lpNumberOfBytesWritten = ulCounter;
    5490  
     5560
    54915561  return(ulCounter);
    54925562}
     
    54945564
    54955565/*****************************************************************************
    5496  * Name      : 
    5497  * Purpose   : 
    5498  * Parameters: 
    5499  * Variables :
    5500  * Result    : 
    5501  * Remark    : 
    5502  * Status    : 
     5566 * Name      :
     5567 * Purpose   :
     5568 * Parameters:
     5569 * Variables :
     5570 * Result    :
     5571 * Remark    :
     5572 * Status    :
    55035573 *
    55045574 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    55175587    {
    55185588      COORD coordWrite;
    5519      
     5589
    55205590      ULONG2COORD(coordWrite,arg3);
    5521        
     5591
    55225592      return (HMDeviceConsoleBufferClass
    55235593              ::FillConsoleOutputAttribute(pHMHandleData,
     
    55275597                                           (LPDWORD)arg4));
    55285598    }
    5529              
     5599
    55305600
    55315601    case DRQ_FILLCONSOLEOUTPUTCHARACTERA:
    55325602    {
    55335603      COORD coordWrite;
    5534      
     5604
    55355605      ULONG2COORD(coordWrite,arg3);
    5536        
     5606
    55375607      return (HMDeviceConsoleBufferClass
    55385608              ::FillConsoleOutputCharacterA(pHMHandleData,
     
    55425612                                            (LPDWORD)arg4));
    55435613    }
    5544    
    5545    
     5614
     5615
    55465616    case DRQ_FILLCONSOLEOUTPUTCHARACTERW:
    55475617    {
    55485618      COORD coordWrite;
    5549      
     5619
    55505620      ULONG2COORD(coordWrite,arg3);
    5551        
     5621
    55525622      return (HMDeviceConsoleBufferClass
    55535623              ::FillConsoleOutputCharacterW(pHMHandleData,
     
    55585628    }
    55595629
    5560    
     5630
    55615631    case DRQ_GETCONSOLECURSORINFO:
    55625632      return (HMDeviceConsoleBufferClass
     
    55645634                                     (PCONSOLE_CURSOR_INFO)arg1));
    55655635
    5566    
     5636
    55675637    case DRQ_GETCONSOLEMODE:
    55685638      return (HMDeviceConsoleBufferClass
     
    55705640                               (LPDWORD)arg1));
    55715641
    5572              
     5642
    55735643    case DRQ_GETCONSOLESCREENBUFFERINFO:
    55745644      return (HMDeviceConsoleBufferClass
    55755645              ::GetConsoleScreenBufferInfo(pHMHandleData,
    55765646                                           (PCONSOLE_SCREEN_BUFFER_INFO)arg1));
    5577    
     5647
    55785648
    55795649    case DRQ_GETLARGESTCONSOLEWINDOWSIZE:
    55805650      return (HMDeviceConsoleBufferClass
    55815651              ::GetLargestConsoleWindowSize(pHMHandleData));
    5582    
     5652
    55835653
    55845654    case DRQ_READCONSOLEOUTPUTA:
     
    55865656      COORD coordDestBufferSize;
    55875657      COORD coordDestBufferCoord;
    5588      
     5658
    55895659      ULONG2COORD(coordDestBufferSize,  arg2);
    55905660      ULONG2COORD(coordDestBufferCoord, arg3);
    5591      
     5661
    55925662      return (HMDeviceConsoleBufferClass
    55935663              ::ReadConsoleOutputA(pHMHandleData,
     
    55975667                                   (PSMALL_RECT)arg4));
    55985668    }
    5599    
    5600    
     5669
     5670
    56015671    case DRQ_READCONSOLEOUTPUTW:
    56025672    {
    56035673      COORD coordDestBufferSize;
    56045674      COORD coordDestBufferCoord;
    5605      
     5675
    56065676      ULONG2COORD(coordDestBufferSize,  arg2);
    56075677      ULONG2COORD(coordDestBufferCoord, arg3);
    5608      
     5678
    56095679      return (HMDeviceConsoleBufferClass
    56105680              ::ReadConsoleOutputW(pHMHandleData,
     
    56145684                                   (PSMALL_RECT)arg4));
    56155685    }
    5616    
     5686
    56175687
    56185688    case DRQ_READCONSOLEOUTPUTATTRIBUTE:
    56195689    {
    56205690      COORD coordReadCoord;
    5621      
     5691
    56225692      ULONG2COORD(coordReadCoord, arg3);
    5623      
     5693
    56245694      return (HMDeviceConsoleBufferClass
    56255695              ::ReadConsoleOutputAttribute(pHMHandleData,
     
    56295699                                   (LPDWORD)arg4));
    56305700    }
    5631    
    5632    
     5701
     5702
    56335703    case DRQ_READCONSOLEOUTPUTCHARACTERA:
    56345704    {
    56355705      COORD coordReadCoord;
    5636      
     5706
    56375707      ULONG2COORD(coordReadCoord, arg3);
    5638      
     5708
    56395709      return (HMDeviceConsoleBufferClass
    56405710              ::ReadConsoleOutputCharacterA(pHMHandleData,
     
    56435713                                            coordReadCoord,
    56445714                                            (LPDWORD)arg4));
    5645     }   
    5646    
    5647    
     5715    }
     5716
     5717
    56485718    case DRQ_READCONSOLEOUTPUTCHARACTERW:
    56495719    {
    56505720      COORD coordReadCoord;
    5651      
     5721
    56525722      ULONG2COORD(coordReadCoord, arg3);
    5653      
     5723
    56545724      return (HMDeviceConsoleBufferClass
    56555725              ::ReadConsoleOutputCharacterW(pHMHandleData,
     
    56585728                                            coordReadCoord,
    56595729                                            (LPDWORD)arg4));
    5660     }   
    5661    
     5730    }
     5731
    56625732
    56635733    case DRQ_SCROLLCONSOLESCREENBUFFERA:
    56645734    {
    56655735      COORD coordDestOrigin;
    5666      
     5736
    56675737      ULONG2COORD(coordDestOrigin, arg3);
    5668      
     5738
    56695739      return (HMDeviceConsoleBufferClass
    56705740              ::ScrollConsoleScreenBufferA(pHMHandleData,
     
    56735743                                           coordDestOrigin,
    56745744                                           (PCHAR_INFO)arg4));
    5675     }   
    5676    
    5677    
     5745    }
     5746
     5747
    56785748    case DRQ_SCROLLCONSOLESCREENBUFFERW:
    56795749    {
    56805750      COORD coordDestOrigin;
    5681      
     5751
    56825752      ULONG2COORD(coordDestOrigin, arg3);
    5683      
     5753
    56845754      return (HMDeviceConsoleBufferClass
    56855755              ::ScrollConsoleScreenBufferW(pHMHandleData,
     
    56885758                                           coordDestOrigin,
    56895759                                           (PCHAR_INFO)arg4));
    5690     }   
    5691 
    5692  
     5760    }
     5761
     5762
    56935763    case DRQ_SETCONSOLEACTIVESCREENBUFFER:
    56945764      return (HMDeviceConsoleBufferClass
     
    57005770              ::SetConsoleCursorInfo(pHMHandleData,
    57015771                                     (PCONSOLE_CURSOR_INFO)arg1));
    5702    
     5772
    57035773
    57045774    case DRQ_SETCONSOLECURSORPOSITION:
    57055775    {
    57065776      COORD coordCursor;
    5707      
     5777
    57085778      ULONG2COORD(coordCursor, arg1);
    5709      
     5779
    57105780      return (HMDeviceConsoleBufferClass
    57115781              ::SetConsoleCursorPosition(pHMHandleData,
    57125782                                         coordCursor));
    57135783    }
    5714    
     5784
    57155785
    57165786    case DRQ_SETCONSOLEMODE:
     
    57195789                               (DWORD)arg1));
    57205790
    5721              
     5791
    57225792    case DRQ_SETCONSOLESCREENBUFFERSIZE:
    57235793    {
    57245794      COORD coordSize;
    5725      
     5795
    57265796      ULONG2COORD(coordSize,arg1);
    5727      
     5797
    57285798      return (HMDeviceConsoleBufferClass::
    57295799                SetConsoleScreenBufferSize(pHMHandleData,
    57305800                                           coordSize));
    57315801    }
    5732              
     5802
    57335803
    57345804    case DRQ_SETCONSOLETEXTATTRIBUTE:
     
    57365806                SetConsoleTextAttribute(pHMHandleData,
    57375807                                        (WORD)arg1));
    5738              
     5808
    57395809
    57405810    case DRQ_SETCONSOLEWINDOWINFO:
     
    57445814                                     (PSMALL_RECT)arg2));
    57455815
    5746  
     5816
    57475817    case DRQ_WRITECONSOLEA:
    57485818      return (HMDeviceConsoleBufferClass
     
    57525822                              (LPDWORD)arg3,
    57535823                              (LPVOID)arg4));
    5754              
    5755              
     5824
     5825
    57565826    case DRQ_WRITECONSOLEW:
    57575827      return (HMDeviceConsoleBufferClass
     
    57615831                              (LPDWORD)arg3,
    57625832                              (LPVOID)arg4));
    5763  
     5833
    57645834
    57655835    case DRQ_WRITECONSOLEOUTPUTA:
     
    57675837      COORD coordSrcBufferSize;
    57685838      COORD coordSrcBufferCoord;
    5769      
     5839
    57705840      ULONG2COORD(coordSrcBufferSize,  arg2);
    57715841      ULONG2COORD(coordSrcBufferCoord, arg3);
    5772      
     5842
    57735843      return (HMDeviceConsoleBufferClass
    57745844              ::WriteConsoleOutputA(pHMHandleData,
     
    57785848                                    (PSMALL_RECT)arg4));
    57795849    }
    5780              
    5781              
     5850
     5851
    57825852    case DRQ_WRITECONSOLEOUTPUTW:
    57835853    {
    57845854      COORD coordSrcBufferSize;
    57855855      COORD coordSrcBufferCoord;
    5786      
     5856
    57875857      ULONG2COORD(coordSrcBufferSize,  arg2);
    57885858      ULONG2COORD(coordSrcBufferCoord, arg3);
    5789      
     5859
    57905860      return (HMDeviceConsoleBufferClass
    57915861              ::WriteConsoleOutputA(pHMHandleData,
     
    57945864                                    coordSrcBufferCoord,
    57955865                                    (PSMALL_RECT)arg4));
    5796     } 
    5797 
    5798              
     5866    }
     5867
     5868
    57995869    case DRQ_WRITECONSOLEOUTPUTATTRIBUTE:
    58005870    {
    58015871      COORD coordWriteCoord;
    5802      
     5872
    58035873      ULONG2COORD(coordWriteCoord,  arg3);
    5804      
     5874
    58055875      return (HMDeviceConsoleBufferClass
    58065876              ::WriteConsoleOutputAttribute(pHMHandleData,
     
    58095879                                            coordWriteCoord,
    58105880                                            (LPDWORD)arg4));
    5811     } 
    5812              
    5813              
     5881    }
     5882
     5883
    58145884    case DRQ_WRITECONSOLEOUTPUTCHARACTERA:
    58155885    {
    58165886      COORD coordWriteCoord;
    5817      
     5887
    58185888      ULONG2COORD(coordWriteCoord,  arg3);
    5819      
     5889
    58205890      return (HMDeviceConsoleBufferClass
    58215891              ::WriteConsoleOutputCharacterA(pHMHandleData,
     
    58245894                                             coordWriteCoord,
    58255895                                             (LPDWORD)arg4));
    5826     } 
    5827  
    5828  
     5896    }
     5897
     5898
    58295899    case DRQ_WRITECONSOLEOUTPUTCHARACTERW:
    58305900    {
    58315901      COORD coordWriteCoord;
    5832      
     5902
    58335903      ULONG2COORD(coordWriteCoord,  arg3);
    5834      
     5904
    58355905      return (HMDeviceConsoleBufferClass
    58365906              ::WriteConsoleOutputCharacterW(pHMHandleData,
     
    58415911    }
    58425912
    5843    
     5913
    58445914    case DRQ_INTERNAL_CONSOLEBUFFERMAP:
    58455915      ConsoleBufferMap((PCONSOLEBUFFER)pHMHandleData->lpHandlerData);
    58465916      return (NO_ERROR);
    5847    
    5848    
     5917
     5918
    58495919    case DRQ_INTERNAL_CONSOLECURSORSHOW:
    58505920      ConsoleCursorShow((PCONSOLEBUFFER)pHMHandleData->lpHandlerData,
    58515921                        (ULONG)arg1);
    58525922      return (NO_ERROR);
    5853    
    5854    
     5923
     5924
    58555925    case DRQ_INTERNAL_CONSOLEADJUSTWINDOW:
    58565926      ConsoleAdjustWindow((PCONSOLEBUFFER)pHMHandleData->lpHandlerData);
    5857       return (NO_ERROR);   
    5858   }
    5859  
    5860  
     5927      return (NO_ERROR);
     5928  }
     5929
     5930
    58615931#ifdef DEBUG_LOCAL
    58625932  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass:_DeviceRequest %s(%08x,%08x,%08x,%08x,%08x,%08x) unknown request\n",
     
    58855955 * Variables :
    58865956 * Result    :
    5887  * Remark    : 
     5957 * Remark    :
    58885958 * Status    : UNTESTED
    58895959 *
     
    58995969  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    59005970  ULONG          ulCounter;                     /* current character counter */
    5901  
     5971
    59025972#ifdef DEBUG_LOCAL2
    59035973  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputAttribute(%08x,attr=%04x,%u,x=%u y=%u,res=%08x).\n",
     
    59095979           lpNumberOfAttrsWritten);
    59105980#endif
    5911  
     5981
    59125982  if ( (dwWriteCoord.X < 0) ||
    59135983       (dwWriteCoord.Y < 0) )
     
    59155985    if (lpNumberOfAttrsWritten != NULL)           /* ensure pointer is valid */
    59165986      *lpNumberOfAttrsWritten = 0;                /* complete error handling */
    5917    
     5987
    59185988    SetLastError(ERROR_INVALID_PARAMETER);
    59195989    return (FALSE);
    59205990  }
    5921  
     5991
    59225992                                    /* check if dwWriteCoord is within specs */
    59235993  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    59265996    if (lpNumberOfAttrsWritten != NULL)           /* ensure pointer is valid */
    59275997      *lpNumberOfAttrsWritten = 0;                /* complete error handling */
    5928    
     5998
    59295999    SetLastError(ERROR_INVALID_PARAMETER);
    59306000    return (FALSE);
    59316001  }
    5932  
     6002
    59336003
    59346004                                        /* OK, now write the attribute lines */
     
    59426012     ) = (UCHAR)(wAttribute & 0xFF);
    59436013                                 /* write attribute, don't change characters */
    5944    
     6014
    59456015    dwWriteCoord.X++;                                 /* move write position */
    59466016    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    59486018      dwWriteCoord.X = 0;                               /* skip to next line */
    59496019      dwWriteCoord.Y++;
    5950      
     6020
    59516021                         /* oops, we're at the end of the buffer. Abort now. */
    59526022      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    59546024        if (lpNumberOfAttrsWritten != NULL)       /* ensure pointer is valid */
    59556025          *lpNumberOfAttrsWritten = ulCounter;
    5956        
     6026
    59576027                                          /* update screen if active console */
    59586028        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    59596029          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    5960        
     6030
    59616031        return (TRUE);
    59626032      }
    59636033    }
    59646034  }
    5965  
     6035
    59666036                                          /* update screen if active console */
    59676037  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    59686038    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    5969  
     6039
    59706040  if (lpNumberOfAttrsWritten != NULL)             /* ensure pointer is valid */
    59716041    *lpNumberOfAttrsWritten = nLength;
    5972  
     6042
    59736043  return (TRUE);
    59746044}
     
    59856055 * Variables :
    59866056 * Result    :
    5987  * Remark    : 
     6057 * Remark    :
    59886058 * Status    : UNTESTED
    59896059 *
     
    59996069  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    60006070  ULONG          ulCounter;                     /* current character counter */
    6001  
     6071
    60026072#ifdef DEBUG_LOCAL2
    60036073  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputCharacterA(%08x,char=%02x,%u,x=%u y=%u,res=%08x).\n",
     
    60156085    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    60166086      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6017    
     6087
    60186088    SetLastError(ERROR_INVALID_PARAMETER);
    60196089    return (FALSE);
    60206090  }
    6021  
    6022  
     6091
     6092
    60236093                                    /* check if dwWriteCoord is within specs */
    60246094  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    60276097    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    60286098      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6029    
     6099
    60306100    SetLastError(ERROR_INVALID_PARAMETER);
    60316101    return (FALSE);
    60326102  }
    6033  
     6103
    60346104
    60356105                                        /* OK, now write the attribute lines */
     
    60426112                              (dwWriteCoord.X * 2)
    60436113     ) = ucCharacter;
    6044    
     6114
    60456115    dwWriteCoord.X++;                                 /* move write position */
    60466116    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    60486118      dwWriteCoord.X = 0;                               /* skip to next line */
    60496119      dwWriteCoord.Y++;
    6050      
     6120
    60516121                         /* oops, we're at the end of the buffer. Abort now. */
    60526122      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    60546124        if (lpNumberOfCharsWritten != NULL)       /* ensure pointer is valid */
    60556125          *lpNumberOfCharsWritten = ulCounter;
    6056        
     6126
    60576127                                          /* update screen if active console */
    60586128        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    60596129          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    6060        
     6130
    60616131        return (TRUE);
    60626132      }
    60636133    }
    60646134  }
    6065  
     6135
    60666136                                          /* update screen if active console */
    60676137  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    60686138    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    6069  
     6139
    60706140  if (lpNumberOfCharsWritten != NULL)             /* ensure pointer is valid */
    60716141    *lpNumberOfCharsWritten = nLength;
    6072  
     6142
    60736143  return (TRUE);
    60746144}
     
    60856155 * Variables :
    60866156 * Result    :
    6087  * Remark    : 
     6157 * Remark    :
    60886158 * Status    : UNTESTED
    60896159 *
     
    60996169  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    61006170  ULONG          ulCounter;                     /* current character counter */
    6101  
     6171
    61026172#ifdef DEBUG_LOCAL2
    61036173  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputCharacterW(%08x,char=%02x,%u,x=%u y=%u,res=%08x).\n",
     
    61096179           lpNumberOfCharsWritten);
    61106180#endif
    6111  
     6181
    61126182  if ( (dwWriteCoord.X < 0) ||
    61136183       (dwWriteCoord.Y < 0) )
     
    61156185    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    61166186      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6117    
     6187
    61186188    SetLastError(ERROR_INVALID_PARAMETER);
    61196189    return (FALSE);
    61206190  }
    6121  
    6122  
     6191
     6192
    61236193                                    /* check if dwWriteCoord is within specs */
    61246194  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    61276197    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    61286198      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6129    
     6199
    61306200    SetLastError(ERROR_INVALID_PARAMETER);
    61316201    return (FALSE);
    61326202  }
    6133  
     6203
    61346204
    61356205                                        /* OK, now write the attribute lines */
     
    61426212                              (dwWriteCoord.X * 2)
    61436213     ) = (UCHAR)wcCharacter;          /* @@@PH unicode to ascii conversion ! */
    6144    
     6214
    61456215    dwWriteCoord.X++;                                 /* move write position */
    61466216    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    61486218      dwWriteCoord.X = 0;                               /* skip to next line */
    61496219      dwWriteCoord.Y++;
    6150      
     6220
    61516221                         /* oops, we're at the end of the buffer. Abort now. */
    61526222      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    61546224        if (lpNumberOfCharsWritten != NULL)       /* ensure pointer is valid */
    61556225          *lpNumberOfCharsWritten = ulCounter;
    6156        
     6226
    61576227                                          /* update screen if active console */
    61586228        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    61596229          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    6160        
     6230
    61616231        return (TRUE);
    61626232      }
    61636233    }
    61646234  }
    6165  
     6235
    61666236                                          /* update screen if active console */
    61676237  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    61686238    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    6169  
     6239
    61706240  if (lpNumberOfCharsWritten != NULL)             /* ensure pointer is valid */
    61716241    *lpNumberOfCharsWritten = nLength;
    6172  
     6242
    61736243  return (TRUE);
    61746244}
     
    61836253 * Variables :
    61846254 * Result    :
    6185  * Remark    : 
     6255 * Remark    :
    61866256 * Status    : UNTESTED
    61876257 *
     
    61936263{
    61946264  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    6195  
     6265
    61966266#ifdef DEBUG_LOCAL2
    61976267  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleMode(%08x,%08x).\n",
     
    61996269           lpMode);
    62006270#endif
    6201  
     6271
    62026272  *lpMode = pConsoleBuffer->dwConsoleMode;    /* return current console mode */
    6203  
     6273
    62046274  return (TRUE);
    62056275}
     
    62136283 * Variables :
    62146284 * Result    :
    6215  * Remark    : 
     6285 * Remark    :
    62166286 * Status    : UNTESTED
    62176287 *
     
    62236293{
    62246294  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    6225  
     6295
    62266296#ifdef DEBUG_LOCAL2
    62276297  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleCursorInfo(%08x,%08x).\n",
     
    62296299           pCCI);
    62306300#endif
    6231  
     6301
    62326302  memcpy(pCCI,                      /* just copy the whole information block */
    62336303         &pConsoleBuffer->CursorInfo,
    62346304         sizeof (pConsoleBuffer->CursorInfo) );
    6235    
     6305
    62366306  return (TRUE);
    62376307}
     
    62456315 * Variables :
    62466316 * Result    :
    6247  * Remark    : 
     6317 * Remark    :
    62486318 * Status    : UNTESTED
    62496319 *
     
    62556325{
    62566326  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    6257  
     6327
    62586328#ifdef DEBUG_LOCAL2
    62596329  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleScreenBufferInfo(%08x,%08x).\n",
     
    62616331           pCSBI);
    62626332#endif
    6263  
     6333
    62646334  pCSBI->dwSize           = pConsoleBuffer->coordBufferSize;
    62656335  pCSBI->dwCursorPosition = pConsoleBuffer->coordCursorPosition;
    62666336  pCSBI->wAttributes      = (USHORT)pConsoleBuffer->ucDefaultAttribute;
    6267  
     6337
    62686338  /* @@@PH unsure, but should be OK */
    62696339  pCSBI->srWindow.Left   = pConsoleBuffer->coordWindowPosition.X;
     
    62736343  pCSBI->srWindow.Bottom = pConsoleBuffer->coordWindowPosition.Y +
    62746344                           pConsoleBuffer->coordWindowSize.Y - 1;
    6275  
     6345
    62766346  pCSBI->dwMaximumWindowSize = pConsoleBuffer->coordBufferSize;
    62776347
    6278   return (TRUE);   
     6348  return (TRUE);
    62796349}
    62806350
     
    62836353 * Name      : DWORD HMDeviceConsoleBufferClass::GetLargestConsoleWindowSize
    62846354 * Purpose   : Determine maximum AVIO size
    6285  * Parameters: 
    6286  * Variables :
    6287  * Result    : 
    6288  * Remark    :
    6289  * Status    : 
     6355 * Parameters:
     6356 * Variables :
     6357 * Result    :
     6358 * Remark    :
     6359 * Status    :
    62906360 *
    62916361 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    62996369  LONG           lScreenCY;
    63006370  APIRET         rc;                                       /* API returncode */
    6301  
    6302  
     6371
     6372
    63036373#ifdef DEBUG_LOCAL
    63046374  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetLargestConsoleWindowSize(%08x).\n",
    63056375           pHMHandleData);
    63066376#endif
    6307  
     6377
    63086378  /* @@@PH determine maximum console window size in characters
    63096379    based on display size and current avio font */
    6310  
     6380
    63116381  lScreenCX = WinQuerySysValue(HWND_DESKTOP,            /* query PM for that */
    63126382                               SV_CXSCREEN);
    6313  
     6383
    63146384  lScreenCY = WinQuerySysValue(HWND_DESKTOP,            /* query PM for that */
    63156385                               SV_CYFULLSCREEN);
    6316  
     6386
    63176387  if (rc != NO_ERROR)
    63186388  {
    63196389    WriteLog("KERNEL32/CONSOLE: VioGetDeviceCellSize failed with #%u.\n",
    63206390             rc);
    6321    
     6391
    63226392    return (FALSE);                                        /* say API failed */
    63236393  }
    6324  
     6394
    63256395  if ( (ConsoleGlobals.sCellCX == 0) ||          /* prevent division by zero */
    63266396       (ConsoleGlobals.sCellCY == 0) )
    63276397  {
    63286398    WriteLog("KERNEL32/CONSOLE: VioGetDeviceCellSize returned 0 value.\n");
    6329    
     6399
    63306400    return (FALSE);                                        /* say API failed */
    63316401  }
    6332  
     6402
    63336403  coordSize.X = lScreenCX / ConsoleGlobals.sCellCX;                            /* calculate */
    63346404  coordSize.Y = lScreenCY / ConsoleGlobals.sCellCY;
    6335  
     6405
    63366406                /* these limitations are due to OS/2's current VIO subsystem */
    63376407  coordSize.X = min(coordSize.X, MAX_OS2_COLUMNS);
    63386408  coordSize.Y = min(coordSize.Y, MAX_OS2_ROWS);
    6339  
     6409
    63406410  return (COORD2ULONG(coordSize));                           /* return value */
    63416411}
     
    63526422 * Variables :
    63536423 * Result    :
    6354  * Remark    : 
     6424 * Remark    :
    63556425 * Status    : UNTESTED
    63566426 *
     
    63696439  ULONG ulReadX, ulReadY;                      /* position data is read from */
    63706440  WORD  wCell;                                        /* currently read data */
    6371  
     6441
    63726442  PCHAR_INFO pchi;
    6373  
     6443
    63746444#ifdef DEBUG_LOCAL2
    63756445  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputA(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    63826452           psrctSourceRect);
    63836453#endif
    6384  
    6385  
     6454
     6455
    63866456  /* verify psrctSourceRect first */
    63876457  psrctSourceRect->Left  = max(psrctSourceRect->Left,  0);
     
    63896459  psrctSourceRect->Right = min(psrctSourceRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    63906460  psrctSourceRect->Bottom= min(psrctSourceRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    6391  
     6461
    63926462                                                     /* verify target buffer */
    63936463  if ( (coordDestBufferSize.X < coordDestBufferCoord.X) ||
     
    63976467    return (FALSE);                                            /* API failed */
    63986468  }
    6399  
     6469
    64006470  ulCX = coordDestBufferSize.X - coordDestBufferCoord.X;
    64016471  ulCY = coordDestBufferSize.Y - coordDestBufferCoord.Y;
    6402  
     6472
    64036473  ulCX = min(ulCX, (psrctSourceRect->Right  - psrctSourceRect->Left));
    64046474  ulCY = min(ulCY, (psrctSourceRect->Bottom - psrctSourceRect->Top));
    6405  
     6475
    64066476                                  /* final calculation of the copy rectangle */
    64076477  psrctSourceRect->Right  = psrctSourceRect->Left + ulCX;
    64086478  psrctSourceRect->Bottom = psrctSourceRect->Top  + ulCY;
    6409  
    6410  
     6479
     6480
    64116481  for (ulY = 0,
    64126482       ulReadY = psrctSourceRect->Top;
    6413        
     6483
    64146484       ulY <= ulCY;
    6415        
     6485
    64166486       ulY++,
    64176487       ulReadY++)
     
    64226492    for (ulX = 0,
    64236493         ulReadX = psrctSourceRect->Left;
    6424          
     6494
    64256495         ulX <= ulCX;
    6426          
     6496
    64276497         ulX++,
    64286498         ulReadX++,
     
    64316501                                                           /* read character */
    64326502      wCell = *(pConsoleBuffer->ppszLine[ulReadY] + ulReadX * 2);
    6433      
     6503
    64346504      pchi->Char.AsciiChar = (UCHAR)(wCell & 0x00FF);
    64356505      pchi->Attributes     = wCell >> 8;
    64366506    }
    64376507  }
    6438  
     6508
    64396509  return (TRUE);                                            /* OK, that's it */
    64406510}
     
    64516521 * Variables :
    64526522 * Result    :
    6453  * Remark    : 
     6523 * Remark    :
    64546524 * Status    : UNTESTED
    64556525 *
     
    64686538  ULONG ulReadX, ulReadY;                      /* position data is read from */
    64696539  WORD  wCell;                                        /* currently read data */
    6470  
     6540
    64716541  PCHAR_INFO pchi;
    6472  
     6542
    64736543#ifdef DEBUG_LOCAL2
    64746544  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputW(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    64816551           psrctSourceRect);
    64826552#endif
    6483  
    6484  
     6553
     6554
    64856555  /* verify psrctSourceRect first */
    64866556  psrctSourceRect->Left  = max(psrctSourceRect->Left,  0);
     
    64886558  psrctSourceRect->Right = min(psrctSourceRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    64896559  psrctSourceRect->Bottom= min(psrctSourceRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    6490  
     6560
    64916561                                                     /* verify target buffer */
    64926562  if ( (coordDestBufferSize.X < coordDestBufferCoord.X) ||
     
    64966566    return (FALSE);                                            /* API failed */
    64976567  }
    6498  
     6568
    64996569  ulCX = coordDestBufferSize.X - coordDestBufferCoord.X;
    65006570  ulCY = coordDestBufferSize.Y - coordDestBufferCoord.Y;
    6501  
     6571
    65026572  ulCX = min(ulCX, (psrctSourceRect->Right  - psrctSourceRect->Left));
    65036573  ulCY = min(ulCY, (psrctSourceRect->Bottom - psrctSourceRect->Top));
    6504  
     6574
    65056575                                  /* final calculation of the copy rectangle */
    65066576  psrctSourceRect->Right  = psrctSourceRect->Left + ulCX;
    65076577  psrctSourceRect->Bottom = psrctSourceRect->Top  + ulCY;
    6508  
    6509  
     6578
     6579
    65106580  for (ulY = 0,
    65116581       ulReadY = psrctSourceRect->Top;
    6512        
     6582
    65136583       ulY <= ulCY;
    6514        
     6584
    65156585       ulY++,
    65166586       ulReadY++)
     
    65216591    for (ulX = 0,
    65226592         ulReadX = psrctSourceRect->Left;
    6523          
     6593
    65246594         ulX <= ulCX;
    6525          
     6595
    65266596         ulX++,
    65276597         ulReadX++,
     
    65306600                                                           /* read character */
    65316601      wCell = *(pConsoleBuffer->ppszLine[ulReadY] + ulReadX * 2);
    6532      
     6602
    65336603                                                     /* @@@PH Ascii->Unicode */
    65346604      pchi->Char.UnicodeChar = (UCHAR)(wCell & 0x00FF);
     
    65366606    }
    65376607  }
    6538  
     6608
    65396609  return (TRUE);                                            /* OK, that's it */
    65406610}
     
    65516621 * Variables :
    65526622 * Result    :
    6553  * Remark    : 
     6623 * Remark    :
    65546624 * Status    : UNTESTED
    65556625 *
     
    65656635  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    65666636  ULONG          ulCounter;                     /* current character counter */
    6567  
     6637
    65686638#ifdef DEBUG_LOCAL2
    65696639  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputAttribute(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    65756645           lpcNumberRead);
    65766646#endif
    6577  
     6647
    65786648  if ( (dwReadCoord.X < 0) ||
    65796649       (dwReadCoord.Y < 0) )
     
    65816651    if (lpcNumberRead != NULL)                       /* ensure pointer is valid */
    65826652      *lpcNumberRead = 0;                            /* complete error handling */
    6583    
     6653
    65846654    SetLastError(ERROR_INVALID_PARAMETER);
    65856655    return (FALSE);
    65866656  }
    6587  
     6657
    65886658                                    /* check if dwReadCoord is within specs */
    65896659  if ( (dwReadCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    65926662    if (lpcNumberRead != NULL)                       /* ensure pointer is valid */
    65936663      *lpcNumberRead = 0;                            /* complete error handling */
    6594    
     6664
    65956665    SetLastError(ERROR_INVALID_PARAMETER);
    65966666    return (FALSE);
    65976667  }
    6598  
     6668
    65996669
    66006670                                        /* OK, now write the attribute lines */
     
    66086678      *(pConsoleBuffer->ppszLine[dwReadCoord.Y] +
    66096679                                (dwReadCoord.X * 2 + 1));
    6610    
     6680
    66116681    dwReadCoord.X++;                                 /* move write position */
    66126682    if (dwReadCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    66146684      dwReadCoord.X = 0;                               /* skip to next line */
    66156685      dwReadCoord.Y++;
    6616      
     6686
    66176687                         /* oops, we're at the end of the buffer. Abort now. */
    66186688      if (dwReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    66206690        if (lpcNumberRead != NULL)                   /* ensure pointer is valid */
    66216691          *lpcNumberRead = ulCounter;
    6622        
     6692
    66236693        return (TRUE);
    66246694      }
    66256695    }
    66266696  }
    6627  
     6697
    66286698  if (lpcNumberRead != NULL)                         /* ensure pointer is valid */
    66296699    *lpcNumberRead = cReadCells;
    6630  
     6700
    66316701  return (TRUE);
    66326702}
     
    66436713 * Variables :
    66446714 * Result    :
    6645  * Remark    : 
     6715 * Remark    :
    66466716 * Status    : UNTESTED
    66476717 *
     
    66576727  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    66586728  ULONG          ulCounter;                     /* current character counter */
    6659  
     6729
    66606730#ifdef DEBUG_LOCAL2
    66616731  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputCharacterA(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    66676737           lpcNumberRead);
    66686738#endif
    6669  
     6739
    66706740  if ( (coordReadCoord.X < 0) ||
    66716741       (coordReadCoord.Y < 0) )
     
    66736743    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    66746744      *lpcNumberRead = 0;                         /* complete error handling */
    6675    
     6745
    66766746    SetLastError(ERROR_INVALID_PARAMETER);
    66776747    return (FALSE);
    66786748  }
    6679  
     6749
    66806750                                  /* check if coordReadCoord is within specs */
    66816751  if ( (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    66846754    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    66856755      *lpcNumberRead = 0;                         /* complete error handling */
    6686    
     6756
    66876757    SetLastError(ERROR_INVALID_PARAMETER);
    66886758    return (FALSE);
    66896759  }
    6690  
     6760
    66916761
    66926762                                        /* OK, now write the attribute lines */
     
    67006770      *(pConsoleBuffer->ppszLine[coordReadCoord.Y] +
    67016771                                (coordReadCoord.X * 2));
    6702    
     6772
    67036773    coordReadCoord.X++;                               /* move write position */
    67046774    if (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    67066776      coordReadCoord.X = 0;                             /* skip to next line */
    67076777      coordReadCoord.Y++;
    6708      
     6778
    67096779                         /* oops, we're at the end of the buffer. Abort now. */
    67106780      if (coordReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    67126782        if (lpcNumberRead != NULL)                /* ensure pointer is valid */
    67136783          *lpcNumberRead = ulCounter;
    6714        
     6784
    67156785        return (TRUE);
    67166786      }
    67176787    }
    67186788  }
    6719  
     6789
    67206790  if (lpcNumberRead != NULL)                         /* ensure pointer is valid */
    67216791    *lpcNumberRead = cchRead;
    6722  
     6792
    67236793  return (TRUE);
    67246794}
     
    67356805 * Variables :
    67366806 * Result    :
    6737  * Remark    : 
     6807 * Remark    :
    67386808 * Status    : UNTESTED
    67396809 *
     
    67496819  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    67506820  ULONG          ulCounter;                     /* current character counter */
    6751  
     6821
    67526822#ifdef DEBUG_LOCAL2
    67536823  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputCharacterW(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    67596829           lpcNumberRead);
    67606830#endif
    6761  
     6831
    67626832  if ( (coordReadCoord.X < 0) ||
    67636833       (coordReadCoord.Y < 0) )
     
    67656835    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    67666836      *lpcNumberRead = 0;                         /* complete error handling */
    6767    
     6837
    67686838    SetLastError(ERROR_INVALID_PARAMETER);
    67696839    return (FALSE);
    67706840  }
    6771  
     6841
    67726842                                  /* check if coordReadCoord is within specs */
    67736843  if ( (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    67766846    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    67776847      *lpcNumberRead = 0;                         /* complete error handling */
    6778    
     6848
    67796849    SetLastError(ERROR_INVALID_PARAMETER);
    67806850    return (FALSE);
    67816851  }
    6782  
     6852
    67836853
    67846854                                        /* OK, now write the attribute lines */
     
    67936863      *(pConsoleBuffer->ppszLine[coordReadCoord.Y] +
    67946864                                (coordReadCoord.X * 2));
    6795    
     6865
    67966866    coordReadCoord.X++;                               /* move write position */
    67976867    if (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    67996869      coordReadCoord.X = 0;                             /* skip to next line */
    68006870      coordReadCoord.Y++;
    6801      
     6871
    68026872                         /* oops, we're at the end of the buffer. Abort now. */
    68036873      if (coordReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    68056875        if (lpcNumberRead != NULL)                /* ensure pointer is valid */
    68066876          *lpcNumberRead = ulCounter;
    6807        
     6877
    68086878        return (TRUE);
    68096879      }
    68106880    }
    68116881  }
    6812  
     6882
    68136883  if (lpcNumberRead != NULL)                         /* ensure pointer is valid */
    68146884    *lpcNumberRead = cchRead;
    6815  
     6885
    68166886  return (TRUE);
    68176887}
     
    68516921  WORD           wAttr;                      /* fill character and attribute */
    68526922  int            iBlitDirection;             /* to handle overlapped buffers */
    6853  
     6923
    68546924#ifdef DEBUG_LOCAL2
    68556925  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ScrollConsoleScreenBufferA(%08x,%08x,%08x,x=%u y=%u,%08x).\n",
     
    68616931           pchiFill);
    68626932#endif
    6863  
     6933
    68646934                                   /* calculate effective clipping rectangle */
    68656935  if (psrctClipRect != NULL)          /* if clipping rectangle was specified */
     
    68686938           psrctClipRect,
    68696939           sizeof (SMALL_RECT) );
    6870      
     6940
    68716941                                          /* check boundary with buffer size */
    68726942    srctView.Left   = max(0, srctView.Left);
     
    68826952    srctView.Bottom = pConsoleBuffer->coordBufferSize.Y;
    68836953  }
    6884  
     6954
    68856955  memcpy(&srctSource,                               /* copy source rectangle */
    68866956         psrctSourceRect,
     
    68916961  srctSource.Right  = min(srctSource.Right, srctView.Right );
    68926962  srctSource.Bottom = min(srctSource.Bottom,srctView.Bottom);
    6893  
     6963
    68946964  srctDest.Left  = max(srctView.Left,   coordDestOrigin.X);
    68956965  srctDest.Top   = max(srctView.Top,    coordDestOrigin.Y);
    68966966  srctDest.Right = min(srctView.Right,  srctDest.Left + srctSource.Right  - srctSource.Left);
    68976967  srctDest.Bottom= min(srctView.Bottom, srctDest.Top  + srctSource.Bottom - srctSource.Top);
    6898  
     6968
    68996969  /****************************
    69006970   * first copy the rectangle *
    69016971   ****************************/
    6902  
     6972
    69036973  if (srctDest.Left >  srctSource.Left) iBlitDirection  = 0;
    69046974  else                                  iBlitDirection  = 1;
    69056975  if (srctDest.Top  >  srctSource.Top)  iBlitDirection += 2;
    6906  
     6976
    69076977                               /* this leaves us with three different cases: */
    69086978                               /*                                            */
     
    69236993      {
    69246994                         /* calculate pointer to start of target screen line */
    6925         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
     6995        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
    69266996                               (srctDest.Left << 1) );
    6927        
     6997
    69286998                         /* calculate pointer to start of source screen line */
    6929         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
     6999        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
    69307000                               (srctSource.Left << 1) );
    6931        
     7001
    69327002        for (iX = srctDest.Left;
    69337003             iX <= srctDest.Right;
     
    69387008      }
    69397009      break;
    6940  
     7010
    69417011    /***************
    69427012     * upper right *
     
    69487018      {
    69497019                           /* calculate pointer to end of target screen line */
    6950         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
     7020        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
    69517021                               ( srctDest.Right << 1) );
    6952        
     7022
    69537023                           /* calculate pointer to end of source screen line */
    6954         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
     7024        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
    69557025                               ( srctSource.Right << 1) );
    6956        
     7026
    69577027        for (iX = srctDest.Right;
    69587028             iX >= srctDest.Left;
     
    69637033      }
    69647034      break;
    6965    
     7035
    69667036    /***************
    69677037     * lower left  *
     
    69737043      {
    69747044                         /* calculate pointer to start of target screen line */
    6975         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
     7045        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
    69767046                               (srctDest.Left << 1) );
    6977        
     7047
    69787048                         /* calculate pointer to start of source screen line */
    6979         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
     7049        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
    69807050                               (srctSource.Left << 1) );
    6981        
     7051
    69827052        for (iX = srctDest.Left;
    69837053             iX <= srctDest.Right;
     
    69987068      {
    69997069                           /* calculate pointer to end of target screen line */
    7000         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
     7070        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
    70017071                               ( srctDest.Right << 1) );
    7002        
     7072
    70037073                           /* calculate pointer to end of source screen line */
    7004         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
     7074        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
    70057075                               (srctSource.Right << 1) );
    7006        
     7076
    70077077        for (iX = srctDest.Right;
    70087078             iX >= srctDest.Left;
     
    70147084      break;
    70157085  }
    7016    
    7017    
     7086
     7087
    70187088              /* this is the character and attribute for the uncovered cells */
    70197089  wAttr = (pchiFill->Char.AsciiChar) + (pchiFill->Attributes << 8);
     
    70247094  {
    70257095    pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY] + srctSource.Left);
    7026    
     7096
    70277097    for (iX = srctSource.Left;
    70287098         iX < srctSource.Right;
     
    70397109        *pusTarget = wAttr;            /* write fill character and attribute */
    70407110  }
    7041  
     7111
    70427112                                          /* update screen if active console */
    70437113  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
     
    70797149  PUSHORT        pusTarget, pusSource;      /* pointer to source, dest cells */
    70807150  WORD           wAttr;                      /* fill character and attribute */
    7081  
     7151
    70827152#ifdef DEBUG_LOCAL2
    70837153  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ScrollConsoleScreenBufferW(%08x,%08x,%08x,x=%u y=%u,%08x).\n",
     
    70897159           pchiFill);
    70907160#endif
    7091  
     7161
    70927162                                   /* calculate effective clipping rectangle */
    70937163  if (psrctClipRect != NULL)          /* if clipping rectangle was specified */
     
    70967166           psrctClipRect,
    70977167           sizeof (SMALL_RECT) );
    7098      
     7168
    70997169                                          /* check boundary with buffer size */
    71007170    srctView.Left   = max(0, srctView.Left);
     
    71107180    srctView.Bottom = pConsoleBuffer->coordBufferSize.Y;
    71117181  }
    7112  
     7182
    71137183  memcpy(&srctSource,                               /* copy source rectangle */
    71147184         psrctSourceRect,
     
    71197189  srctSource.Right  = min(srctSource.Right, srctView.Right );
    71207190  srctSource.Bottom = min(srctSource.Bottom,srctView.Bottom);
    7121  
     7191
    71227192  srctDest.Left  = max(srctView.Left,   coordDestOrigin.X);
    71237193  srctDest.Top   = max(srctView.Top,    coordDestOrigin.Y);
    71247194  srctDest.Right = min(srctView.Right,  srctDest.Left + srctSource.Right  - srctSource.Left);
    71257195  srctDest.Bottom= min(srctView.Bottom, srctDest.Top  + srctSource.Bottom - srctSource.Top);
    7126  
     7196
    71277197  /* first copy the rectangle */
    71287198  for (ulY = 0;
     
    71317201  {
    71327202                         /* calculate pointer to start of target screen line */
    7133     pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctDest.Top] + 
     7203    pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctDest.Top] +
    71347204                           srctDest.Left);
    7135    
     7205
    71367206                         /* calculate pointer to start of source screen line */
    7137     pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctSource.Top] + 
     7207    pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctSource.Top] +
    71387208                           srctSource.Left);
    7139    
     7209
    71407210    for (ulX = srctDest.Left;
    71417211         ulX < srctDest.Right;
     
    71457215      *pusTarget = *pusSource;                             /* copy character */
    71467216  }
    7147  
    7148  
     7217
     7218
    71497219              /* this is the character and attribute for the uncovered cells */
    71507220  /* @@@PH Unicode->Ascii translation */
     
    71567226  {
    71577227    pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY] + srctSource.Left);
    7158    
     7228
    71597229    for (ulX = srctSource.Left;
    71607230         ulX < srctSource.Right;
     
    71637233      *pusTarget = wAttr;              /* write fill character and attribute */
    71647234  }
    7165  
     7235
    71667236                                          /* update screen if active console */
    71677237  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    71687238    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7169  
     7239
    71707240  return (TRUE);
    71717241}
     
    71797249 * Variables :
    71807250 * Result    :
    7181  * Remark    : 
     7251 * Remark    :
    71827252 * Status    : UNTESTED
    71837253 *
     
    71897259{
    71907260  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7191  
     7261
    71927262#ifdef DEBUG_LOCAL2
    71937263  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleCursorInfo(%08x,%08x).\n",
     
    71957265           pCCI);
    71967266#endif
    7197  
     7267
    71987268                                                       /* validate structure */
    71997269  if ( (pCCI->dwSize < 1) ||
     
    72037273    return (FALSE);                                            /* API failed */
    72047274  }
    7205  
     7275
    72067276              /* if we're the active buffer, remove cursor from screen first */
    72077277  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    72087278    ConsoleCursorShow(pConsoleBuffer,
    72097279                      CONSOLECURSOR_HIDE);
    7210    
     7280
    72117281  memcpy(&pConsoleBuffer->CursorInfo,    /* copy the whole information block */
    72127282         pCCI,
    72137283         sizeof (pConsoleBuffer->CursorInfo) );
    7214    
     7284
    72157285  return (TRUE);
    72167286}
     
    72247294 * Variables :
    72257295 * Result    :
    7226  * Remark    : 
     7296 * Remark    :
    72277297 * Status    : UNTESTED
    72287298 *
     
    72347304{
    72357305  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7236  
     7306
    72377307#ifdef DEBUG_LOCAL2
    72387308  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleCursorPosition(%08x,x=%u.y=%u).\n",
     
    72417311           coordCursorPosition.Y);
    72427312#endif
    7243  
     7313
    72447314                                  /* @@@PH remove cursor from screen first ! */
    72457315  pConsoleBuffer->coordCursorPosition = coordCursorPosition;
    7246  
     7316
    72477317  return (TRUE);
    72487318}
     
    72567326 * Variables :
    72577327 * Result    :
    7258  * Remark    : 
     7328 * Remark    :
    72597329 * Status    : UNTESTED
    72607330 *
     
    72667336{
    72677337  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7268  
     7338
    72697339#ifdef DEBUG_LOCAL2
    72707340  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleMode(%08x,%08x).\n",
     
    72727342           dwMode);
    72737343#endif
    7274  
     7344
    72757345  pConsoleBuffer->dwConsoleMode = dwMode;        /* set current console mode */
    7276  
     7346
    72777347  return (TRUE);
    72787348}
     
    72877357 * Variables :
    72887358 * Result    :
    7289  * Remark    : 
     7359 * Remark    :
    72907360 * Status    : UNTESTED
    72917361 *
     
    73007370  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    73017371  ULONG ulLine;                                        /* line index counter */
    7302  
     7372
    73037373#ifdef DEBUG_LOCAL2
    73047374  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleScreenBufferSize(%u,%u).\n",
     
    73067376           coordSize.Y);
    73077377#endif
    7308  
    7309  
     7378
     7379
    73107380                                 /* re-allocate the whole line-pointer array */
    73117381  ulSize = coordSize.Y * (coordSize.X * 2 + sizeof (PSZ) );
     
    73147384    if (pConsoleBuffer->ppszLine != NULL)        /* if old buffer is present */
    73157385      free (pConsoleBuffer->ppszLine);                    /* free old buffer */
    7316    
     7386
    73177387    pConsoleBuffer->ppszLine          = NULL;
    73187388    pConsoleBuffer->coordBufferSize.X = 0;
     
    73227392    pConsoleBuffer->coordWindowPosition.X = 0;
    73237393    pConsoleBuffer->coordWindowPosition.Y = 0;
    7324    
     7394
    73257395    return (TRUE);                                                     /* OK */
    73267396  }
    73277397
    7328  
     7398
    73297399  ppszNew = (PSZ *) malloc(ulSize);                        /* allocate array */
    73307400  if (ppszNew == NULL)                            /* check proper allocation */
     
    73337403    return (FALSE);                                 /* raise error condition */
    73347404  }
    7335  
     7405
    73367406
    73377407  for (ulLine = 0;                               /* setup line pointer array */
     
    73497419                 ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 24) +
    73507420                 ((ULONG)' ' << 16) );
    7351  
     7421
    73527422                                                    /* scroll the line index */
    73537423  for (ulLine = 0;
     
    73577427                          (PUSHORT)(ppszNew[ulLine]),
    73587428                          coordSize.X);
    7359  
    7360  
    7361  
     7429
     7430
     7431
    73627432                                                   /* copy lines as required */
    73637433  if (pConsoleBuffer->ppszLine != NULL)         /* previous buffer present ? */
    73647434  {
    73657435    ULONG x, y;
    7366    
     7436
    73677437                                          /* copy old characters as required */
    73687438    x = min(pConsoleBuffer->coordBufferSize.X, coordSize.X);
    73697439    y = min(pConsoleBuffer->coordBufferSize.Y, coordSize.Y);
    7370    
     7440
    73717441    for (ulLine = 0;                                    /* copy line by line */
    73727442         ulLine < y;
     
    73757445             pConsoleBuffer->ppszLine[ulLine],
    73767446             x * 2);
    7377    
     7447
    73787448    free (pConsoleBuffer->ppszLine);    /* free previous screen buffer array */
    73797449  }
    7380  
     7450
    73817451
    73827452  pConsoleBuffer->ppszLine          = ppszNew;     /* poke in the new values */
     
    73857455  pConsoleBuffer->coordCursorPosition.X = 0;
    73867456  pConsoleBuffer->coordCursorPosition.Y = 0;
    7387  
     7457
    73887458  /* @@@PH to be changed ! */
    73897459  pConsoleBuffer->coordWindowSize.X = coordSize.X;                /* default */
     
    73957465  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    73967466    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7397  
     7467
    73987468  return TRUE;
    73997469}
     
    74017471
    74027472/*****************************************************************************
    7403  * Name      : 
    7404  * Purpose   : 
    7405  * Parameters: 
    7406  * Variables :
    7407  * Result    : 
    7408  * Remark    :
    7409  * Status    : 
     7473 * Name      :
     7474 * Purpose   :
     7475 * Parameters:
     7476 * Variables :
     7477 * Result    :
     7478 * Remark    :
     7479 * Status    :
    74107480 *
    74117481 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    74167486{
    74177487  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7418  
     7488
    74197489#ifdef DEBUG_LOCAL2
    74207490  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleTextAttribute(%u).\n",
    74217491           wAttr);
    74227492#endif
    7423  
     7493
    74247494  pConsoleBuffer->ucDefaultAttribute = (UCHAR)wAttr;
    74257495  return (TRUE);
     
    74287498
    74297499/*****************************************************************************
    7430  * Name      : 
    7431  * Purpose   : 
    7432  * Parameters: 
    7433  * Variables :
    7434  * Result    : 
    7435  * Remark    :
    7436  * Status    : 
     7500 * Name      :
     7501 * Purpose   :
     7502 * Parameters:
     7503 * Variables :
     7504 * Result    :
     7505 * Remark    :
     7506 * Status    :
    74377507 *
    74387508 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    74427512{
    74437513  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7444  
     7514
    74457515#ifdef DEBUG_LOCAL
    74467516  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleActiveScreenBuffer().\n");
    74477517#endif
    7448  
     7518
    74497519                              /* set new buffer handle to the global console */
    74507520  ConsoleGlobals.hConsoleBuffer  = pHMHandleData->hHandle;
    74517521  ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7452  
     7522
    74537523  return (TRUE);
    74547524}
     
    74637533 * Variables :
    74647534 * Result    :
    7465  * Remark    : 
     7535 * Remark    :
    74667536 * Status    : UNTESTED
    74677537 *
     
    74747544{
    74757545  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7476  
     7546
    74777547#ifdef DEBUG_LOCAL2
    74787548  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleWindowInfo(%08x,%u,%08x).\n",
     
    74817551           psrctWindowRect);
    74827552#endif
    7483  
     7553
    74847554  if (fAbsolute == TRUE)                  /* absolute coordinates provided ? */
    74857555  {
     
    74957565      return (FALSE);                                               /* error */
    74967566    }
    7497    
     7567
    74987568                                 /* check we don't go beyond screen buffer ! */
    74997569    if ( ((psrctWindowRect->Right  - psrctWindowRect->Left) > pConsoleBuffer->coordBufferSize.X) ||
     
    75067576      return (FALSE);                                               /* error */
    75077577    }
    7508        
     7578
    75097579    pConsoleBuffer->coordWindowSize.X     = psrctWindowRect->Right -
    75107580                                            psrctWindowRect->Left;
    75117581    pConsoleBuffer->coordWindowSize.Y     = psrctWindowRect->Bottom -
    75127582                                            psrctWindowRect->Top;
    7513    
     7583
    75147584    pConsoleBuffer->coordWindowPosition.X = psrctWindowRect->Left;
    75157585    pConsoleBuffer->coordWindowPosition.Y = psrctWindowRect->Top;
     
    75217591    int iPosX;
    75227592    int iPosY;
    7523    
     7593
    75247594    iSizeX = pConsoleBuffer->coordWindowSize.X + psrctWindowRect->Left + psrctWindowRect->Right;
    75257595    iSizeY = pConsoleBuffer->coordWindowSize.Y + psrctWindowRect->Top  + psrctWindowRect->Bottom;
    75267596    iPosX  = pConsoleBuffer->coordWindowPosition.X  + psrctWindowRect->Left;
    75277597    iPosY  = pConsoleBuffer->coordWindowPosition.Y  + psrctWindowRect->Top;
    7528    
     7598
    75297599                                 /* check we don't go beyond screen buffer ! */
    75307600    if ( (iSizeX > pConsoleBuffer->coordBufferSize.X) ||
     
    75417611      return (FALSE);                                               /* error */
    75427612    }
    7543  
     7613
    75447614                                       /* Values are verified for being OK ! */
    75457615    pConsoleBuffer->coordWindowPosition.X  = iPosX;
     
    75487618    pConsoleBuffer->coordWindowSize.Y = iSizeY;
    75497619  }
    7550  
     7620
    75517621  /* update window */
    7552   /* @@@PH 
    7553    
     7622  /* @@@PH
     7623
    75547624   ConsoleWindowResize(COORD coordWindowSize,
    75557625                       COORD coordWindowPos,
    7556    
     7626
    75577627   */
    7558  
     7628
    75597629                                          /* update window contents (scroll) */
    75607630                                          /* update screen if active console */
     
    75767646 * Variables :
    75777647 * Result    :
    7578  * Remark    : 
     7648 * Remark    :
    75797649 * Status    : UNTESTED
    75807650 *
     
    75897659{
    75907660  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7591  
     7661
    75927662#ifdef DEBUG_LOCAL2
    75937663  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleA(%08x,%08x,%u,%08x,%08x).\n",
     
    75987668           lpvReserved);
    75997669#endif
    7600  
     7670
    76017671  /* simply forward the request to that routine */
    76027672  return (HMDeviceConsoleBufferClass::WriteFile(pHMHandleData,
     
    76187688 * Variables :
    76197689 * Result    :
    7620  * Remark    : 
     7690 * Remark    :
    76217691 * Status    : UNTESTED
    76227692 *
     
    76317701{
    76327702  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7633  
     7703
    76347704#ifdef DEBUG_LOCAL2
    76357705  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleW(%08x,%08x,%u,%08x,%08x).\n",
     
    76407710           lpvReserved);
    76417711#endif
    7642  
     7712
    76437713  /* @@@PH AScii -> unicode translation */
    7644  
     7714
    76457715  /* simply forward the request to that routine */
    76467716  return (HMDeviceConsoleBufferClass::WriteFile(pHMHandleData,
     
    76627732 * Variables :
    76637733 * Result    :
    7664  * Remark    : 
     7734 * Remark    :
    76657735 * Status    : UNTESTED
    76667736 *
     
    76797749  ULONG ulWriteX, ulWriteY;                    /* position data is read from */
    76807750  WORD  wCell;                                        /* currently read data */
    7681  
     7751
    76827752  PCHAR_INFO pchi;
    76837753  PSZ        pszTarget;
    7684  
     7754
    76857755#ifdef DEBUG_LOCAL2
    76867756  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputA(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    76937763           psrctDestRect);
    76947764#endif
    7695  
    7696  
     7765
     7766
    76977767  /* verify psrctDestRect first */
    76987768  psrctDestRect->Left  = max(psrctDestRect->Left,  0);
     
    77007770  psrctDestRect->Right = min(psrctDestRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    77017771  psrctDestRect->Bottom= min(psrctDestRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    7702  
     7772
    77037773                                                     /* verify target buffer */
    77047774  if ( (coordSrcBufferSize.X < coordSrcBufferCoord.X) ||
     
    77087778    return (FALSE);                                            /* API failed */
    77097779  }
    7710  
     7780
    77117781  ulCX = coordSrcBufferSize.X - coordSrcBufferCoord.X;
    77127782  ulCY = coordSrcBufferSize.Y - coordSrcBufferCoord.Y;
    7713  
     7783
    77147784  ulCX = min(ulCX, (psrctDestRect->Right  - psrctDestRect->Left));
    77157785  ulCY = min(ulCY, (psrctDestRect->Bottom - psrctDestRect->Top));
    7716  
     7786
    77177787                                  /* final calculation of the copy rectangle */
    77187788  psrctDestRect->Right  = psrctDestRect->Left + ulCX;
    77197789  psrctDestRect->Bottom = psrctDestRect->Top  + ulCY;
    7720  
    7721  
     7790
     7791
    77227792  for (ulY = 0,
    77237793       ulWriteY = psrctDestRect->Top;
    7724        
     7794
    77257795       ulY <= ulCY;
    7726        
     7796
    77277797       ulY++,
    77287798       ulWriteY++)
     
    77317801                          + sizeof(CHAR_INFO) * (coordSrcBufferCoord.Y + ulY)
    77327802                            * coordSrcBufferSize.X;
    7733    
     7803
    77347804                                /* calculate pointer to start of screen line */
    77357805    pszTarget = pConsoleBuffer->ppszLine[ulWriteY] + psrctDestRect->Left;
    7736    
     7806
    77377807    for (ulX = 0,
    77387808         ulWriteX = psrctDestRect->Left;
    7739          
     7809
    77407810         ulX <= ulCX;
    7741          
     7811
    77427812         ulX++,
    77437813         ulWriteX++,
     
    77497819    }
    77507820  }
    7751  
     7821
    77527822                                          /* update screen if active console */
    77537823  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    77547824    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7755    
     7825
    77567826  return (TRUE);                                            /* OK, that's it */
    77577827}
     
    77687838 * Variables :
    77697839 * Result    :
    7770  * Remark    : 
     7840 * Remark    :
    77717841 * Status    : UNTESTED
    77727842 *
     
    77857855  ULONG ulWriteX, ulWriteY;                    /* position data is read from */
    77867856  WORD  wCell;                                        /* currently read data */
    7787  
     7857
    77887858  PCHAR_INFO pchi;
    77897859  PSZ        pszTarget;
    7790  
     7860
    77917861#ifdef DEBUG_LOCAL2
    77927862  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputW(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    77997869           psrctDestRect);
    78007870#endif
    7801  
    7802  
     7871
     7872
    78037873  /* verify psrctDestRect first */
    78047874  psrctDestRect->Left  = max(psrctDestRect->Left,  0);
     
    78067876  psrctDestRect->Right = min(psrctDestRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    78077877  psrctDestRect->Bottom= min(psrctDestRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    7808  
     7878
    78097879                                                     /* verify target buffer */
    78107880  if ( (coordSrcBufferSize.X < coordSrcBufferCoord.X) ||
     
    78147884    return (FALSE);                                            /* API failed */
    78157885  }
    7816  
     7886
    78177887  ulCX = coordSrcBufferSize.X - coordSrcBufferCoord.X;
    78187888  ulCY = coordSrcBufferSize.Y - coordSrcBufferCoord.Y;
    7819  
     7889
    78207890  ulCX = min(ulCX, (psrctDestRect->Right  - psrctDestRect->Left));
    78217891  ulCY = min(ulCY, (psrctDestRect->Bottom - psrctDestRect->Top));
    7822  
     7892
    78237893                                  /* final calculation of the copy rectangle */
    78247894  psrctDestRect->Right  = psrctDestRect->Left + ulCX;
    78257895  psrctDestRect->Bottom = psrctDestRect->Top  + ulCY;
    7826  
    7827  
     7896
     7897
    78287898  for (ulY = 0,
    78297899       ulWriteY = psrctDestRect->Top;
    7830        
     7900
    78317901       ulY <= ulCY;
    7832        
     7902
    78337903       ulY++,
    78347904       ulWriteY++)
     
    78377907                          + sizeof(CHAR_INFO) * (coordSrcBufferCoord.Y + ulY)
    78387908                            * coordSrcBufferSize.X;
    7839    
     7909
    78407910                                /* calculate pointer to start of screen line */
    78417911    pszTarget = pConsoleBuffer->ppszLine[ulWriteY] + psrctDestRect->Left;
    7842    
     7912
    78437913    for (ulX = 0,
    78447914         ulWriteX = psrctDestRect->Left;
    7845          
     7915
    78467916         ulX <= ulCX;
    7847          
     7917
    78487918         ulX++,
    78497919         ulWriteX++,
     
    78557925    }
    78567926  }
    7857  
     7927
    78587928                                          /* update screen if active console */
    78597929  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    78607930    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7861    
     7931
    78627932  return (TRUE);                                            /* OK, that's it */
    78637933}
     
    78747944 * Variables :
    78757945 * Result    :
    7876  * Remark    : 
     7946 * Remark    :
    78777947 * Status    : UNTESTED
    78787948 *
     
    78887958  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    78897959  ULONG          ulCounter;                     /* current character counter */
    7890  
     7960
    78917961#ifdef DEBUG_LOCAL2
    78927962  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputAttribute(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    79007970           lpcWritten);
    79017971#endif
    7902  
     7972
    79037973  if ( (dwWriteCoord.X < 0) ||
    79047974       (dwWriteCoord.Y < 0) )
     
    79067976    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    79077977      *lpcWritten = 0;                            /* complete error handling */
    7908    
     7978
    79097979    SetLastError(ERROR_INVALID_PARAMETER);
    79107980    return (FALSE);
    79117981  }
    7912  
     7982
    79137983                                    /* check if dwWriteCoord is within specs */
    79147984  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    79177987    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    79187988      *lpcWritten = 0;                            /* complete error handling */
    7919    
     7989
    79207990    SetLastError(ERROR_INVALID_PARAMETER);
    79217991    return (FALSE);
    79227992  }
    7923  
     7993
    79247994
    79257995                                        /* OK, now write the attribute lines */
     
    79338003                              (dwWriteCoord.X * 2 + 1)
    79348004     ) = (UCHAR)*lpwAttribute;           /* write attribute and skip to next */
    7935    
     8005
    79368006    dwWriteCoord.X++;                                 /* move write position */
    79378007    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    79398009      dwWriteCoord.X = 0;                               /* skip to next line */
    79408010      dwWriteCoord.Y++;
    7941      
     8011
    79428012                         /* oops, we're at the end of the buffer. Abort now. */
    79438013      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    79458015        if (lpcWritten != NULL)                   /* ensure pointer is valid */
    79468016          *lpcWritten = ulCounter;
    7947        
     8017
    79488018                                          /* update screen if active console */
    79498019        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    79508020          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    7951        
     8021
    79528022        return (TRUE);
    79538023      }
    79548024    }
    79558025  }
    7956  
     8026
    79578027                                          /* update screen if active console */
    79588028  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    79598029    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7960  
     8030
    79618031  if (lpcWritten != NULL)                         /* ensure pointer is valid */
    79628032    *lpcWritten = cWriteCells;
    7963  
     8033
    79648034  return (TRUE);
    79658035}
     
    79768046 * Variables :
    79778047 * Result    :
    7978  * Remark    : 
     8048 * Remark    :
    79798049 * Status    : UNTESTED
    79808050 *
     
    79908060  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    79918061  ULONG          ulCounter;                     /* current character counter */
    7992  
     8062
    79938063#ifdef DEBUG_LOCAL2
    79948064  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputCharacterA(%08x,pstr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    80008070           lpcWritten);
    80018071#endif
    8002  
     8072
    80038073  if ( (dwWriteCoord.X < 0) ||
    80048074       (dwWriteCoord.Y < 0) )
     
    80068076    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    80078077      *lpcWritten = 0;                            /* complete error handling */
    8008    
     8078
    80098079    SetLastError(ERROR_INVALID_PARAMETER);
    80108080    return (FALSE);
    80118081  }
    8012  
     8082
    80138083                                    /* check if dwWriteCoord is within specs */
    80148084  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    80178087    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    80188088      *lpcWritten = 0;                            /* complete error handling */
    8019    
     8089
    80208090    SetLastError(ERROR_INVALID_PARAMETER);
    80218091    return (FALSE);
    80228092  }
    8023  
     8093
    80248094
    80258095                                        /* OK, now write the character lines */
     
    80338103                              (dwWriteCoord.X * 2)
    80348104     ) = (UCHAR)*lpWriteBuffer;          /* write character and skip to next */
    8035    
     8105
    80368106    dwWriteCoord.X++;                                 /* move write position */
    80378107    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    80398109      dwWriteCoord.X = 0;                               /* skip to next line */
    80408110      dwWriteCoord.Y++;
    8041      
     8111
    80428112                         /* oops, we're at the end of the buffer. Abort now. */
    80438113      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    80458115        if (lpcWritten != NULL)                   /* ensure pointer is valid */
    80468116          *lpcWritten = ulCounter;
    8047        
     8117
    80488118                                          /* update screen if active console */
    80498119        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    80508120          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    8051        
     8121
    80528122        return (TRUE);
    80538123      }
    80548124    }
    80558125  }
    8056  
     8126
    80578127                                          /* update screen if active console */
    80588128  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    80598129    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    8060  
     8130
    80618131  if (lpcWritten != NULL)                         /* ensure pointer is valid */
    80628132    *lpcWritten = cchWrite;
    8063  
     8133
    80648134  return (TRUE);
    80658135}
     
    80908160  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    80918161  ULONG          ulCounter;                     /* current character counter */
    8092  
     8162
    80938163#ifdef DEBUG_LOCAL2
    80948164  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputCharacterW(%08x,pstr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    81008170           lpcWritten);
    81018171#endif
    8102  
     8172
    81038173  if ( (dwWriteCoord.X < 0) ||
    81048174       (dwWriteCoord.Y < 0) )
     
    81068176    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    81078177      *lpcWritten = 0;                            /* complete error handling */
    8108    
     8178
    81098179    SetLastError(ERROR_INVALID_PARAMETER);
    81108180    return (FALSE);
    81118181  }
    8112  
     8182
    81138183                                    /* check if dwWriteCoord is within specs */
    81148184  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    81178187    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    81188188      *lpcWritten = 0;                            /* complete error handling */
    8119    
     8189
    81208190    SetLastError(ERROR_INVALID_PARAMETER);
    81218191    return (FALSE);
    81228192  }
    8123  
     8193
    81248194
    81258195                                        /* OK, now write the character lines */
     
    81348204     ) = (UCHAR)*lpWriteBuffer;          /* write character and skip to next */
    81358205                                       /* @@@PH unicode to ascii translation */
    8136    
     8206
    81378207    dwWriteCoord.X++;                                 /* move write position */
    81388208    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    81408210      dwWriteCoord.X = 0;                               /* skip to next line */
    81418211      dwWriteCoord.Y++;
    8142      
     8212
    81438213                         /* oops, we're at the end of the buffer. Abort now. */
    81448214      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    81468216        if (lpcWritten != NULL)                   /* ensure pointer is valid */
    81478217          *lpcWritten = ulCounter;
    8148        
     8218
    81498219                                          /* update screen if active console */
    81508220        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    81518221          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    8152        
     8222
    81538223        return (TRUE);
    81548224      }
    81558225    }
    81568226  }
    8157  
     8227
    81588228                                          /* update screen if active console */
    81598229  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    81608230    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    8161  
     8231
    81628232  if (lpcWritten != NULL)                         /* ensure pointer is valid */
    81638233    *lpcWritten = cchWrite;
    8164  
     8234
    81658235  return (TRUE);
    81668236}
Note: See TracChangeset for help on using the changeset viewer.