Ignore:
Timestamp:
Jun 1, 1999, 12:08:16 AM (26 years ago)
Author:
phaller
Message:

Code cleanup #1 for build, mainly addresses linkage problems

File:
1 edited

Legend:

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

    r4 r17  
    1 /* $Id: console.cpp,v 1.1 1999-05-24 20:19:43 ktk Exp $ */
    2 
    3 /*
    4  *
    5  * Project Odin Software License can be found in LICENSE.TXT
    6  *
    7  */
    81/*
    92 * Win32 Console API Translation for OS/2
     
    114 * 1998/02/10 Patrick Haller (haller@zebra.fh-weingarten.de)
    125 *
    13  * @(#) 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
    147 */
    158
     
    2720 * Remark                                                                    *
    2821 *****************************************************************************
    29 
     22 
    3023 - DWORD HandlerRoutine (DWORD dwCtrlType)
    3124   basically an exception handler routine. handles a few signals / excpts.
    3225   should be somewhere near the exception handling code ... :)
    33 
     26   
    3427   Hmm, however as PM applications don't really get a ctrl-c signal,
    3528   I'll have to do this on my own ...
    36 
     29 
    3730 - supply unicode<->ascii conversions for all the _A and _W function pairs.
    38 
     31 
    3932 - problem: we can't prevent thread1 from blocking the message queue ?
    4033            what will happen if a WinTerminate() is issued there ?
    4134            will the message queue be closed and provide smooth tasking ?
    4235            how will open32 react on this ?
    43 
     36 
    4437 - ECHO_LINE_INPUT / ReadFile blocks till CR
    45 
     38 
    4639 - scrollbars
    4740 * do some flowchart to exactly determine WHEN to use WHICH setting
    4841   and perform WHAT action
    49 
     42 
    5043 - clipboard support
    5144*/
    52 
     45 
    5346
    5447/*****************************************************************************
     
    6962#include <stdlib.h>
    7063#include <string.h>
     64#include <odin.h>
     65
    7166#include "win32type.h"
     67#include "unicode.h"
    7268#include "misc.h"
     69#include "HandleManager.h"
    7370#include "console.h"
    7471#include "console2.h"
    7572#include "conprop.h"
    76 #include "unicode.h"
    77 #include "HandleManager.h"
    7873
    7974
     
    8277 ***********************************/
    8378
    84 extern "C"
    85 {
    86   void   _System O32_SetLastError(DWORD  dwError);
    87   DWORD  _System O32_GetLastError(void);
    88   LPSTR  _System O32_GetCommandLine(void);
    89   void   _System O32_ReplaceExceptionHandler(void);
    90   void   _System O32_ExitProcess(UINT exitcode);
    91   HANDLE _System O32_GetStdHandle(DWORD dwDevice);
    92   DWORD  _System O32_GetFileType(HANDLE hFile);
     79extern "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);
    9388}
    9489
     
    185180 *****************************************************************************/
    186181
    187 
     182                                       
    188183static APIRET ConsoleTerminate(void);/* termination of the console subsystem */
    189184
     
    248243    HEV    hevConsole;                            /* console event semaphore */
    249244    APIRET rcConsole;                /* initialization status of the console */
    250     HAB    hab;                                       /* anchor block handle */
    251     HMQ    hmq;               /* message queue handle for the console window */
     245    HAB    hab;                                       /* anchor block handle */
     246    HMQ    hmq;               /* message queue handle for the console window */
    252247    QMSG   qmsg;                           /* message for the console window */
    253248    ULONG  flFrameFlags;                      /* frame window creation flags */
     
    255250    HWND   hwndFrame;                                 /* frame window handle */
    256251    HWND   hwndClient;                               /* client window handle */
    257 
     252 
    258253    HWND   hwndHorzScroll;                /* handle of horizontal scroll bar */
    259254    HWND   hwndVertScroll;                  /* handle of vertical scroll bar */
    260255    BOOL   fHasVertScroll;            /* indicates if scrollbars are visible */
    261256    BOOL   fHasHorzScroll;
    262 
     257 
    263258    HDC    hdcConsole;                             /* console device context */
    264259    PFNWP  pfnwpFrameOriginal;            /* original frame window procedure */
    265 
     260 
    266261    HWND     hwndMenuConsole;                          /* console popup menu */
    267262    HMODULE  hmodResource;           /* resources are stored in KERNEL32.DLL */
    268263    HPOINTER hPtrConsole;                                    /* console icon */
    269 
     264 
    270265    HANDLE hConsoleBuffer;            /* handle of the active console buffer */
    271266    HANDLE hConsoleBufferDefault;    /* handle of the default console buffer */
    272 
     267 
    273268    HVPS   hvpsConsole;                   /* console AVIO presentation space */
    274 
     269 
    275270    COORD  coordMaxWindowPels;              /* maximum window size in pixels */
    276271    COORD  coordWindowSize;                   /* current console window size */
    277272    COORD  coordWindowPos;                           /* scroller's positions */
    278 
     273 
    279274    SHORT  sCellCX; /* height and width of a avio cell with the current font */
    280275    SHORT  sCellCY;
    281 
     276 
    282277    BOOL   fUpdateRequired; /* set to TRUE if next WM_TIMER shall update the */
    283278                           /* AVIO presentation space from the consolebuffer */
     
    286281    ULONG  ulTimerFrequency;             /* cursor + blitter timer frequency */
    287282    ULONG  ulTimerCursor;                 /* cursor loop counter for divisor */
    288 
     283 
    289284    CONSOLEOPTIONS Options;            /* the console's options / properties */
    290285
     
    312307
    313308/*****************************************************************************
    314  * Name      :
    315  * Purpose   :
    316  * Parameters:
    317  * Variables :
    318  * Result    :
     309 * Name      : 
     310 * Purpose   : 
     311 * Parameters: 
     312 * Variables :
     313 * Result    : 
    319314 * Remark    :
    320  * Status    :
     315 * Status    : 
    321316 *
    322317 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    323318 *****************************************************************************/
    324319
    325 APIRET ConsoleInit(void)                /* creation of the console subsystem */
     320APIRET EXPORT ConsoleInit(void)         /* creation of the console subsystem */
    326321{
    327322  APIRET rc;                                              /* API return code */
    328323  ULONG  ulPostCount;                              /* semaphore post counter */
    329 
    330 
    331 
     324 
     325 
     326 
    332327  if (ConsoleGlobals.hevConsole != NULLHANDLE) /* we're already initialized ?*/
    333328    return (NO_ERROR);                             /* then abort immediately */
    334 
     329   
    335330                                 /* create console synchronization semaphore */
    336331  rc = DosCreateEventSem (NULL,
     
    340335  if (rc != NO_ERROR)                                       /* other error ? */
    341336    return (rc);                                    /* raise error condition */
    342 
    343 
     337 
     338 
    344339                                     /* create console input queue semaphore */
    345340  rc = DosCreateEventSem (NULL,
     
    352347    return (rc);                                    /* raise error condition */
    353348  }
    354 
     349 
    355350
    356351  /***************************************************************************
    357352   * Create pseudo-devices and initialize ConsoleGlobals                     *
    358353   ***************************************************************************/
    359 
     354 
    360355  rc = ConsoleDevicesRegister();                 /* ensure devices are there */
    361356  if (rc != NO_ERROR)                                    /* check for errors */
     
    365360    return (rc);                                    /* raise error condition */
    366361  }
    367 
    368 
     362 
     363 
    369364  /***************************************************************************
    370365   * Presentation Manager Initialization phase                               *
    371366   ***************************************************************************/
    372 
     367 
    373368    /* OK, we're about to initialize the console subsystem for this process. */
    374369                           /* start message thread for console object window */
     
    378373                                           NULL);
    379374                                   /* has the thread been created properly ? */
    380   if (ConsoleGlobals.tidConsole == -1)
     375  if (ConsoleGlobals.tidConsole == -1) 
    381376  {
    382377    DosCloseEventSem(ConsoleInput.hevInputQueue);   /* close other semaphore */
     
    390385                   ConsoleGlobals.Options.ulConsoleThreadPriorityDelta,
    391386                   ConsoleGlobals.tidConsole);
    392 
    393 
     387                   
     388 
    394389                      /* wait for the child thread to do it's initialization */
    395390                                              /* timeout isn't really useful */
     
    403398    return (rc);                                    /* raise error condition */
    404399  }
    405 
     400 
    406401  DosResetEventSem(ConsoleGlobals.hevConsole,       /* reset event semaphore */
    407402                   &ulPostCount);
    408 
     403 
    409404  rc = ConsoleGlobals.rcConsole;   /* pass thru console thread's return code */
    410 
     405 
    411406  return (rc);                                                         /* OK */
    412407}
     
    417412 * Purpose   : creates and registers console devices if the standard handles
    418413 *             are not redirected to a file
    419  * Parameters:
    420  * Variables :
    421  * Result    :
     414 * Parameters: 
     415 * Variables :
     416 * Result    : 
    422417 * Remark    :
    423  * Status    :
     418 * Status    : 
    424419 *
    425420 * Author    : Patrick Haller [Tue, 1998/03/17 01:55]
    426421 *****************************************************************************/
    427422
    428 APIRET ConsoleDevicesRegister(void)
     423APIRET EXPORT ConsoleDevicesRegister(void)
    429424{
    430425  DWORD  dwType;                                       /* device handle type */
     
    432427  HANDLE hStandardOut;                           /* stdout handle to CONOUT$ */
    433428  HANDLE hStandardError;                         /* stderr handle to CONOUT$ */
    434 
     429 
    435430  HMDeviceConsoleInClass     *pHMDeviceConsoleIn;
    436431  HMDeviceConsoleOutClass    *pHMDeviceConsoleOut;
    437432  HMDeviceConsoleBufferClass *pHMDeviceConsoleBuffer;
    438 
     433 
    439434  DWORD rc;
    440 
     435 
    441436  static fDevicesInitialized;          /* have we been initialized already ? */
    442 
     437 
    443438  if (fDevicesInitialized == TRUE)                 /* OK, we're already done */
    444439    return (NO_ERROR);
    445440  else
    446441    fDevicesInitialized = TRUE;
    447 
     442 
    448443  dprintf(("KERNEL32:ConsoleDevicesRegister\n"));
    449 
    450 
     444 
     445 
    451446  /*************************************
    452447   * Initialize Console Window Options *
     
    455450  ConsoleGlobals.Options.fTerminateAutomatically = FALSE;
    456451  ConsoleGlobals.Options.fSpeakerEnabled         = TRUE;
    457 
     452 
    458453  ConsoleGlobals.Options.fSetWindowPosition      = FALSE;
    459454  ConsoleGlobals.Options.coordDefaultPosition.X  = 0;
     
    465460  ConsoleGlobals.coordWindowPos.X                = 0;
    466461  ConsoleGlobals.coordWindowPos.Y                = 0;
    467 
     462 
    468463  ConsoleGlobals.Options.fQuickInsert            = FALSE;
    469464  ConsoleGlobals.Options.fInsertMode             = FALSE;
    470465  ConsoleGlobals.Options.fMouseActions           = FALSE;
    471   ConsoleGlobals.Options.fToolbarActive          = FALSE;
     466  ConsoleGlobals.Options.fToolbarActive          = FALSE;     
    472467
    473468  ConsoleGlobals.Options.ucDefaultAttribute = 0x0007;  /* 07 = grey on black */
    474 
     469 
    475470  ConsoleGlobals.Options.ulTabSize               = 8;      /* tabulator size */
    476471  ConsoleGlobals.Options.ulUpdateLimit           = 8; /* scroll max. n lines */
    477 
     472 
    478473                                     /* priority settings for message thread */
    479474  ConsoleGlobals.Options.ulConsoleThreadPriorityClass = PRTYC_REGULAR;
    480475  ConsoleGlobals.Options.ulConsoleThreadPriorityDelta = +10;
    481 
     476 
    482477  ConsoleGlobals.Options.ucCursorDivisor = 10; /* timer divisor for blinking */
    483 
     478 
    484479  ConsoleGlobals.ulTimerFrequency = 10;  /* cursor + blitter timer frequency */
    485480
    486 
     481 
    487482  ConsoleGlobals.flFrameFlags = FCF_SIZEBORDER   |   /* frame creation flags */
    488483                                FCF_TITLEBAR     |
     
    494489                                FCF_VERTSCROLL   |
    495490                                FCF_MINMAX;
    496 
     491 
    497492                                                   /* generate copy of title */
    498   ConsoleGlobals.pszWindowTitle = strdup(O32_GetCommandLine());
    499 
     493  ConsoleGlobals.pszWindowTitle = strdup(GetCommandLineA());
     494 
    500495                                    /* obtain module handle to our resources */
    501496  rc = DosQueryModuleHandle("KERNEL32",
     
    504499    WriteLog("KERNEL32/CONSOLE: Can't get handle to KERNEL32 (%u).\n",
    505500             rc);
    506 
     501 
    507502                                             /* standard console input modes */
    508503  ConsoleInput.dwConsoleMode = ENABLE_LINE_INPUT      |
    509504                               ENABLE_PROCESSED_INPUT;
    510505  /* @@@PH ENABLE_ECHO_INPUT || ENABLE_MOUSE_INPUT; */
    511 
     506   
    512507  ConsoleGlobals.hConsoleBufferDefault = INVALID_HANDLE_VALUE;
    513508  ConsoleGlobals.hConsoleBuffer        = INVALID_HANDLE_VALUE;
    514 
    515 
     509 
     510 
    516511  /***************************************************************************
    517512   * Standard handles     Initialization phase                               *
    518513   ***************************************************************************/
    519 
     514   
    520515                   /* create devices and register devices with handlemanager */
    521 
     516   
    522517    pHMDeviceConsoleIn  = new HMDeviceConsoleInClass("CONIN$");
    523518    rc = HMDeviceRegister ("CONIN$",
     
    526521      dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONIN$ failed with %u.\n",
    527522               rc));
    528 
    529 
     523   
     524   
    530525    pHMDeviceConsoleOut = new HMDeviceConsoleOutClass("CONOUT$");
    531526    rc = HMDeviceRegister ("CONOUT$",
     
    533528    if (rc != NO_ERROR)                                  /* check for errors */
    534529      dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONOUT$ failed with %u.\n",
    535                rc));
    536 
    537 
     530               rc));   
     531   
     532   
    538533    pHMDeviceConsoleBuffer = new HMDeviceConsoleBufferClass("CONBUFFER$");
    539534    rc = HMDeviceRegister ("CONBUFFER$",
     
    541536    if (rc != NO_ERROR)                                  /* check for errors */
    542537      dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONBUFFER$ failed with %u.\n",
    543                rc));
    544 
    545 
     538               rc));   
     539   
     540   
    546541      /***********************************************************************
    547542       * initialize stdin handle                                             *
    548543       ***********************************************************************/
    549       hStandardIn = O32_GetStdHandle(STD_INPUT_HANDLE);
    550       dwType = O32_GetFileType(hStandardIn);
     544      hStandardIn = GetStdHandle(STD_INPUT_HANDLE);
     545      dwType = GetFileType(hStandardIn);
    551546      if (dwType == FILE_TYPE_CHAR)                /* is handle redirected ? */
    552547        hStandardIn = HMCreateFile("CONIN$",
     
    557552                                   CONSOLE_TEXTMODE_BUFFER,
    558553                                   0);
    559 
     554   
    560555      HMSetStdHandle(STD_INPUT_HANDLE,
    561556                     hStandardIn);
    562 
     557       
    563558      /***********************************************************************
    564559       * initialize stdout handle                                            *
    565560       ***********************************************************************/
    566       hStandardOut = O32_GetStdHandle(STD_OUTPUT_HANDLE);
    567       dwType = O32_GetFileType(hStandardOut);
     561      hStandardOut = GetStdHandle(STD_OUTPUT_HANDLE);
     562      dwType = GetFileType(hStandardOut);
    568563      if (dwType == FILE_TYPE_CHAR)                /* is handle redirected ? */
    569564        hStandardOut = HMCreateFile("CONOUT$",
     
    573568                                   0,
    574569                                   CONSOLE_TEXTMODE_BUFFER,
    575                                    0);
    576 
     570                                   0);     
     571   
    577572      HMSetStdHandle(STD_OUTPUT_HANDLE,
    578573                     hStandardOut);
    579 
    580 
     574   
     575 
    581576      /***********************************************************************
    582577       * initialize stderr handle                                            *
    583578       ***********************************************************************/
    584       hStandardError = O32_GetStdHandle(STD_ERROR_HANDLE);
    585       dwType = O32_GetFileType(hStandardError);
     579      hStandardError = GetStdHandle(STD_ERROR_HANDLE);
     580      dwType = GetFileType(hStandardError);
    586581      if (dwType == FILE_TYPE_CHAR)                /* is handle redirected ? */
    587582        hStandardError = HMCreateFile("CONOUT$",
     
    592587                                   CONSOLE_TEXTMODE_BUFFER,
    593588                                   0);
    594 
     589   
    595590      HMSetStdHandle(STD_ERROR_HANDLE,
    596591                     hStandardError);
     
    610605 *             leak if an application keeps opening and closing the console
    611606 *             frequently.
    612  * Status    :
     607 * Status    : 
    613608 *
    614609 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    618613{
    619614  APIRET rc;
    620 
     615 
    621616  WinPostMsg (ConsoleGlobals.hwndFrame,         /* force thread to terminate */
    622617              WM_CLOSE,
     
    626621  rc = DosWaitThread(&ConsoleGlobals.tidConsole,/* wait until thd terminates */
    627622                     DCWW_WAIT);
    628 
     623 
    629624                                           /* close the consolebuffer handle */
    630   HMCloseHandle(ConsoleGlobals.hConsoleBufferDefault);
     625  HMCloseHandle(ConsoleGlobals.hConsoleBufferDefault); 
    631626  free(ConsoleGlobals.pszWindowTitle);   /* free previously allocated memory */
    632627
     
    640635 * Parameters: VOID
    641636 * Variables :
    642  * Result    :
    643  * Remark    :
    644  * Status    :
     637 * Result    : 
     638 * Remark    : 
     639 * Status    : 
    645640 *
    646641 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    647642 *****************************************************************************/
    648643
    649 void ConsoleWaitClose(void)
     644void EXPORT ConsoleWaitClose(void)
    650645{
    651646  CHAR szBuffer[128];                                /* buffer for the title */
    652647  BOOL fResult;                /* result from subsequent calls to Win32 APIs */
    653 
     648 
    654649                                /* check if there is a console window at all */
    655650  if (ConsoleIsActive() == FALSE)
    656651    return;                                                          /* nope */
    657 
     652 
    658653  strcpy (szBuffer,               /* indicate console process has terminated */
    659654          "Completed: ");
    660 
    661   fResult = GetConsoleTitleA(szBuffer + 11,/* 11 is length of Completed:_ */
     655 
     656  fResult = OS2GetConsoleTitleA(szBuffer + 11,/* 11 is length of Completed:_ */
    662657                                sizeof(szBuffer) - 11);
    663658
    664 
     659 
    665660                                /* Set new title: Win32 Console - Terminated */
    666   fResult = SetConsoleTitleA(szBuffer);
    667 
     661  fResult = OS2SetConsoleTitleA(szBuffer);
     662 
    668663                                          /* terminate console immediately ? */
    669664  if (ConsoleGlobals.Options.fTerminateAutomatically == FALSE)
     
    678673 * Parameters: VOID
    679674 * Variables :
    680  * Result    :
    681  * Remark    :
    682  * Status    :
     675 * Result    : 
     676 * Remark    : 
     677 * Status    : 
    683678 *
    684679 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    685680 *****************************************************************************/
    686681
    687 BOOL ConsoleIsActive(void)
     682BOOL EXPORT ConsoleIsActive(void)
    688683{
    689684  return (NULLHANDLE != ConsoleGlobals.hevConsole);
     
    698693 * Result    : is placed in Globals.rcConsole
    699694 * Remark    : the main thread has to wait for this thread
    700  * Status    :
     695 * Status    : 
    701696 *
    702697 * Author    : Patrick Haller [Tue, 1998/02/10 02:49]
     
    706701{
    707702  APIRET rc;                                              /* API return code */
    708 
    709 
     703 
     704 
    710705  ConsoleGlobals.rcConsole = NO_ERROR;                     /* initialization */
    711 
     706 
    712707  ConsoleGlobals.hab = WinInitialize(0);             /* enable thread for PM */
    713708  if (ConsoleGlobals.hab == NULLHANDLE) /* if anchor block allocation failed */
    714     ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
     709    ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;   
    715710  else
    716711  {
    717712                                                     /* create message queue */
    718     ConsoleGlobals.hmq = WinCreateMsgQueue(ConsoleGlobals.hab,
     713    ConsoleGlobals.hmq = WinCreateMsgQueue(ConsoleGlobals.hab, 
    719714                                           0);
    720715    if (ConsoleGlobals.hmq == NULLHANDLE)  /* if msg queue allocation failed */
    721716    {
    722717      WinTerminate(ConsoleGlobals.hab);     /* stop thread from accessing PM */
    723       ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
     718      ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY; 
    724719    }
    725720    else
     
    729724                           ConsoleWindowProc,
    730725                           CS_SIZEREDRAW,
    731                            0)
     726                           0) 
    732727          == FALSE)
    733728      {
     
    756751    } /* WinCreateMsgQueue */
    757752  } /* WinInitialize */
    758 
    759 
     753 
     754 
    760755  DosPostEventSem(ConsoleGlobals.hevConsole);      /* signal the main thread */
    761 
    762 
     756 
     757 
    763758  if (ConsoleGlobals.rcConsole != NO_ERROR)      /* if we ran into a problem */
    764759  {
     
    768763    return;                    /* abort the message queue thread immediately */
    769764  }
    770 
    771 
     765 
     766 
    772767  while( WinGetMsg(ConsoleGlobals.hab,                       /* message loop */
    773768                   &ConsoleGlobals.qmsg,
    774769                   NULLHANDLE,
    775770                   0,
    776                    0) )
     771                   0) ) 
    777772    WinDispatchMsg(ConsoleGlobals.hab,               /* dispatch the message */
    778773                   &ConsoleGlobals.qmsg);
    779 
     774 
    780775                                    /* do the cleanup, destroy window, queue */
    781776                                    /* and stop thread from using PM         */
    782   WinDestroyWindow  (ConsoleGlobals.hwndFrame);
    783   WinDestroyMsgQueue(ConsoleGlobals.hmq);
     777  WinDestroyWindow  (ConsoleGlobals.hwndFrame);   
     778  WinDestroyMsgQueue(ConsoleGlobals.hmq);         
    784779  WinTerminate      (ConsoleGlobals.hab);
    785 
     780 
    786781                   /* destruction of semaphore indicates console is shutdown */
    787782  DosCloseEventSem(ConsoleInput.hevInputQueue);     /* close other semaphore */
    788   DosCloseEventSem(ConsoleGlobals.hevConsole);
     783  DosCloseEventSem(ConsoleGlobals.hevConsole); 
    789784  ConsoleGlobals.hevConsole  = NULLHANDLE;          /* for ConsoleIsActive() */
    790785  ConsoleInput.hevInputQueue = NULLHANDLE;
    791 
     786 
    792787  /* @@@PH we've got to exit the process here ! */
    793   O32_ExitProcess(1);
     788  ExitProcess(1);
    794789}
    795790
     
    804799 * Variables :
    805800 * Result    : MRESULT for PM
    806  * Remark    :
    807  * Status    :
     801 * Remark    : 
     802 * Status    : 
    808803 *
    809804 * Author    : Patrick Haller [Tue, 1998/02/10 03:24]
     
    818813  static HPS   hps;
    819814
    820   switch(msg)
     815  switch(msg) 
    821816  {
    822817    /*************************************************************************
    823818     * WM_CREATE window creation                                             *
    824819     *************************************************************************/
    825 
     820   
    826821    case WM_CREATE:
    827822      WinPostMsg(hwnd,                            /* deferred initialization */
     
    830825                 (MPARAM)NULL);
    831826      break;
    832 
    833 
     827   
     828   
    834829    case UM_CONSOLE_CREATE:
    835830    {
     
    840835      hwndFrame = ConsoleGlobals.hwndFrame;
    841836      ConsoleGlobals.pfnwpFrameOriginal = WinSubclassWindow(hwndFrame,
    842                                                             ConsoleFrameWindowProc);
     837                                                            ConsoleFrameWindowProc);     
    843838
    844839      ConsoleGlobals.hwndMenuConsole
     
    855850                 (MPARAM)ConsoleGlobals.hPtrConsole,
    856851                 0L );
    857 
     852     
    858853               /* determine handles of the horizontal / vertical scroll bars */
    859854      ConsoleGlobals.hwndVertScroll = WinWindowFromID(ConsoleGlobals.hwndFrame,
    860855                                                      FID_VERTSCROLL);
    861 
     856     
    862857      ConsoleGlobals.hwndHorzScroll = WinWindowFromID(ConsoleGlobals.hwndFrame,
    863858                                                      FID_HORZSCROLL);
    864 
     859     
    865860                            /* the initial state of the controls is DETACHED */
    866861      WinSetParent(ConsoleGlobals.hwndHorzScroll,          /* detach control */
    867862                   HWND_OBJECT,
    868863                   FALSE);
    869 
     864     
    870865      WinSetParent(ConsoleGlobals.hwndVertScroll,          /* detach control */
    871866                   HWND_OBJECT,
    872                    FALSE);
    873 
    874 
     867                   FALSE);   
     868     
     869     
    875870                                           /* create AVIO presentation space */
    876871      rc = VioCreatePS(&ConsoleGlobals.hvpsConsole,
     
    883878        WriteLog("KERNEL32/CONSOLE:VioCreatePS=%u\n",
    884879                 rc);
    885 
     880     
    886881 /* PH 1998/02/12 this seems to be an OS/2 PM bug:
    887882    when doing a WinOpenWindowDC here, PM hangs. Seems it never gets back into
    888883    the message loop. To investigate and report to IBM
    889884  */
    890 
     885 
    891886                               /* get a device context for the client window */
    892887      ConsoleGlobals.hdcConsole = WinOpenWindowDC(hwnd);
     
    896891      if (rc != NO_ERROR)                                    /* check errors */
    897892        WriteLog("KERNEL32/CONSOLE:VioAssociate=%u\n",
    898                  rc);
     893                 rc);   
    899894
    900895      ConsoleFontQuery();                        /* query current cell sizes */
    901 
     896     
    902897                                          /* adjust window size and position */
    903898      HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
     
    906901                      0,
    907902                      0,
    908                       0);
    909 
     903                      0);     
     904     
    910905            /* @@@PH if console is maximized - now switched on per default ! */
    911       WinSetWindowPos (ConsoleGlobals.hwndFrame,
     906      WinSetWindowPos (ConsoleGlobals.hwndFrame, 
    912907                       HWND_DESKTOP,
    913908                       0,
     
    921916                         2 * WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER),
    922917                       SWP_SIZE);
    923 
     918     
    924919                             /* do we have to set the window position also ? */
    925920      if (ConsoleGlobals.Options.fSetWindowPosition == TRUE)
    926         WinSetWindowPos (ConsoleGlobals.hwndFrame,
     921        WinSetWindowPos (ConsoleGlobals.hwndFrame,   
    927922                         HWND_DESKTOP,
    928923                         ConsoleGlobals.Options.coordDefaultPosition.X,
     
    931926                         0,
    932927                         SWP_MOVE);
    933 
     928     
    934929                     /* start timer service for blitting and cursor blinking */
    935930      ConsoleGlobals.idTimer = WinStartTimer (ConsoleGlobals.hab,
    936                                               hwnd,
     931                                              hwnd,     
    937932                                              CONSOLE_TIMER_ID,  /* timer id */
    938933                                              ConsoleGlobals.ulTimerFrequency);
     
    944939    }
    945940    break;
    946 
    947 
     941   
     942   
    948943    /*************************************************************************
    949944     * WM_DESTROY window destruction                                         *
    950945     *************************************************************************/
    951 
     946   
    952947    case WM_DESTROY:
    953948      WinStopTimer (ConsoleGlobals.hab,                      /* anchor block */
    954949                    hwnd,
    955950                    ConsoleGlobals.idTimer);                     /* timer ID */
    956 
     951   
    957952      VioAssociate(NULL,
    958953                   ConsoleGlobals.hvpsConsole); /* disassociates the AVIO PS */
    959954      VioDestroyPS(ConsoleGlobals.hvpsConsole); /* destroys the AVIO PS      */
    960 
     955   
    961956      WinDestroyWindow(ConsoleGlobals.hwndMenuConsole);
    962957      WinDestroyPointer(ConsoleGlobals.hPtrConsole);
    963958      break;
    964 
    965 
     959   
     960   
    966961    /*************************************************************************
    967962     * WM_TIMER display cursor and update AVIO PS if required                *
    968963     *************************************************************************/
    969 
     964   
    970965    case WM_TIMER:
    971966                                       /* check if console has to be updated */
     
    973968      {
    974969        ConsoleGlobals.fUpdateRequired = FALSE;     /* as soon as possible ! */
    975 
     970       
    976971                                /* as device to map itself to the VIO buffer */
    977972        HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
     
    981976                        0,
    982977                        0);
    983 
     978       
    984979        { /* DEBUG */
    985980          APIRET rc;
     
    989984                       0,
    990985                       ConsoleGlobals.hvpsConsole);
    991 
     986       
    992987          dprintf(("KERNEL32::Console::1 VioShowPS(%u,%u,%u)=%u\n",
    993988                   ConsoleGlobals.coordWindowSize.Y,
     
    996991                   rc));
    997992        }
    998 
     993         
    999994                                             /* cursor is overwritten here ! */
    1000995        HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
     
    1003998                        0,
    1004999                        0,
    1005                         0);
     1000                        0);     
    10061001      }
    10071002      else
     
    10221017      break;
    10231018
    1024 
     1019   
    10251020    /*************************************************************************
    10261021     * WM_MINMAXFRAME handle window repaint in case of iconized window       *
    10271022     *************************************************************************/
    1028 
     1023   
    10291024    case WM_MINMAXFRAME :
    10301025    {
    10311026      BOOL  fShow = ! (((PSWP) mp1)->fl & SWP_MINIMIZE);
    1032       HENUM henum;
     1027      HENUM henum; 
    10331028      HWND  hwndChild;
    10341029
     
    10431038    }
    10441039    break;
    1045 
    1046 
     1040   
     1041   
    10471042    /*************************************************************************
    10481043     * WM_PAINT repaint the window                                           *
     
    10601055                       0,
    10611056                       ConsoleGlobals.hvpsConsole);
    1062 
     1057       
    10631058        dprintf(("KERNEL32::Console::2 VioShowPS(%u,%u,%u)=%u\n",
    10641059                 ConsoleGlobals.coordWindowSize.Y,
     
    10671062                 rc));
    10681063      }
    1069 
     1064   
    10701065      WinEndPaint(hps);
    10711066      break;
    1072 
    1073 
     1067   
     1068   
    10741069    /*************************************************************************
    10751070     * WM_SIZE resize the window                                             *
     
    10831078                      0,
    10841079                      0,
    1085                       0);
    1086 
     1080                      0);     
     1081     
    10871082      return WinDefAVioWindowProc(hwnd,
    10881083                                  (USHORT)msg,
     
    10901085                                  (ULONG)mp2);
    10911086    }
    1092 
    1093 
     1087   
     1088   
    10941089    /*************************************************************************
    10951090     * context menue                                                         *
     
    11031098                    SHORT2FROMMP(mp1),
    11041099                    CM_CONSOLE_PROPERTIES,                        /* item id */
    1105                     PU_HCONSTRAIN |
     1100                    PU_HCONSTRAIN | 
    11061101                    PU_VCONSTRAIN |
    11071102                    PU_KEYBOARD   |
     
    11111106    }
    11121107    return (MPARAM)FALSE;
    1113 
    1114 
     1108   
     1109   
    11151110    /*************************************************************************
    11161111     * WM_COMMAND command processing                                         *
     
    11221117        /* close console window, however we can't call ConsoleTerminate here!*/
    11231118        case CM_CONSOLE_EXIT:
    1124           WinPostMsg (ConsoleGlobals.hwndFrame,
     1119          WinPostMsg (ConsoleGlobals.hwndFrame,     
    11251120                      WM_CLOSE,
    11261121                      (MPARAM)NULL,
     
    11281123
    11291124          return (MPARAM)FALSE;
    1130 
    1131 
     1125       
     1126       
    11321127        case CM_CONSOLE_REPAINT:
    11331128          WinInvalidateRect(ConsoleGlobals.hwndClient,/* redraw frame window */
     
    11401135        {
    11411136          ULONG ulResult;                              /* response from user */
    1142 
     1137         
    11431138          ConsoleGlobals.Options.hmodResources =       /* save module handle */
    11441139            ConsoleGlobals.hmodResource;
    1145 
     1140         
    11461141          ulResult = WinDlgBox(HWND_DESKTOP,
    11471142                               ConsoleGlobals.hwndClient,
     
    11501145                               DLG_CONSOLE_PROPERTIES,
    11511146                               (PVOID)&ConsoleGlobals.Options);
     1147          /* @@@PH update settings if necessary */
     1148         
    11521149          return (MPARAM) FALSE;
    11531150        }
     
    11561153    break;
    11571154
    1158 
     1155   
    11591156    /*************************************************************************
    11601157     * WM_CHAR keyboard char processing                                      *
    11611158     *************************************************************************/
    1162 
     1159   
    11631160    case WM_CHAR:
    11641161      ConsoleInputEventPushKey(mp1,                 /* push event into queue */
    11651162                               mp2);
    11661163      break;                                  /* enable further processing ! */
    1167 
    1168 
     1164   
     1165   
    11691166    /*************************************************************************
    11701167     * WM_SETFOCUS focus changing processing                                 *
    11711168     *************************************************************************/
    1172 
     1169   
    11731170    case WM_SETFOCUS:
    11741171      ConsoleInputEventPushFocus((BOOL)mp2);        /* push event into queue */
    11751172      break;                                  /* enable further processing ! */
    1176 
    1177 
     1173   
     1174   
    11781175    /*************************************************************************
    11791176     * WM_MOUSEMOVE mouse event processing                                   *
    11801177     *************************************************************************/
    1181 
     1178   
    11821179    case WM_MOUSEMOVE:
    11831180    case WM_BUTTON1UP:
     
    11951192      break;                                  /* enable further processing ! */
    11961193  }
    1197 
     1194 
    11981195  return WinDefWindowProc(hwnd,                     /* to default processing */
    11991196                          msg,
     
    12121209 * Variables :
    12131210 * Result    : MRESULT for PM
    1214  * Remark    :
    1215  * Status    :
     1211 * Remark    : 
     1212 * Status    : 
    12161213 *
    12171214 * Author    : Patrick Haller [Tue, 1998/02/10 03:24]
     
    12231220                                               MPARAM mp2)
    12241221{
    1225   switch(msg)
     1222  switch(msg) 
    12261223  {
    12271224    /*************************************************************************
    12281225     * WM_QUERYTRACKINFO handling                                            *
    12291226     *************************************************************************/
    1230     case WM_QUERYTRACKINFO:
     1227    case WM_QUERYTRACKINFO: 
    12311228    {
    12321229       MRESULT    mr;                                      /* message result */
     
    12371234                                              msg,
    12381235                                              mp1,
    1239                                               mp2);
     1236                                              mp2);       
    12401237
    12411238       pTrackInfo = (PTRACKINFO)mp2;                /* get track information */
     
    12651262 * Variables :
    12661263 * Result    : none
    1267  * Remark    :
    1268  * Status    :
     1264 * Remark    : 
     1265 * Status    : 
    12691266 *
    12701267 * Author    : Patrick Haller [Tue, 1998/02/17 12:57]
     
    12741271{
    12751272  ULONG ulLine;
    1276 
     1273 
    12771274  ULONG ulSizeX;                               /* blitting length and height */
    12781275  ULONG ulSizeY;
    1279 
     1276 
    12801277  ulSizeX = 2 * min(ConsoleGlobals.coordWindowSize.X,
    12811278                    pConsoleBuffer->coordBufferSize.X -
    12821279                    ConsoleGlobals.coordWindowPos.X);
    1283 
     1280 
    12841281  ulSizeY = min(ConsoleGlobals.coordWindowSize.Y,
    12851282                pConsoleBuffer->coordBufferSize.Y -
    12861283                ConsoleGlobals.coordWindowPos.Y);
    1287 
     1284 
    12881285                      /* check if we're called with non-existing line buffer */
    12891286  if (pConsoleBuffer->ppszLine == NULL)
    12901287    return;
    1291 
     1288 
    12921289  for (ulLine = ConsoleGlobals.coordWindowPos.Y;
    12931290       ulLine < ulSizeY;
    12941291       ulLine++)
    1295     VioWrtCellStr(pConsoleBuffer->ppszLine[ulLine] +
     1292    VioWrtCellStr(pConsoleBuffer->ppszLine[ulLine] + 
    12961293                    ConsoleGlobals.coordWindowPos.X,
    12971294                  ulSizeX,
     
    13081305 * Variables :
    13091306 * Result    : none
    1310  * Remark    :
    1311  * Status    :
     1307 * Remark    : 
     1308 * Status    : 
    13121309 *
    13131310 * Author    : Patrick Haller [Tue, 1998/02/17 12:57]
     
    13191316{
    13201317  ULONG  ulCounter;
    1321 
     1318 
    13221319  for (ulCounter = 0;
    13231320       ulCounter < (ulSize >> 1);
     
    13251322       pusTarget+=2)
    13261323    *(PULONG)pusTarget = ulPattern;
    1327 
     1324 
    13281325  if (ulSize & 0x00000001)
    13291326    *pusTarget = (USHORT)ulPattern;
     
    13391336 * Variables :
    13401337 * Result    : none
    1341  * Remark    :
    1342  * Status    :
     1338 * Remark    : 
     1339 * Status    : 
    13431340 *
    13441341 * Author    : Patrick Haller [Tue, 1998/02/17 12:57]
     
    13511348  ULONG ulPosition;
    13521349  ULONG ulScrollLine;
    1353 
     1350 
    13541351  static ULONG ulUpdateCounter;                /* counter for jump-scrolling */
    1355 
     1352 
    13561353                              /* calculate new line offset to the first line */
    13571354  pConsoleBuffer->ulScrollLineOffset += ulLines;
    13581355  pConsoleBuffer->ulScrollLineOffset %= pConsoleBuffer->coordBufferSize.Y;
    1359 
     1356 
    13601357                                                   /* do we have to scroll ? */
    13611358  if (ulLines < pConsoleBuffer->coordBufferSize.Y)
     
    13651362         ulLine++)
    13661363    {
    1367       ulScrollLine = (ulLine + pConsoleBuffer->ulScrollLineOffset)
     1364      ulScrollLine = (ulLine + pConsoleBuffer->ulScrollLineOffset) 
    13681365                     % pConsoleBuffer->coordBufferSize.Y;
    1369 
     1366     
    13701367      ulPosition = (ULONG)pConsoleBuffer->ppszLine
    13711368                   + (pConsoleBuffer->coordBufferSize.Y * sizeof (PSZ) )
    13721369                   + (pConsoleBuffer->coordBufferSize.X * 2 * ulScrollLine);
    1373 
     1370     
    13741371      pConsoleBuffer->ppszLine[ulLine] = (PSZ)ulPosition;
    13751372    }
    13761373  }
    1377 
     1374 
    13781375                                                  /* enforce the upper limit */
    13791376  if (ulLines > pConsoleBuffer->coordBufferSize.Y)
    13801377    ulLines = pConsoleBuffer->coordBufferSize.Y;
    1381 
     1378 
    13821379  ulPosition = ( ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 8) +
    13831380                 ((ULONG)' ') +
    13841381                 ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 24) +
    13851382                 ((ULONG)' ' << 16) );
    1386 
     1383 
    13871384                                                    /* scroll the line index */
    1388   for (ulLine = pConsoleBuffer->coordBufferSize.Y - ulLines;
     1385  for (ulLine = pConsoleBuffer->coordBufferSize.Y - ulLines; 
    13891386       ulLine < pConsoleBuffer->coordBufferSize.Y;
    13901387       ulLine++)
     
    13921389                          (PUSHORT)(pConsoleBuffer->ppszLine[ulLine]),
    13931390                          pConsoleBuffer->coordBufferSize.X);
    1394 
     1391 
    13951392    /* this code ensures frequent screen updating, even if the timer prooves */
    13961393                                                            /* to be to slow */
     
    14161413 * Result    : API returncode
    14171414 * Remark    :
    1418  * Status    :
     1415 * Status    : 
    14191416 *
    14201417 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    14251422  PINPUT_RECORD pirFree;                           /* pointer to free record */
    14261423  APIRET        rc;                                        /* API-returncode */
    1427 
     1424 
    14281425#ifdef DEBUG_LOCAL2
    14291426  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPush(%08x).\n",
     
    14341431  if (pirFree->EventType != 0x0000)
    14351432    return (ERROR_QUE_NO_MEMORY);                         /* queue is full ! */
    1436 
     1433     
    14371434                                                       /* put event in queue */
    14381435  memcpy(pirFree,                                               /* copy data */
    14391436         pInputRecord,
    14401437         sizeof (INPUT_RECORD) );
    1441 
     1438 
    14421439  ConsoleInput.ulIndexFree++;                        /* update index counter */
    14431440  if (ConsoleInput.ulIndexFree >= CONSOLE_INPUTQUEUESIZE)
    14441441    ConsoleInput.ulIndexFree = 0;
    1445 
     1442 
    14461443  ConsoleInput.ulEvents++;                   /* increate queue event counter */
    1447 
     1444 
    14481445                                                  /* unblock reading threads */
    14491446  rc = DosPostEventSem(ConsoleInput.hevInputQueue);
     
    14591456 * Result    : API returncode
    14601457 * Remark    :
    1461  * Status    :
     1458 * Status    : 
    14621459 *
    14631460 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    14681465  PINPUT_RECORD pirEvent;                         /* pointer to event record */
    14691466  APIRET        rc;                                        /* API-returncode */
    1470 
     1467 
    14711468#ifdef DEBUG_LOCAL2
    14721469  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPop(%08x).\n",
    14731470           pInputRecord));
    14741471#endif
    1475 
     1472 
    14761473  if (ConsoleInput.ulEvents == 0)                         /* empty console ? */
    14771474    return (ERROR_QUE_EMPTY);                            /* queue is empty ! */
    1478 
     1475 
    14791476                                                          /* get first event */
    14801477  pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent];
    14811478  if (pirEvent->EventType == 0x0000)
    14821479    return (ERROR_QUE_EMPTY);                            /* queue is empty ! */
    1483 
     1480     
    14841481                                                       /* put event in queue */
    14851482  memcpy(pInputRecord,                                          /* copy data */
    14861483         pirEvent,
    14871484         sizeof (INPUT_RECORD) );
    1488 
     1485 
    14891486  pirEvent->EventType = 0x0000;                 /* mark event as read = free */
    1490 
     1487 
    14911488  if (ConsoleInput.ulEvents >= 0)       /* decrease number of console events */
    14921489    ConsoleInput.ulEvents--;
    1493 
     1490 
    14941491  ConsoleInput.ulIndexEvent++;                       /* update index counter */
    14951492  if (ConsoleInput.ulIndexEvent >= CONSOLE_INPUTQUEUESIZE)
    14961493    ConsoleInput.ulIndexEvent = 0;
    1497 
     1494 
    14981495  return (NO_ERROR);                                                   /* OK */
    14991496}
     
    15081505 * Remark    : @@@PH: 2nd table that learns codes automatically from "down"
    15091506 *                    messages from PM. With Alt-a, etc. it is 0 for "up" ?
    1510  * Status    :
     1507 * Status    : 
    15111508 *
    15121509 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    16271624   /* VK_M_BUTTONRELEASE  0x006B */ 0,
    16281625   /* VK_M_DOUBLECLICK    0x006C */ 0,
    1629 
     1626   
    16301627#if 0
    163116280xA4, /* WIN_VK_LMENU   ??? */
     
    16761673  USHORT       usVk       = ((ULONG)mp2 & 0xffff0000) >> 16;
    16771674  UCHAR        ucChar     = usCh & 0x00ff;
    1678 
     1675 
    16791676#ifdef DEBUG_LOCAL2
    16801677  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushKey(%08x,%08x).\n",
     
    16831680#endif
    16841681
    1685 
     1682 
    16861683  InputRecord.EventType = KEY_EVENT;                 /* fill event structure */
    16871684  InputRecord.Event.KeyEvent.dwControlKeyState = 0;
    1688 
     1685 
    16891686  if (fsFlags & KC_SHIFT) InputRecord.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED;
    16901687  if (fsFlags & KC_ALT)   InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
    16911688  if (fsFlags & KC_CTRL)  InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
    1692 
    1693   /* @@@PH no support for RIGHT_ALT_PRESSED,
     1689 
     1690  /* @@@PH no support for RIGHT_ALT_PRESSED, 
    16941691                          RIGHT_CTRL_PRESSED,
    1695                           NUMLOCK_ON,
    1696                           SCROLLLOCK_ON,
    1697                           CAPSLOCK_ON,
    1698                           ENHANCED_KEY
     1692                          NUMLOCK_ON, 
     1693                          SCROLLLOCK_ON, 
     1694                          CAPSLOCK_ON, 
     1695                          ENHANCED_KEY 
    16991696   */
    17001697
     
    17031700  InputRecord.Event.KeyEvent.wVirtualKeyCode  = usVk;
    17041701  InputRecord.Event.KeyEvent.wVirtualScanCode = ucScanCode;
    1705 
     1702 
    17061703             /* check if ascii is valid, if so then wVirtualKeyCode = ascii, */
    17071704             /* else go through the table                                    */
     
    17151712      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF;
    17161713    else
    1717       InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;
     1714      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;   
    17181715  }
    17191716  else
     
    17241721          tabVirtualKeyCodes[usVk];                     /* translate keycode */
    17251722    }
    1726 
     1723   
    17271724                /* this is a workaround for empty / invalid wVirtualKeyCodes */
    17281725  if (InputRecord.Event.KeyEvent.wVirtualKeyCode == 0x0000)
     
    17331730      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF;
    17341731    else
    1735       InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;
    1736   }
    1737 
    1738 
     1732      InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;   
     1733  }
     1734 
     1735   
    17391736  /* @@@PH handle special keys */
    17401737  if ( (ucChar != 0xe0) && (ucChar != 0x00) )
     
    17461743    InputRecord.Event.KeyEvent.uChar.AsciiChar  = (ucChar >> 8);
    17471744  }
    1748 
     1745 
    17491746              /* further processing according the current input console mode */
    17501747  if (ConsoleInput.dwConsoleMode & ENABLE_PROCESSED_INPUT)
     
    17521749    /* filter ctrl-c, etc. */
    17531750  }
    1754 
     1751 
    17551752#if 0
    17561753  /* DEBUG */
     
    17651762           SHORT1FROMMP(mp2),
    17661763           SHORT2FROMMP(mp2)));
    1767 
     1764 
    17681765  dprintf(("DEBUG: ascii=[%c] (%02x)",
    17691766           InputRecord.Event.KeyEvent.uChar.AsciiChar,
    17701767           InputRecord.Event.KeyEvent.uChar.AsciiChar));
    17711768#endif
    1772 
     1769 
    17731770  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    17741771  return (rc);                                                         /* OK */
     
    17831780 * Result    : API returncode
    17841781 * Remark    :
    1785  * Status    :
     1782 * Status    : 
    17861783 *
    17871784 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    17961793  USHORT             fsFlags = SHORT2FROMMP(mp2);           /* get key flags */
    17971794  static USHORT      usButtonState;     /* keeps track of mouse button state */
    1798 
     1795 
    17991796                                      /* do we have to process mouse input ? */
    18001797  if ( !(ConsoleInput.dwConsoleMode & ENABLE_MOUSE_INPUT))
    18011798    return (NO_ERROR);                                 /* return immediately */
    1802 
     1799 
    18031800  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMouse(%08x,%08x,%08x).\n",
    18041801           ulMessage,
    18051802           mp1,
    18061803           mp2));
    1807 
     1804 
    18081805  memset(&InputRecord,                                 /* zero the structure */
    18091806         0,
    18101807         sizeof (INPUT_RECORD) );
    1811 
     1808 
    18121809  InputRecord.EventType = MOUSE_EVENT;               /* fill event structure */
    1813 
     1810 
    18141811  switch (ulMessage)
    18151812  {
    1816     case WM_MOUSEMOVE:
     1813    case WM_MOUSEMOVE: 
    18171814      InputRecord.Event.MouseEvent.dwEventFlags      = MOUSE_MOVED;
    18181815      InputRecord.Event.MouseEvent.dwMousePosition.X = SHORT1FROMMP(mp1);
    18191816      InputRecord.Event.MouseEvent.dwMousePosition.Y = SHORT2FROMMP(mp1);
    1820 
     1817     
    18211818      InputRecord.Event.MouseEvent.dwButtonState     = usButtonState;
    1822 
     1819     
    18231820      if (fsFlags & KC_SHIFT) InputRecord.Event.MouseEvent.dwControlKeyState |= SHIFT_PRESSED;
    18241821      if (fsFlags & KC_ALT)   InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
    18251822      if (fsFlags & KC_CTRL)  InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
    1826 
    1827       /* @@@PH no support for RIGHT_ALT_PRESSED,
     1823     
     1824      /* @@@PH no support for RIGHT_ALT_PRESSED, 
    18281825                              RIGHT_CTRL_PRESSED,
    1829                               NUMLOCK_ON,
    1830                               SCROLLLOCK_ON,
    1831                               CAPSLOCK_ON,
    1832                               ENHANCED_KEY
     1826                              NUMLOCK_ON, 
     1827                              SCROLLLOCK_ON, 
     1828                              CAPSLOCK_ON, 
     1829                              ENHANCED_KEY 
    18331830       */
    18341831      break;
    1835 
     1832   
    18361833    case WM_BUTTON1UP:
    18371834      usButtonState            &= ~FROM_LEFT_1ST_BUTTON_PRESSED;
    18381835      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18391836      break;
    1840 
     1837   
    18411838    case WM_BUTTON1DOWN:
    18421839      usButtonState            |=  FROM_LEFT_1ST_BUTTON_PRESSED;
    18431840      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18441841      break;
    1845 
     1842 
    18461843    case WM_BUTTON2UP:
    18471844      usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED;
    18481845      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18491846      break;
    1850 
     1847   
    18511848    case WM_BUTTON2DOWN:
    18521849      usButtonState |= FROM_LEFT_2ND_BUTTON_PRESSED;
    18531850      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18541851      break;
    1855 
     1852   
    18561853    case WM_BUTTON3UP:
    18571854      usButtonState &= ~FROM_LEFT_3RD_BUTTON_PRESSED;
    18581855      InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
    18591856      break;
    1860 
     1857   
    18611858    case WM_BUTTON3DOWN:
    18621859      usButtonState |=  FROM_LEFT_3RD_BUTTON_PRESSED;
     
    18691866      usButtonState &= ~FROM_LEFT_1ST_BUTTON_PRESSED;
    18701867      break;
    1871 
     1868 
    18721869    case WM_BUTTON2DBLCLK:
    18731870      InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK;
     
    18751872      usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED;
    18761873      break;
    1877 
     1874     
    18781875    case WM_BUTTON3DBLCLK:
    18791876      InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK;
     
    18821879      break;
    18831880  }
    1884 
     1881 
    18851882                        /* @@@PH pseudo-support for RIGHTMOST_BUTTON_PRESSED */
    18861883  if (InputRecord.Event.MouseEvent.dwButtonState & FROM_LEFT_3RD_BUTTON_PRESSED)
    18871884    InputRecord.Event.MouseEvent.dwButtonState |= RIGHTMOST_BUTTON_PRESSED;
    1888 
     1885 
    18891886  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    18901887  return (rc);                                                         /* OK */
     
    18991896 * Result    : API returncode
    19001897 * Remark    :
    1901  * Status    :
     1898 * Status    : 
    19021899 *
    19031900 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    19121909  if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
    19131910    return (NO_ERROR);                                 /* return immediately */
    1914 
     1911 
    19151912  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushWindow(x = %u, y = %u).\n",
    19161913           coordWindowSize.X,
    19171914           coordWindowSize.Y));
    1918 
     1915 
    19191916  InputRecord.EventType = WINDOW_BUFFER_SIZE_EVENT;  /* fill event structure */
    1920 
     1917 
    19211918  InputRecord.Event.WindowBufferSizeEvent.dwSize = coordWindowSize;
    1922 
     1919 
    19231920  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    19241921  return (rc);                                                         /* OK */
     
    19331930 * Result    : API returncode
    19341931 * Remark    :
    1935  * Status    :
     1932 * Status    : 
    19361933 *
    19371934 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    19421939  INPUT_RECORD     InputRecord;                /* the input record structure */
    19431940  APIRET           rc;                                     /* API-returncode */
    1944 
     1941 
    19451942  /* @@@PH this is unknown to me - there's no separate bit for menu events ? */
    19461943                                     /* do we have to process window input ? */
    19471944  if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
    19481945    return (NO_ERROR);                                 /* return immediately */
    1949 
     1946 
    19501947  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMenu(%08x).\n",
    19511948           dwCommandId));
    1952 
     1949 
    19531950  InputRecord.EventType = MENU_EVENT;                /* fill event structure */
    1954 
     1951 
    19551952  InputRecord.Event.MenuEvent.dwCommandId = dwCommandId;
    1956 
     1953 
    19571954  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    19581955  return (rc);                                                         /* OK */
     
    19671964 * Result    : API returncode
    19681965 * Remark    :
    1969  * Status    :
     1966 * Status    : 
    19701967 *
    19711968 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    19761973  INPUT_RECORD     InputRecord;                /* the input record structure */
    19771974  APIRET           rc;                                     /* API-returncode */
    1978 
     1975 
    19791976  /* @@@PH this is unknown to me - there's no separate bit for menu events ? */
    19801977                                     /* do we have to process window input ? */
    19811978  if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
    19821979    return (NO_ERROR);                                 /* return immediately */
    1983 
     1980 
    19841981  dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushFocus(%08x).\n",
    19851982           bSetFocus));
    1986 
     1983 
    19871984  InputRecord.EventType = FOCUS_EVENT;               /* fill event structure */
    1988 
     1985 
    19891986  InputRecord.Event.FocusEvent.bSetFocus = bSetFocus;
    1990 
     1987 
    19911988  rc = ConsoleInputEventPush(&InputRecord);           /* add it to the queue */
    19921989  return (rc);                                                         /* OK */
     
    19971994 * Name      : static ULONG ConsoleInputQueueEvents
    19981995 * Purpose   : query number of events in the queue
    1999  * Parameters:
     1996 * Parameters: 
    20001997 * Variables :
    20011998 * Result    : number of events
    20021999 * Remark    :
    2003  * Status    :
     2000 * Status    : 
    20042001 *
    20052002 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    20152012 * Name      : static void ConsoleCursorShow
    20162013 * Purpose   : query number of events in the queue
    2017  * Parameters:
     2014 * Parameters: 
    20182015 * Variables :
    20192016 * Result    : number of events
    20202017 * Remark    :
    2021  * Status    :
     2018 * Status    : 
    20222019 *
    20232020 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    20312028  static BOOL fState;                                /* current cursor state */
    20322029  RECTL rclWindow;                                    /* current window size */
    2033 
     2030 
    20342031#ifdef DEBUG_LOCAL2
    20352032  dprintf(("KERNEL32:Console:ConsoleCursorShow(%u)\n",
    20362033           ulCursorMode));
    20372034#endif
    2038 
     2035 
    20392036  if (pConsoleBuffer->CursorInfo.bVisible == FALSE)/* cursor is switched off */
    20402037    return;                                            /* return immediately */
    2041 
     2038 
    20422039  switch (ulCursorMode)
    20432040  {
     
    20482045        fState = FALSE;       /* set to invisible and invert our cursor rect */
    20492046      break;
    2050 
     2047   
    20512048    case CONSOLECURSOR_SHOW:
    20522049      if (fState == TRUE)                        /* cursor currently shown ? */
     
    20552052        fState = TRUE;          /* set to visible and invert our cursor rect */
    20562053      break;
    2057 
     2054   
    20582055    case CONSOLECURSOR_BLINK:
    20592056      fState = !fState;      /* let there be on off on off on off on off ... */
    20602057      break;
    2061 
     2058 
    20622059    case CONSOLECURSOR_OVERWRITTEN:       /* our cursor has been overwritten */
    20632060      fState = TRUE;                       /* so show the cursor immediately */
    20642061      break;
    20652062  }
    2066 
    2067 
     2063 
     2064 
    20682065                                              /* query current window's size */
    20692066  WinQueryWindowRect(ConsoleGlobals.hwndClient,
    20702067                     &rclWindow);
    2071 
     2068 
    20722069                                      /* calculate coordinates of the cursor */
    20732070  rclCursor.xLeft   = ConsoleGlobals.sCellCX * pConsoleBuffer->coordCursorPosition.X;
     
    20792076                       pConsoleBuffer->CursorInfo.dwSize /
    20802077                       100);
    2081 
     2078                       
    20822079  hps = WinGetPS(ConsoleGlobals.hwndClient);                      /* get HPS */
    2083 
     2080 
    20842081  /* @@@PH invert coordinates here ... */
    20852082  WinInvertRect(hps,                  /* our cursor is an inverted rectangle */
    20862083                &rclCursor);
    2087 
     2084 
    20882085  WinReleasePS(hps);                                /* release the hps again */
    20892086}
     
    20932090 * Name      : static APIRET ConsoleFontQuery
    20942091 * Purpose   : queries the current font cell sizes
    2095  * Parameters:
     2092 * Parameters: 
    20962093 * Variables :
    20972094 * Result    : API returncode
    20982095 * Remark    :
    2099  * Status    :
     2096 * Status    : 
    21002097 *
    21012098 * Author    : Patrick Haller [Tue, 1998/03/07 16:55]
     
    21132110 * Name      : static void ConsoleCursorShow
    21142111 * Purpose   : query number of events in the queue
    2115  * Parameters:
     2112 * Parameters: 
    21162113 * Variables :
    21172114 * Result    : number of events
    21182115 * Remark    : called during INIT, FONTCHANGE, RESIZE, BUFFERCHANGE
    2119  * Status    :
     2116 * Status    : 
    21202117 *
    21212118 * Author    : Patrick Haller [Wed, 1998/04/29 16:55]
     
    21282125  PRECTL pRcl = &rcl;
    21292126  ULONG  flStyle;                              /* window frame control style */
    2130 
     2127 
    21312128  BOOL fNeedVertScroll;                      /* indicates need of scrollbars */
    21322129  BOOL fNeedHorzScroll;
    2133 
     2130 
    21342131  LONG lScrollX;                           /* width and height of scrollbars */
    21352132  LONG lScrollY;
    2136 
     2133 
    21372134                                         /* now calculate actual window size */
    21382135  lX = ConsoleGlobals.sCellCX * ConsoleGlobals.coordWindowSize.X;
    21392136  lY = ConsoleGlobals.sCellCY * ConsoleGlobals.coordWindowSize.Y;
    2140 
     2137 
    21412138  if ( (ConsoleGlobals.sCellCX == 0) ||          /* prevent division by zero */
    21422139       (ConsoleGlobals.sCellCY == 0) )
    2143     return;
    2144 
     2140    return;   
     2141 
    21452142         /* calculate maximum console window size in pixels for the tracking */
    21462143  ConsoleGlobals.coordMaxWindowPels.X = ConsoleGlobals.sCellCX * pConsoleBuffer->coordWindowSize.X
    21472144                                        + WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) * 2;
    2148 
     2145 
    21492146  ConsoleGlobals.coordMaxWindowPels.Y = ConsoleGlobals.sCellCY * pConsoleBuffer->coordWindowSize.Y
    21502147                                        + WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) * 2
    21512148                                        + WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
    2152 
     2149 
    21532150  /***************************/
    21542151  /* @@@PH broken code below */
    21552152  /***************************/
    21562153  return;
    2157 
     2154 
    21582155                             /* add the window border height and width, etc. */
    21592156  WinQueryWindowRect (ConsoleGlobals.hwndClient,
    21602157                      pRcl);
    2161 
     2158 
    21622159                                                   /* calculate visible area */
    21632160   /* calculate real client window rectangle and take care of the scrollbars */
    21642161  lScrollX = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
    21652162  lScrollY = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
    2166   if (ConsoleGlobals.fHasHorzScroll)
     2163  if (ConsoleGlobals.fHasHorzScroll) 
    21672164  {
    21682165    lY += lScrollY;
    21692166    ConsoleGlobals.coordMaxWindowPels.Y += lScrollY;
    21702167  }
    2171 
    2172   if (ConsoleGlobals.fHasVertScroll)
     2168 
     2169  if (ConsoleGlobals.fHasVertScroll) 
    21732170  {
    21742171    lX += lScrollX;
    21752172    ConsoleGlobals.coordMaxWindowPels.X += lScrollX;
    21762173  }
    2177 
     2174 
    21782175  /* @@@PH might NOT exceed maximum VioPS size ! */
    2179   ConsoleGlobals.coordWindowSize.X = (pRcl->xRight - pRcl->xLeft)
     2176  ConsoleGlobals.coordWindowSize.X = (pRcl->xRight - pRcl->xLeft)   
    21802177                                     / ConsoleGlobals.sCellCX;
    2181 
    2182   ConsoleGlobals.coordWindowSize.Y = (pRcl->yTop   - pRcl->yBottom)
     2178 
     2179  ConsoleGlobals.coordWindowSize.Y = (pRcl->yTop   - pRcl->yBottom) 
    21832180                                     / ConsoleGlobals.sCellCY;
    2184 
     2181 
    21852182                                    /* do we have to enable the scrollbars ? */
    21862183  fNeedHorzScroll = lX < pConsoleBuffer->coordWindowSize.X * ConsoleGlobals.sCellCX;
    21872184  fNeedVertScroll = lY < pConsoleBuffer->coordWindowSize.Y * ConsoleGlobals.sCellCY;
    2188 
     2185 
    21892186
    21902187  if ( (ConsoleGlobals.fHasVertScroll != fNeedVertScroll) ||
     
    21932190    flStyle = WinQueryWindowULong(ConsoleGlobals.hwndFrame,
    21942191                                  QWL_STYLE);
    2195 
     2192 
    21962193                                           /* now set or remove the controls */
    21972194    if (ConsoleGlobals.fHasHorzScroll != fNeedHorzScroll)
     
    22112208        ConsoleGlobals.coordWindowPos.X = 0;    /* we can see the whole buffer */
    22122209      }
    2213 
     2210 
    22142211    if (ConsoleGlobals.fHasVertScroll != fNeedVertScroll)
    22152212      if (fNeedVertScroll)
     
    22252222        WinSetParent(ConsoleGlobals.hwndVertScroll,        /* detach control */
    22262223                     HWND_OBJECT,
    2227                      FALSE);
     2224                     FALSE);   
    22282225        ConsoleGlobals.coordWindowPos.Y = 0;  /* we can see the whole buffer */
    22292226      }
    2230 
    2231 
     2227 
     2228 
    22322229    WinSendMsg(ConsoleGlobals.hwndFrame,                     /* update frame */
    22332230               WM_UPDATEFRAME,
    22342231               MPFROMLONG(flStyle),
    22352232               MPVOID);
    2236 
     2233   
    22372234    WinInvalidateRect(ConsoleGlobals.hwndFrame,       /* redraw frame window */
    22382235                      NULL,
    22392236                      TRUE);
    2240 
     2237   
    22412238    ConsoleGlobals.fHasVertScroll = fNeedVertScroll;       /* update globals */
    22422239    ConsoleGlobals.fHasHorzScroll = fNeedHorzScroll;       /* update globals */
    22432240  }
    2244 
    2245 
     2241   
     2242 
    22462243                                    /* setup the scrollbars and scrollranges */
    22472244  if (ConsoleGlobals.fHasVertScroll)
     
    22492246    /* setup vertical scrollbar */
    22502247  }
    2251 
    2252 
     2248 
     2249 
    22532250  if (ConsoleGlobals.fHasHorzScroll)
    22542251  {
    22552252    /* setup horizonal scrollbar */
    22562253  }
    2257 
    2258 
     2254   
     2255 
    22592256  WinCalcFrameRect(ConsoleGlobals.hwndFrame,    /* calculate frame rectangle */
    22602257                   pRcl,
    22612258                   FALSE);
    2262 
     2259 
    22632260  /* @@@PH client may not overlap frame ! */
    22642261  /* @@@PH write values to TRACKINFO      */
    2265 
     2262 
    22662263#if 0
    22672264  /* @@@PH this results in recursion */
     
    22732270                   lY,
    22742271                   SWP_SIZE);
    2275 
     2272 
    22762273  WinSetWindowPos (ConsoleGlobals.hwndFrame,    /* adjust client window size */
    22772274                   HWND_DESKTOP,
     
    22862283
    22872284/*****************************************************************************
    2288  * Name      : BOOL WIN32API AllocConsole
    2289  * Purpose   : The AllocConsole function allocates a new console
     2285 * Name      : BOOL WIN32API OS2AllocConsole
     2286 * Purpose   : The AllocConsole function allocates a new console 
    22902287 *             for the calling process
    22912288 * Parameters: VOID
     
    23002297 *****************************************************************************/
    23012298
    2302 BOOL WIN32API AllocConsole(VOID)
     2299BOOL WIN32API OS2AllocConsole(VOID)
    23032300{
    23042301  APIRET rc;                                               /* API returncode */
    2305 
     2302 
    23062303#ifdef DEBUG_LOCAL2
    23072304  WriteLog("KERNEL32/CONSOLE: OS2AllocConsole() called.\n");
    23082305#endif
    2309 
     2306 
    23102307  rc = ConsoleInit();                    /* initialize subsystem if required */
    23112308  if (rc != NO_ERROR)                                    /* check for errors */
    23122309  {
    2313     O32_SetLastError(rc);                            /* pass thru the error code */
     2310    SetLastError(rc);                            /* pass thru the error code */
    23142311    return FALSE;                                          /* signal failure */
    23152312  }
     
    23202317
    23212318/*****************************************************************************
    2322  * Name      : HANDLE WIN32API CreateConsoleScreenBuffer
     2319 * Name      : HANDLE WIN32API OS2CreateConsoleScreenBuffer
    23232320 * Purpose   : The CreateConsoleScreenBuffer function creates a console
    23242321 *             screen buffer and returns a handle of it.
     
    23292326 *             LPVOID lpScreenBufferData - reserved
    23302327 * Variables :
    2331  * Result    :
     2328 * Result    : 
    23322329 * Remark    : a console buffer is a kernel heap object equipped with
    23332330 *             share modes, access rights, etc.
     
    23352332 *             console device driver for it ... maybe this turns out to
    23362333 *             be necessary since we've got to handle CONIN$ and CONOUT$, too.
    2337  * Status    :
     2334 * Status    : 
    23382335 *
    23392336 * Author    : Patrick Haller [Tue, 1998/02/10 03:55]
    23402337 *****************************************************************************/
    23412338
    2342 HANDLE WIN32API CreateConsoleScreenBuffer(DWORD  dwDesiredAccess,
     2339HANDLE WIN32API OS2CreateConsoleScreenBuffer(DWORD  dwDesiredAccess,
    23432340                                             DWORD  dwShareMode,
    23442341                                             LPVOID lpSecurityAttributes,
     
    23472344{
    23482345  HANDLE hResult;
    2349 
     2346 
    23502347#ifdef DEBUG_LOCAL2
    23512348  WriteLog("KERNEL32/CONSOLE:OS2CreateConsoleScreenBuffer(%08x,%08x,%08x,%08x,%08x).\n",
     
    23642361                         dwFlags,
    23652362                         INVALID_HANDLE_VALUE);
    2366 
     2363 
    23672364  return hResult;
    23682365}
     
    23702367
    23712368/*****************************************************************************
    2372  * Name      :
    2373  * Purpose   :
    2374  * Parameters:
    2375  * Variables :
    2376  * Result    :
     2369 * Name      : 
     2370 * Purpose   : 
     2371 * Parameters: 
     2372 * Variables :
     2373 * Result    : 
    23772374 * Remark    :
    2378  * Status    :
     2375 * Status    : 
    23792376 *
    23802377 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    23812378 *****************************************************************************/
    23822379
    2383 BOOL WIN32API FillConsoleOutputAttribute(HANDLE  hConsoleOutput,
     2380BOOL WIN32API OS2FillConsoleOutputAttribute(HANDLE  hConsoleOutput,
    23842381                                            WORD    wAttribute,
    23852382                                            DWORD   nLength,
     
    23882385{
    23892386  BOOL fResult;
    2390 
     2387 
    23912388#ifdef DEBUG_LOCAL2
    23922389  WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputAttribute(%08x,%04x,%08x,%08x,%08x).\n",
     
    23972394           lpNumberOfAttrsWritten);
    23982395#endif
    2399 
     2396 
    24002397  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    24012398                                  DRQ_FILLCONSOLEOUTPUTATTRIBUTE,
     
    24032400                                  (ULONG)nLength,
    24042401                                  COORD2ULONG(dwWriteCoord),
    2405                                   (ULONG)lpNumberOfAttrsWritten);
    2406 
     2402                                  (ULONG)lpNumberOfAttrsWritten); 
     2403 
    24072404  return fResult;
    24082405}
     
    24102407
    24112408/*****************************************************************************
    2412  * Name      :
    2413  * Purpose   :
    2414  * Parameters:
    2415  * Variables :
    2416  * Result    :
     2409 * Name      : 
     2410 * Purpose   : 
     2411 * Parameters: 
     2412 * Variables :
     2413 * Result    : 
    24172414 * Remark    :
    2418  * Status    :
     2415 * Status    : 
    24192416 *
    24202417 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    24212418 *****************************************************************************/
    24222419
    2423 BOOL WIN32API FillConsoleOutputCharacterA(HANDLE  hConsoleOutput,
     2420BOOL WIN32API OS2FillConsoleOutputCharacterA(HANDLE  hConsoleOutput,
    24242421                                             UCHAR   cCharacter,
    24252422                                             DWORD   nLength,
     
    24282425{
    24292426  BOOL fResult;
    2430 
     2427 
    24312428#ifdef DEBUG_LOCAL2
    24322429  WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterA(%08x,%c,%08x,%08x,%08x).\n",
     
    24372434           lpNumberOfCharsWritten);
    24382435#endif
    2439 
     2436 
    24402437  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    24412438                                  DRQ_FILLCONSOLEOUTPUTCHARACTERA,
     
    24432440                                  (ULONG)nLength,
    24442441                                  COORD2ULONG(dwWriteCoord),
    2445                                   (ULONG)lpNumberOfCharsWritten);
    2446 
    2447   return fResult;
    2448 }
    2449 
    2450 
    2451 /*****************************************************************************
    2452  * Name      :
    2453  * Purpose   :
    2454  * Parameters:
    2455  * Variables :
    2456  * Result    :
     2442                                  (ULONG)lpNumberOfCharsWritten); 
     2443 
     2444  return fResult; 
     2445}
     2446
     2447
     2448/*****************************************************************************
     2449 * Name      : 
     2450 * Purpose   : 
     2451 * Parameters: 
     2452 * Variables :
     2453 * Result    : 
    24572454 * Remark    :
    2458  * Status    :
     2455 * Status    : 
    24592456 *
    24602457 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    24612458 *****************************************************************************/
    24622459
    2463 BOOL WIN32API FillConsoleOutputCharacterW(HANDLE  hConsoleOutput,
     2460BOOL WIN32API OS2FillConsoleOutputCharacterW(HANDLE  hConsoleOutput,
    24642461                                             WCHAR   cCharacter,
    24652462                                             DWORD   nLength,
     
    24682465{
    24692466  BOOL fResult;
    2470 
     2467 
    24712468#ifdef DEBUG_LOCAL2
    24722469  WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterW(%08x,%c,%08x,%08x,%08x) .\n",
     
    24772474           lpNumberOfCharsWritten);
    24782475#endif
    2479 
     2476 
    24802477  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    24812478                                  DRQ_FILLCONSOLEOUTPUTCHARACTERW,
     
    24902487
    24912488/*****************************************************************************
    2492  * Name      :
    2493  * Purpose   :
    2494  * Parameters:
    2495  * Variables :
    2496  * Result    :
     2489 * Name      : 
     2490 * Purpose   : 
     2491 * Parameters: 
     2492 * Variables :
     2493 * Result    : 
    24972494 * Remark    :
    2498  * Status    :
     2495 * Status    : 
    24992496 *
    25002497 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    25012498 *****************************************************************************/
    25022499
    2503 BOOL WIN32API FlushConsoleInputBuffer( HANDLE hConsoleInput )
     2500BOOL WIN32API OS2FlushConsoleInputBuffer( HANDLE hConsoleInput )
    25042501{
    25052502  BOOL fResult;
    2506 
     2503 
    25072504#ifdef DEBUG_LOCAL2
    25082505  WriteLog("KERNEL32/CONSOLE: OS2FlushConsoleInputBuffer(%08x).\n",
    25092506           hConsoleInput);
    25102507#endif
    2511 
     2508 
    25122509  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    25132510                                  DRQ_FLUSHCONSOLEINPUTBUFFER,
     
    25222519
    25232520/*****************************************************************************
    2524  * Name      : BOOL WIN32API FreeConsole
     2521 * Name      : BOOL WIN32API OS2FreeConsole
    25252522 * Purpose   : The FreeConsole function detaches the calling process
    25262523 *             from its console.
     
    25362533 *****************************************************************************/
    25372534
    2538 BOOL WIN32API FreeConsole( VOID )
     2535BOOL WIN32API OS2FreeConsole( VOID )
    25392536{
    25402537  APIRET rc;                                               /* API returncode */
    2541 
     2538 
    25422539#ifdef DEBUG_LOCAL2
    25432540  WriteLog("KERNEL32/CONSOLE: OS2FreeConsole() called.\n");
    25442541#endif
    2545 
     2542 
    25462543  rc = ConsoleTerminate();                /* terminate subsystem if required */
    25472544  if (rc != NO_ERROR)                                    /* check for errors */
    25482545  {
    2549     O32_SetLastError(rc);                            /* pass thru the error code */
     2546    SetLastError(rc);                            /* pass thru the error code */
    25502547    return FALSE;                                          /* signal failure */
    25512548  }
    25522549  else
    25532550    return TRUE;                                                /* Fine ! :) */
    2554 
    2555   return TRUE;
    2556 }
    2557 
    2558 
    2559 /*****************************************************************************
    2560  * Name      :
    2561  * Purpose   :
    2562  * Parameters:
    2563  * Variables :
    2564  * Result    :
     2551 
     2552  return TRUE; 
     2553}
     2554
     2555
     2556/*****************************************************************************
     2557 * Name      : 
     2558 * Purpose   : 
     2559 * Parameters: 
     2560 * Variables :
     2561 * Result    : 
    25652562 * Remark    :
    2566  * Status    :
     2563 * Status    : 
    25672564 *
    25682565 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    25692566 *****************************************************************************/
    25702567
    2571 BOOL WIN32API GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
     2568BOOL WIN32API OS2GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
    25722569                                          DWORD dwProcessGroupId)
    25732570{
     
    25772574           dwProcessGroupId);
    25782575#endif
    2579 
     2576 
    25802577  return TRUE;
    25812578}
     
    25832580
    25842581/*****************************************************************************
    2585  * Name      :
    2586  * Purpose   :
    2587  * Parameters:
    2588  * Variables :
    2589  * Result    :
     2582 * Name      : 
     2583 * Purpose   : 
     2584 * Parameters: 
     2585 * Variables :
     2586 * Result    : 
    25902587 * Remark    :
    2591  * Status    :
     2588 * Status    : 
    25922589 *
    25932590 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    25942591 *****************************************************************************/
    25952592
    2596 UINT WIN32API GetConsoleCP(VOID)
     2593UINT WIN32API OS2GetConsoleCP(VOID)
    25972594{
    25982595#ifdef DEBUG_LOCAL2
    25992596  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCP not implemented.\n");
    26002597#endif
    2601 
     2598 
    26022599  return 1;
    26032600}
     
    26052602
    26062603/*****************************************************************************
    2607  * Name      :
    2608  * Purpose   :
    2609  * Parameters:
    2610  * Variables :
    2611  * Result    :
     2604 * Name      : 
     2605 * Purpose   : 
     2606 * Parameters: 
     2607 * Variables :
     2608 * Result    : 
    26122609 * Remark    :
    2613  * Status    :
     2610 * Status    : 
    26142611 *
    26152612 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    26162613 *****************************************************************************/
    26172614
    2618 BOOL WIN32API GetConsoleCursorInfo(HANDLE               hConsoleOutput,
     2615BOOL WIN32API OS2GetConsoleCursorInfo(HANDLE               hConsoleOutput,
    26192616                                      PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
    26202617{
    26212618  BOOL fResult;
    2622 
     2619 
    26232620#ifdef DEBUG_LOCAL2
    26242621  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCursorInfo(%08x,%08x).\n",
     
    26262623           lpConsoleCursorInfo);
    26272624#endif
    2628 
     2625 
    26292626  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    26302627                                  DRQ_GETCONSOLECURSORINFO,
     
    26392636
    26402637/*****************************************************************************
    2641  * Name      :
    2642  * Purpose   :
    2643  * Parameters:
    2644  * Variables :
    2645  * Result    :
     2638 * Name      : 
     2639 * Purpose   : 
     2640 * Parameters: 
     2641 * Variables :
     2642 * Result    : 
    26462643 * Remark    :
    2647  * Status    :
     2644 * Status    : 
    26482645 *
    26492646 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    26502647 *****************************************************************************/
    26512648
    2652 BOOL WIN32API GetConsoleMode(HANDLE  hConsole,
     2649BOOL WIN32API OS2GetConsoleMode(HANDLE  hConsole,
    26532650                                LPDWORD lpMode)
    26542651{
    26552652  BOOL fResult;
    2656 
     2653 
    26572654#ifdef DEBUG_LOCAL2
    26582655  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleMode(%08x,%08x).\n",
     
    26602657           lpMode);
    26612658#endif
    2662 
     2659 
    26632660  fResult = (BOOL)HMDeviceRequest(hConsole,
    26642661                                  DRQ_GETCONSOLEMODE,
     
    26672664                                  0,
    26682665                                  0);
    2669 
     2666 
    26702667  return fResult;
    26712668}
     
    26732670
    26742671/*****************************************************************************
    2675  * Name      :
    2676  * Purpose   :
    2677  * Parameters:
    2678  * Variables :
    2679  * Result    :
     2672 * Name      : 
     2673 * Purpose   : 
     2674 * Parameters: 
     2675 * Variables :
     2676 * Result    : 
    26802677 * Remark    :
    2681  * Status    :
     2678 * Status    : 
    26822679 *
    26832680 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    26842681 *****************************************************************************/
    26852682
    2686 UINT WIN32API GetConsoleOutputCP(VOID)
     2683UINT WIN32API OS2GetConsoleOutputCP(VOID)
    26872684{
    26882685#ifdef DEBUG_LOCAL2
    26892686  WriteLog("KERNEL32/CONSOLE: OS2GetConsoleOutputCP not implemented.\n");
    26902687#endif
    2691 
     2688 
    26922689  return 1;
    26932690}
     
    26952692
    26962693/*****************************************************************************
    2697  * Name      :
    2698  * Purpose   :
    2699  * Parameters:
    2700  * Variables :
    2701  * Result    :
     2694 * Name      : 
     2695 * Purpose   : 
     2696 * Parameters: 
     2697 * Variables :
     2698 * Result    : 
    27022699 * Remark    :
    2703  * Status    :
     2700 * Status    : 
    27042701 *
    27052702 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    27062703 *****************************************************************************/
    27072704
    2708 BOOL WIN32API GetConsoleScreenBufferInfo(HANDLE                      hConsoleOutput,
     2705BOOL WIN32API OS2GetConsoleScreenBufferInfo(HANDLE                      hConsoleOutput,
    27092706                                            PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
    27102707{
     
    27162713           lpConsoleScreenBufferInfo);
    27172714#endif
    2718 
     2715 
    27192716  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    27202717                                  DRQ_GETCONSOLESCREENBUFFERINFO,
     
    27292726
    27302727/*****************************************************************************
    2731  * Name      : DWORD WIN32API GetConsoleTitle
     2728 * Name      : DWORD WIN32API OS2GetConsoleTitle
    27322729 * Purpose   : Query the current console window title
    27332730 * Parameters: LPTSTR lpConsoleTitle
     
    27412738 *****************************************************************************/
    27422739
    2743 DWORD WIN32API GetConsoleTitleA(LPTSTR lpConsoleTitle,
     2740DWORD WIN32API OS2GetConsoleTitleA(LPTSTR lpConsoleTitle,
    27442741                                   DWORD  nSize)
    27452742{
     
    27512748           nSize);
    27522749#endif
    2753 
     2750 
    27542751  if (ConsoleGlobals.pszWindowTitle == NULL)    /* is there a window title ? */
    27552752    return 0;                                           /* abort immediately */
    2756 
     2753 
    27572754  ulLength = strlen(ConsoleGlobals.pszWindowTitle);        /* length of text */
    2758 
     2755 
    27592756  strncpy(lpConsoleTitle,
    27602757          ConsoleGlobals.pszWindowTitle,
    27612758          nSize);
    2762 
     2759 
    27632760  return (nSize < ulLength) ? nSize : ulLength;
    27642761}
     
    27662763
    27672764/*****************************************************************************
    2768  * Name      : DWORD WIN32API GetConsoleTitle
     2765 * Name      : DWORD WIN32API OS2GetConsoleTitle
    27692766 * Purpose   : Query the current console window title
    27702767 * Parameters: LPTSTR lpConsoleTitle
     
    27782775 *****************************************************************************/
    27792776
    2780 DWORD WIN32API GetConsoleTitleW(LPTSTR lpConsoleTitle,
     2777DWORD WIN32API OS2GetConsoleTitleW(LPTSTR lpConsoleTitle,
    27812778                                   DWORD  nSize)
    27822779{
     
    27882785           nSize);
    27892786#endif
    2790 
     2787 
    27912788  if (ConsoleGlobals.pszWindowTitle == NULL)    /* is there a window title ? */
    27922789    return 0;                                           /* abort immediately */
    2793 
     2790 
    27942791  ulLength = strlen(ConsoleGlobals.pszWindowTitle);        /* length of text */
    2795 
     2792 
    27962793  strncpy(lpConsoleTitle,
    27972794          ConsoleGlobals.pszWindowTitle,
    27982795          nSize);
    2799 
     2796 
    28002797  /* @@@PH Ascii2Unicode */
    2801 
     2798 
    28022799  return (nSize < ulLength) ? nSize : ulLength;
    28032800}
     
    28052802
    28062803/*****************************************************************************
    2807  * Name      : COORD WIN32API GetLargestConsoleWindowSize
     2804 * Name      : COORD WIN32API OS2GetLargestConsoleWindowSize
    28082805 * Purpose   : Determine maximum AVIO size
    2809  * Parameters:
    2810  * Variables :
    2811  * Result    :
     2806 * Parameters: 
     2807 * Variables :
     2808 * Result    : 
    28122809 * Remark    :
    2813  * Status    :
     2810 * Status    : 
    28142811 *
    28152812 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    28162813 *****************************************************************************/
    28172814
    2818 COORD WIN32API GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
     2815COORD WIN32API OS2GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
    28192816{
    28202817  DWORD dwResult;
    28212818  COORD coordResult;
    2822 
     2819 
    28232820#ifdef DEBUG_LOCAL2
    28242821  WriteLog("KERNEL32/CONSOLE: OS2GetLargestConsoleWindowSize(%08x).\n",
    28252822           hConsoleOutput);
    28262823#endif
    2827 
     2824 
    28282825  dwResult = HMDeviceRequest(hConsoleOutput,
    28292826                             DRQ_GETLARGESTCONSOLEWINDOWSIZE,
     
    28312828                             0,
    28322829                             0,
    2833                              0);
    2834 
     2830                             0); 
     2831 
    28352832  ULONG2COORD(coordResult,dwResult)
    28362833  return ( coordResult );
     
    28392836
    28402837/*****************************************************************************
    2841  * Name      :
    2842  * Purpose   :
    2843  * Parameters:
    2844  * Variables :
    2845  * Result    :
     2838 * Name      : 
     2839 * Purpose   : 
     2840 * Parameters: 
     2841 * Variables :
     2842 * Result    : 
    28462843 * Remark    :
    2847  * Status    :
     2844 * Status    : 
    28482845 *
    28492846 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    28502847 *****************************************************************************/
    28512848
    2852 BOOL WIN32API GetNumberOfConsoleInputEvents(HANDLE  hConsoleInput,
     2849BOOL WIN32API OS2GetNumberOfConsoleInputEvents(HANDLE  hConsoleInput,
    28532850                                               LPDWORD lpNumberOfEvents)
    28542851{
     
    28602857           lpNumberOfEvents);
    28612858#endif
    2862 
     2859 
    28632860  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    28642861                                  DRQ_GETNUMBEROFCONSOLEINPUTEVENTS,
     
    28672864                                  0,
    28682865                                  0);
    2869 
     2866 
    28702867  return fResult;
    28712868}
     
    28732870
    28742871/*****************************************************************************
    2875  * Name      :
    2876  * Purpose   :
    2877  * Parameters:
    2878  * Variables :
    2879  * Result    :
     2872 * Name      : 
     2873 * Purpose   : 
     2874 * Parameters: 
     2875 * Variables :
     2876 * Result    : 
    28802877 * Remark    :
    2881  * Status    :
     2878 * Status    : 
    28822879 *
    28832880 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    28842881 *****************************************************************************/
    28852882
    2886 BOOL WIN32API GetNumberOfConsoleMouseButtons(LPDWORD lpcNumberOfMouseButtons)
     2883BOOL WIN32API OS2GetNumberOfConsoleMouseButtons(LPDWORD lpcNumberOfMouseButtons)
    28872884{
    28882885  LONG lMouseButtons;
    2889 
     2886 
    28902887#ifdef DEBUG_LOCAL2
    28912888  WriteLog("KERNEL32/CONSOLE: OS2GetNumberOfConsoleMouseButtons(%08x).\n",
    28922889           lpcNumberOfMouseButtons);
    28932890#endif
    2894 
     2891 
    28952892  lMouseButtons = WinQuerySysValue(HWND_DESKTOP,        /* query PM for that */
    28962893                                   SV_CMOUSEBUTTONS);
    2897 
     2894 
    28982895  *lpcNumberOfMouseButtons = (DWORD)lMouseButtons;
    2899 
     2896 
    29002897  return TRUE;
    29012898}
     
    29032900
    29042901/*****************************************************************************
    2905  * Name      :
    2906  * Purpose   :
    2907  * Parameters:
    2908  * Variables :
    2909  * Result    :
     2902 * Name      : 
     2903 * Purpose   : 
     2904 * Parameters: 
     2905 * Variables :
     2906 * Result    : 
    29102907 * Remark    :
    2911  * Status    :
     2908 * Status    : 
    29122909 *
    29132910 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    29142911 *****************************************************************************/
    29152912
    2916 BOOL WIN32API PeekConsoleInputW(HANDLE        hConsoleInput,
     2913BOOL WIN32API OS2PeekConsoleInputW(HANDLE        hConsoleInput,
    29172914                                   PINPUT_RECORD pirBuffer,
    29182915                                   DWORD         cInRecords,
     
    29282925           lpcRead);
    29292926#endif
    2930 
     2927 
    29312928  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    29322929                                  DRQ_PEEKCONSOLEINPUTW,
     
    29352932                                  (ULONG)lpcRead,
    29362933                                  0);
    2937 
     2934 
    29382935  return fResult;
    29392936}
     
    29412938
    29422939/*****************************************************************************
    2943  * Name      :
    2944  * Purpose   :
    2945  * Parameters:
    2946  * Variables :
    2947  * Result    :
     2940 * Name      : 
     2941 * Purpose   : 
     2942 * Parameters: 
     2943 * Variables :
     2944 * Result    : 
    29482945 * Remark    :
    2949  * Status    :
     2946 * Status    : 
    29502947 *
    29512948 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    29522949 *****************************************************************************/
    29532950
    2954 BOOL WIN32API PeekConsoleInputA(HANDLE        hConsoleInput,
     2951BOOL WIN32API OS2PeekConsoleInputA(HANDLE        hConsoleInput,
    29552952                                   PINPUT_RECORD pirBuffer,
    29562953                                   DWORD         cInRecords,
     
    29582955{
    29592956  BOOL fResult;
    2960 
     2957 
    29612958#ifdef DEBUG_LOCAL2
    29622959  WriteLog("KERNEL32/CONSOLE: OS2PeekConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    29662963           lpcRead);
    29672964#endif
    2968 
     2965 
    29692966  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    29702967                                  DRQ_PEEKCONSOLEINPUTA,
     
    29732970                                  (ULONG)lpcRead,
    29742971                                  0);
    2975 
    2976   return fResult;
    2977 }
    2978 
    2979 
    2980 /*****************************************************************************
    2981  * Name      :
    2982  * Purpose   :
    2983  * Parameters:
    2984  * Variables :
    2985  * Result    :
     2972 
     2973  return fResult; 
     2974}
     2975
     2976
     2977/*****************************************************************************
     2978 * Name      : 
     2979 * Purpose   : 
     2980 * Parameters: 
     2981 * Variables :
     2982 * Result    : 
    29862983 * Remark    :
    2987  * Status    :
     2984 * Status    : 
    29882985 *
    29892986 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    29902987 *****************************************************************************/
    29912988
    2992 BOOL WIN32API ReadConsoleA(HANDLE  hConsoleInput,
     2989BOOL WIN32API OS2ReadConsoleA(HANDLE  hConsoleInput,
    29932990                              LPVOID  lpvBuffer,
    29942991                              DWORD   cchToRead,
     
    29972994{
    29982995  BOOL fResult;
    2999 
     2996 
    30002997#ifdef DEBUG_LOCAL2
    30012998  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleA(%08x,%08x,%08x,%08x,%08x).\n",
     
    30063003           lpvReserved);
    30073004#endif
    3008 
     3005 
    30093006  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    30103007                                  DRQ_READCONSOLEA,
     
    30133010                                  (ULONG)lpcchRead,
    30143011                                  (ULONG)lpvReserved);
    3015 
    3016   return fResult;
    3017 }
    3018 
    3019 
    3020 /*****************************************************************************
    3021  * Name      :
    3022  * Purpose   :
    3023  * Parameters:
    3024  * Variables :
    3025  * Result    :
     3012 
     3013  return fResult; 
     3014}
     3015
     3016
     3017/*****************************************************************************
     3018 * Name      : 
     3019 * Purpose   : 
     3020 * Parameters: 
     3021 * Variables :
     3022 * Result    : 
    30263023 * Remark    :
    3027  * Status    :
     3024 * Status    : 
    30283025 *
    30293026 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    30303027 *****************************************************************************/
    30313028
    3032 BOOL WIN32API ReadConsoleW(HANDLE  hConsoleInput,
     3029BOOL WIN32API OS2ReadConsoleW(HANDLE  hConsoleInput,
    30333030                              LPVOID  lpvBuffer,
    30343031                              DWORD   cchToRead,
     
    30373034{
    30383035  BOOL fResult;
    3039 
     3036 
    30403037#ifdef DEBUG_LOCAL2
    30413038  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleW(%08x,%08x,%08x,%08x,%08x).\n",
     
    30463043           lpvReserved);
    30473044#endif
    3048 
     3045 
    30493046  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    30503047                                  DRQ_READCONSOLEW,
     
    30533050                                  (ULONG)lpcchRead,
    30543051                                  (ULONG)lpvReserved);
    3055 
    3056   return fResult;
    3057 }
    3058 
    3059 
    3060 /*****************************************************************************
    3061  * Name      :
    3062  * Purpose   :
    3063  * Parameters:
    3064  * Variables :
    3065  * Result    :
     3052 
     3053  return fResult; 
     3054}
     3055
     3056
     3057/*****************************************************************************
     3058 * Name      : 
     3059 * Purpose   : 
     3060 * Parameters: 
     3061 * Variables :
     3062 * Result    : 
    30663063 * Remark    :
    3067  * Status    :
     3064 * Status    : 
    30683065 *
    30693066 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    30703067 *****************************************************************************/
    30713068
    3072 BOOL WIN32API ReadConsoleInputA(HANDLE        hConsoleInput,
     3069BOOL WIN32API OS2ReadConsoleInputA(HANDLE        hConsoleInput,
    30733070                                   PINPUT_RECORD pirBuffer,
    30743071                                   DWORD         cInRecords,
     
    30763073{
    30773074  BOOL fResult;
    3078 
     3075 
    30793076#ifdef DEBUG_LOCAL2
    30803077  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    30843081           lpcRead);
    30853082#endif
    3086 
     3083 
    30873084  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    30883085                                  DRQ_READCONSOLEINPUTA,
     
    30913088                                  (ULONG)lpcRead,
    30923089                                  0);
    3093 
    3094   return fResult;
    3095 }
    3096 
    3097 
    3098 /*****************************************************************************
    3099  * Name      :
    3100  * Purpose   :
    3101  * Parameters:
    3102  * Variables :
    3103  * Result    :
     3090 
     3091  return fResult; 
     3092}
     3093
     3094
     3095/*****************************************************************************
     3096 * Name      : 
     3097 * Purpose   : 
     3098 * Parameters: 
     3099 * Variables :
     3100 * Result    : 
    31043101 * Remark    :
    3105  * Status    :
     3102 * Status    : 
    31063103 *
    31073104 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    31083105 *****************************************************************************/
    31093106
    3110 BOOL WIN32API ReadConsoleInputW(HANDLE        hConsoleInput,
     3107BOOL WIN32API OS2ReadConsoleInputW(HANDLE        hConsoleInput,
    31113108                                   PINPUT_RECORD pirBuffer,
    31123109                                   DWORD         cInRecords,
     
    31143111{
    31153112  BOOL fResult;
    3116 
     3113 
    31173114#ifdef DEBUG_LOCAL2
    31183115  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    31223119           lpcRead);
    31233120#endif
    3124 
     3121 
    31253122  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    31263123                                  DRQ_READCONSOLEINPUTW,
     
    31293126                                  (ULONG)lpcRead,
    31303127                                  0);
    3131 
    3132   return fResult;
    3133 }
    3134 
    3135 
    3136 /*****************************************************************************
    3137  * Name      :
    3138  * Purpose   :
    3139  * Parameters:
    3140  * Variables :
    3141  * Result    :
     3128 
     3129  return fResult; 
     3130}
     3131
     3132
     3133/*****************************************************************************
     3134 * Name      : 
     3135 * Purpose   : 
     3136 * Parameters: 
     3137 * Variables :
     3138 * Result    : 
    31423139 * Remark    :
    3143  * Status    :
     3140 * Status    : 
    31443141 *
    31453142 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    31463143 *****************************************************************************/
    31473144
    3148 BOOL WIN32API ReadConsoleOutputA(HANDLE      hConsoleOutput,
     3145BOOL WIN32API OS2ReadConsoleOutputA(HANDLE      hConsoleOutput,
    31493146                                    PCHAR_INFO  pchiDestBuffer,
    31503147                                    COORD       coordDestBufferSize,
     
    31533150{
    31543151  BOOL fResult;
    3155 
     3152 
    31563153#ifdef DEBUG_LOCAL2
    31573154  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n",
     
    31623159           psrctSourceRect);
    31633160#endif
    3164 
     3161 
    31653162  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    31663163                                  DRQ_READCONSOLEOUTPUTA,
     
    31693166                                  COORD2ULONG(coordDestBufferCoord),
    31703167                                  (ULONG)psrctSourceRect);
    3171 
    3172   return fResult;
    3173 }
    3174 
    3175 
    3176 /*****************************************************************************
    3177  * Name      :
    3178  * Purpose   :
    3179  * Parameters:
    3180  * Variables :
    3181  * Result    :
     3168 
     3169  return fResult; 
     3170}
     3171
     3172
     3173/*****************************************************************************
     3174 * Name      : 
     3175 * Purpose   : 
     3176 * Parameters: 
     3177 * Variables :
     3178 * Result    : 
    31823179 * Remark    :
    3183  * Status    :
     3180 * Status    : 
    31843181 *
    31853182 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    31863183 *****************************************************************************/
    31873184
    3188 BOOL WIN32API ReadConsoleOutputW(HANDLE      hConsoleOutput,
     3185BOOL WIN32API OS2ReadConsoleOutputW(HANDLE      hConsoleOutput,
    31893186                                    PCHAR_INFO  pchiDestBuffer,
    31903187                                    COORD       coordDestBufferSize,
     
    31933190{
    31943191  BOOL fResult;
    3195 
     3192 
    31963193#ifdef DEBUG_LOCAL2
    31973194  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n",
     
    32023199           psrctSourceRect);
    32033200#endif
    3204 
     3201 
    32053202  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    32063203                                  DRQ_READCONSOLEOUTPUTW,
     
    32093206                                  COORD2ULONG(coordDestBufferCoord),
    32103207                                  (ULONG)psrctSourceRect);
    3211 
    3212   return fResult;
    3213 }
    3214 
    3215 
    3216 /*****************************************************************************
    3217  * Name      :
    3218  * Purpose   :
    3219  * Parameters:
    3220  * Variables :
    3221  * Result    :
     3208 
     3209  return fResult; 
     3210}
     3211
     3212
     3213/*****************************************************************************
     3214 * Name      : 
     3215 * Purpose   : 
     3216 * Parameters: 
     3217 * Variables :
     3218 * Result    : 
    32223219 * Remark    :
    3223  * Status    :
     3220 * Status    : 
    32243221 *
    32253222 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    32263223 *****************************************************************************/
    32273224
    3228 BOOL WIN32API ReadConsoleOutputAttribute(HANDLE  hConsoleOutput,
     3225BOOL WIN32API OS2ReadConsoleOutputAttribute(HANDLE  hConsoleOutput,
    32293226                                            LPWORD  lpwAttribute,
    32303227                                            DWORD   cReadCells,
     
    32333230{
    32343231  BOOL fResult;
    3235 
     3232 
    32363233#ifdef DEBUG_LOCAL2
    32373234  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n",
     
    32423239           lpcNumberRead);
    32433240#endif
    3244 
     3241 
    32453242  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    32463243                                  DRQ_READCONSOLEOUTPUTATTRIBUTE,
     
    32493246                                  COORD2ULONG(coordReadCoord),
    32503247                                  (ULONG)lpcNumberRead);
    3251 
    3252   return fResult;
    3253 }
    3254 
    3255 
    3256 /*****************************************************************************
    3257  * Name      :
    3258  * Purpose   :
    3259  * Parameters:
    3260  * Variables :
    3261  * Result    :
     3248 
     3249  return fResult; 
     3250}
     3251
     3252
     3253/*****************************************************************************
     3254 * Name      : 
     3255 * Purpose   : 
     3256 * Parameters: 
     3257 * Variables :
     3258 * Result    : 
    32623259 * Remark    :
    3263  * Status    :
     3260 * Status    : 
    32643261 *
    32653262 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    32663263 *****************************************************************************/
    32673264
    3268 BOOL WIN32API ReadConsoleOutputCharacterA(HANDLE  hConsoleOutput,
     3265BOOL WIN32API OS2ReadConsoleOutputCharacterA(HANDLE  hConsoleOutput,
    32693266                                             LPTSTR  lpReadBuffer,
    32703267                                             DWORD   cchRead,
     
    32733270{
    32743271  BOOL fResult;
    3275 
     3272 
    32763273#ifdef DEBUG_LOCAL2
    32773274  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n",
     
    32823279           lpcNumberRead);
    32833280#endif
    3284 
     3281 
    32853282  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    32863283                                  DRQ_READCONSOLEOUTPUTCHARACTERA,
     
    32893286                                  COORD2ULONG(coordReadCoord),
    32903287                                  (ULONG)lpcNumberRead);
    3291 
    3292   return fResult;
    3293 }
    3294 
    3295 
    3296 /*****************************************************************************
    3297  * Name      :
    3298  * Purpose   :
    3299  * Parameters:
    3300  * Variables :
    3301  * Result    :
     3288 
     3289  return fResult; 
     3290}
     3291
     3292
     3293/*****************************************************************************
     3294 * Name      : 
     3295 * Purpose   : 
     3296 * Parameters: 
     3297 * Variables :
     3298 * Result    : 
    33023299 * Remark    :
    3303  * Status    :
     3300 * Status    : 
    33043301 *
    33053302 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    33063303 *****************************************************************************/
    33073304
    3308 BOOL WIN32API ReadConsoleOutputCharacterW(HANDLE  hConsoleOutput,
     3305BOOL WIN32API OS2ReadConsoleOutputCharacterW(HANDLE  hConsoleOutput,
    33093306                                             LPTSTR  lpReadBuffer,
    33103307                                             DWORD   cchRead,
     
    33133310{
    33143311  BOOL fResult;
    3315 
     3312 
    33163313#ifdef DEBUG_LOCAL2
    33173314  WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n",
     
    33223319           lpcNumberRead);
    33233320#endif
    3324 
     3321 
    33253322  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    33263323                                  DRQ_READCONSOLEOUTPUTCHARACTERW,
     
    33293326                                  COORD2ULONG(coordReadCoord),
    33303327                                  (ULONG)lpcNumberRead);
    3331 
    3332   return fResult;
    3333 }
    3334 
    3335 
    3336 /*****************************************************************************
    3337  * Name      :
    3338  * Purpose   :
    3339  * Parameters:
    3340  * Variables :
    3341  * Result    :
     3328 
     3329  return fResult; 
     3330}
     3331
     3332
     3333/*****************************************************************************
     3334 * Name      : 
     3335 * Purpose   : 
     3336 * Parameters: 
     3337 * Variables :
     3338 * Result    : 
    33423339 * Remark    :
    3343  * Status    :
     3340 * Status    : 
    33443341 *
    33453342 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    33463343 *****************************************************************************/
    33473344
    3348 BOOL WIN32API ScrollConsoleScreenBufferA(HANDLE      hConsoleOutput,
     3345BOOL WIN32API OS2ScrollConsoleScreenBufferA(HANDLE      hConsoleOutput,
    33493346                                            PSMALL_RECT psrctSourceRect,
    33503347                                            PSMALL_RECT psrctClipRect,
     
    33533350{
    33543351  BOOL fResult;
    3355 
     3352 
    33563353#ifdef DEBUG_LOCAL2
    33573354  WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferA(%08x,%08x,%08x,%08x,%08x).\n",
     
    33623359           pchiFill);
    33633360#endif
    3364 
     3361 
    33653362  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    33663363                                  DRQ_SCROLLCONSOLESCREENBUFFERA,
     
    33693366                                  COORD2ULONG(coordDestOrigin),
    33703367                                  (ULONG)pchiFill);
    3371 
    3372   return fResult;
    3373 }
    3374 
    3375 
    3376 /*****************************************************************************
    3377  * Name      :
    3378  * Purpose   :
    3379  * Parameters:
    3380  * Variables :
    3381  * Result    :
     3368 
     3369  return fResult; 
     3370}
     3371
     3372
     3373/*****************************************************************************
     3374 * Name      : 
     3375 * Purpose   : 
     3376 * Parameters: 
     3377 * Variables :
     3378 * Result    : 
    33823379 * Remark    :
    3383  * Status    :
     3380 * Status    : 
    33843381 *
    33853382 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    33863383 *****************************************************************************/
    33873384
    3388 BOOL WIN32API ScrollConsoleScreenBufferW(HANDLE      hConsoleOutput,
     3385BOOL WIN32API OS2ScrollConsoleScreenBufferW(HANDLE      hConsoleOutput,
    33893386                                            PSMALL_RECT psrctSourceRect,
    33903387                                            PSMALL_RECT psrctClipRect,
     
    33933390{
    33943391  BOOL fResult;
    3395 
     3392 
    33963393#ifdef DEBUG_LOCAL2
    33973394  WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferW(%08x,%08x,%08x,%08x,%08x).\n",
     
    34023399           pchiFill);
    34033400#endif
    3404 
     3401 
    34053402  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    34063403                                  DRQ_SCROLLCONSOLESCREENBUFFERW,
     
    34093406                                  COORD2ULONG(coordDestOrigin),
    34103407                                  (ULONG)pchiFill);
    3411 
    3412   return fResult;
    3413 }
    3414 
    3415 /*****************************************************************************
    3416  * Name      :
    3417  * Purpose   :
    3418  * Parameters:
    3419  * Variables :
    3420  * Result    :
     3408 
     3409  return fResult; 
     3410}
     3411
     3412/*****************************************************************************
     3413 * Name      : 
     3414 * Purpose   : 
     3415 * Parameters: 
     3416 * Variables :
     3417 * Result    : 
    34213418 * Remark    :
    3422  * Status    :
     3419 * Status    : 
    34233420 *
    34243421 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    34253422 *****************************************************************************/
    34263423
    3427 BOOL WIN32API SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
     3424BOOL WIN32API OS2SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
    34283425{
    34293426  BOOL fResult;
    3430 
     3427 
    34313428#ifdef DEBUG_LOCAL2
    34323429  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleActiveScreenBuffer(%08x).\n",
    34333430           hConsoleOutput);
    34343431#endif
    3435 
     3432 
    34363433  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    34373434                                  DRQ_SETCONSOLEACTIVESCREENBUFFER,
     
    34403437                                  0,
    34413438                                  0);
    3442 
    3443   return fResult;
    3444 }
    3445 
    3446 
    3447 /*****************************************************************************
    3448  * Name      :
    3449  * Purpose   :
    3450  * Parameters:
    3451  * Variables :
    3452  * Result    :
     3439 
     3440  return fResult; 
     3441}
     3442
     3443
     3444/*****************************************************************************
     3445 * Name      : 
     3446 * Purpose   : 
     3447 * Parameters: 
     3448 * Variables :
     3449 * Result    : 
    34533450 * Remark    :
    3454  * Status    :
     3451 * Status    : 
    34553452 *
    34563453 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    34573454 *****************************************************************************/
    34583455
    3459 BOOL WIN32API SetConsoleCP(UINT IDCodePage)
     3456BOOL WIN32API OS2SetConsoleCP(UINT IDCodePage)
    34603457{
    34613458#ifdef DEBUG_LOCAL2
     
    34633460           IDCodePage);
    34643461#endif
    3465 
     3462 
    34663463  return TRUE;
    34673464}
     
    34693466
    34703467/*****************************************************************************
    3471  * Name      :
    3472  * Purpose   :
    3473  * Parameters:
    3474  * Variables :
    3475  * Result    :
     3468 * Name      : 
     3469 * Purpose   : 
     3470 * Parameters: 
     3471 * Variables :
     3472 * Result    : 
    34763473 * Remark    :
    3477  * Status    :
     3474 * Status    : 
    34783475 *
    34793476 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    34803477 *****************************************************************************/
    34813478
    3482 BOOL WIN32API SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine,
     3479BOOL WIN32API OS2SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine,
    34833480                                       BOOL             fAdd)
    34843481{
     
    34883485           fAdd);
    34893486#endif
    3490 
     3487 
    34913488  return TRUE;
    34923489}
     
    34943491
    34953492/*****************************************************************************
    3496  * Name      :
    3497  * Purpose   :
    3498  * Parameters:
    3499  * Variables :
    3500  * Result    :
     3493 * Name      : 
     3494 * Purpose   : 
     3495 * Parameters: 
     3496 * Variables :
     3497 * Result    : 
    35013498 * Remark    :
    3502  * Status    :
     3499 * Status    : 
    35033500 *
    35043501 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    35053502 *****************************************************************************/
    35063503
    3507 BOOL WIN32API SetConsoleCursorInfo(HANDLE               hConsoleOutput,
     3504BOOL WIN32API OS2SetConsoleCursorInfo(HANDLE               hConsoleOutput,
    35083505                                      PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
    35093506{
    35103507  BOOL fResult;
    3511 
     3508 
    35123509#ifdef DEBUG_LOCAL2
    35133510  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorInfo(%08x,%08x).\n",
     
    35153512           lpConsoleCursorInfo);
    35163513#endif
    3517 
     3514 
    35183515  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    35193516                                  DRQ_SETCONSOLECURSORINFO,
     
    35223519                                  0,
    35233520                                  0);
    3524 
    3525   return fResult;
    3526 }
    3527 
    3528 
    3529 /*****************************************************************************
    3530  * Name      :
    3531  * Purpose   :
    3532  * Parameters:
    3533  * Variables :
    3534  * Result    :
     3521 
     3522  return fResult; 
     3523}
     3524
     3525
     3526/*****************************************************************************
     3527 * Name      : 
     3528 * Purpose   : 
     3529 * Parameters: 
     3530 * Variables :
     3531 * Result    : 
    35353532 * Remark    :
    3536  * Status    :
     3533 * Status    : 
    35373534 *
    35383535 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    35403537 *****************************************************************************/
    35413538
    3542 BOOL WIN32API SetConsoleCursorPosition(HANDLE hConsoleOutput,
     3539BOOL WIN32API OS2SetConsoleCursorPosition(HANDLE hConsoleOutput,
    35433540                                          COORD  coordCursor)
    35443541{
    35453542  BOOL fResult;
    3546 
     3543 
    35473544#ifdef DEBUG_LOCAL2
    35483545  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorPosition(%08x,%08x).\n",
     
    35503547           coordCursor);
    35513548#endif
    3552 
     3549 
    35533550  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    35543551                                  DRQ_SETCONSOLECURSORPOSITION,
     
    35573554                                  0,
    35583555                                  0);
    3559 
    3560   return fResult;
    3561 }
    3562 
    3563 
    3564 /*****************************************************************************
    3565  * Name      :
    3566  * Purpose   :
    3567  * Parameters:
    3568  * Variables :
    3569  * Result    :
     3556 
     3557  return fResult; 
     3558}
     3559
     3560
     3561/*****************************************************************************
     3562 * Name      : 
     3563 * Purpose   : 
     3564 * Parameters: 
     3565 * Variables :
     3566 * Result    : 
    35703567 * Remark    :
    3571  * Status    :
     3568 * Status    : 
    35723569 *
    35733570 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    35743571 *****************************************************************************/
    35753572
    3576 BOOL WIN32API SetConsoleMode(HANDLE hConsole,
     3573BOOL WIN32API OS2SetConsoleMode(HANDLE hConsole,
    35773574                                DWORD  fdwMode)
    35783575{
    35793576 BOOL fResult;
    3580 
     3577 
    35813578#ifdef DEBUG_LOCAL2
    35823579  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleMode(%08x,%08x).\n",
     
    35843581           fdwMode);
    35853582#endif
    3586 
     3583 
    35873584  fResult = (BOOL)HMDeviceRequest(hConsole,
    35883585                                  DRQ_SETCONSOLEMODE,
     
    35913588                                  0,
    35923589                                  0);
    3593 
     3590 
    35943591  return fResult;
    35953592}
     
    35973594
    35983595/*****************************************************************************
    3599  * Name      :
    3600  * Purpose   :
    3601  * Parameters:
    3602  * Variables :
    3603  * Result    :
     3596 * Name      : 
     3597 * Purpose   : 
     3598 * Parameters: 
     3599 * Variables :
     3600 * Result    : 
    36043601 * Remark    :
    3605  * Status    :
     3602 * Status    : 
    36063603 *
    36073604 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    36083605 *****************************************************************************/
    36093606
    3610 BOOL WIN32API SetConsoleOutputCP(UINT IDCodePage)
     3607BOOL WIN32API OS2SetConsoleOutputCP(UINT IDCodePage)
    36113608{
    36123609#ifdef DEBUG_LOCAL2
     
    36143611           IDCodePage);
    36153612#endif
    3616 
     3613 
    36173614  return TRUE;
    36183615}
     
    36203617
    36213618/*****************************************************************************
    3622  * Name      :
    3623  * Purpose   :
    3624  * Parameters:
    3625  * Variables :
    3626  * Result    :
     3619 * Name      : 
     3620 * Purpose   : 
     3621 * Parameters: 
     3622 * Variables :
     3623 * Result    : 
    36273624 * Remark    :
    3628  * Status    :
     3625 * Status    : 
    36293626 *
    36303627 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    36313628 *****************************************************************************/
    36323629
    3633 BOOL WIN32API SetConsoleScreenBufferSize(HANDLE hConsoleOutput,
     3630BOOL WIN32API OS2SetConsoleScreenBufferSize(HANDLE hConsoleOutput,
    36343631                                            COORD  coordSize)
    36353632{
    36363633  BOOL fResult;
    3637 
     3634 
    36383635#ifdef DEBUG_LOCAL2
    36393636  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleScreenBufferSize(%08x,%08x).\n",
     
    36413638           coordSize);
    36423639#endif
    3643 
     3640 
    36443641  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    36453642                                  DRQ_SETCONSOLESCREENBUFFERSIZE,
     
    36483645                                  0,
    36493646                                  0);
    3650 
    3651   return fResult;
    3652 }
    3653 
    3654 
    3655 /*****************************************************************************
    3656  * Name      :
    3657  * Purpose   :
    3658  * Parameters:
    3659  * Variables :
    3660  * Result    :
     3647 
     3648  return fResult; 
     3649}
     3650
     3651
     3652/*****************************************************************************
     3653 * Name      : 
     3654 * Purpose   : 
     3655 * Parameters: 
     3656 * Variables :
     3657 * Result    : 
    36613658 * Remark    :
    3662  * Status    :
     3659 * Status    : 
    36633660 *
    36643661 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    36653662 *****************************************************************************/
    36663663
    3667 BOOL WIN32API SetConsoleTextAttribute(HANDLE hConsoleOutput,
     3664BOOL WIN32API OS2SetConsoleTextAttribute(HANDLE hConsoleOutput,
    36683665                                         WORD   wAttr)
    36693666{
    36703667  BOOL fResult;
    3671 
     3668 
    36723669#ifdef DEBUG_LOCAL2
    36733670  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleTextAttribute(%08x,%04x).\n",
     
    36753672           wAttr);
    36763673#endif
    3677 
     3674 
    36783675  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    36793676                                  DRQ_SETCONSOLETEXTATTRIBUTE,
     
    36823679                                  0,
    36833680                                  0);
    3684 
    3685   return fResult;
    3686 }
    3687 
    3688 
    3689 /*****************************************************************************
    3690  * Name      : BOOL WIN32API SetConsoleTitleA
     3681 
     3682  return fResult; 
     3683}
     3684
     3685
     3686/*****************************************************************************
     3687 * Name      : BOOL WIN32API OS2SetConsoleTitleA
    36913688 * Purpose   : Set new title text for the console window
    36923689 * Parameters: LPTSTR lpszTitle
    36933690 * Variables :
    3694  * Result    :
     3691 * Result    : 
    36953692 * Remark    :
    36963693 * Status    : REWRITTEN UNTESTED
     
    36993696 *****************************************************************************/
    37003697
    3701 BOOL WIN32API SetConsoleTitleA(LPTSTR lpszTitle)
     3698BOOL WIN32API OS2SetConsoleTitleA(LPTSTR lpszTitle)
    37023699{
    37033700#ifdef DEBUG_LOCAL2
     
    37053702           lpszTitle);
    37063703#endif
    3707 
     3704 
    37083705  if (ConsoleGlobals.pszWindowTitle != NULL)           /* previously set name */
    37093706    free (ConsoleGlobals.pszWindowTitle);                     /* then free it */
    3710 
     3707 
    37113708  ConsoleGlobals.pszWindowTitle = strdup(lpszTitle);     /* copy the new name */
    3712 
     3709 
    37133710  WinSetWindowText(ConsoleGlobals.hwndFrame,           /* set new title text */
    37143711                   ConsoleGlobals.pszWindowTitle);
    3715 
     3712 
    37163713  return TRUE;
    37173714}
     
    37193716
    37203717/*****************************************************************************
    3721  * Name      : BOOL WIN32API SetConsoleTitleW
     3718 * Name      : BOOL WIN32API OS2SetConsoleTitleW
    37223719 * Purpose   : Set new title text for the console window
    37233720 * Parameters: LPTSTR lpszTitle
    37243721 * Variables :
    3725  * Result    :
     3722 * Result    : 
    37263723 * Remark    :
    37273724 * Status    : REWRITTEN UNTESTED
     
    37303727 *****************************************************************************/
    37313728
    3732 BOOL WIN32API SetConsoleTitleW(LPTSTR lpszTitle)
     3729BOOL WIN32API OS2SetConsoleTitleW(LPTSTR lpszTitle)
    37333730{
    37343731#ifdef DEBUG_LOCAL2
     
    37363733           lpszTitle);
    37373734#endif
    3738 
     3735 
    37393736  /* @@@PH Unicode2Ascii */
    3740 
     3737 
    37413738  if (ConsoleGlobals.pszWindowTitle != NULL)           /* previously set name */
    37423739    free (ConsoleGlobals.pszWindowTitle);                     /* then free it */
    3743 
     3740 
    37443741  ConsoleGlobals.pszWindowTitle = strdup(lpszTitle);     /* copy the new name */
    3745 
     3742 
    37463743  WinSetWindowText(ConsoleGlobals.hwndFrame,           /* set new title text */
    37473744                   ConsoleGlobals.pszWindowTitle);
    3748 
     3745 
    37493746  return TRUE;
    37503747}
     
    37523749
    37533750/*****************************************************************************
    3754  * Name      :
    3755  * Purpose   :
    3756  * Parameters:
    3757  * Variables :
    3758  * Result    :
     3751 * Name      : 
     3752 * Purpose   : 
     3753 * Parameters: 
     3754 * Variables :
     3755 * Result    : 
    37593756 * Remark    :
    3760  * Status    :
     3757 * Status    : 
    37613758 *
    37623759 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    37633760 *****************************************************************************/
    37643761
    3765 BOOL WIN32API SetConsoleWindowInfo(HANDLE      hConsoleOutput,
     3762BOOL WIN32API OS2SetConsoleWindowInfo(HANDLE      hConsoleOutput,
    37663763                                      BOOL        fAbsolute,
    37673764                                      PSMALL_RECT psrctWindowRect)
    37683765{
    37693766  BOOL fResult;
    3770 
     3767 
    37713768#ifdef DEBUG_LOCAL2
    37723769  WriteLog("KERNEL32/CONSOLE: OS2SetConsoleWindowInfo(%08x,%08x,%08x).\n",
     
    37753772           psrctWindowRect);
    37763773#endif
    3777 
     3774 
    37783775  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    37793776                                  DRQ_SETCONSOLEWINDOWINFO,
     
    37823779                                  0,
    37833780                                  0);
    3784 
    3785   return fResult;
    3786 }
    3787 
    3788 
    3789 /*****************************************************************************
    3790  * Name      :
    3791  * Purpose   :
    3792  * Parameters:
    3793  * Variables :
    3794  * Result    :
     3781 
     3782  return fResult; 
     3783}
     3784
     3785
     3786/*****************************************************************************
     3787 * Name      : 
     3788 * Purpose   : 
     3789 * Parameters: 
     3790 * Variables :
     3791 * Result    : 
    37953792 * Remark    :
    3796  * Status    :
     3793 * Status    : 
    37973794 *
    37983795 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    37993796 *****************************************************************************/
    38003797
    3801 BOOL WIN32API WriteConsoleA(HANDLE      hConsoleOutput,
     3798BOOL WIN32API OS2WriteConsoleA(HANDLE      hConsoleOutput,
    38023799                               CONST VOID* lpvBuffer,
    38033800                               DWORD       cchToWrite,
     
    38063803{
    38073804  BOOL fResult;
    3808 
     3805 
    38093806#ifdef DEBUG_LOCAL2
    38103807  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleA(%08x,%08x,%08x,%08x,%08x).\n",
     
    38153812           lpvReserved);
    38163813#endif
    3817 
     3814 
    38183815  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    38193816                                  DRQ_WRITECONSOLEA,
     
    38223819                                  (ULONG)lpcchWritten,
    38233820                                  (ULONG)lpvReserved);
    3824 
    3825   return fResult;
    3826 }
    3827 
    3828 
    3829 /*****************************************************************************
    3830  * Name      :
    3831  * Purpose   :
    3832  * Parameters:
    3833  * Variables :
    3834  * Result    :
     3821 
     3822  return fResult; 
     3823}
     3824
     3825
     3826/*****************************************************************************
     3827 * Name      : 
     3828 * Purpose   : 
     3829 * Parameters: 
     3830 * Variables :
     3831 * Result    : 
    38353832 * Remark    :
    3836  * Status    :
     3833 * Status    : 
    38373834 *
    38383835 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    38393836 *****************************************************************************/
    38403837
    3841 BOOL WIN32API WriteConsoleW(HANDLE      hConsoleOutput,
     3838BOOL WIN32API OS2WriteConsoleW(HANDLE      hConsoleOutput,
    38423839                               CONST VOID* lpvBuffer,
    38433840                               DWORD       cchToWrite,
     
    38463843{
    38473844  BOOL fResult;
    3848 
     3845 
    38493846#ifdef DEBUG_LOCAL2
    38503847  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleW(%08x,%08x,%08x,%08x,%08x).\n",
     
    38553852           lpvReserved);
    38563853#endif
    3857 
     3854 
    38583855  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    38593856                                  DRQ_WRITECONSOLEW,
     
    38623859                                  (ULONG)lpcchWritten,
    38633860                                  (ULONG)lpvReserved);
    3864 
    3865   return fResult;
    3866 }
    3867 
    3868 
    3869 /*****************************************************************************
    3870  * Name      :
    3871  * Purpose   :
    3872  * Parameters:
    3873  * Variables :
    3874  * Result    :
     3861 
     3862  return fResult; 
     3863}
     3864
     3865
     3866/*****************************************************************************
     3867 * Name      : 
     3868 * Purpose   : 
     3869 * Parameters: 
     3870 * Variables :
     3871 * Result    : 
    38753872 * Remark    :
    3876  * Status    :
     3873 * Status    : 
    38773874 *
    38783875 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    38793876 *****************************************************************************/
    38803877
    3881 BOOL WIN32API WriteConsoleInputA(HANDLE        hConsoleInput,
     3878BOOL WIN32API OS2WriteConsoleInputA(HANDLE        hConsoleInput,
    38823879                                    PINPUT_RECORD pirBuffer,
    38833880                                    DWORD         cInRecords,
     
    38853882{
    38863883  BOOL fResult;
    3887 
     3884 
    38883885#ifdef DEBUG_LOCAL2
    38893886  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    38933890           lpcWritten);
    38943891#endif
    3895 
     3892 
    38963893  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    38973894                                  DRQ_WRITECONSOLEINPUTA,
     
    39003897                                  (ULONG)lpcWritten,
    39013898                                  0);
    3902 
    3903   return fResult;
    3904 }
    3905 
    3906 
    3907 /*****************************************************************************
    3908  * Name      :
    3909  * Purpose   :
    3910  * Parameters:
    3911  * Variables :
    3912  * Result    :
     3899 
     3900  return fResult; 
     3901}
     3902
     3903
     3904/*****************************************************************************
     3905 * Name      : 
     3906 * Purpose   : 
     3907 * Parameters: 
     3908 * Variables :
     3909 * Result    : 
    39133910 * Remark    :
    3914  * Status    :
     3911 * Status    : 
    39153912 *
    39163913 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    39173914 *****************************************************************************/
    39183915
    3919 BOOL WIN32API WriteConsoleInputW(HANDLE        hConsoleInput,
     3916BOOL WIN32API OS2WriteConsoleInputW(HANDLE        hConsoleInput,
    39203917                                    PINPUT_RECORD pirBuffer,
    39213918                                    DWORD         cInRecords,
     
    39233920{
    39243921  BOOL fResult;
    3925 
     3922 
    39263923#ifdef DEBUG_LOCAL2
    39273924  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    39313928           lpcWritten);
    39323929#endif
    3933 
     3930 
    39343931  fResult = (BOOL)HMDeviceRequest(hConsoleInput,
    39353932                                  DRQ_WRITECONSOLEINPUTW,
     
    39383935                                  (ULONG)lpcWritten,
    39393936                                  0);
    3940 
    3941   return fResult;
    3942 }
    3943 
    3944 
    3945 /*****************************************************************************
    3946  * Name      :
    3947  * Purpose   :
    3948  * Parameters:
    3949  * Variables :
    3950  * Result    :
     3937 
     3938  return fResult; 
     3939}
     3940
     3941
     3942/*****************************************************************************
     3943 * Name      : 
     3944 * Purpose   : 
     3945 * Parameters: 
     3946 * Variables :
     3947 * Result    : 
    39513948 * Remark    :
    3952  * Status    :
     3949 * Status    : 
    39533950 *
    39543951 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    39553952 *****************************************************************************/
    39563953
    3957 BOOL WIN32API WriteConsoleOutputA(HANDLE      hConsoleOutput,
     3954BOOL WIN32API OS2WriteConsoleOutputA(HANDLE      hConsoleOutput,
    39583955                                     PCHAR_INFO  pchiSrcBuffer,
    39593956                                     COORD       coordSrcBufferSize,
     
    39623959{
    39633960  BOOL fResult;
    3964 
     3961 
    39653962#ifdef DEBUG_LOCAL2
    39663963  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n",
     
    39713968           psrctDestRect);
    39723969#endif
    3973 
     3970 
    39743971  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    39753972                                  DRQ_WRITECONSOLEOUTPUTA,
     
    39783975                                  COORD2ULONG(coordSrcBufferCoord),
    39793976                                  (ULONG)psrctDestRect);
    3980 
    3981   return fResult;
    3982 }
    3983 
    3984 
    3985 /*****************************************************************************
    3986  * Name      :
    3987  * Purpose   :
    3988  * Parameters:
    3989  * Variables :
    3990  * Result    :
     3977 
     3978  return fResult; 
     3979}
     3980
     3981
     3982/*****************************************************************************
     3983 * Name      : 
     3984 * Purpose   : 
     3985 * Parameters: 
     3986 * Variables :
     3987 * Result    : 
    39913988 * Remark    :
    3992  * Status    :
     3989 * Status    : 
    39933990 *
    39943991 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    39953992 *****************************************************************************/
    39963993
    3997 BOOL WIN32API WriteConsoleOutputW(HANDLE      hConsoleOutput,
     3994BOOL WIN32API OS2WriteConsoleOutputW(HANDLE      hConsoleOutput,
    39983995                                     PCHAR_INFO  pchiSrcBuffer,
    39993996                                     COORD       coordSrcBufferSize,
     
    40023999{
    40034000  BOOL fResult;
    4004 
     4001 
    40054002#ifdef DEBUG_LOCAL2
    40064003  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n",
     
    40114008           psrctDestRect);
    40124009#endif
    4013 
     4010 
    40144011  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    40154012                                  DRQ_WRITECONSOLEOUTPUTW,
     
    40184015                                  COORD2ULONG(coordSrcBufferCoord),
    40194016                                  (ULONG)psrctDestRect);
    4020 
    4021   return fResult;
    4022 }
    4023 
    4024 /*****************************************************************************
    4025  * Name      :
    4026  * Purpose   :
    4027  * Parameters:
    4028  * Variables :
    4029  * Result    :
     4017 
     4018  return fResult; 
     4019}
     4020
     4021/*****************************************************************************
     4022 * Name      : 
     4023 * Purpose   : 
     4024 * Parameters: 
     4025 * Variables :
     4026 * Result    : 
    40304027 * Remark    :
    4031  * Status    :
     4028 * Status    : 
    40324029 *
    40334030 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    40344031 *****************************************************************************/
    40354032
    4036 BOOL WIN32API WriteConsoleOutputAttribute(HANDLE  hConsoleOutput,
     4033BOOL WIN32API OS2WriteConsoleOutputAttribute(HANDLE  hConsoleOutput,
    40374034                                             LPWORD  lpwAttribute,
    40384035                                             DWORD   cWriteCells,
     
    40414038{
    40424039  BOOL fResult;
    4043 
     4040 
    40444041#ifdef DEBUG_LOCAL2
    40454042  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n",
     
    40504047           lpcNumberWritten);
    40514048#endif
    4052 
     4049 
    40534050  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    40544051                                  DRQ_WRITECONSOLEOUTPUTATTRIBUTE,
     
    40574054                                  COORD2ULONG(coordWriteCoord),
    40584055                                  (ULONG)lpcNumberWritten);
    4059 
    4060   return fResult;
    4061 }
    4062 
    4063 
    4064 /*****************************************************************************
    4065  * Name      :
    4066  * Purpose   :
    4067  * Parameters:
    4068  * Variables :
    4069  * Result    :
     4056 
     4057  return fResult; 
     4058}
     4059
     4060
     4061/*****************************************************************************
     4062 * Name      : 
     4063 * Purpose   : 
     4064 * Parameters: 
     4065 * Variables :
     4066 * Result    : 
    40704067 * Remark    :
    4071  * Status    :
     4068 * Status    : 
    40724069 *
    40734070 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    40744071 *****************************************************************************/
    40754072
    4076 BOOL WIN32API WriteConsoleOutputCharacterA(HANDLE  hConsoleOutput,
     4073BOOL WIN32API OS2WriteConsoleOutputCharacterA(HANDLE  hConsoleOutput,
    40774074                                              LPTSTR  lpWriteBuffer,
    40784075                                              DWORD   cchWrite,
     
    40814078{
    40824079  BOOL fResult;
    4083 
     4080 
    40844081#ifdef DEBUG_LOCAL2
    40854082  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n",
     
    40904087           lpcWritten);
    40914088#endif
    4092 
     4089 
    40934090  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    40944091                                  DRQ_WRITECONSOLEOUTPUTCHARACTERA,
     
    40974094                                  COORD2ULONG(coordWriteCoord),
    40984095                                  (ULONG)lpcWritten);
    4099 
    4100   return fResult;
    4101 }
    4102 
    4103 
    4104 /*****************************************************************************
    4105  * Name      :
    4106  * Purpose   :
    4107  * Parameters:
    4108  * Variables :
    4109  * Result    :
     4096 
     4097  return fResult; 
     4098}
     4099
     4100
     4101/*****************************************************************************
     4102 * Name      : 
     4103 * Purpose   : 
     4104 * Parameters: 
     4105 * Variables :
     4106 * Result    : 
    41104107 * Remark    :
    4111  * Status    :
     4108 * Status    : 
    41124109 *
    41134110 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
    41144111 *****************************************************************************/
    41154112
    4116 BOOL WIN32API WriteConsoleOutputCharacterW(HANDLE  hConsoleOutput,
     4113BOOL WIN32API OS2WriteConsoleOutputCharacterW(HANDLE  hConsoleOutput,
    41174114                                              LPTSTR  lpWriteBuffer,
    41184115                                              DWORD   cchWrite,
     
    41214118{
    41224119  BOOL fResult;
    4123 
     4120 
    41244121#ifdef DEBUG_LOCAL2
    41254122  WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n",
     
    41304127           lpcWritten);
    41314128#endif
    4132 
     4129 
    41334130  fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
    41344131                                  DRQ_WRITECONSOLEOUTPUTCHARACTERW,
     
    41374134                                  COORD2ULONG(coordWriteCoord),
    41384135                                  (ULONG)lpcWritten);
    4139 
    4140   return fResult;
     4136 
     4137  return fResult; 
    41414138}
    41424139
     
    41514148 *             PHMHANDLEDATA pHMHandleDataTemplate data of the template handle
    41524149 * Variables :
    4153  * Result    :
     4150 * Result    : 
    41544151 * Remark    : @@@PH CONIN$ handles should be exclusive
    41554152 *                   reject other requests to this device
    41564153 * Status    : NO_ERROR - API succeeded
    4157  *             other    - what is to be set in O32_SetLastError
     4154 *             other    - what is to be set in SetLastError
    41584155 *
    41594156 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    41734170           pHMHandleDataTemplate);
    41744171#endif
    4175 
     4172 
    41764173  pHMHandleData->dwType = FILE_TYPE_CHAR;        /* we're a character device */
    4177 
     4174 
    41784175  return(NO_ERROR);
    41794176}
     
    41814178
    41824179/*****************************************************************************
    4183  * Name      :
    4184  * Purpose   :
    4185  * Parameters:
    4186  * Variables :
    4187  * Result    :
    4188  * Remark    :
    4189  * Status    :
     4180 * Name      : 
     4181 * Purpose   : 
     4182 * Parameters: 
     4183 * Variables :
     4184 * Result    : 
     4185 * Remark    : 
     4186 * Status    : 
    41904187 *
    41914188 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    42034200  INPUT_RECORD InputRecord;               /* buffer for the event to be read */
    42044201  ULONG  ulPostCounter;                            /* semaphore post counter */
    4205 
     4202 
    42064203#ifdef DEBUG_LOCAL
    42074204  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    42134210           lpOverlapped);
    42144211#endif
    4215 
     4212 
    42164213  ulCounter = 0;                              /* read ascii chars from queue */
    42174214  pszTarget = (PSZ)lpBuffer;
    4218 
     4215 
    42194216  /* @@@PH: ConsoleMode: ENABLE_LINE_INPUT - blocks until CR is read */
    4220 
     4217 
    42214218                                  /* block if no key events are in the queue */
    42224219  for (;ulCounter==0;)                       /* until we got some characters */
     
    42294226                       &ulPostCounter);            /* post counter - ignored */
    42304227    }
    4231 
     4228   
    42324229    do
    42334230    {
     
    42404237          pszTarget++;
    42414238          ulCounter++;
    4242 
     4239         
    42434240                                                     /* local echo enabled ? */
    42444241          if (ConsoleInput.dwConsoleMode & ENABLE_ECHO_INPUT)
     
    42484245                        &ulPostCounter,                      /* dummy result */
    42494246                        NULL);
    4250 
     4247         
    42514248          if (ulCounter >= nNumberOfBytesToRead)        /* at buffer's end ? */
    42524249            goto __readfile_exit;
     
    42574254    while (rc == NO_ERROR);
    42584255  }
    4259 
     4256 
    42604257__readfile_exit:
    4261 
     4258 
    42624259  *lpNumberOfBytesRead = ulCounter;                          /* write result */
    42634260
     
    42674264
    42684265/*****************************************************************************
    4269  * Name      :
    4270  * Purpose   :
    4271  * Parameters:
    4272  * Variables :
    4273  * Result    :
    4274  * Remark    :
    4275  * Status    :
     4266 * Name      : 
     4267 * Purpose   : 
     4268 * Parameters: 
     4269 * Variables :
     4270 * Result    : 
     4271 * Remark    : 
     4272 * Status    : 
    42764273 *
    42774274 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    42944291           lpOverlapped);
    42954292#endif
    4296 
     4293 
    42974294  return(ERROR_ACCESS_DENIED);
    42984295}
     
    43004297
    43014298/*****************************************************************************
    4302  * Name      :
    4303  * Purpose   :
    4304  * Parameters:
    4305  * Variables :
    4306  * Result    :
    4307  * Remark    :
    4308  * Status    :
     4299 * Name      : 
     4300 * Purpose   : 
     4301 * Parameters: 
     4302 * Variables :
     4303 * Result    : 
     4304 * Remark    : 
     4305 * Status    : 
    43094306 *
    43104307 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    43234320      return (HMDeviceConsoleInClass::
    43244321              FlushConsoleInputBuffer(pHMHandleData));
    4325 
     4322   
    43264323    case DRQ_GETNUMBEROFCONSOLEINPUTEVENTS:
    43274324      return (HMDeviceConsoleInClass::
    43284325              GetNumberOfConsoleInputEvents(pHMHandleData,
    43294326                                            (LPDWORD)arg1));
    4330 
     4327   
    43314328    case DRQ_PEEKCONSOLEINPUTA:
    43324329      return (HMDeviceConsoleInClass::
     
    43354332                                (DWORD)        arg2,
    43364333                                (LPDWORD)      arg3));
    4337 
     4334   
    43384335    case DRQ_PEEKCONSOLEINPUTW:
    43394336      return (HMDeviceConsoleInClass::
     
    43424339                                (DWORD)        arg2,
    43434340                                (LPDWORD)      arg3));
    4344 
    4345 
     4341 
     4342 
    43464343    case DRQ_READCONSOLEA:
    43474344      return (HMDeviceConsoleInClass::
     
    43514348                           (LPDWORD)     arg3,
    43524349                           (LPVOID)      arg4));
    4353 
     4350 
    43544351    case DRQ_READCONSOLEW:
    43554352      return (HMDeviceConsoleInClass::
     
    43594356                           (LPDWORD)     arg3,
    43604357                           (LPVOID)      arg4));
    4361 
     4358   
    43624359    case DRQ_READCONSOLEINPUTA:
    43634360      return (HMDeviceConsoleInClass::
     
    43654362                                (PINPUT_RECORD)arg1,
    43664363                                (DWORD)arg2,
    4367                                 (LPDWORD)arg3));
    4368 
     4364                                (LPDWORD)arg3));   
     4365   
    43694366    case DRQ_READCONSOLEINPUTW:
    43704367      return (HMDeviceConsoleInClass::
     
    43804377                                (DWORD)arg2,
    43814378                                (LPDWORD)arg3));
    4382 
     4379   
    43834380    case DRQ_WRITECONSOLEINPUTW:
    43844381      return (HMDeviceConsoleInClass::
     
    43874384                                (DWORD)arg2,
    43884385                                (LPDWORD)arg3));
    4389 
    4390   }
    4391 
     4386 
     4387  }
     4388 
    43924389#ifdef DEBUG_LOCAL
    43934390  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass:_DeviceRequest %s(%08x,%08x,%08x,%08x,%08x,%08x) unknown request\n",
     
    44014398#endif
    44024399
    4403   O32_SetLastError(ERROR_INVALID_FUNCTION);           /* request not implemented */
     4400  SetLastError(ERROR_INVALID_FUNCTION);           /* request not implemented */
    44044401  return(FALSE);                 /* we assume this indicates API call failed */
    44054402}
     
    44124409 * Variables :
    44134410 * Result    :
    4414  * Remark    :
     4411 * Remark    : 
    44154412 * Status    : UNTESTED
    44164413 *
     
    44214418{
    44224419  ULONG ulCounter;                                           /* loop counter */
    4423 
     4420 
    44244421#ifdef DEBUG_LOCAL2
    44254422  WriteLog("KERNEL32/CONSOLE: CONIN$::FlushConsoleInputBuffer(%08x).\n",
    44264423           pHMHandleData);
    44274424#endif
    4428 
     4425 
    44294426  ConsoleInput.ulIndexFree  = 0;
    44304427  ConsoleInput.ulIndexEvent = 0;
    44314428  ConsoleInput.ulEvents     = 0;
    4432 
     4429 
    44334430  for (ulCounter = 0;
    44344431       ulCounter < CONSOLE_INPUTQUEUESIZE;
     
    44484445 * Result    :
    44494446
    4450  * Remark    :
     4447 * Remark    : 
    44514448 * Status    : UNTESTED
    44524449 *
     
    44624459           lpMode);
    44634460#endif
    4464 
     4461 
    44654462  *lpMode = ConsoleInput.dwConsoleMode;       /* return current console mode */
    44664463
     
    44764473 * Variables :
    44774474 * Result    :
    4478  * Remark    :
     4475 * Remark    : 
    44794476 * Status    : UNTESTED
    44804477 *
     
    44904487           lpNumberOfEvents);
    44914488#endif
    4492 
     4489 
    44934490  *lpNumberOfEvents = ConsoleInput.ulEvents;      /* return number of events */
    44944491
     
    45234520  ULONG         ulCurrentEvent;       /* index of current event in the queue */
    45244521  PINPUT_RECORD pirEvent;                /* pointer to current queue element */
    4525 
     4522 
    45264523#ifdef DEBUG_LOCAL2
    45274524  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    45314528           lpcRead);
    45324529#endif
    4533 
     4530 
    45344531  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    45354532  {
     
    45374534    return (TRUE);                                         /* OK, we're done */
    45384535  }
    4539 
    4540 
     4536 
     4537 
    45414538  for (ulCounter = 0,
    45424539       ulCurrentEvent = ConsoleInput.ulIndexEvent,
    45434540       pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent];
    4544 
     4541       
    45454542       ulCounter < cInRecords;
    4546 
     4543       
    45474544       ulCounter++,
    45484545       ulCurrentEvent++,
     
    45554552      pirEvent       = ConsoleInput.arrInputRecord;
    45564553    }
    4557 
     4554   
    45584555    if (pirEvent->EventType == 0x0000)                   /* no more events ? */
    45594556      break;                                              /* leave loop then */
    4560 
     4557   
    45614558    memcpy(pirEvent,                                      /* copy event data */
    45624559           pirBuffer,
     
    45954592  ULONG         ulCurrentEvent;       /* index of current event in the queue */
    45964593  PINPUT_RECORD pirEvent;                /* pointer to current queue element */
    4597 
     4594 
    45984595#ifdef DEBUG_LOCAL2
    45994596  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    46034600           lpcRead);
    46044601#endif
    4605 
     4602 
    46064603  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    46074604  {
     
    46094606    return (TRUE);                                         /* OK, we're done */
    46104607  }
    4611 
    4612 
     4608 
     4609 
    46134610  for (ulCounter = 0,
    46144611       ulCurrentEvent = ConsoleInput.ulIndexEvent,
    46154612       pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent];
    4616 
     4613       
    46174614       ulCounter < cInRecords;
    4618 
     4615       
    46194616       ulCounter++,
    46204617       ulCurrentEvent++,
     
    46274624      pirEvent       = ConsoleInput.arrInputRecord;
    46284625    }
    4629 
     4626   
    46304627    if (pirEvent->EventType == 0x0000)                   /* no more events ? */
    46314628      break;                                              /* leave loop then */
    4632 
     4629   
    46334630    memcpy(pirEvent,                                      /* copy event data */
    46344631           pirBuffer,
     
    46514648 * Variables :
    46524649 * Result    :
    4653  * Remark    :
     4650 * Remark    : 
    46544651 * Status    : UNTESTED
    46554652 *
     
    46644661{
    46654662  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    4666 
     4663 
    46674664#ifdef DEBUG_LOCAL2
    46684665  WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleA(%08x,%08x,%u,%08x,%08x).\n",
     
    46734670           lpvReserved);
    46744671#endif
    4675 
     4672 
    46764673                               /* simply forward the request to that routine */
    46774674  return (HMDeviceConsoleInClass::ReadFile(pHMHandleData,
     
    46934690 * Variables :
    46944691 * Result    :
    4695  * Remark    :
     4692 * Remark    : 
    46964693 * Status    : UNTESTED
    46974694 *
     
    47074704  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    47084705  DWORD          dwResult;
    4709 
     4706 
    47104707#ifdef DEBUG_LOCAL2
    47114708  WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleW(%08x,%08x,%u,%08x,%08x).\n",
     
    47164713           lpvReserved);
    47174714#endif
    4718 
     4715 
    47194716                               /* simply forward the request to that routine */
    47204717  dwResult = HMDeviceConsoleInClass::ReadFile(pHMHandleData,
     
    47244721                                              NULL);
    47254722  /* @@@PH AScii -> unicode translation */
    4726 
     4723 
    47274724  return (dwResult);                                  /* deliver return code */
    47284725}
     
    47514748  ULONG  ulPostCounter;                  /* semaphore post counter - ignored */
    47524749  APIRET rc;                                               /* API returncode */
    4753 
     4750 
    47544751#ifdef DEBUG_LOCAL2
    47554752  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputA(%08x,%08x,%08x,%08x).\n",
     
    47594756           lpcRead);
    47604757#endif
    4761 
     4758 
    47624759  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    47634760  {
     
    47674764                     &ulPostCounter);              /* post counter - ignored */
    47684765  }
    4769 
    4770 
     4766 
     4767 
    47714768  /* now read events into target buffer */
    47724769  for (ulPostCounter = 0;
     
    47794776      break;
    47804777  }
    4781 
     4778 
    47824779  *lpcRead = ulPostCounter;                 /* return number of records read */
    47834780  return (TRUE);                                                       /* OK */
     
    48074804  ULONG ulPostCounter;                   /* semaphore post counter - ignored */
    48084805  APIRET rc;                                               /* API returncode */
    4809 
     4806 
    48104807#ifdef DEBUG_LOCAL2
    48114808  WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputW(%08x,%08x,%08x,%08x).\n",
     
    48154812           lpcRead);
    48164813#endif
    4817 
     4814 
    48184815  if (ConsoleInputQueryEvents() == 0)         /* if queue is currently empty */
    48194816  {
     
    48234820                     &ulPostCounter);              /* post counter - ignored */
    48244821  }
    4825 
    4826 
     4822 
     4823 
    48274824  /* now read events into target buffer */
    48284825  for (ulPostCounter = 0;
     
    48354832      break;
    48364833  }
    4837 
     4834 
    48384835  *lpcRead = ulPostCounter;                 /* return number of records read */
    48394836  return (TRUE);                                                       /* OK */
     
    48484845 * Variables :
    48494846 * Result    :
    4850  * Remark    :
     4847 * Remark    : 
    48514848 * Status    : UNTESTED
    48524849 *
     
    48584855{
    48594856  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    4860 
     4857 
    48614858#ifdef DEBUG_LOCAL2
    48624859  WriteLog("KERNEL32/CONSOLE: CONIN$::SetConsoleMode(%08x,%08x).\n",
     
    48644861           dwMode);
    48654862#endif
    4866 
     4863 
    48674864  ConsoleInput.dwConsoleMode = dwMode;           /* set current console mode */
    4868 
     4865 
    48694866  return (TRUE);
    48704867}
     
    48744871 * Name      : DWORD HMDeviceConsoleInClass::WriteConsoleInputA
    48754872 * Purpose   : this writes event records directly into the queue
    4876  * Parameters: PHMHANDLEDATA pHMHandleData
     4873 * Parameters: PHMHANDLEDATA pHMHandleData         
    48774874 *             PINPUT_RECORD pirBuffer
    48784875 *             DWORD         cInRecords
    48794876 *             LPDWORD       lpcWritten
    48804877 * Variables :
    4881  * Result    :
    4882  * Remark    :
     4878 * Result    : 
     4879 * Remark    : 
    48834880 * Status    : NO_ERROR - API succeeded
    4884  *             other    - what is to be set in O32_SetLastError
     4881 *             other    - what is to be set in SetLastError
    48854882 *
    48864883 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    48954892  APIRET         rc;                                       /* API returncode */
    48964893  ULONG          ulCounter;                                  /* loop counter */
    4897 
     4894 
    48984895#ifdef DEBUG_LOCAL2
    48994896  WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputA(%08x,%08x,%u,%08x).\n",
     
    49034900           lpcWritten);
    49044901#endif
    4905 
     4902 
    49064903  for (ulCounter = 0;
    49074904       ulCounter < cInRecords;
     
    49134910      break;
    49144911  }
    4915 
     4912 
    49164913  *lpcWritten = ulCounter;                /* return number of events written */
    49174914  return (TRUE);                                                       /* OK */
     
    49224919 * Name      : DWORD HMDeviceConsoleInClass::WriteConsoleInputW
    49234920 * Purpose   : this writes event records directly into the queue
    4924  * Parameters: PHMHANDLEDATA pHMHandleData
     4921 * Parameters: PHMHANDLEDATA pHMHandleData         
    49254922 *             PINPUT_RECORD pirBuffer
    49264923 *             DWORD         cInRecords
    49274924 *             LPDWORD       lpcWritten
    49284925 * Variables :
    4929  * Result    :
    4930  * Remark    :
     4926 * Result    : 
     4927 * Remark    : 
    49314928 * Status    : NO_ERROR - API succeeded
    4932  *             other    - what is to be set in O32_SetLastError
     4929 *             other    - what is to be set in SetLastError
    49334930 *
    49344931 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    49434940  APIRET         rc;                                       /* API returncode */
    49444941  ULONG          ulCounter;                                  /* loop counter */
    4945 
     4942 
    49464943#ifdef DEBUG_LOCAL2
    49474944  WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputW(%08x,%08x,%u,%08x).\n",
     
    49514948           lpcWritten);
    49524949#endif
    4953 
     4950 
    49544951  for (ulCounter = 0;
    49554952       ulCounter < cInRecords;
     
    49614958      break;
    49624959  }
    4963 
     4960 
    49644961  *lpcWritten = ulCounter;                /* return number of events written */
    49654962  return (TRUE);                                                       /* OK */
     
    49774974 *             PHMHANDLEDATA pHMHandleDataTemplate data of the template handle
    49784975 * Variables :
    4979  * Result    :
    4980  * Remark    :
     4976 * Result    : 
     4977 * Remark    : 
    49814978 * Status    : NO_ERROR - API succeeded
    4982  *             other    - what is to be set in O32_SetLastError
     4979 *             other    - what is to be set in SetLastError
    49834980 *
    49844981 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    49934990  BOOL   fResult;
    49944991  HANDLE hConsole;
    4995 
     4992 
    49964993#ifdef DEBUG_LOCAL2
    49974994  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass %s(%s,%08x,%08x,%08x)\n",
     
    50024999           pHMHandleDataTemplate);
    50035000#endif
    5004 
     5001 
    50055002  pHMHandleData->dwType = FILE_TYPE_CHAR;        /* we're a character device */
    5006 
    5007 
     5003 
     5004 
    50085005                 /* if no default buffer is available, then do default setup */
    50095006  if (ConsoleGlobals.hConsoleBuffer == INVALID_HANDLE_VALUE)
    50105007  {
    50115008                /* now we need a default screen buffer with the default size */
    5012     hConsole = CreateConsoleScreenBuffer(0,
     5009    hConsole = OS2CreateConsoleScreenBuffer(0,
    50135010                                            0,
    50145011                                            NULL,
     
    50235020      return INVALID_HANDLE_VALUE;   /* abort further processing immediately */
    50245021    }
    5025 
    5026     fResult = SetConsoleTextAttribute(hConsole,
     5022   
     5023    fResult = OS2SetConsoleTextAttribute(hConsole,
    50275024                                         ConsoleGlobals.Options.ucDefaultAttribute);
    50285025#ifdef DEBUG_LOCAL
     
    50315028               GetLastError());
    50325029#endif
    5033 
    5034     fResult = SetConsoleScreenBufferSize(hConsole,
     5030   
     5031    fResult = OS2SetConsoleScreenBufferSize(hConsole,
    50355032                                            ConsoleGlobals.Options.coordDefaultSize);
    50365033    if (fResult == FALSE)
     
    50435040      return (INVALID_HANDLE_VALUE);            /* abort further processing */
    50445041    }
    5045 
    5046     fResult = SetConsoleActiveScreenBuffer(hConsole);
     5042 
     5043    fResult = OS2SetConsoleActiveScreenBuffer(hConsole);
    50475044    if (fResult == FALSE)
    50485045    {
     
    50605057    }
    50615058  }
    5062 
     5059 
    50635060  return(NO_ERROR);
    50645061}
     
    50665063
    50675064/*****************************************************************************
    5068  * Name      :
    5069  * Purpose   :
    5070  * Parameters:
    5071  * Variables :
    5072  * Result    :
    5073  * Remark    :
    5074  * Status    :
     5065 * Name      : 
     5066 * Purpose   : 
     5067 * Parameters: 
     5068 * Variables :
     5069 * Result    : 
     5070 * Remark    : 
     5071 * Status    : 
    50755072 *
    50765073 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    50835080                                        LPOVERLAPPED  lpOverlapped)
    50845081{
    5085 
     5082 
    50865083#ifdef DEBUG_LOCAL
    50875084  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    50935090           lpOverlapped);
    50945091#endif
    5095 
     5092 
    50965093  return(ERROR_ACCESS_DENIED);
    50975094}
     
    50995096
    51005097/*****************************************************************************
    5101  * Name      :
    5102  * Purpose   :
    5103  * Parameters:
    5104  * Variables :
    5105  * Result    :
    5106  * Remark    :
    5107  * Status    :
     5098 * Name      : 
     5099 * Purpose   : 
     5100 * Parameters: 
     5101 * Variables :
     5102 * Result    : 
     5103 * Remark    : 
     5104 * Status    : 
    51085105 *
    51095106 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    51175114{
    51185115  DWORD dwResult;                        /* result from subsequent WriteFile */
    5119 
     5116 
    51205117#ifdef DEBUG_LOCAL2
    51215118  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleOutClass:WriteFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    51275124           lpOverlapped);
    51285125#endif
    5129 
     5126 
    51305127        /* just prevent an endless loop, although this condition might never */
    51315128                                                                /* be true ! */
     
    51405137                    0);
    51415138#endif
    5142 
     5139   
    51435140    dwResult = HMWriteFile(ConsoleGlobals.hConsoleBuffer,
    51445141                           lpBuffer,
     
    51465143                           lpNumberOfBytesWritten,
    51475144                           lpOverlapped);
    5148 
     5145   
    51495146#if 0
    51505147    HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,        /* show the cursor */
     
    51555152                    0);
    51565153#endif
    5157 
     5154   
    51585155    return (dwResult);                                 /* return result code */
    51595156  }
     
    51675164 * Purpose   : we just forward those device requests to the console buffer
    51685165 *             currently associated with the console itself.
    5169  * Parameters:
    5170  * Variables :
    5171  * Result    :
    5172  * Remark    :
     5166 * Parameters: 
     5167 * Variables :
     5168 * Result    : 
     5169 * Remark    : 
    51735170 * Status    : UNTESTED
    51745171 *
     
    52175214 * Variables :
    52185215 * Result    :
    5219  * Remark    :
     5216 * Remark    : 
    52205217 * Status    : NO_ERROR - API succeeded
    5221  *             other    - what is to be set in O32_SetLastError
     5218 *             other    - what is to be set in SetLastError
    52225219 *
    52235220 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    52305227{
    52315228  PCONSOLEBUFFER pConsoleBuffer;                 /* console buffer structure */
    5232 
     5229 
    52335230#ifdef DEBUG_LOCAL
    52345231  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass %s(%s,%08x,%08x,%08x)\n",
     
    52395236           pHMHandleDataTemplate);
    52405237#endif
    5241 
     5238 
    52425239  pHMHandleData->dwType = FILE_TYPE_CHAR;        /* we're a character device */
    5243 
     5240 
    52445241  pHMHandleData->lpHandlerData = malloc ( sizeof(CONSOLEBUFFER) );
    5245 
     5242 
    52465243#ifdef DEBUG_LOCAL
    52475244  WriteLog("KERNEL32/CONSOLE:CheckPoint1: %s pHMHandleData=%08xh, lpHandlerData=%08xh\n",
     
    52505247           pHMHandleData->lpHandlerData);
    52515248#endif
    5252 
    5253 
     5249 
     5250 
    52545251  if (pHMHandleData->lpHandlerData == NULL)              /* check allocation */
    52555252  {
    5256     O32_SetLastError(ERROR_NOT_ENOUGH_MEMORY);          /* set error information */
     5253    SetLastError(ERROR_NOT_ENOUGH_MEMORY);          /* set error information */
    52575254    return (INVALID_HANDLE_VALUE);                  /* raise error condition */
    52585255  }
     
    52605257  {
    52615258    pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    5262 
     5259   
    52635260    memset(pHMHandleData->lpHandlerData,             /* initialize structure */
    52645261           0,
    52655262           sizeof (CONSOLEBUFFER) );
    5266 
     5263 
    52675264                                                      /* set buffer defaults */
    52685265    pConsoleBuffer->dwConsoleMode = ENABLE_PROCESSED_OUTPUT |
    52695266                                    ENABLE_WRAP_AT_EOL_OUTPUT;
    5270 
     5267 
    52715268    pConsoleBuffer->CursorInfo.dwSize   = 2;                  /* 2 scanlines */
    52725269    pConsoleBuffer->CursorInfo.bVisible = TRUE;
    52735270  }
    5274 
     5271 
    52755272  return(NO_ERROR);
    52765273}
     
    52785275
    52795276/*****************************************************************************
    5280  * Name      :
    5281  * Purpose   :
    5282  * Parameters:
    5283  * Variables :
    5284  * Result    :
    5285  * Remark    :
    5286  * Status    :
     5277 * Name      : 
     5278 * Purpose   : 
     5279 * Parameters: 
     5280 * Variables :
     5281 * Result    : 
     5282 * Remark    : 
     5283 * Status    : 
    52875284 *
    52885285 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    52915288DWORD HMDeviceConsoleBufferClass::CloseHandle(PHMHANDLEDATA pHMHandleData)
    52925289{
    5293 
     5290 
    52945291#ifdef DEBUG_LOCAL
    52955292  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass::CloseHandle %s(%08x)\n",
     
    52975294           pHMHandleData);
    52985295#endif
    5299 
     5296 
    53005297  if (pHMHandleData->lpHandlerData != NULL)                 /* check pointer */
    53015298  {
    53025299    PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    5303 
     5300   
    53045301
    53055302    if (pConsoleBuffer->ppszLine != NULL)        /* free line buffer array ! */
    53065303      free (pConsoleBuffer->ppszLine);
    5307 
     5304     
    53085305    free (pHMHandleData->lpHandlerData);          /* free device object data */
    53095306    pHMHandleData->lpHandlerData = NULL;
    53105307  }
    5311 
     5308 
    53125309  return(NO_ERROR);
    53135310}
     
    53155312
    53165313/*****************************************************************************
    5317  * Name      :
    5318  * Purpose   :
    5319  * Parameters:
    5320  * Variables :
    5321  * Result    :
    5322  * Remark    :
    5323  * Status    :
     5314 * Name      : 
     5315 * Purpose   : 
     5316 * Parameters: 
     5317 * Variables :
     5318 * Result    : 
     5319 * Remark    : 
     5320 * Status    : 
    53245321 *
    53255322 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    53325329                                           LPOVERLAPPED  lpOverlapped)
    53335330{
    5334 
     5331 
    53355332#ifdef DEBUG_LOCAL
    53365333  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    53425339           lpOverlapped);
    53435340#endif
    5344 
     5341 
    53455342  return(ERROR_ACCESS_DENIED);
    53465343}
     
    53485345
    53495346/*****************************************************************************
    5350  * Name      :
    5351  * Purpose   :
    5352  * Parameters:
    5353  * Variables :
    5354  * Result    :
    5355  * Remark    :
    5356  * Status    :
     5347 * Name      : 
     5348 * Purpose   : 
     5349 * Parameters: 
     5350 * Variables :
     5351 * Result    : 
     5352 * Remark    : 
     5353 * Status    : 
    53575354 *
    53585355 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    53695366           PSZ   pszBuffer = (PSZ)lpBuffer;
    53705367  register UCHAR ucChar;
    5371 
     5368 
    53725369#ifdef DEBUG_LOCAL2
    53735370  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass:WriteFile %s(%08x,%08x,%08x,%08x,%08x)\n",
     
    53795376           lpOverlapped);
    53805377#endif
    5381 
     5378 
    53825379                      /* check if we're called with non-existing line buffer */
    53835380  if (pConsoleBuffer->ppszLine == NULL)
    53845381    return (ERROR_SYS_INTERNAL);
    5385 
     5382 
    53865383  for (ulCounter = 0;
    53875384       ulCounter < nNumberOfBytesToWrite;
     
    53895386  {
    53905387    ucChar = pszBuffer[ulCounter];                        /* map to register */
    5391 
     5388   
    53925389    if ( (pConsoleBuffer->dwConsoleMode & ENABLE_PROCESSED_OUTPUT) &&
    53935390         (ucChar < 32) )     /* this is faster than a large switch statement */
     
    54005397                    ConsoleGlobals.Options.ulSpeakerDuration);
    54015398          break;
    5402 
     5399     
    54035400        case 8: /* Backspace */
    54045401          if (pConsoleBuffer->coordCursorPosition.X > 0)
    54055402            pConsoleBuffer->coordCursorPosition.X--;
    54065403          break;
    5407 
     5404 
    54085405        case 9: /* Tab */
    54095406          pConsoleBuffer->coordCursorPosition.X =
    5410             (pConsoleBuffer->coordCursorPosition.X
    5411              / ConsoleGlobals.Options.ulTabSize
     5407            (pConsoleBuffer->coordCursorPosition.X 
     5408             / ConsoleGlobals.Options.ulTabSize 
    54125409             + 1)
    54135410            * ConsoleGlobals.Options.ulTabSize;
    5414 
     5411       
    54155412          if (pConsoleBuffer->coordCursorPosition.X >=
    54165413              pConsoleBuffer->coordBufferSize.X)
     
    54185415            pConsoleBuffer->coordCursorPosition.X = 0;
    54195416            pConsoleBuffer->coordCursorPosition.Y++;
    5420 
     5417           
    54215418            if (pConsoleBuffer->coordCursorPosition.Y >=
    54225419                pConsoleBuffer->coordBufferSize.Y)
     
    54315428          }
    54325429          break;
    5433 
     5430         
    54345431        case 10: /* LINEFEED */
    54355432          pConsoleBuffer->coordCursorPosition.Y++;
    5436 
     5433         
    54375434          if (pConsoleBuffer->coordCursorPosition.Y >=
    54385435              pConsoleBuffer->coordBufferSize.Y)
     
    54435440          }
    54445441          break;
    5445 
     5442         
    54465443        case 13: /* CARRIAGE RETURN */
    54475444          pConsoleBuffer->coordCursorPosition.X = 0;
    54485445          break;
    5449 
     5446       
    54505447        default:
    54515448          break;
     
    54575454      *(pConsoleBuffer->ppszLine[pConsoleBuffer->coordCursorPosition.Y] +
    54585455        pConsoleBuffer->coordCursorPosition.X * 2) = pszBuffer[ulCounter];
    5459 
     5456       
    54605457      pConsoleBuffer->coordCursorPosition.X++;
    5461 
     5458   
    54625459      if (pConsoleBuffer->coordCursorPosition.X >=
    54635460          pConsoleBuffer->coordBufferSize.X)
     
    54655462        pConsoleBuffer->coordCursorPosition.X = 0;
    54665463        pConsoleBuffer->coordCursorPosition.Y++;
    5467 
     5464       
    54685465        if (pConsoleBuffer->coordCursorPosition.Y >=
    54695466            pConsoleBuffer->coordBufferSize.Y)
     
    54855482    }
    54865483  }
    5487 
     5484 
    54885485                                          /* update screen if active console */
    54895486  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    54905487    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    5491 
     5488 
    54925489  *lpNumberOfBytesWritten = ulCounter;
    5493 
     5490 
    54945491  return(ulCounter);
    54955492}
     
    54975494
    54985495/*****************************************************************************
    5499  * Name      :
    5500  * Purpose   :
    5501  * Parameters:
    5502  * Variables :
    5503  * Result    :
    5504  * Remark    :
    5505  * Status    :
     5496 * Name      : 
     5497 * Purpose   : 
     5498 * Parameters: 
     5499 * Variables :
     5500 * Result    : 
     5501 * Remark    : 
     5502 * Status    : 
    55065503 *
    55075504 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     
    55205517    {
    55215518      COORD coordWrite;
    5522 
     5519     
    55235520      ULONG2COORD(coordWrite,arg3);
    5524 
     5521       
    55255522      return (HMDeviceConsoleBufferClass
    55265523              ::FillConsoleOutputAttribute(pHMHandleData,
     
    55305527                                           (LPDWORD)arg4));
    55315528    }
    5532 
     5529             
    55335530
    55345531    case DRQ_FILLCONSOLEOUTPUTCHARACTERA:
    55355532    {
    55365533      COORD coordWrite;
    5537 
     5534     
    55385535      ULONG2COORD(coordWrite,arg3);
    5539 
     5536       
    55405537      return (HMDeviceConsoleBufferClass
    55415538              ::FillConsoleOutputCharacterA(pHMHandleData,
     
    55455542                                            (LPDWORD)arg4));
    55465543    }
    5547 
    5548 
     5544   
     5545   
    55495546    case DRQ_FILLCONSOLEOUTPUTCHARACTERW:
    55505547    {
    55515548      COORD coordWrite;
    5552 
     5549     
    55535550      ULONG2COORD(coordWrite,arg3);
    5554 
     5551       
    55555552      return (HMDeviceConsoleBufferClass
    55565553              ::FillConsoleOutputCharacterW(pHMHandleData,
     
    55615558    }
    55625559
    5563 
     5560   
    55645561    case DRQ_GETCONSOLECURSORINFO:
    55655562      return (HMDeviceConsoleBufferClass
     
    55675564                                     (PCONSOLE_CURSOR_INFO)arg1));
    55685565
    5569 
     5566   
    55705567    case DRQ_GETCONSOLEMODE:
    55715568      return (HMDeviceConsoleBufferClass
     
    55735570                               (LPDWORD)arg1));
    55745571
    5575 
     5572             
    55765573    case DRQ_GETCONSOLESCREENBUFFERINFO:
    55775574      return (HMDeviceConsoleBufferClass
    55785575              ::GetConsoleScreenBufferInfo(pHMHandleData,
    55795576                                           (PCONSOLE_SCREEN_BUFFER_INFO)arg1));
    5580 
     5577   
    55815578
    55825579    case DRQ_GETLARGESTCONSOLEWINDOWSIZE:
    55835580      return (HMDeviceConsoleBufferClass
    55845581              ::GetLargestConsoleWindowSize(pHMHandleData));
    5585 
     5582   
    55865583
    55875584    case DRQ_READCONSOLEOUTPUTA:
     
    55895586      COORD coordDestBufferSize;
    55905587      COORD coordDestBufferCoord;
    5591 
     5588     
    55925589      ULONG2COORD(coordDestBufferSize,  arg2);
    55935590      ULONG2COORD(coordDestBufferCoord, arg3);
    5594 
     5591     
    55955592      return (HMDeviceConsoleBufferClass
    55965593              ::ReadConsoleOutputA(pHMHandleData,
     
    56005597                                   (PSMALL_RECT)arg4));
    56015598    }
    5602 
    5603 
     5599   
     5600   
    56045601    case DRQ_READCONSOLEOUTPUTW:
    56055602    {
    56065603      COORD coordDestBufferSize;
    56075604      COORD coordDestBufferCoord;
    5608 
     5605     
    56095606      ULONG2COORD(coordDestBufferSize,  arg2);
    56105607      ULONG2COORD(coordDestBufferCoord, arg3);
    5611 
     5608     
    56125609      return (HMDeviceConsoleBufferClass
    56135610              ::ReadConsoleOutputW(pHMHandleData,
     
    56175614                                   (PSMALL_RECT)arg4));
    56185615    }
    5619 
     5616   
    56205617
    56215618    case DRQ_READCONSOLEOUTPUTATTRIBUTE:
    56225619    {
    56235620      COORD coordReadCoord;
    5624 
     5621     
    56255622      ULONG2COORD(coordReadCoord, arg3);
    5626 
     5623     
    56275624      return (HMDeviceConsoleBufferClass
    56285625              ::ReadConsoleOutputAttribute(pHMHandleData,
     
    56325629                                   (LPDWORD)arg4));
    56335630    }
    5634 
    5635 
     5631   
     5632   
    56365633    case DRQ_READCONSOLEOUTPUTCHARACTERA:
    56375634    {
    56385635      COORD coordReadCoord;
    5639 
     5636     
    56405637      ULONG2COORD(coordReadCoord, arg3);
    5641 
     5638     
    56425639      return (HMDeviceConsoleBufferClass
    56435640              ::ReadConsoleOutputCharacterA(pHMHandleData,
     
    56465643                                            coordReadCoord,
    56475644                                            (LPDWORD)arg4));
    5648     }
    5649 
    5650 
     5645    }   
     5646   
     5647   
    56515648    case DRQ_READCONSOLEOUTPUTCHARACTERW:
    56525649    {
    56535650      COORD coordReadCoord;
    5654 
     5651     
    56555652      ULONG2COORD(coordReadCoord, arg3);
    5656 
     5653     
    56575654      return (HMDeviceConsoleBufferClass
    56585655              ::ReadConsoleOutputCharacterW(pHMHandleData,
     
    56615658                                            coordReadCoord,
    56625659                                            (LPDWORD)arg4));
    5663     }
    5664 
     5660    }   
     5661   
    56655662
    56665663    case DRQ_SCROLLCONSOLESCREENBUFFERA:
    56675664    {
    56685665      COORD coordDestOrigin;
    5669 
     5666     
    56705667      ULONG2COORD(coordDestOrigin, arg3);
    5671 
     5668     
    56725669      return (HMDeviceConsoleBufferClass
    56735670              ::ScrollConsoleScreenBufferA(pHMHandleData,
     
    56765673                                           coordDestOrigin,
    56775674                                           (PCHAR_INFO)arg4));
    5678     }
    5679 
    5680 
     5675    }   
     5676   
     5677   
    56815678    case DRQ_SCROLLCONSOLESCREENBUFFERW:
    56825679    {
    56835680      COORD coordDestOrigin;
    5684 
     5681     
    56855682      ULONG2COORD(coordDestOrigin, arg3);
    5686 
     5683     
    56875684      return (HMDeviceConsoleBufferClass
    56885685              ::ScrollConsoleScreenBufferW(pHMHandleData,
     
    56915688                                           coordDestOrigin,
    56925689                                           (PCHAR_INFO)arg4));
    5693     }
    5694 
    5695 
     5690    }   
     5691
     5692 
    56965693    case DRQ_SETCONSOLEACTIVESCREENBUFFER:
    56975694      return (HMDeviceConsoleBufferClass
     
    57035700              ::SetConsoleCursorInfo(pHMHandleData,
    57045701                                     (PCONSOLE_CURSOR_INFO)arg1));
    5705 
     5702   
    57065703
    57075704    case DRQ_SETCONSOLECURSORPOSITION:
    57085705    {
    57095706      COORD coordCursor;
    5710 
     5707     
    57115708      ULONG2COORD(coordCursor, arg1);
    5712 
     5709     
    57135710      return (HMDeviceConsoleBufferClass
    57145711              ::SetConsoleCursorPosition(pHMHandleData,
    57155712                                         coordCursor));
    57165713    }
    5717 
     5714   
    57185715
    57195716    case DRQ_SETCONSOLEMODE:
     
    57225719                               (DWORD)arg1));
    57235720
    5724 
     5721             
    57255722    case DRQ_SETCONSOLESCREENBUFFERSIZE:
    57265723    {
    57275724      COORD coordSize;
    5728 
     5725     
    57295726      ULONG2COORD(coordSize,arg1);
    5730 
     5727     
    57315728      return (HMDeviceConsoleBufferClass::
    57325729                SetConsoleScreenBufferSize(pHMHandleData,
    57335730                                           coordSize));
    57345731    }
    5735 
     5732             
    57365733
    57375734    case DRQ_SETCONSOLETEXTATTRIBUTE:
     
    57395736                SetConsoleTextAttribute(pHMHandleData,
    57405737                                        (WORD)arg1));
    5741 
     5738             
    57425739
    57435740    case DRQ_SETCONSOLEWINDOWINFO:
     
    57475744                                     (PSMALL_RECT)arg2));
    57485745
    5749 
     5746 
    57505747    case DRQ_WRITECONSOLEA:
    57515748      return (HMDeviceConsoleBufferClass
     
    57555752                              (LPDWORD)arg3,
    57565753                              (LPVOID)arg4));
    5757 
    5758 
     5754             
     5755             
    57595756    case DRQ_WRITECONSOLEW:
    57605757      return (HMDeviceConsoleBufferClass
     
    57645761                              (LPDWORD)arg3,
    57655762                              (LPVOID)arg4));
    5766 
     5763 
    57675764
    57685765    case DRQ_WRITECONSOLEOUTPUTA:
     
    57705767      COORD coordSrcBufferSize;
    57715768      COORD coordSrcBufferCoord;
    5772 
     5769     
    57735770      ULONG2COORD(coordSrcBufferSize,  arg2);
    57745771      ULONG2COORD(coordSrcBufferCoord, arg3);
    5775 
     5772     
    57765773      return (HMDeviceConsoleBufferClass
    57775774              ::WriteConsoleOutputA(pHMHandleData,
     
    57815778                                    (PSMALL_RECT)arg4));
    57825779    }
    5783 
    5784 
     5780             
     5781             
    57855782    case DRQ_WRITECONSOLEOUTPUTW:
    57865783    {
    57875784      COORD coordSrcBufferSize;
    57885785      COORD coordSrcBufferCoord;
    5789 
     5786     
    57905787      ULONG2COORD(coordSrcBufferSize,  arg2);
    57915788      ULONG2COORD(coordSrcBufferCoord, arg3);
    5792 
     5789     
    57935790      return (HMDeviceConsoleBufferClass
    57945791              ::WriteConsoleOutputA(pHMHandleData,
     
    57975794                                    coordSrcBufferCoord,
    57985795                                    (PSMALL_RECT)arg4));
    5799     }
    5800 
    5801 
     5796    } 
     5797
     5798             
    58025799    case DRQ_WRITECONSOLEOUTPUTATTRIBUTE:
    58035800    {
    58045801      COORD coordWriteCoord;
    5805 
     5802     
    58065803      ULONG2COORD(coordWriteCoord,  arg3);
    5807 
     5804     
    58085805      return (HMDeviceConsoleBufferClass
    58095806              ::WriteConsoleOutputAttribute(pHMHandleData,
     
    58125809                                            coordWriteCoord,
    58135810                                            (LPDWORD)arg4));
    5814     }
    5815 
    5816 
     5811    } 
     5812             
     5813             
    58175814    case DRQ_WRITECONSOLEOUTPUTCHARACTERA:
    58185815    {
    58195816      COORD coordWriteCoord;
    5820 
     5817     
    58215818      ULONG2COORD(coordWriteCoord,  arg3);
    5822 
     5819     
    58235820      return (HMDeviceConsoleBufferClass
    58245821              ::WriteConsoleOutputCharacterA(pHMHandleData,
     
    58275824                                             coordWriteCoord,
    58285825                                             (LPDWORD)arg4));
    5829     }
    5830 
    5831 
     5826    } 
     5827 
     5828 
    58325829    case DRQ_WRITECONSOLEOUTPUTCHARACTERW:
    58335830    {
    58345831      COORD coordWriteCoord;
    5835 
     5832     
    58365833      ULONG2COORD(coordWriteCoord,  arg3);
    5837 
     5834     
    58385835      return (HMDeviceConsoleBufferClass
    58395836              ::WriteConsoleOutputCharacterW(pHMHandleData,
     
    58445841    }
    58455842
    5846 
     5843   
    58475844    case DRQ_INTERNAL_CONSOLEBUFFERMAP:
    58485845      ConsoleBufferMap((PCONSOLEBUFFER)pHMHandleData->lpHandlerData);
    58495846      return (NO_ERROR);
    5850 
    5851 
     5847   
     5848   
    58525849    case DRQ_INTERNAL_CONSOLECURSORSHOW:
    58535850      ConsoleCursorShow((PCONSOLEBUFFER)pHMHandleData->lpHandlerData,
    58545851                        (ULONG)arg1);
    58555852      return (NO_ERROR);
    5856 
    5857 
     5853   
     5854   
    58585855    case DRQ_INTERNAL_CONSOLEADJUSTWINDOW:
    58595856      ConsoleAdjustWindow((PCONSOLEBUFFER)pHMHandleData->lpHandlerData);
    5860       return (NO_ERROR);
    5861   }
    5862 
    5863 
     5857      return (NO_ERROR);   
     5858  }
     5859 
     5860 
    58645861#ifdef DEBUG_LOCAL
    58655862  WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleBufferClass:_DeviceRequest %s(%08x,%08x,%08x,%08x,%08x,%08x) unknown request\n",
     
    58735870#endif
    58745871
    5875   O32_SetLastError(ERROR_INVALID_FUNCTION);           /* request not implemented */
     5872  SetLastError(ERROR_INVALID_FUNCTION);           /* request not implemented */
    58765873  return(FALSE);                 /* we assume this indicates API call failed */
    58775874}
     
    58885885 * Variables :
    58895886 * Result    :
    5890  * Remark    :
     5887 * Remark    : 
    58915888 * Status    : UNTESTED
    58925889 *
     
    59025899  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    59035900  ULONG          ulCounter;                     /* current character counter */
    5904 
     5901 
    59055902#ifdef DEBUG_LOCAL2
    59065903  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputAttribute(%08x,attr=%04x,%u,x=%u y=%u,res=%08x).\n",
     
    59125909           lpNumberOfAttrsWritten);
    59135910#endif
    5914 
     5911 
    59155912  if ( (dwWriteCoord.X < 0) ||
    59165913       (dwWriteCoord.Y < 0) )
     
    59185915    if (lpNumberOfAttrsWritten != NULL)           /* ensure pointer is valid */
    59195916      *lpNumberOfAttrsWritten = 0;                /* complete error handling */
    5920 
    5921     O32_SetLastError(ERROR_INVALID_PARAMETER);
     5917   
     5918    SetLastError(ERROR_INVALID_PARAMETER);
    59225919    return (FALSE);
    59235920  }
    5924 
     5921 
    59255922                                    /* check if dwWriteCoord is within specs */
    59265923  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    59295926    if (lpNumberOfAttrsWritten != NULL)           /* ensure pointer is valid */
    59305927      *lpNumberOfAttrsWritten = 0;                /* complete error handling */
    5931 
    5932     O32_SetLastError(ERROR_INVALID_PARAMETER);
     5928   
     5929    SetLastError(ERROR_INVALID_PARAMETER);
    59335930    return (FALSE);
    59345931  }
    5935 
     5932 
    59365933
    59375934                                        /* OK, now write the attribute lines */
     
    59455942     ) = (UCHAR)(wAttribute & 0xFF);
    59465943                                 /* write attribute, don't change characters */
    5947 
     5944   
    59485945    dwWriteCoord.X++;                                 /* move write position */
    59495946    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    59515948      dwWriteCoord.X = 0;                               /* skip to next line */
    59525949      dwWriteCoord.Y++;
    5953 
     5950     
    59545951                         /* oops, we're at the end of the buffer. Abort now. */
    59555952      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    59575954        if (lpNumberOfAttrsWritten != NULL)       /* ensure pointer is valid */
    59585955          *lpNumberOfAttrsWritten = ulCounter;
    5959 
     5956       
    59605957                                          /* update screen if active console */
    59615958        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    59625959          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    5963 
     5960       
    59645961        return (TRUE);
    59655962      }
    59665963    }
    59675964  }
    5968 
     5965 
    59695966                                          /* update screen if active console */
    59705967  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    59715968    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    5972 
     5969 
    59735970  if (lpNumberOfAttrsWritten != NULL)             /* ensure pointer is valid */
    59745971    *lpNumberOfAttrsWritten = nLength;
    5975 
     5972 
    59765973  return (TRUE);
    59775974}
     
    59885985 * Variables :
    59895986 * Result    :
    5990  * Remark    :
     5987 * Remark    : 
    59915988 * Status    : UNTESTED
    59925989 *
     
    60025999  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    60036000  ULONG          ulCounter;                     /* current character counter */
    6004 
     6001 
    60056002#ifdef DEBUG_LOCAL2
    60066003  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputCharacterA(%08x,char=%02x,%u,x=%u y=%u,res=%08x).\n",
     
    60186015    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    60196016      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6020 
    6021     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6017   
     6018    SetLastError(ERROR_INVALID_PARAMETER);
    60226019    return (FALSE);
    60236020  }
    6024 
    6025 
     6021 
     6022 
    60266023                                    /* check if dwWriteCoord is within specs */
    60276024  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    60306027    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    60316028      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6032 
    6033     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6029   
     6030    SetLastError(ERROR_INVALID_PARAMETER);
    60346031    return (FALSE);
    60356032  }
    6036 
     6033 
    60376034
    60386035                                        /* OK, now write the attribute lines */
     
    60456042                              (dwWriteCoord.X * 2)
    60466043     ) = ucCharacter;
    6047 
     6044   
    60486045    dwWriteCoord.X++;                                 /* move write position */
    60496046    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    60516048      dwWriteCoord.X = 0;                               /* skip to next line */
    60526049      dwWriteCoord.Y++;
    6053 
     6050     
    60546051                         /* oops, we're at the end of the buffer. Abort now. */
    60556052      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    60576054        if (lpNumberOfCharsWritten != NULL)       /* ensure pointer is valid */
    60586055          *lpNumberOfCharsWritten = ulCounter;
    6059 
     6056       
    60606057                                          /* update screen if active console */
    60616058        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    60626059          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    6063 
     6060       
    60646061        return (TRUE);
    60656062      }
    60666063    }
    60676064  }
    6068 
     6065 
    60696066                                          /* update screen if active console */
    60706067  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    60716068    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    6072 
     6069 
    60736070  if (lpNumberOfCharsWritten != NULL)             /* ensure pointer is valid */
    60746071    *lpNumberOfCharsWritten = nLength;
    6075 
     6072 
    60766073  return (TRUE);
    60776074}
     
    60886085 * Variables :
    60896086 * Result    :
    6090  * Remark    :
     6087 * Remark    : 
    60916088 * Status    : UNTESTED
    60926089 *
     
    61026099  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    61036100  ULONG          ulCounter;                     /* current character counter */
    6104 
     6101 
    61056102#ifdef DEBUG_LOCAL2
    61066103  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::FillConsoleOutputCharacterW(%08x,char=%02x,%u,x=%u y=%u,res=%08x).\n",
     
    61126109           lpNumberOfCharsWritten);
    61136110#endif
    6114 
     6111 
    61156112  if ( (dwWriteCoord.X < 0) ||
    61166113       (dwWriteCoord.Y < 0) )
     
    61186115    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    61196116      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6120 
    6121     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6117   
     6118    SetLastError(ERROR_INVALID_PARAMETER);
    61226119    return (FALSE);
    61236120  }
    6124 
    6125 
     6121 
     6122 
    61266123                                    /* check if dwWriteCoord is within specs */
    61276124  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    61306127    if (lpNumberOfCharsWritten != NULL)           /* ensure pointer is valid */
    61316128      *lpNumberOfCharsWritten = 0;                /* complete error handling */
    6132 
    6133     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6129   
     6130    SetLastError(ERROR_INVALID_PARAMETER);
    61346131    return (FALSE);
    61356132  }
    6136 
     6133 
    61376134
    61386135                                        /* OK, now write the attribute lines */
     
    61456142                              (dwWriteCoord.X * 2)
    61466143     ) = (UCHAR)wcCharacter;          /* @@@PH unicode to ascii conversion ! */
    6147 
     6144   
    61486145    dwWriteCoord.X++;                                 /* move write position */
    61496146    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    61516148      dwWriteCoord.X = 0;                               /* skip to next line */
    61526149      dwWriteCoord.Y++;
    6153 
     6150     
    61546151                         /* oops, we're at the end of the buffer. Abort now. */
    61556152      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    61576154        if (lpNumberOfCharsWritten != NULL)       /* ensure pointer is valid */
    61586155          *lpNumberOfCharsWritten = ulCounter;
    6159 
     6156       
    61606157                                          /* update screen if active console */
    61616158        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    61626159          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    6163 
     6160       
    61646161        return (TRUE);
    61656162      }
    61666163    }
    61676164  }
    6168 
     6165 
    61696166                                          /* update screen if active console */
    61706167  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    61716168    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    6172 
     6169 
    61736170  if (lpNumberOfCharsWritten != NULL)             /* ensure pointer is valid */
    61746171    *lpNumberOfCharsWritten = nLength;
    6175 
     6172 
    61766173  return (TRUE);
    61776174}
     
    61866183 * Variables :
    61876184 * Result    :
    6188  * Remark    :
     6185 * Remark    : 
    61896186 * Status    : UNTESTED
    61906187 *
     
    61966193{
    61976194  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    6198 
     6195 
    61996196#ifdef DEBUG_LOCAL2
    62006197  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleMode(%08x,%08x).\n",
     
    62026199           lpMode);
    62036200#endif
    6204 
     6201 
    62056202  *lpMode = pConsoleBuffer->dwConsoleMode;    /* return current console mode */
    6206 
     6203 
    62076204  return (TRUE);
    62086205}
     
    62166213 * Variables :
    62176214 * Result    :
    6218  * Remark    :
     6215 * Remark    : 
    62196216 * Status    : UNTESTED
    62206217 *
     
    62266223{
    62276224  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    6228 
     6225 
    62296226#ifdef DEBUG_LOCAL2
    62306227  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleCursorInfo(%08x,%08x).\n",
     
    62326229           pCCI);
    62336230#endif
    6234 
     6231 
    62356232  memcpy(pCCI,                      /* just copy the whole information block */
    62366233         &pConsoleBuffer->CursorInfo,
    62376234         sizeof (pConsoleBuffer->CursorInfo) );
    6238 
     6235   
    62396236  return (TRUE);
    62406237}
     
    62486245 * Variables :
    62496246 * Result    :
    6250  * Remark    :
     6247 * Remark    : 
    62516248 * Status    : UNTESTED
    62526249 *
     
    62586255{
    62596256  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    6260 
     6257 
    62616258#ifdef DEBUG_LOCAL2
    62626259  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetConsoleScreenBufferInfo(%08x,%08x).\n",
     
    62646261           pCSBI);
    62656262#endif
    6266 
     6263 
    62676264  pCSBI->dwSize           = pConsoleBuffer->coordBufferSize;
    62686265  pCSBI->dwCursorPosition = pConsoleBuffer->coordCursorPosition;
    62696266  pCSBI->wAttributes      = (USHORT)pConsoleBuffer->ucDefaultAttribute;
    6270 
     6267 
    62716268  /* @@@PH unsure, but should be OK */
    62726269  pCSBI->srWindow.Left   = pConsoleBuffer->coordWindowPosition.X;
     
    62766273  pCSBI->srWindow.Bottom = pConsoleBuffer->coordWindowPosition.Y +
    62776274                           pConsoleBuffer->coordWindowSize.Y - 1;
    6278 
     6275 
    62796276  pCSBI->dwMaximumWindowSize = pConsoleBuffer->coordBufferSize;
    62806277
    6281   return (TRUE);
     6278  return (TRUE);   
    62826279}
    62836280
     
    62866283 * Name      : DWORD HMDeviceConsoleBufferClass::GetLargestConsoleWindowSize
    62876284 * Purpose   : Determine maximum AVIO size
    6288  * Parameters:
    6289  * Variables :
    6290  * Result    :
     6285 * Parameters: 
     6286 * Variables :
     6287 * Result    : 
    62916288 * Remark    :
    6292  * Status    :
     6289 * Status    : 
    62936290 *
    62946291 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    63026299  LONG           lScreenCY;
    63036300  APIRET         rc;                                       /* API returncode */
    6304 
    6305 
     6301 
     6302 
    63066303#ifdef DEBUG_LOCAL
    63076304  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::GetLargestConsoleWindowSize(%08x).\n",
    63086305           pHMHandleData);
    63096306#endif
    6310 
     6307 
    63116308  /* @@@PH determine maximum console window size in characters
    63126309    based on display size and current avio font */
    6313 
     6310 
    63146311  lScreenCX = WinQuerySysValue(HWND_DESKTOP,            /* query PM for that */
    63156312                               SV_CXSCREEN);
    6316 
     6313 
    63176314  lScreenCY = WinQuerySysValue(HWND_DESKTOP,            /* query PM for that */
    63186315                               SV_CYFULLSCREEN);
    6319 
     6316 
    63206317  if (rc != NO_ERROR)
    63216318  {
    63226319    WriteLog("KERNEL32/CONSOLE: VioGetDeviceCellSize failed with #%u.\n",
    63236320             rc);
    6324 
     6321   
    63256322    return (FALSE);                                        /* say API failed */
    63266323  }
    6327 
     6324 
    63286325  if ( (ConsoleGlobals.sCellCX == 0) ||          /* prevent division by zero */
    63296326       (ConsoleGlobals.sCellCY == 0) )
    63306327  {
    63316328    WriteLog("KERNEL32/CONSOLE: VioGetDeviceCellSize returned 0 value.\n");
    6332 
     6329   
    63336330    return (FALSE);                                        /* say API failed */
    63346331  }
    6335 
     6332 
    63366333  coordSize.X = lScreenCX / ConsoleGlobals.sCellCX;                            /* calculate */
    63376334  coordSize.Y = lScreenCY / ConsoleGlobals.sCellCY;
    6338 
     6335 
    63396336                /* these limitations are due to OS/2's current VIO subsystem */
    63406337  coordSize.X = min(coordSize.X, MAX_OS2_COLUMNS);
    63416338  coordSize.Y = min(coordSize.Y, MAX_OS2_ROWS);
    6342 
     6339 
    63436340  return (COORD2ULONG(coordSize));                           /* return value */
    63446341}
     
    63556352 * Variables :
    63566353 * Result    :
    6357  * Remark    :
     6354 * Remark    : 
    63586355 * Status    : UNTESTED
    63596356 *
     
    63726369  ULONG ulReadX, ulReadY;                      /* position data is read from */
    63736370  WORD  wCell;                                        /* currently read data */
    6374 
     6371 
    63756372  PCHAR_INFO pchi;
    6376 
     6373 
    63776374#ifdef DEBUG_LOCAL2
    63786375  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputA(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    63856382           psrctSourceRect);
    63866383#endif
    6387 
    6388 
     6384 
     6385 
    63896386  /* verify psrctSourceRect first */
    63906387  psrctSourceRect->Left  = max(psrctSourceRect->Left,  0);
     
    63926389  psrctSourceRect->Right = min(psrctSourceRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    63936390  psrctSourceRect->Bottom= min(psrctSourceRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    6394 
     6391 
    63956392                                                     /* verify target buffer */
    63966393  if ( (coordDestBufferSize.X < coordDestBufferCoord.X) ||
    63976394       (coordDestBufferSize.Y < coordDestBufferCoord.Y) )
    63986395  {
    6399     O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
     6396    SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
    64006397    return (FALSE);                                            /* API failed */
    64016398  }
    6402 
     6399 
    64036400  ulCX = coordDestBufferSize.X - coordDestBufferCoord.X;
    64046401  ulCY = coordDestBufferSize.Y - coordDestBufferCoord.Y;
    6405 
     6402 
    64066403  ulCX = min(ulCX, (psrctSourceRect->Right  - psrctSourceRect->Left));
    64076404  ulCY = min(ulCY, (psrctSourceRect->Bottom - psrctSourceRect->Top));
    6408 
     6405 
    64096406                                  /* final calculation of the copy rectangle */
    64106407  psrctSourceRect->Right  = psrctSourceRect->Left + ulCX;
    64116408  psrctSourceRect->Bottom = psrctSourceRect->Top  + ulCY;
    6412 
    6413 
     6409 
     6410 
    64146411  for (ulY = 0,
    64156412       ulReadY = psrctSourceRect->Top;
    6416 
     6413       
    64176414       ulY <= ulCY;
    6418 
     6415       
    64196416       ulY++,
    64206417       ulReadY++)
     
    64256422    for (ulX = 0,
    64266423         ulReadX = psrctSourceRect->Left;
    6427 
     6424         
    64286425         ulX <= ulCX;
    6429 
     6426         
    64306427         ulX++,
    64316428         ulReadX++,
     
    64346431                                                           /* read character */
    64356432      wCell = *(pConsoleBuffer->ppszLine[ulReadY] + ulReadX * 2);
    6436 
     6433     
    64376434      pchi->Char.AsciiChar = (UCHAR)(wCell & 0x00FF);
    64386435      pchi->Attributes     = wCell >> 8;
    64396436    }
    64406437  }
    6441 
     6438 
    64426439  return (TRUE);                                            /* OK, that's it */
    64436440}
     
    64546451 * Variables :
    64556452 * Result    :
    6456  * Remark    :
     6453 * Remark    : 
    64576454 * Status    : UNTESTED
    64586455 *
     
    64716468  ULONG ulReadX, ulReadY;                      /* position data is read from */
    64726469  WORD  wCell;                                        /* currently read data */
    6473 
     6470 
    64746471  PCHAR_INFO pchi;
    6475 
     6472 
    64766473#ifdef DEBUG_LOCAL2
    64776474  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputW(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    64846481           psrctSourceRect);
    64856482#endif
    6486 
    6487 
     6483 
     6484 
    64886485  /* verify psrctSourceRect first */
    64896486  psrctSourceRect->Left  = max(psrctSourceRect->Left,  0);
     
    64916488  psrctSourceRect->Right = min(psrctSourceRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    64926489  psrctSourceRect->Bottom= min(psrctSourceRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    6493 
     6490 
    64946491                                                     /* verify target buffer */
    64956492  if ( (coordDestBufferSize.X < coordDestBufferCoord.X) ||
    64966493       (coordDestBufferSize.Y < coordDestBufferCoord.Y) )
    64976494  {
    6498     O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
     6495    SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
    64996496    return (FALSE);                                            /* API failed */
    65006497  }
    6501 
     6498 
    65026499  ulCX = coordDestBufferSize.X - coordDestBufferCoord.X;
    65036500  ulCY = coordDestBufferSize.Y - coordDestBufferCoord.Y;
    6504 
     6501 
    65056502  ulCX = min(ulCX, (psrctSourceRect->Right  - psrctSourceRect->Left));
    65066503  ulCY = min(ulCY, (psrctSourceRect->Bottom - psrctSourceRect->Top));
    6507 
     6504 
    65086505                                  /* final calculation of the copy rectangle */
    65096506  psrctSourceRect->Right  = psrctSourceRect->Left + ulCX;
    65106507  psrctSourceRect->Bottom = psrctSourceRect->Top  + ulCY;
    6511 
    6512 
     6508 
     6509 
    65136510  for (ulY = 0,
    65146511       ulReadY = psrctSourceRect->Top;
    6515 
     6512       
    65166513       ulY <= ulCY;
    6517 
     6514       
    65186515       ulY++,
    65196516       ulReadY++)
     
    65246521    for (ulX = 0,
    65256522         ulReadX = psrctSourceRect->Left;
    6526 
     6523         
    65276524         ulX <= ulCX;
    6528 
     6525         
    65296526         ulX++,
    65306527         ulReadX++,
     
    65336530                                                           /* read character */
    65346531      wCell = *(pConsoleBuffer->ppszLine[ulReadY] + ulReadX * 2);
    6535 
     6532     
    65366533                                                     /* @@@PH Ascii->Unicode */
    65376534      pchi->Char.UnicodeChar = (UCHAR)(wCell & 0x00FF);
     
    65396536    }
    65406537  }
    6541 
     6538 
    65426539  return (TRUE);                                            /* OK, that's it */
    65436540}
     
    65546551 * Variables :
    65556552 * Result    :
    6556  * Remark    :
     6553 * Remark    : 
    65576554 * Status    : UNTESTED
    65586555 *
     
    65686565  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    65696566  ULONG          ulCounter;                     /* current character counter */
    6570 
     6567 
    65716568#ifdef DEBUG_LOCAL2
    65726569  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputAttribute(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    65786575           lpcNumberRead);
    65796576#endif
    6580 
     6577 
    65816578  if ( (dwReadCoord.X < 0) ||
    65826579       (dwReadCoord.Y < 0) )
     
    65846581    if (lpcNumberRead != NULL)                       /* ensure pointer is valid */
    65856582      *lpcNumberRead = 0;                            /* complete error handling */
    6586 
    6587     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6583   
     6584    SetLastError(ERROR_INVALID_PARAMETER);
    65886585    return (FALSE);
    65896586  }
    6590 
     6587 
    65916588                                    /* check if dwReadCoord is within specs */
    65926589  if ( (dwReadCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    65956592    if (lpcNumberRead != NULL)                       /* ensure pointer is valid */
    65966593      *lpcNumberRead = 0;                            /* complete error handling */
    6597 
    6598     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6594   
     6595    SetLastError(ERROR_INVALID_PARAMETER);
    65996596    return (FALSE);
    66006597  }
    6601 
     6598 
    66026599
    66036600                                        /* OK, now write the attribute lines */
     
    66116608      *(pConsoleBuffer->ppszLine[dwReadCoord.Y] +
    66126609                                (dwReadCoord.X * 2 + 1));
    6613 
     6610   
    66146611    dwReadCoord.X++;                                 /* move write position */
    66156612    if (dwReadCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    66176614      dwReadCoord.X = 0;                               /* skip to next line */
    66186615      dwReadCoord.Y++;
    6619 
     6616     
    66206617                         /* oops, we're at the end of the buffer. Abort now. */
    66216618      if (dwReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    66236620        if (lpcNumberRead != NULL)                   /* ensure pointer is valid */
    66246621          *lpcNumberRead = ulCounter;
    6625 
     6622       
    66266623        return (TRUE);
    66276624      }
    66286625    }
    66296626  }
    6630 
     6627 
    66316628  if (lpcNumberRead != NULL)                         /* ensure pointer is valid */
    66326629    *lpcNumberRead = cReadCells;
    6633 
     6630 
    66346631  return (TRUE);
    66356632}
     
    66466643 * Variables :
    66476644 * Result    :
    6648  * Remark    :
     6645 * Remark    : 
    66496646 * Status    : UNTESTED
    66506647 *
     
    66606657  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    66616658  ULONG          ulCounter;                     /* current character counter */
    6662 
     6659 
    66636660#ifdef DEBUG_LOCAL2
    66646661  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputCharacterA(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    66706667           lpcNumberRead);
    66716668#endif
    6672 
     6669 
    66736670  if ( (coordReadCoord.X < 0) ||
    66746671       (coordReadCoord.Y < 0) )
     
    66766673    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    66776674      *lpcNumberRead = 0;                         /* complete error handling */
    6678 
    6679     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6675   
     6676    SetLastError(ERROR_INVALID_PARAMETER);
    66806677    return (FALSE);
    66816678  }
    6682 
     6679 
    66836680                                  /* check if coordReadCoord is within specs */
    66846681  if ( (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    66876684    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    66886685      *lpcNumberRead = 0;                         /* complete error handling */
    6689 
    6690     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6686   
     6687    SetLastError(ERROR_INVALID_PARAMETER);
    66916688    return (FALSE);
    66926689  }
    6693 
     6690 
    66946691
    66956692                                        /* OK, now write the attribute lines */
     
    67036700      *(pConsoleBuffer->ppszLine[coordReadCoord.Y] +
    67046701                                (coordReadCoord.X * 2));
    6705 
     6702   
    67066703    coordReadCoord.X++;                               /* move write position */
    67076704    if (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    67096706      coordReadCoord.X = 0;                             /* skip to next line */
    67106707      coordReadCoord.Y++;
    6711 
     6708     
    67126709                         /* oops, we're at the end of the buffer. Abort now. */
    67136710      if (coordReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    67156712        if (lpcNumberRead != NULL)                /* ensure pointer is valid */
    67166713          *lpcNumberRead = ulCounter;
    6717 
     6714       
    67186715        return (TRUE);
    67196716      }
    67206717    }
    67216718  }
    6722 
     6719 
    67236720  if (lpcNumberRead != NULL)                         /* ensure pointer is valid */
    67246721    *lpcNumberRead = cchRead;
    6725 
     6722 
    67266723  return (TRUE);
    67276724}
     
    67386735 * Variables :
    67396736 * Result    :
    6740  * Remark    :
     6737 * Remark    : 
    67416738 * Status    : UNTESTED
    67426739 *
     
    67526749  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    67536750  ULONG          ulCounter;                     /* current character counter */
    6754 
     6751 
    67556752#ifdef DEBUG_LOCAL2
    67566753  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ReadConsoleOutputCharacterW(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    67626759           lpcNumberRead);
    67636760#endif
    6764 
     6761 
    67656762  if ( (coordReadCoord.X < 0) ||
    67666763       (coordReadCoord.Y < 0) )
     
    67686765    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    67696766      *lpcNumberRead = 0;                         /* complete error handling */
    6770 
    6771     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6767   
     6768    SetLastError(ERROR_INVALID_PARAMETER);
    67726769    return (FALSE);
    67736770  }
    6774 
     6771 
    67756772                                  /* check if coordReadCoord is within specs */
    67766773  if ( (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    67796776    if (lpcNumberRead != NULL)                    /* ensure pointer is valid */
    67806777      *lpcNumberRead = 0;                         /* complete error handling */
    6781 
    6782     O32_SetLastError(ERROR_INVALID_PARAMETER);
     6778   
     6779    SetLastError(ERROR_INVALID_PARAMETER);
    67836780    return (FALSE);
    67846781  }
    6785 
     6782 
    67866783
    67876784                                        /* OK, now write the attribute lines */
     
    67966793      *(pConsoleBuffer->ppszLine[coordReadCoord.Y] +
    67976794                                (coordReadCoord.X * 2));
    6798 
     6795   
    67996796    coordReadCoord.X++;                               /* move write position */
    68006797    if (coordReadCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    68026799      coordReadCoord.X = 0;                             /* skip to next line */
    68036800      coordReadCoord.Y++;
    6804 
     6801     
    68056802                         /* oops, we're at the end of the buffer. Abort now. */
    68066803      if (coordReadCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    68086805        if (lpcNumberRead != NULL)                /* ensure pointer is valid */
    68096806          *lpcNumberRead = ulCounter;
    6810 
     6807       
    68116808        return (TRUE);
    68126809      }
    68136810    }
    68146811  }
    6815 
     6812 
    68166813  if (lpcNumberRead != NULL)                         /* ensure pointer is valid */
    68176814    *lpcNumberRead = cchRead;
    6818 
     6815 
    68196816  return (TRUE);
    68206817}
     
    68546851  WORD           wAttr;                      /* fill character and attribute */
    68556852  int            iBlitDirection;             /* to handle overlapped buffers */
    6856 
     6853 
    68576854#ifdef DEBUG_LOCAL2
    68586855  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ScrollConsoleScreenBufferA(%08x,%08x,%08x,x=%u y=%u,%08x).\n",
     
    68646861           pchiFill);
    68656862#endif
    6866 
     6863 
    68676864                                   /* calculate effective clipping rectangle */
    68686865  if (psrctClipRect != NULL)          /* if clipping rectangle was specified */
     
    68716868           psrctClipRect,
    68726869           sizeof (SMALL_RECT) );
    6873 
     6870     
    68746871                                          /* check boundary with buffer size */
    68756872    srctView.Left   = max(0, srctView.Left);
     
    68856882    srctView.Bottom = pConsoleBuffer->coordBufferSize.Y;
    68866883  }
    6887 
     6884 
    68886885  memcpy(&srctSource,                               /* copy source rectangle */
    68896886         psrctSourceRect,
     
    68946891  srctSource.Right  = min(srctSource.Right, srctView.Right );
    68956892  srctSource.Bottom = min(srctSource.Bottom,srctView.Bottom);
    6896 
     6893 
    68976894  srctDest.Left  = max(srctView.Left,   coordDestOrigin.X);
    68986895  srctDest.Top   = max(srctView.Top,    coordDestOrigin.Y);
    68996896  srctDest.Right = min(srctView.Right,  srctDest.Left + srctSource.Right  - srctSource.Left);
    69006897  srctDest.Bottom= min(srctView.Bottom, srctDest.Top  + srctSource.Bottom - srctSource.Top);
    6901 
     6898 
    69026899  /****************************
    69036900   * first copy the rectangle *
    69046901   ****************************/
    6905 
     6902 
    69066903  if (srctDest.Left >  srctSource.Left) iBlitDirection  = 0;
    69076904  else                                  iBlitDirection  = 1;
    69086905  if (srctDest.Top  >  srctSource.Top)  iBlitDirection += 2;
    6909 
     6906 
    69106907                               /* this leaves us with three different cases: */
    69116908                               /*                                            */
     
    69266923      {
    69276924                         /* calculate pointer to start of target screen line */
    6928         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
     6925        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
    69296926                               (srctDest.Left << 1) );
    6930 
     6927       
    69316928                         /* calculate pointer to start of source screen line */
    6932         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
     6929        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
    69336930                               (srctSource.Left << 1) );
    6934 
     6931       
    69356932        for (iX = srctDest.Left;
    69366933             iX <= srctDest.Right;
     
    69416938      }
    69426939      break;
    6943 
     6940 
    69446941    /***************
    69456942     * upper right *
     
    69516948      {
    69526949                           /* calculate pointer to end of target screen line */
    6953         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
     6950        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
    69546951                               ( srctDest.Right << 1) );
    6955 
     6952       
    69566953                           /* calculate pointer to end of source screen line */
    6957         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
     6954        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
    69586955                               ( srctSource.Right << 1) );
    6959 
     6956       
    69606957        for (iX = srctDest.Right;
    69616958             iX >= srctDest.Left;
     
    69666963      }
    69676964      break;
    6968 
     6965   
    69696966    /***************
    69706967     * lower left  *
     
    69766973      {
    69776974                         /* calculate pointer to start of target screen line */
    6978         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
     6975        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
    69796976                               (srctDest.Left << 1) );
    6980 
     6977       
    69816978                         /* calculate pointer to start of source screen line */
    6982         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
     6979        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
    69836980                               (srctSource.Left << 1) );
    6984 
     6981       
    69856982        for (iX = srctDest.Left;
    69866983             iX <= srctDest.Right;
     
    70016998      {
    70026999                           /* calculate pointer to end of target screen line */
    7003         pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] +
     7000        pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctDest.Top] + 
    70047001                               ( srctDest.Right << 1) );
    7005 
     7002       
    70067003                           /* calculate pointer to end of source screen line */
    7007         pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] +
     7004        pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[iY + srctSource.Top] + 
    70087005                               (srctSource.Right << 1) );
    7009 
     7006       
    70107007        for (iX = srctDest.Right;
    70117008             iX >= srctDest.Left;
     
    70177014      break;
    70187015  }
    7019 
    7020 
     7016   
     7017   
    70217018              /* this is the character and attribute for the uncovered cells */
    70227019  wAttr = (pchiFill->Char.AsciiChar) + (pchiFill->Attributes << 8);
     
    70277024  {
    70287025    pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[iY] + srctSource.Left);
    7029 
     7026   
    70307027    for (iX = srctSource.Left;
    70317028         iX < srctSource.Right;
     
    70427039        *pusTarget = wAttr;            /* write fill character and attribute */
    70437040  }
    7044 
     7041 
    70457042                                          /* update screen if active console */
    70467043  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
     
    70827079  PUSHORT        pusTarget, pusSource;      /* pointer to source, dest cells */
    70837080  WORD           wAttr;                      /* fill character and attribute */
    7084 
     7081 
    70857082#ifdef DEBUG_LOCAL2
    70867083  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::ScrollConsoleScreenBufferW(%08x,%08x,%08x,x=%u y=%u,%08x).\n",
     
    70927089           pchiFill);
    70937090#endif
    7094 
     7091 
    70957092                                   /* calculate effective clipping rectangle */
    70967093  if (psrctClipRect != NULL)          /* if clipping rectangle was specified */
     
    70997096           psrctClipRect,
    71007097           sizeof (SMALL_RECT) );
    7101 
     7098     
    71027099                                          /* check boundary with buffer size */
    71037100    srctView.Left   = max(0, srctView.Left);
     
    71137110    srctView.Bottom = pConsoleBuffer->coordBufferSize.Y;
    71147111  }
    7115 
     7112 
    71167113  memcpy(&srctSource,                               /* copy source rectangle */
    71177114         psrctSourceRect,
     
    71227119  srctSource.Right  = min(srctSource.Right, srctView.Right );
    71237120  srctSource.Bottom = min(srctSource.Bottom,srctView.Bottom);
    7124 
     7121 
    71257122  srctDest.Left  = max(srctView.Left,   coordDestOrigin.X);
    71267123  srctDest.Top   = max(srctView.Top,    coordDestOrigin.Y);
    71277124  srctDest.Right = min(srctView.Right,  srctDest.Left + srctSource.Right  - srctSource.Left);
    71287125  srctDest.Bottom= min(srctView.Bottom, srctDest.Top  + srctSource.Bottom - srctSource.Top);
    7129 
     7126 
    71307127  /* first copy the rectangle */
    71317128  for (ulY = 0;
     
    71347131  {
    71357132                         /* calculate pointer to start of target screen line */
    7136     pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctDest.Top] +
     7133    pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctDest.Top] + 
    71377134                           srctDest.Left);
    7138 
     7135   
    71397136                         /* calculate pointer to start of source screen line */
    7140     pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctSource.Top] +
     7137    pusSource = (PUSHORT) (pConsoleBuffer->ppszLine[ulY + srctSource.Top] + 
    71417138                           srctSource.Left);
    7142 
     7139   
    71437140    for (ulX = srctDest.Left;
    71447141         ulX < srctDest.Right;
     
    71487145      *pusTarget = *pusSource;                             /* copy character */
    71497146  }
    7150 
    7151 
     7147 
     7148 
    71527149              /* this is the character and attribute for the uncovered cells */
    71537150  /* @@@PH Unicode->Ascii translation */
     
    71597156  {
    71607157    pusTarget = (PUSHORT) (pConsoleBuffer->ppszLine[ulY] + srctSource.Left);
    7161 
     7158   
    71627159    for (ulX = srctSource.Left;
    71637160         ulX < srctSource.Right;
     
    71667163      *pusTarget = wAttr;              /* write fill character and attribute */
    71677164  }
    7168 
     7165 
    71697166                                          /* update screen if active console */
    71707167  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    71717168    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7172 
     7169 
    71737170  return (TRUE);
    71747171}
     
    71827179 * Variables :
    71837180 * Result    :
    7184  * Remark    :
     7181 * Remark    : 
    71857182 * Status    : UNTESTED
    71867183 *
     
    71927189{
    71937190  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7194 
     7191 
    71957192#ifdef DEBUG_LOCAL2
    71967193  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleCursorInfo(%08x,%08x).\n",
     
    71987195           pCCI);
    71997196#endif
    7200 
     7197 
    72017198                                                       /* validate structure */
    72027199  if ( (pCCI->dwSize < 1) ||
    72037200       (pCCI->dwSize > 100) )
    72047201  {
    7205     O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set extended error info */
     7202    SetLastError(ERROR_INVALID_PARAMETER);        /* set extended error info */
    72067203    return (FALSE);                                            /* API failed */
    72077204  }
    7208 
     7205 
    72097206              /* if we're the active buffer, remove cursor from screen first */
    72107207  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    72117208    ConsoleCursorShow(pConsoleBuffer,
    72127209                      CONSOLECURSOR_HIDE);
    7213 
     7210   
    72147211  memcpy(&pConsoleBuffer->CursorInfo,    /* copy the whole information block */
    72157212         pCCI,
    72167213         sizeof (pConsoleBuffer->CursorInfo) );
    7217 
     7214   
    72187215  return (TRUE);
    72197216}
     
    72277224 * Variables :
    72287225 * Result    :
    7229  * Remark    :
     7226 * Remark    : 
    72307227 * Status    : UNTESTED
    72317228 *
     
    72377234{
    72387235  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7239 
     7236 
    72407237#ifdef DEBUG_LOCAL2
    72417238  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleCursorPosition(%08x,x=%u.y=%u).\n",
     
    72447241           coordCursorPosition.Y);
    72457242#endif
    7246 
     7243 
    72477244                                  /* @@@PH remove cursor from screen first ! */
    72487245  pConsoleBuffer->coordCursorPosition = coordCursorPosition;
    7249 
     7246 
    72507247  return (TRUE);
    72517248}
     
    72597256 * Variables :
    72607257 * Result    :
    7261  * Remark    :
     7258 * Remark    : 
    72627259 * Status    : UNTESTED
    72637260 *
     
    72697266{
    72707267  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7271 
     7268 
    72727269#ifdef DEBUG_LOCAL2
    72737270  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleMode(%08x,%08x).\n",
     
    72757272           dwMode);
    72767273#endif
    7277 
     7274 
    72787275  pConsoleBuffer->dwConsoleMode = dwMode;        /* set current console mode */
    7279 
     7276 
    72807277  return (TRUE);
    72817278}
     
    72907287 * Variables :
    72917288 * Result    :
    7292  * Remark    :
     7289 * Remark    : 
    72937290 * Status    : UNTESTED
    72947291 *
     
    73037300  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    73047301  ULONG ulLine;                                        /* line index counter */
    7305 
     7302 
    73067303#ifdef DEBUG_LOCAL2
    73077304  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleScreenBufferSize(%u,%u).\n",
     
    73097306           coordSize.Y);
    73107307#endif
    7311 
    7312 
     7308 
     7309 
    73137310                                 /* re-allocate the whole line-pointer array */
    73147311  ulSize = coordSize.Y * (coordSize.X * 2 + sizeof (PSZ) );
     
    73177314    if (pConsoleBuffer->ppszLine != NULL)        /* if old buffer is present */
    73187315      free (pConsoleBuffer->ppszLine);                    /* free old buffer */
    7319 
     7316   
    73207317    pConsoleBuffer->ppszLine          = NULL;
    73217318    pConsoleBuffer->coordBufferSize.X = 0;
     
    73257322    pConsoleBuffer->coordWindowPosition.X = 0;
    73267323    pConsoleBuffer->coordWindowPosition.Y = 0;
    7327 
     7324   
    73287325    return (TRUE);                                                     /* OK */
    73297326  }
    73307327
    7331 
     7328 
    73327329  ppszNew = (PSZ *) malloc(ulSize);                        /* allocate array */
    73337330  if (ppszNew == NULL)                            /* check proper allocation */
    73347331  {
    7335     O32_SetLastError(ERROR_NOT_ENOUGH_MEMORY);          /* set error information */
     7332    SetLastError(ERROR_NOT_ENOUGH_MEMORY);          /* set error information */
    73367333    return (FALSE);                                 /* raise error condition */
    73377334  }
    7338 
     7335 
    73397336
    73407337  for (ulLine = 0;                               /* setup line pointer array */
     
    73527349                 ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 24) +
    73537350                 ((ULONG)' ' << 16) );
    7354 
     7351 
    73557352                                                    /* scroll the line index */
    73567353  for (ulLine = 0;
     
    73607357                          (PUSHORT)(ppszNew[ulLine]),
    73617358                          coordSize.X);
    7362 
    7363 
    7364 
     7359 
     7360 
     7361 
    73657362                                                   /* copy lines as required */
    73667363  if (pConsoleBuffer->ppszLine != NULL)         /* previous buffer present ? */
    73677364  {
    73687365    ULONG x, y;
    7369 
     7366   
    73707367                                          /* copy old characters as required */
    73717368    x = min(pConsoleBuffer->coordBufferSize.X, coordSize.X);
    73727369    y = min(pConsoleBuffer->coordBufferSize.Y, coordSize.Y);
    7373 
     7370   
    73747371    for (ulLine = 0;                                    /* copy line by line */
    73757372         ulLine < y;
     
    73787375             pConsoleBuffer->ppszLine[ulLine],
    73797376             x * 2);
    7380 
     7377   
    73817378    free (pConsoleBuffer->ppszLine);    /* free previous screen buffer array */
    73827379  }
    7383 
     7380 
    73847381
    73857382  pConsoleBuffer->ppszLine          = ppszNew;     /* poke in the new values */
     
    73887385  pConsoleBuffer->coordCursorPosition.X = 0;
    73897386  pConsoleBuffer->coordCursorPosition.Y = 0;
    7390 
     7387 
    73917388  /* @@@PH to be changed ! */
    73927389  pConsoleBuffer->coordWindowSize.X = coordSize.X;                /* default */
     
    73987395  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    73997396    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7400 
     7397 
    74017398  return TRUE;
    74027399}
     
    74047401
    74057402/*****************************************************************************
    7406  * Name      :
    7407  * Purpose   :
    7408  * Parameters:
    7409  * Variables :
    7410  * Result    :
     7403 * Name      : 
     7404 * Purpose   : 
     7405 * Parameters: 
     7406 * Variables :
     7407 * Result    : 
    74117408 * Remark    :
    7412  * Status    :
     7409 * Status    : 
    74137410 *
    74147411 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    74197416{
    74207417  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7421 
     7418 
    74227419#ifdef DEBUG_LOCAL2
    74237420  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleTextAttribute(%u).\n",
    74247421           wAttr);
    74257422#endif
    7426 
     7423 
    74277424  pConsoleBuffer->ucDefaultAttribute = (UCHAR)wAttr;
    74287425  return (TRUE);
     
    74317428
    74327429/*****************************************************************************
    7433  * Name      :
    7434  * Purpose   :
    7435  * Parameters:
    7436  * Variables :
    7437  * Result    :
     7430 * Name      : 
     7431 * Purpose   : 
     7432 * Parameters: 
     7433 * Variables :
     7434 * Result    : 
    74387435 * Remark    :
    7439  * Status    :
     7436 * Status    : 
    74407437 *
    74417438 * Author    : Patrick Haller [Tue, 1998/02/10 01:55]
     
    74457442{
    74467443  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7447 
     7444 
    74487445#ifdef DEBUG_LOCAL
    74497446  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleActiveScreenBuffer().\n");
    74507447#endif
    7451 
     7448 
    74527449                              /* set new buffer handle to the global console */
    74537450  ConsoleGlobals.hConsoleBuffer  = pHMHandleData->hHandle;
    74547451  ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7455 
     7452 
    74567453  return (TRUE);
    74577454}
     
    74667463 * Variables :
    74677464 * Result    :
    7468  * Remark    :
     7465 * Remark    : 
    74697466 * Status    : UNTESTED
    74707467 *
     
    74777474{
    74787475  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7479 
     7476 
    74807477#ifdef DEBUG_LOCAL2
    74817478  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::SetConsoleWindowInfo(%08x,%u,%08x).\n",
     
    74847481           psrctWindowRect);
    74857482#endif
    7486 
     7483 
    74877484  if (fAbsolute == TRUE)                  /* absolute coordinates provided ? */
    74887485  {
     
    74957492       )
    74967493    {
    7497       O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set error information */
     7494      SetLastError(ERROR_INVALID_PARAMETER);        /* set error information */
    74987495      return (FALSE);                                               /* error */
    74997496    }
    7500 
     7497   
    75017498                                 /* check we don't go beyond screen buffer ! */
    75027499    if ( ((psrctWindowRect->Right  - psrctWindowRect->Left) > pConsoleBuffer->coordBufferSize.X) ||
     
    75067503       )
    75077504    {
    7508       O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set error information */
     7505      SetLastError(ERROR_INVALID_PARAMETER);        /* set error information */
    75097506      return (FALSE);                                               /* error */
    75107507    }
    7511 
     7508       
    75127509    pConsoleBuffer->coordWindowSize.X     = psrctWindowRect->Right -
    75137510                                            psrctWindowRect->Left;
    75147511    pConsoleBuffer->coordWindowSize.Y     = psrctWindowRect->Bottom -
    75157512                                            psrctWindowRect->Top;
    7516 
     7513   
    75177514    pConsoleBuffer->coordWindowPosition.X = psrctWindowRect->Left;
    75187515    pConsoleBuffer->coordWindowPosition.Y = psrctWindowRect->Top;
     
    75247521    int iPosX;
    75257522    int iPosY;
    7526 
     7523   
    75277524    iSizeX = pConsoleBuffer->coordWindowSize.X + psrctWindowRect->Left + psrctWindowRect->Right;
    75287525    iSizeY = pConsoleBuffer->coordWindowSize.Y + psrctWindowRect->Top  + psrctWindowRect->Bottom;
    75297526    iPosX  = pConsoleBuffer->coordWindowPosition.X  + psrctWindowRect->Left;
    75307527    iPosY  = pConsoleBuffer->coordWindowPosition.Y  + psrctWindowRect->Top;
    7531 
     7528   
    75327529                                 /* check we don't go beyond screen buffer ! */
    75337530    if ( (iSizeX > pConsoleBuffer->coordBufferSize.X) ||
     
    75417538       )
    75427539    {
    7543       O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set error information */
     7540      SetLastError(ERROR_INVALID_PARAMETER);        /* set error information */
    75447541      return (FALSE);                                               /* error */
    75457542    }
    7546 
     7543 
    75477544                                       /* Values are verified for being OK ! */
    75487545    pConsoleBuffer->coordWindowPosition.X  = iPosX;
     
    75517548    pConsoleBuffer->coordWindowSize.Y = iSizeY;
    75527549  }
    7553 
     7550 
    75547551  /* update window */
    7555   /* @@@PH
    7556 
     7552  /* @@@PH 
     7553   
    75577554   ConsoleWindowResize(COORD coordWindowSize,
    75587555                       COORD coordWindowPos,
    7559 
     7556   
    75607557   */
    7561 
     7558 
    75627559                                          /* update window contents (scroll) */
    75637560                                          /* update screen if active console */
     
    75797576 * Variables :
    75807577 * Result    :
    7581  * Remark    :
     7578 * Remark    : 
    75827579 * Status    : UNTESTED
    75837580 *
     
    75927589{
    75937590  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7594 
     7591 
    75957592#ifdef DEBUG_LOCAL2
    75967593  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleA(%08x,%08x,%u,%08x,%08x).\n",
     
    76017598           lpvReserved);
    76027599#endif
    7603 
     7600 
    76047601  /* simply forward the request to that routine */
    76057602  return (HMDeviceConsoleBufferClass::WriteFile(pHMHandleData,
     
    76217618 * Variables :
    76227619 * Result    :
    7623  * Remark    :
     7620 * Remark    : 
    76247621 * Status    : UNTESTED
    76257622 *
     
    76347631{
    76357632  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    7636 
     7633 
    76377634#ifdef DEBUG_LOCAL2
    76387635  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleW(%08x,%08x,%u,%08x,%08x).\n",
     
    76437640           lpvReserved);
    76447641#endif
    7645 
     7642 
    76467643  /* @@@PH AScii -> unicode translation */
    7647 
     7644 
    76487645  /* simply forward the request to that routine */
    76497646  return (HMDeviceConsoleBufferClass::WriteFile(pHMHandleData,
     
    76657662 * Variables :
    76667663 * Result    :
    7667  * Remark    :
     7664 * Remark    : 
    76687665 * Status    : UNTESTED
    76697666 *
     
    76827679  ULONG ulWriteX, ulWriteY;                    /* position data is read from */
    76837680  WORD  wCell;                                        /* currently read data */
    7684 
     7681 
    76857682  PCHAR_INFO pchi;
    76867683  PSZ        pszTarget;
    7687 
     7684 
    76887685#ifdef DEBUG_LOCAL2
    76897686  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputA(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    76967693           psrctDestRect);
    76977694#endif
    7698 
    7699 
     7695 
     7696 
    77007697  /* verify psrctDestRect first */
    77017698  psrctDestRect->Left  = max(psrctDestRect->Left,  0);
     
    77037700  psrctDestRect->Right = min(psrctDestRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    77047701  psrctDestRect->Bottom= min(psrctDestRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    7705 
     7702 
    77067703                                                     /* verify target buffer */
    77077704  if ( (coordSrcBufferSize.X < coordSrcBufferCoord.X) ||
    77087705       (coordSrcBufferSize.Y < coordSrcBufferCoord.Y) )
    77097706  {
    7710     O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
     7707    SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
    77117708    return (FALSE);                                            /* API failed */
    77127709  }
    7713 
     7710 
    77147711  ulCX = coordSrcBufferSize.X - coordSrcBufferCoord.X;
    77157712  ulCY = coordSrcBufferSize.Y - coordSrcBufferCoord.Y;
    7716 
     7713 
    77177714  ulCX = min(ulCX, (psrctDestRect->Right  - psrctDestRect->Left));
    77187715  ulCY = min(ulCY, (psrctDestRect->Bottom - psrctDestRect->Top));
    7719 
     7716 
    77207717                                  /* final calculation of the copy rectangle */
    77217718  psrctDestRect->Right  = psrctDestRect->Left + ulCX;
    77227719  psrctDestRect->Bottom = psrctDestRect->Top  + ulCY;
    7723 
    7724 
     7720 
     7721 
    77257722  for (ulY = 0,
    77267723       ulWriteY = psrctDestRect->Top;
    7727 
     7724       
    77287725       ulY <= ulCY;
    7729 
     7726       
    77307727       ulY++,
    77317728       ulWriteY++)
     
    77347731                          + sizeof(CHAR_INFO) * (coordSrcBufferCoord.Y + ulY)
    77357732                            * coordSrcBufferSize.X;
    7736 
     7733   
    77377734                                /* calculate pointer to start of screen line */
    77387735    pszTarget = pConsoleBuffer->ppszLine[ulWriteY] + psrctDestRect->Left;
    7739 
     7736   
    77407737    for (ulX = 0,
    77417738         ulWriteX = psrctDestRect->Left;
    7742 
     7739         
    77437740         ulX <= ulCX;
    7744 
     7741         
    77457742         ulX++,
    77467743         ulWriteX++,
     
    77527749    }
    77537750  }
    7754 
     7751 
    77557752                                          /* update screen if active console */
    77567753  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    77577754    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7758 
     7755   
    77597756  return (TRUE);                                            /* OK, that's it */
    77607757}
     
    77717768 * Variables :
    77727769 * Result    :
    7773  * Remark    :
     7770 * Remark    : 
    77747771 * Status    : UNTESTED
    77757772 *
     
    77887785  ULONG ulWriteX, ulWriteY;                    /* position data is read from */
    77897786  WORD  wCell;                                        /* currently read data */
    7790 
     7787 
    77917788  PCHAR_INFO pchi;
    77927789  PSZ        pszTarget;
    7793 
     7790 
    77947791#ifdef DEBUG_LOCAL2
    77957792  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputW(%08x,%08x,x=%u y=%u,x=%u y=%u, %08x).\n",
     
    78027799           psrctDestRect);
    78037800#endif
    7804 
    7805 
     7801 
     7802 
    78067803  /* verify psrctDestRect first */
    78077804  psrctDestRect->Left  = max(psrctDestRect->Left,  0);
     
    78097806  psrctDestRect->Right = min(psrctDestRect->Right, pConsoleBuffer->coordBufferSize.X - 1);
    78107807  psrctDestRect->Bottom= min(psrctDestRect->Bottom,pConsoleBuffer->coordBufferSize.Y - 1);
    7811 
     7808 
    78127809                                                     /* verify target buffer */
    78137810  if ( (coordSrcBufferSize.X < coordSrcBufferCoord.X) ||
    78147811       (coordSrcBufferSize.Y < coordSrcBufferCoord.Y) )
    78157812  {
    7816     O32_SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
     7813    SetLastError(ERROR_INVALID_PARAMETER);        /* set detailed error info */
    78177814    return (FALSE);                                            /* API failed */
    78187815  }
    7819 
     7816 
    78207817  ulCX = coordSrcBufferSize.X - coordSrcBufferCoord.X;
    78217818  ulCY = coordSrcBufferSize.Y - coordSrcBufferCoord.Y;
    7822 
     7819 
    78237820  ulCX = min(ulCX, (psrctDestRect->Right  - psrctDestRect->Left));
    78247821  ulCY = min(ulCY, (psrctDestRect->Bottom - psrctDestRect->Top));
    7825 
     7822 
    78267823                                  /* final calculation of the copy rectangle */
    78277824  psrctDestRect->Right  = psrctDestRect->Left + ulCX;
    78287825  psrctDestRect->Bottom = psrctDestRect->Top  + ulCY;
    7829 
    7830 
     7826 
     7827 
    78317828  for (ulY = 0,
    78327829       ulWriteY = psrctDestRect->Top;
    7833 
     7830       
    78347831       ulY <= ulCY;
    7835 
     7832       
    78367833       ulY++,
    78377834       ulWriteY++)
     
    78407837                          + sizeof(CHAR_INFO) * (coordSrcBufferCoord.Y + ulY)
    78417838                            * coordSrcBufferSize.X;
    7842 
     7839   
    78437840                                /* calculate pointer to start of screen line */
    78447841    pszTarget = pConsoleBuffer->ppszLine[ulWriteY] + psrctDestRect->Left;
    7845 
     7842   
    78467843    for (ulX = 0,
    78477844         ulWriteX = psrctDestRect->Left;
    7848 
     7845         
    78497846         ulX <= ulCX;
    7850 
     7847         
    78517848         ulX++,
    78527849         ulWriteX++,
     
    78587855    }
    78597856  }
    7860 
     7857 
    78617858                                          /* update screen if active console */
    78627859  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    78637860    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7864 
     7861   
    78657862  return (TRUE);                                            /* OK, that's it */
    78667863}
     
    78777874 * Variables :
    78787875 * Result    :
    7879  * Remark    :
     7876 * Remark    : 
    78807877 * Status    : UNTESTED
    78817878 *
     
    78917888  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    78927889  ULONG          ulCounter;                     /* current character counter */
    7893 
     7890 
    78947891#ifdef DEBUG_LOCAL2
    78957892  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputAttribute(%08x,pattr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    79037900           lpcWritten);
    79047901#endif
    7905 
     7902 
    79067903  if ( (dwWriteCoord.X < 0) ||
    79077904       (dwWriteCoord.Y < 0) )
     
    79097906    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    79107907      *lpcWritten = 0;                            /* complete error handling */
    7911 
    7912     O32_SetLastError(ERROR_INVALID_PARAMETER);
     7908   
     7909    SetLastError(ERROR_INVALID_PARAMETER);
    79137910    return (FALSE);
    79147911  }
    7915 
     7912 
    79167913                                    /* check if dwWriteCoord is within specs */
    79177914  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    79207917    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    79217918      *lpcWritten = 0;                            /* complete error handling */
    7922 
    7923     O32_SetLastError(ERROR_INVALID_PARAMETER);
     7919   
     7920    SetLastError(ERROR_INVALID_PARAMETER);
    79247921    return (FALSE);
    79257922  }
    7926 
     7923 
    79277924
    79287925                                        /* OK, now write the attribute lines */
     
    79367933                              (dwWriteCoord.X * 2 + 1)
    79377934     ) = (UCHAR)*lpwAttribute;           /* write attribute and skip to next */
    7938 
     7935   
    79397936    dwWriteCoord.X++;                                 /* move write position */
    79407937    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    79427939      dwWriteCoord.X = 0;                               /* skip to next line */
    79437940      dwWriteCoord.Y++;
    7944 
     7941     
    79457942                         /* oops, we're at the end of the buffer. Abort now. */
    79467943      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    79487945        if (lpcWritten != NULL)                   /* ensure pointer is valid */
    79497946          *lpcWritten = ulCounter;
    7950 
     7947       
    79517948                                          /* update screen if active console */
    79527949        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    79537950          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    7954 
     7951       
    79557952        return (TRUE);
    79567953      }
    79577954    }
    79587955  }
    7959 
     7956 
    79607957                                          /* update screen if active console */
    79617958  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    79627959    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    7963 
     7960 
    79647961  if (lpcWritten != NULL)                         /* ensure pointer is valid */
    79657962    *lpcWritten = cWriteCells;
    7966 
     7963 
    79677964  return (TRUE);
    79687965}
     
    79797976 * Variables :
    79807977 * Result    :
    7981  * Remark    :
     7978 * Remark    : 
    79827979 * Status    : UNTESTED
    79837980 *
     
    79937990  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    79947991  ULONG          ulCounter;                     /* current character counter */
    7995 
     7992 
    79967993#ifdef DEBUG_LOCAL2
    79977994  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputCharacterA(%08x,pstr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    80038000           lpcWritten);
    80048001#endif
    8005 
     8002 
    80068003  if ( (dwWriteCoord.X < 0) ||
    80078004       (dwWriteCoord.Y < 0) )
     
    80098006    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    80108007      *lpcWritten = 0;                            /* complete error handling */
    8011 
    8012     O32_SetLastError(ERROR_INVALID_PARAMETER);
     8008   
     8009    SetLastError(ERROR_INVALID_PARAMETER);
    80138010    return (FALSE);
    80148011  }
    8015 
     8012 
    80168013                                    /* check if dwWriteCoord is within specs */
    80178014  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    80208017    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    80218018      *lpcWritten = 0;                            /* complete error handling */
    8022 
    8023     O32_SetLastError(ERROR_INVALID_PARAMETER);
     8019   
     8020    SetLastError(ERROR_INVALID_PARAMETER);
    80248021    return (FALSE);
    80258022  }
    8026 
     8023 
    80278024
    80288025                                        /* OK, now write the character lines */
     
    80368033                              (dwWriteCoord.X * 2)
    80378034     ) = (UCHAR)*lpWriteBuffer;          /* write character and skip to next */
    8038 
     8035   
    80398036    dwWriteCoord.X++;                                 /* move write position */
    80408037    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    80428039      dwWriteCoord.X = 0;                               /* skip to next line */
    80438040      dwWriteCoord.Y++;
    8044 
     8041     
    80458042                         /* oops, we're at the end of the buffer. Abort now. */
    80468043      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    80488045        if (lpcWritten != NULL)                   /* ensure pointer is valid */
    80498046          *lpcWritten = ulCounter;
    8050 
     8047       
    80518048                                          /* update screen if active console */
    80528049        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    80538050          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    8054 
     8051       
    80558052        return (TRUE);
    80568053      }
    80578054    }
    80588055  }
    8059 
     8056 
    80608057                                          /* update screen if active console */
    80618058  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    80628059    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    8063 
     8060 
    80648061  if (lpcWritten != NULL)                         /* ensure pointer is valid */
    80658062    *lpcWritten = cchWrite;
    8066 
     8063 
    80678064  return (TRUE);
    80688065}
     
    80938090  PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
    80948091  ULONG          ulCounter;                     /* current character counter */
    8095 
     8092 
    80968093#ifdef DEBUG_LOCAL2
    80978094  WriteLog("KERNEL32/CONSOLE: CONBUFFER$::WriteConsoleOutputCharacterW(%08x,pstr=%08x,%u,x=%u y=%u,res=%08x).\n",
     
    81038100           lpcWritten);
    81048101#endif
    8105 
     8102 
    81068103  if ( (dwWriteCoord.X < 0) ||
    81078104       (dwWriteCoord.Y < 0) )
     
    81098106    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    81108107      *lpcWritten = 0;                            /* complete error handling */
    8111 
    8112     O32_SetLastError(ERROR_INVALID_PARAMETER);
     8108   
     8109    SetLastError(ERROR_INVALID_PARAMETER);
    81138110    return (FALSE);
    81148111  }
    8115 
     8112 
    81168113                                    /* check if dwWriteCoord is within specs */
    81178114  if ( (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X) ||
     
    81208117    if (lpcWritten != NULL)                       /* ensure pointer is valid */
    81218118      *lpcWritten = 0;                            /* complete error handling */
    8122 
    8123     O32_SetLastError(ERROR_INVALID_PARAMETER);
     8119   
     8120    SetLastError(ERROR_INVALID_PARAMETER);
    81248121    return (FALSE);
    81258122  }
    8126 
     8123 
    81278124
    81288125                                        /* OK, now write the character lines */
     
    81378134     ) = (UCHAR)*lpWriteBuffer;          /* write character and skip to next */
    81388135                                       /* @@@PH unicode to ascii translation */
    8139 
     8136   
    81408137    dwWriteCoord.X++;                                 /* move write position */
    81418138    if (dwWriteCoord.X >= pConsoleBuffer->coordBufferSize.X)
     
    81438140      dwWriteCoord.X = 0;                               /* skip to next line */
    81448141      dwWriteCoord.Y++;
    8145 
     8142     
    81468143                         /* oops, we're at the end of the buffer. Abort now. */
    81478144      if (dwWriteCoord.Y >= pConsoleBuffer->coordBufferSize.Y)
     
    81498146        if (lpcWritten != NULL)                   /* ensure pointer is valid */
    81508147          *lpcWritten = ulCounter;
    8151 
     8148       
    81528149                                          /* update screen if active console */
    81538150        if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    81548151          ConsoleGlobals.fUpdateRequired = TRUE;/* update with next WM_TIMER */
    8155 
     8152       
    81568153        return (TRUE);
    81578154      }
    81588155    }
    81598156  }
    8160 
     8157 
    81618158                                          /* update screen if active console */
    81628159  if (pHMHandleData->hHandle == ConsoleGlobals.hConsoleBuffer)
    81638160    ConsoleGlobals.fUpdateRequired = TRUE;      /* update with next WM_TIMER */
    8164 
     8161 
    81658162  if (lpcWritten != NULL)                         /* ensure pointer is valid */
    81668163    *lpcWritten = cchWrite;
    8167 
     8164 
    81688165  return (TRUE);
    81698166}
Note: See TracChangeset for help on using the changeset viewer.