| 1 | /* $Id: console.cpp,v 1.28 2001-10-01 01:47:01 bird Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Win32 Console API Translation for OS/2
|
|---|
| 5 | *
|
|---|
| 6 | * 1998/02/10 Patrick Haller (haller@zebra.fh-weingarten.de)
|
|---|
| 7 | *
|
|---|
| 8 | * @(#) console.cpp 1.0.0 1998/02/10 PH Start from scratch
|
|---|
| 9 | *
|
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 11 | *
|
|---|
| 12 | */
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | #ifdef DEBUG
|
|---|
| 16 | #define DEBUG_LOCAL
|
|---|
| 17 | #define DEBUG_LOCAL2
|
|---|
| 18 | #endif
|
|---|
| 19 |
|
|---|
| 20 | //#undef DEBUG_LOCAL
|
|---|
| 21 | //#undef DEBUG_LOCAL2
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | /*****************************************************************************
|
|---|
| 25 | * Remark *
|
|---|
| 26 | *****************************************************************************
|
|---|
| 27 |
|
|---|
| 28 | - DWORD HandlerRoutine (DWORD dwCtrlType)
|
|---|
| 29 | basically an exception handler routine. handles a few signals / excpts.
|
|---|
| 30 | should be somewhere near the exception handling code ... :)
|
|---|
| 31 |
|
|---|
| 32 | Hmm, however as PM applications don't really get a ctrl-c signal,
|
|---|
| 33 | I'll have to do this on my own ...
|
|---|
| 34 |
|
|---|
| 35 | - supply unicode<->ascii conversions for all the _A and _W function pairs.
|
|---|
| 36 |
|
|---|
| 37 | - problem: we can't prevent thread1 from blocking the message queue ?
|
|---|
| 38 | what will happen if a WinTerminate() is issued there ?
|
|---|
| 39 | will the message queue be closed and provide smooth tasking ?
|
|---|
| 40 | how will open32 react on this ?
|
|---|
| 41 |
|
|---|
| 42 | - ECHO_LINE_INPUT / ReadFile blocks till CR
|
|---|
| 43 |
|
|---|
| 44 | - scrollbars
|
|---|
| 45 | * do some flowchart to exactly determine WHEN to use WHICH setting
|
|---|
| 46 | and perform WHAT action
|
|---|
| 47 |
|
|---|
| 48 | - clipboard support
|
|---|
| 49 | */
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 | /*******************************************************************************
|
|---|
| 53 | * Header Files *
|
|---|
| 54 | *******************************************************************************/
|
|---|
| 55 | #include <process.h>
|
|---|
| 56 | #include <stdlib.h>
|
|---|
| 57 | #include <string.h>
|
|---|
| 58 |
|
|---|
| 59 | #define INCL_WIN
|
|---|
| 60 | #define INCL_DOSMEMMGR
|
|---|
| 61 | #define INCL_DOSSEMAPHORES
|
|---|
| 62 | #define INCL_DOSERRORS
|
|---|
| 63 | #define INCL_DOSPROCESS
|
|---|
| 64 | #define INCL_DOSMODULEMGR
|
|---|
| 65 | #define INCL_VIO
|
|---|
| 66 | #define INCL_KBD
|
|---|
| 67 | #define INCL_AVIO
|
|---|
| 68 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
|---|
| 69 |
|
|---|
| 70 | #include <win32type.h>
|
|---|
| 71 | #include <win32api.h>
|
|---|
| 72 | #include <misc.h>
|
|---|
| 73 |
|
|---|
| 74 | #include "conwin.h" // Windows Header for console only
|
|---|
| 75 | #include "HandleManager.h"
|
|---|
| 76 | #include "HMDevice.h"
|
|---|
| 77 |
|
|---|
| 78 | #include "console.h"
|
|---|
| 79 | #include "console2.h"
|
|---|
| 80 | #include "conin.h"
|
|---|
| 81 | #include "conout.h"
|
|---|
| 82 | #include "conbuffer.h"
|
|---|
| 83 | #include "conbuffervio.h"
|
|---|
| 84 |
|
|---|
| 85 | #include "conprop.h"
|
|---|
| 86 | #include "unicode.h"
|
|---|
| 87 | #include "heapstring.h"
|
|---|
| 88 |
|
|---|
| 89 | #define DBG_LOCALLOG DBG_console
|
|---|
| 90 | #include "dbglocal.h"
|
|---|
| 91 |
|
|---|
| 92 | #include <os2sel.h>
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 | /*******************************************************************************
|
|---|
| 96 | * Process Global Structures *
|
|---|
| 97 | *******************************************************************************/
|
|---|
| 98 | static ICONSOLEGLOBALS ConsoleGlobals;
|
|---|
| 99 | static ICONSOLEINPUT ConsoleInput;
|
|---|
| 100 | BOOL flVioConsole = FALSE;
|
|---|
| 101 |
|
|---|
| 102 | /*******************************************************************************
|
|---|
| 103 | * Internal Functions *
|
|---|
| 104 | *******************************************************************************/
|
|---|
| 105 | static void iConsoleInputQueueLock();
|
|---|
| 106 | static void iConsoleInputQueueUnlock();
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | /*****************************************************************************
|
|---|
| 110 | * Name : iConsoleInputQueueLock
|
|---|
| 111 | * Purpose : lock the input queue to ensure correct event sequence
|
|---|
| 112 | * Parameters:
|
|---|
| 113 | * Variables :
|
|---|
| 114 | * Result :
|
|---|
| 115 | * Remark :
|
|---|
| 116 | * Status :
|
|---|
| 117 | *
|
|---|
| 118 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 119 | *****************************************************************************/
|
|---|
| 120 |
|
|---|
| 121 | static void iConsoleInputQueueLock()
|
|---|
| 122 | {
|
|---|
| 123 | APIRET rc;
|
|---|
| 124 |
|
|---|
| 125 | rc = DosRequestMutexSem(ConsoleInput.hmtxInputQueue,
|
|---|
| 126 | SEM_INDEFINITE_WAIT);
|
|---|
| 127 | if (rc != NO_ERROR)
|
|---|
| 128 | dprintf(("KERNEL32: Console:iConsoleInputQueueLock error %08xh\n",
|
|---|
| 129 | rc));
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 | /*****************************************************************************
|
|---|
| 134 | * Name : iConsoleInputQueueUnlock
|
|---|
| 135 | * Purpose : unlock the input queue
|
|---|
| 136 | * Parameters:
|
|---|
| 137 | * Variables :
|
|---|
| 138 | * Result :
|
|---|
| 139 | * Remark :
|
|---|
| 140 | * Status :
|
|---|
| 141 | *
|
|---|
| 142 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 143 | *****************************************************************************/
|
|---|
| 144 |
|
|---|
| 145 | static void iConsoleInputQueueUnlock()
|
|---|
| 146 | {
|
|---|
| 147 | APIRET rc;
|
|---|
| 148 |
|
|---|
| 149 | rc = DosReleaseMutexSem(ConsoleInput.hmtxInputQueue);
|
|---|
| 150 | if (rc != NO_ERROR)
|
|---|
| 151 | dprintf(("KERNEL32: Console:iConsoleInputQueueUnlock error %08xh\n",
|
|---|
| 152 | rc));
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 | /*****************************************************************************
|
|---|
| 157 | * Name :
|
|---|
| 158 | * Purpose :
|
|---|
| 159 | * Parameters:
|
|---|
| 160 | * Variables :
|
|---|
| 161 | * Result :
|
|---|
| 162 | * Remark :
|
|---|
| 163 | * Status :
|
|---|
| 164 | *
|
|---|
| 165 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 166 | *****************************************************************************/
|
|---|
| 167 |
|
|---|
| 168 | APIRET iConsoleInit(BOOL fVioConsole) /* creation of the console subsystem */
|
|---|
| 169 | {
|
|---|
| 170 | APIRET rc; /* API return code */
|
|---|
| 171 | ULONG ulPostCount; /* semaphore post counter */
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 | flVioConsole = fVioConsole;
|
|---|
| 175 |
|
|---|
| 176 | if (ConsoleGlobals.hevConsole != NULLHANDLE) /* we're already initialized ?*/
|
|---|
| 177 | return (NO_ERROR); /* then abort immediately */
|
|---|
| 178 |
|
|---|
| 179 | if(flVioConsole == TRUE)
|
|---|
| 180 | {
|
|---|
| 181 | /***************************************************************************
|
|---|
| 182 | * Create pseudo-devices and initialize ConsoleGlobals *
|
|---|
| 183 | ***************************************************************************/
|
|---|
| 184 |
|
|---|
| 185 | rc = iConsoleDevicesRegister(); /* ensure devices are there */
|
|---|
| 186 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 187 | {
|
|---|
| 188 | return (rc); /* raise error condition */
|
|---|
| 189 | }
|
|---|
| 190 | rc = DosCreateMutexSem(NULL,
|
|---|
| 191 | &ConsoleInput.hmtxInputQueue,
|
|---|
| 192 | 0L,
|
|---|
| 193 | FALSE);
|
|---|
| 194 | if (rc != NO_ERROR) /* other error ? */
|
|---|
| 195 | {
|
|---|
| 196 | return (rc); /* raise error condition */
|
|---|
| 197 | }
|
|---|
| 198 |
|
|---|
| 199 | return NO_ERROR;
|
|---|
| 200 | }
|
|---|
| 201 | else {
|
|---|
| 202 | /* create console synchronization semaphore */
|
|---|
| 203 | rc = DosCreateEventSem (NULL,
|
|---|
| 204 | &ConsoleGlobals.hevConsole,
|
|---|
| 205 | 0L, /* semaphore is private */
|
|---|
| 206 | FALSE); /* reset state */
|
|---|
| 207 | if (rc != NO_ERROR) /* other error ? */
|
|---|
| 208 | return (rc); /* raise error condition */
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 | /* create console input queue semaphore */
|
|---|
| 212 | rc = DosCreateEventSem (NULL,
|
|---|
| 213 | &ConsoleInput.hevInputQueue,
|
|---|
| 214 | 0L, /* semaphore is private */
|
|---|
| 215 | FALSE); /* reset state */
|
|---|
| 216 | if (rc != NO_ERROR) /* other error ? */
|
|---|
| 217 | {
|
|---|
| 218 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* close other semaphore */
|
|---|
| 219 | return (rc); /* raise error condition */
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | rc = DosCreateMutexSem(NULL,
|
|---|
| 224 | &ConsoleInput.hmtxInputQueue,
|
|---|
| 225 | 0L,
|
|---|
| 226 | FALSE);
|
|---|
| 227 | if (rc != NO_ERROR) /* other error ? */
|
|---|
| 228 | {
|
|---|
| 229 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* close other semaphore */
|
|---|
| 230 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 231 | return (rc); /* raise error condition */
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | /***************************************************************************
|
|---|
| 235 | * Create pseudo-devices and initialize ConsoleGlobals *
|
|---|
| 236 | ***************************************************************************/
|
|---|
| 237 |
|
|---|
| 238 | rc = iConsoleDevicesRegister(); /* ensure devices are there */
|
|---|
| 239 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 240 | {
|
|---|
| 241 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* close other semaphore */
|
|---|
| 242 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 243 | return (rc); /* raise error condition */
|
|---|
| 244 | }
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 | /***************************************************************************
|
|---|
| 248 | * Presentation Manager Initialization phase *
|
|---|
| 249 | ***************************************************************************/
|
|---|
| 250 |
|
|---|
| 251 | /* OK, we're about to initialize the console subsystem for this process. */
|
|---|
| 252 | /* start message thread for console object window */
|
|---|
| 253 | ConsoleGlobals.tidConsole = _beginthread(iConsoleMsgThread,
|
|---|
| 254 | NULL,
|
|---|
| 255 | 12288,
|
|---|
| 256 | NULL);
|
|---|
| 257 | /* has the thread been created properly ? */
|
|---|
| 258 | if (ConsoleGlobals.tidConsole == -1)
|
|---|
| 259 | {
|
|---|
| 260 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 261 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* close event semaphore */
|
|---|
| 262 | ConsoleGlobals.hevConsole = NULLHANDLE; /* for ConsoleIsActive() */
|
|---|
| 263 | return (rc); /* raise error condition */
|
|---|
| 264 | }
|
|---|
| 265 | else
|
|---|
| 266 | DosSetPriority(PRTYS_THREAD, /* set priority */
|
|---|
| 267 | ConsoleGlobals.Options.ulConsoleThreadPriorityClass,
|
|---|
| 268 | ConsoleGlobals.Options.ulConsoleThreadPriorityDelta,
|
|---|
| 269 | ConsoleGlobals.tidConsole);
|
|---|
| 270 |
|
|---|
| 271 |
|
|---|
| 272 | /* wait for the child thread to do it's initialization */
|
|---|
| 273 | /* timeout isn't really useful */
|
|---|
| 274 | rc = DosWaitEventSem(ConsoleGlobals.hevConsole,
|
|---|
| 275 | SEM_INDEFINITE_WAIT);
|
|---|
| 276 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 277 | {
|
|---|
| 278 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 279 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* close event semaphore */
|
|---|
| 280 | ConsoleGlobals.hevConsole = NULLHANDLE; /* for ConsoleIsActive() */
|
|---|
| 281 | return (rc); /* raise error condition */
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 | DosResetEventSem(ConsoleGlobals.hevConsole, /* reset event semaphore */
|
|---|
| 285 | &ulPostCount);
|
|---|
| 286 |
|
|---|
| 287 | rc = ConsoleGlobals.rcConsole; /* pass thru console thread's return code */
|
|---|
| 288 |
|
|---|
| 289 | return (rc); /* OK */
|
|---|
| 290 | }
|
|---|
| 291 | }
|
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 | /*****************************************************************************
|
|---|
| 295 | * Name : ConsoleDevicesRegister
|
|---|
| 296 | * Purpose : creates and registers console devices if the standard handles
|
|---|
| 297 | * are not redirected to a file
|
|---|
| 298 | * Parameters:
|
|---|
| 299 | * Variables :
|
|---|
| 300 | * Result :
|
|---|
| 301 | * Remark :
|
|---|
| 302 | * Status :
|
|---|
| 303 | *
|
|---|
| 304 | * Author : Patrick Haller [Tue, 1998/03/17 01:55]
|
|---|
| 305 | *****************************************************************************/
|
|---|
| 306 |
|
|---|
| 307 | APIRET iConsoleDevicesRegister(void)
|
|---|
| 308 | {
|
|---|
| 309 | DWORD dwType; /* device handle type */
|
|---|
| 310 | HANDLE hStandardIn; /* stdin handle to CONIN$ */
|
|---|
| 311 | HANDLE hStandardOut; /* stdout handle to CONOUT$ */
|
|---|
| 312 | HANDLE hStandardError; /* stderr handle to CONOUT$ */
|
|---|
| 313 |
|
|---|
| 314 | HMDeviceConsoleInClass *pHMDeviceConsoleIn;
|
|---|
| 315 | HMDeviceConsoleOutClass *pHMDeviceConsoleOut;
|
|---|
| 316 | HMDeviceConsoleBufferClass *pHMDeviceConsoleBuffer;
|
|---|
| 317 |
|
|---|
| 318 | DWORD rc;
|
|---|
| 319 |
|
|---|
| 320 | static BOOL fDevicesInitialized; /* have we been initialized already ? */
|
|---|
| 321 |
|
|---|
| 322 | if (fDevicesInitialized == TRUE) /* OK, we're already done */
|
|---|
| 323 | return (NO_ERROR);
|
|---|
| 324 | else
|
|---|
| 325 | fDevicesInitialized = TRUE;
|
|---|
| 326 |
|
|---|
| 327 | dprintf(("KERNEL32:ConsoleDevicesRegister\n"));
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 | /*************************************
|
|---|
| 331 | * Initialize Console Window Options *
|
|---|
| 332 | *************************************/
|
|---|
| 333 |
|
|---|
| 334 | // load defaults
|
|---|
| 335 | ConsolePropertyDefault(&ConsoleGlobals.Options);
|
|---|
| 336 |
|
|---|
| 337 | ConsoleGlobals.ulTimerFrequency = 10; /* cursor + blitter timer frequency */
|
|---|
| 338 |
|
|---|
| 339 | ConsoleGlobals.coordWindowSize.X = ConsoleGlobals.Options.coordDefaultSize.X;
|
|---|
| 340 | ConsoleGlobals.coordWindowSize.Y = ConsoleGlobals.Options.coordDefaultSize.Y;
|
|---|
| 341 | ConsoleGlobals.coordWindowPos.X = 0;
|
|---|
| 342 | ConsoleGlobals.coordWindowPos.Y = 0;
|
|---|
| 343 | if(flVioConsole == TRUE) {
|
|---|
| 344 | VIOMODEINFO videoinfo;
|
|---|
| 345 |
|
|---|
| 346 | videoinfo.cb = sizeof(VIOMODEINFO);
|
|---|
| 347 | rc = VioGetMode(&videoinfo, 0);
|
|---|
| 348 | if(rc == 0) {
|
|---|
| 349 | dprintf(("video mode (%d,%d)", videoinfo.col, videoinfo.row));
|
|---|
| 350 | ConsoleGlobals.coordWindowSize.X = videoinfo.col;
|
|---|
| 351 | ConsoleGlobals.coordWindowSize.Y = videoinfo.row;
|
|---|
| 352 | }
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 | ConsoleGlobals.flFrameFlags = FCF_SIZEBORDER | /* frame creation flags */
|
|---|
| 357 | FCF_TITLEBAR |
|
|---|
| 358 | FCF_SHELLPOSITION|
|
|---|
| 359 | FCF_SYSMENU |
|
|---|
| 360 | FCF_TASKLIST |
|
|---|
| 361 | FCF_AUTOICON |
|
|---|
| 362 | FCF_HORZSCROLL |
|
|---|
| 363 | FCF_VERTSCROLL |
|
|---|
| 364 | FCF_MINMAX;
|
|---|
| 365 |
|
|---|
| 366 | /* generate copy of title */
|
|---|
| 367 | ConsoleGlobals.pszWindowTitle = strdup(GetCommandLineA());
|
|---|
| 368 |
|
|---|
| 369 | /* obtain module handle to our resources */
|
|---|
| 370 | rc = DosQueryModuleHandle("KERNEL32",
|
|---|
| 371 | &ConsoleGlobals.hmodResource);
|
|---|
| 372 | if (rc != NO_ERROR)
|
|---|
| 373 | WriteLog("KERNEL32/CONSOLE: Can't get handle to KERNEL32 (%u).\n",
|
|---|
| 374 | rc);
|
|---|
| 375 |
|
|---|
| 376 | /* standard console input modes */
|
|---|
| 377 | ConsoleInput.dwConsoleMode = ENABLE_LINE_INPUT |
|
|---|
| 378 | ENABLE_PROCESSED_INPUT;
|
|---|
| 379 | /* @@@PH ENABLE_ECHO_INPUT || ENABLE_MOUSE_INPUT; */
|
|---|
| 380 |
|
|---|
| 381 | ConsoleGlobals.hConsoleBufferDefault = INVALID_HANDLE_VALUE;
|
|---|
| 382 | ConsoleGlobals.hConsoleBuffer = INVALID_HANDLE_VALUE;
|
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 | if (flVioConsole == FALSE)
|
|---|
| 386 | {
|
|---|
| 387 | // defaults are effective, try to read and apply stored properties
|
|---|
| 388 | if (ConsolePropertyLoad(&ConsoleGlobals.Options) == NO_ERROR)
|
|---|
| 389 | ConsolePropertyApply(&ConsoleGlobals.Options);
|
|---|
| 390 | }
|
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 | /***************************************************************************
|
|---|
| 394 | * Standard handles Initialization phase *
|
|---|
| 395 | ***************************************************************************/
|
|---|
| 396 |
|
|---|
| 397 | /* create devices and register devices with handlemanager */
|
|---|
| 398 | pHMDeviceConsoleIn = new HMDeviceConsoleInClass("CONIN$",
|
|---|
| 399 | &ConsoleInput,
|
|---|
| 400 | &ConsoleGlobals);
|
|---|
| 401 |
|
|---|
| 402 | rc = HMDeviceRegister ("CONIN$",
|
|---|
| 403 | pHMDeviceConsoleIn);
|
|---|
| 404 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 405 | dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONIN$ failed with %u.\n",
|
|---|
| 406 | rc));
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 | pHMDeviceConsoleOut = new HMDeviceConsoleOutClass("CONOUT$",
|
|---|
| 410 | &ConsoleInput,
|
|---|
| 411 | &ConsoleGlobals);
|
|---|
| 412 | rc = HMDeviceRegister ("CONOUT$",
|
|---|
| 413 | pHMDeviceConsoleOut);
|
|---|
| 414 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 415 | dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONOUT$ failed with %u.\n",
|
|---|
| 416 | rc));
|
|---|
| 417 |
|
|---|
| 418 | if(flVioConsole == TRUE)
|
|---|
| 419 | {
|
|---|
| 420 | pHMDeviceConsoleBuffer = (HMDeviceConsoleBufferClass *)new HMDeviceConsoleVioBufferClass("CONBUFFER$",
|
|---|
| 421 | &ConsoleInput,
|
|---|
| 422 | &ConsoleGlobals);
|
|---|
| 423 | }
|
|---|
| 424 | else {
|
|---|
| 425 | pHMDeviceConsoleBuffer = new HMDeviceConsoleBufferClass("CONBUFFER$",
|
|---|
| 426 | &ConsoleInput,
|
|---|
| 427 | &ConsoleGlobals);
|
|---|
| 428 | }
|
|---|
| 429 | rc = HMDeviceRegister ("CONBUFFER$",
|
|---|
| 430 | pHMDeviceConsoleBuffer);
|
|---|
| 431 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 432 | dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONBUFFER$ failed with %u.\n",
|
|---|
| 433 | rc));
|
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 | if(flVioConsole == FALSE)
|
|---|
| 437 | {
|
|---|
| 438 | /***********************************************************************
|
|---|
| 439 | * initialize stdin handle *
|
|---|
| 440 | ***********************************************************************/
|
|---|
| 441 | hStandardIn = GetStdHandle(STD_INPUT_HANDLE);
|
|---|
| 442 | dwType = GetFileType(hStandardIn);
|
|---|
| 443 | if (dwType == FILE_TYPE_CHAR) /* is handle redirected ? */
|
|---|
| 444 | hStandardIn = HMCreateFile("CONIN$",
|
|---|
| 445 | GENERIC_READ | GENERIC_WRITE,
|
|---|
| 446 | FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|---|
| 447 | NULL,
|
|---|
| 448 | 0,
|
|---|
| 449 | CONSOLE_TEXTMODE_BUFFER,
|
|---|
| 450 | 0);
|
|---|
| 451 |
|
|---|
| 452 | HMSetStdHandle(STD_INPUT_HANDLE,
|
|---|
| 453 | hStandardIn);
|
|---|
| 454 |
|
|---|
| 455 | /***********************************************************************
|
|---|
| 456 | * initialize stdout handle *
|
|---|
| 457 | ***********************************************************************/
|
|---|
| 458 | hStandardOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
|---|
| 459 | dwType = GetFileType(hStandardOut);
|
|---|
| 460 | if (dwType == FILE_TYPE_CHAR) /* is handle redirected ? */
|
|---|
| 461 | hStandardOut = HMCreateFile("CONOUT$",
|
|---|
| 462 | GENERIC_READ | GENERIC_WRITE,
|
|---|
| 463 | FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|---|
| 464 | NULL,
|
|---|
| 465 | 0,
|
|---|
| 466 | CONSOLE_TEXTMODE_BUFFER,
|
|---|
| 467 | 0);
|
|---|
| 468 |
|
|---|
| 469 | HMSetStdHandle(STD_OUTPUT_HANDLE,
|
|---|
| 470 | hStandardOut);
|
|---|
| 471 |
|
|---|
| 472 | /***********************************************************************
|
|---|
| 473 | * initialize stderr handle *
|
|---|
| 474 | ***********************************************************************/
|
|---|
| 475 | hStandardError = GetStdHandle(STD_ERROR_HANDLE);
|
|---|
| 476 | dwType = GetFileType(hStandardError);
|
|---|
| 477 | if (dwType == FILE_TYPE_CHAR) /* is handle redirected ? */
|
|---|
| 478 | hStandardError = HMCreateFile("CONOUT$",
|
|---|
| 479 | GENERIC_READ | GENERIC_WRITE,
|
|---|
| 480 | FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|---|
| 481 | NULL,
|
|---|
| 482 | 0,
|
|---|
| 483 | CONSOLE_TEXTMODE_BUFFER,
|
|---|
| 484 | 0);
|
|---|
| 485 |
|
|---|
| 486 | HMSetStdHandle(STD_ERROR_HANDLE,
|
|---|
| 487 | hStandardError);
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 | return (NO_ERROR); /* OK */
|
|---|
| 491 | }
|
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 | /*****************************************************************************
|
|---|
| 495 | * Name : static APIRET ConsoleTerminate
|
|---|
| 496 | * Purpose : Shuts the OS/2 console subsystem down
|
|---|
| 497 | * Parameters: VOID
|
|---|
| 498 | * Variables :
|
|---|
| 499 | * Result : OS/2 API return code
|
|---|
| 500 | * Remark : That consolebuffer handle that became allocated as default
|
|---|
| 501 | * screen buffer is lost here. This would be a serious memory
|
|---|
| 502 | * leak if an application keeps opening and closing the console
|
|---|
| 503 | * frequently.
|
|---|
| 504 | * Status :
|
|---|
| 505 | *
|
|---|
| 506 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 507 | *****************************************************************************/
|
|---|
| 508 |
|
|---|
| 509 | ULONG iConsoleTerminate(VOID)
|
|---|
| 510 | {
|
|---|
| 511 | APIRET rc = NO_ERROR;
|
|---|
| 512 |
|
|---|
| 513 | if(flVioConsole == FALSE)
|
|---|
| 514 | {
|
|---|
| 515 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* close other semaphore */
|
|---|
| 516 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 | WinPostMsg (ConsoleGlobals.hwndFrame, /* force thread to terminate */
|
|---|
| 520 | WM_CLOSE,
|
|---|
| 521 | (MPARAM)NULL,
|
|---|
| 522 | (MPARAM)NULL);
|
|---|
| 523 |
|
|---|
| 524 | rc = DosWaitThread(&ConsoleGlobals.tidConsole,/* wait until thd terminates */
|
|---|
| 525 | DCWW_WAIT);
|
|---|
| 526 |
|
|---|
| 527 | }
|
|---|
| 528 | DosCloseMutexSem(ConsoleInput.hmtxInputQueue); /* close semaphore */
|
|---|
| 529 |
|
|---|
| 530 | /* close the consolebuffer handle */
|
|---|
| 531 | HMCloseHandle(ConsoleGlobals.hConsoleBufferDefault);
|
|---|
| 532 | free(ConsoleGlobals.pszWindowTitle); /* free previously allocated memory */
|
|---|
| 533 |
|
|---|
| 534 | return (rc); /* OK */
|
|---|
| 535 | }
|
|---|
| 536 |
|
|---|
| 537 |
|
|---|
| 538 | /*****************************************************************************
|
|---|
| 539 | * Name : static void ConsoleWaitClose
|
|---|
| 540 | * Purpose : Wait for the user to close console window
|
|---|
| 541 | * Parameters: VOID
|
|---|
| 542 | * Variables :
|
|---|
| 543 | * Result :
|
|---|
| 544 | * Remark :
|
|---|
| 545 | * Status :
|
|---|
| 546 | *
|
|---|
| 547 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 548 | *****************************************************************************/
|
|---|
| 549 |
|
|---|
| 550 | void iConsoleWaitClose(void)
|
|---|
| 551 | {
|
|---|
| 552 | CHAR szBuffer[128]; /* buffer for the title */
|
|---|
| 553 | BOOL fResult; /* result from subsequent calls to Win32 APIs */
|
|---|
| 554 |
|
|---|
| 555 | /* check if there is a console window at all */
|
|---|
| 556 | if (iConsoleIsActive() == FALSE)
|
|---|
| 557 | return; /* nope */
|
|---|
| 558 |
|
|---|
| 559 | if(flVioConsole == TRUE) //no need to wait for VIO session
|
|---|
| 560 | return;
|
|---|
| 561 |
|
|---|
| 562 | strcpy (szBuffer, /* indicate console process has terminated */
|
|---|
| 563 | "Completed: ");
|
|---|
| 564 |
|
|---|
| 565 | fResult = GetConsoleTitleA(szBuffer + 11,/* 11 is length of Completed:_ */
|
|---|
| 566 | sizeof(szBuffer) - 11);
|
|---|
| 567 |
|
|---|
| 568 |
|
|---|
| 569 | /* Set new title: Win32 Console - Terminated */
|
|---|
| 570 | fResult = SetConsoleTitleA(szBuffer);
|
|---|
| 571 |
|
|---|
| 572 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* close other semaphore */
|
|---|
| 573 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 574 | DosCloseMutexSem(ConsoleInput.hmtxInputQueue); /* close semaphore */
|
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 | /* terminate console immediately ? */
|
|---|
| 578 | if (ConsoleGlobals.Options.fTerminateAutomatically == FALSE) {
|
|---|
| 579 | if(getenv("ODIN_AUTOEXITCONSOLE") == NULL) {
|
|---|
| 580 | DosWaitThread(&ConsoleGlobals.tidConsole, /* wait until thd terminates */
|
|---|
| 581 | DCWW_WAIT);
|
|---|
| 582 | }
|
|---|
| 583 | }
|
|---|
| 584 | }
|
|---|
| 585 |
|
|---|
| 586 |
|
|---|
| 587 | /*****************************************************************************
|
|---|
| 588 | * Name : static BOOL ConsoleIsActive
|
|---|
| 589 | * Purpose : Check if Console window is opened
|
|---|
| 590 | * Parameters: VOID
|
|---|
| 591 | * Variables :
|
|---|
| 592 | * Result :
|
|---|
| 593 | * Remark :
|
|---|
| 594 | * Status :
|
|---|
| 595 | *
|
|---|
| 596 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 597 | *****************************************************************************/
|
|---|
| 598 |
|
|---|
| 599 | BOOL iConsoleIsActive(void)
|
|---|
| 600 | {
|
|---|
| 601 | if(flVioConsole == TRUE) //actually, this isn't needed in VIO mode
|
|---|
| 602 | return TRUE;
|
|---|
| 603 |
|
|---|
| 604 | return (NULLHANDLE != ConsoleGlobals.hevConsole);
|
|---|
| 605 | }
|
|---|
| 606 |
|
|---|
| 607 |
|
|---|
| 608 | /*****************************************************************************
|
|---|
| 609 | * Name : static VOID ConsoleMsgThread
|
|---|
| 610 | * Purpose : Message handler thread for the console object window
|
|---|
| 611 | * Parameters: PVOID pDummy
|
|---|
| 612 | * Variables :
|
|---|
| 613 | * Result : is placed in Globals.rcConsole
|
|---|
| 614 | * Remark : the main thread has to wait for this thread
|
|---|
| 615 | * Status :
|
|---|
| 616 | *
|
|---|
| 617 | * Author : Patrick Haller [Tue, 1998/02/10 02:49]
|
|---|
| 618 | *****************************************************************************/
|
|---|
| 619 |
|
|---|
| 620 | VOID iConsoleMsgThread(PVOID pParameters)
|
|---|
| 621 | {
|
|---|
| 622 | APIRET rc; /* API return code */
|
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 | ConsoleGlobals.rcConsole = NO_ERROR; /* initialization */
|
|---|
| 626 |
|
|---|
| 627 | ConsoleGlobals.hab = WinInitialize(0); /* enable thread for PM */
|
|---|
| 628 | if (ConsoleGlobals.hab == NULLHANDLE) /* if anchor block allocation failed */
|
|---|
| 629 | ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
|
|---|
| 630 | else
|
|---|
| 631 | {
|
|---|
| 632 | /* create message queue */
|
|---|
| 633 | ConsoleGlobals.hmq = WinCreateMsgQueue(ConsoleGlobals.hab,
|
|---|
| 634 | 0);
|
|---|
| 635 | if (ConsoleGlobals.hmq == NULLHANDLE) /* if msg queue allocation failed */
|
|---|
| 636 | {
|
|---|
| 637 | WinTerminate(ConsoleGlobals.hab); /* stop thread from accessing PM */
|
|---|
| 638 | ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
|
|---|
| 639 | }
|
|---|
| 640 | else
|
|---|
| 641 | {
|
|---|
| 642 | if (WinRegisterClass(ConsoleGlobals.hab, /* register our class with PM */
|
|---|
| 643 | SZ_CONSOLE_CLASS,
|
|---|
| 644 | iConsoleWindowProc,
|
|---|
| 645 | CS_SIZEREDRAW,
|
|---|
| 646 | 0)
|
|---|
| 647 | == FALSE)
|
|---|
| 648 | {
|
|---|
| 649 | WinDestroyMsgQueue(ConsoleGlobals.hmq); /* destroy message queue */
|
|---|
| 650 | WinTerminate(ConsoleGlobals.hab); /* stop thread from accessing PM */
|
|---|
| 651 | ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
|
|---|
| 652 | }
|
|---|
| 653 | else
|
|---|
| 654 | {
|
|---|
| 655 | ConsoleGlobals.hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
|
|---|
| 656 | WS_VISIBLE,
|
|---|
| 657 | &ConsoleGlobals.flFrameFlags,
|
|---|
| 658 | SZ_CONSOLE_CLASS,
|
|---|
| 659 | ConsoleGlobals.pszWindowTitle,
|
|---|
| 660 | 0,
|
|---|
| 661 | ConsoleGlobals.hmodResource,
|
|---|
| 662 | ID_CONSOLE_MAIN,
|
|---|
| 663 | &ConsoleGlobals.hwndClient);
|
|---|
| 664 | if (ConsoleGlobals.hwndFrame == NULLHANDLE) /* check window creation */
|
|---|
| 665 | {
|
|---|
| 666 | WinDestroyMsgQueue(ConsoleGlobals.hmq); /* destroy message queue */
|
|---|
| 667 | WinTerminate(ConsoleGlobals.hab); /* stop thread from accessing PM */
|
|---|
| 668 | ConsoleGlobals.rcConsole = ERROR_NOT_ENOUGH_MEMORY;
|
|---|
| 669 | } /* WinCreateStdWindow */
|
|---|
| 670 | } /* WinRegisterClass */
|
|---|
| 671 | } /* WinCreateMsgQueue */
|
|---|
| 672 | } /* WinInitialize */
|
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 | DosPostEventSem(ConsoleGlobals.hevConsole); /* signal the main thread */
|
|---|
| 676 |
|
|---|
| 677 |
|
|---|
| 678 | if (ConsoleGlobals.rcConsole != NO_ERROR) /* if we ran into a problem */
|
|---|
| 679 | {
|
|---|
| 680 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 681 | DosCloseEventSem(ConsoleGlobals.hevConsole); /* subsystem not running .. */
|
|---|
| 682 | ConsoleGlobals.hevConsole = NULLHANDLE; /* for ConsoleIsActive() */
|
|---|
| 683 | return; /* abort the message queue thread immediately */
|
|---|
| 684 | }
|
|---|
| 685 |
|
|---|
| 686 |
|
|---|
| 687 | while( WinGetMsg(ConsoleGlobals.hab, /* message loop */
|
|---|
| 688 | &ConsoleGlobals.qmsg,
|
|---|
| 689 | NULLHANDLE,
|
|---|
| 690 | 0,
|
|---|
| 691 | 0) )
|
|---|
| 692 | WinDispatchMsg(ConsoleGlobals.hab, /* dispatch the message */
|
|---|
| 693 | &ConsoleGlobals.qmsg);
|
|---|
| 694 |
|
|---|
| 695 | /* do the cleanup, destroy window, queue */
|
|---|
| 696 | /* and stop thread from using PM */
|
|---|
| 697 | WinDestroyWindow (ConsoleGlobals.hwndFrame);
|
|---|
| 698 | WinDestroyMsgQueue(ConsoleGlobals.hmq);
|
|---|
| 699 | WinTerminate (ConsoleGlobals.hab);
|
|---|
| 700 |
|
|---|
| 701 | /* destruction of semaphore indicates console is shutdown */
|
|---|
| 702 | DosCloseEventSem(ConsoleInput.hevInputQueue); /* close other semaphore */
|
|---|
| 703 | DosCloseEventSem(ConsoleGlobals.hevConsole);
|
|---|
| 704 | DosCloseMutexSem(ConsoleInput.hmtxInputQueue); /* close semaphore */
|
|---|
| 705 |
|
|---|
| 706 | ConsoleGlobals.hevConsole = NULLHANDLE; /* for ConsoleIsActive() */
|
|---|
| 707 | ConsoleInput.hevInputQueue = NULLHANDLE;
|
|---|
| 708 | ConsoleInput.hmtxInputQueue = NULLHANDLE;
|
|---|
| 709 |
|
|---|
| 710 | /* @@@PH we've got to exit the process here ! */
|
|---|
| 711 | ExitProcess(1);
|
|---|
| 712 | }
|
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 | /*****************************************************************************
|
|---|
| 716 | * Name : static MRESULT EXPENTRY ConsoleWindowProc
|
|---|
| 717 | * Purpose : Window Procedure for OUR console window
|
|---|
| 718 | * Parameters: HWND hwnd - window handle
|
|---|
| 719 | * ULONG msg - message identifier
|
|---|
| 720 | * MPARAM mp1 - message parameter 1
|
|---|
| 721 | * MPARAM mp2 - message parameter 2
|
|---|
| 722 | * Variables :
|
|---|
| 723 | * Result : MRESULT for PM
|
|---|
| 724 | * Remark :
|
|---|
| 725 | * Status :
|
|---|
| 726 | *
|
|---|
| 727 | * Author : Patrick Haller [Tue, 1998/02/10 03:24]
|
|---|
| 728 | *****************************************************************************/
|
|---|
| 729 |
|
|---|
| 730 | MRESULT EXPENTRY iConsoleWindowProc(HWND hwnd,
|
|---|
| 731 | ULONG msg,
|
|---|
| 732 | MPARAM mp1,
|
|---|
| 733 | MPARAM mp2)
|
|---|
| 734 | {
|
|---|
| 735 | static RECTL rcl; /* window rectangle */
|
|---|
| 736 | static HPS hps;
|
|---|
| 737 |
|
|---|
| 738 | switch(msg)
|
|---|
| 739 | {
|
|---|
| 740 | /*************************************************************************
|
|---|
| 741 | * WM_CREATE window creation *
|
|---|
| 742 | *************************************************************************/
|
|---|
| 743 |
|
|---|
| 744 | case WM_CREATE:
|
|---|
| 745 | WinPostMsg(hwnd, /* deferred initialization */
|
|---|
| 746 | UM_CONSOLE_CREATE,
|
|---|
| 747 | (MPARAM)NULL,
|
|---|
| 748 | (MPARAM)NULL);
|
|---|
| 749 | break;
|
|---|
| 750 |
|
|---|
| 751 |
|
|---|
| 752 | case UM_CONSOLE_CREATE:
|
|---|
| 753 | {
|
|---|
| 754 | APIRET rc; /* API return code */
|
|---|
| 755 | HWND hwndFrame; /* frame window handle */
|
|---|
| 756 |
|
|---|
| 757 | /* subclass the frame window */
|
|---|
| 758 | hwndFrame = ConsoleGlobals.hwndFrame;
|
|---|
| 759 | ConsoleGlobals.pfnwpFrameOriginal = WinSubclassWindow(hwndFrame,
|
|---|
| 760 | iConsoleFrameWindowProc);
|
|---|
| 761 |
|
|---|
| 762 | ConsoleGlobals.hwndMenuConsole
|
|---|
| 763 | = WinLoadMenu (hwnd, /* load context menue */
|
|---|
| 764 | ConsoleGlobals.hmodResource,
|
|---|
| 765 | ID_CONSOLE_MAIN);
|
|---|
| 766 |
|
|---|
| 767 | /* set an icon for the dialog */
|
|---|
| 768 | ConsoleGlobals.hPtrConsole = WinLoadPointer(HWND_DESKTOP,
|
|---|
| 769 | ConsoleGlobals.hmodResource,
|
|---|
| 770 | ID_CONSOLE_MAIN );
|
|---|
| 771 | WinSendMsg(ConsoleGlobals.hwndFrame,
|
|---|
| 772 | WM_SETICON,
|
|---|
| 773 | (MPARAM)ConsoleGlobals.hPtrConsole,
|
|---|
| 774 | 0L );
|
|---|
| 775 |
|
|---|
| 776 | /* determine handles of the horizontal / vertical scroll bars */
|
|---|
| 777 | ConsoleGlobals.hwndVertScroll = WinWindowFromID(ConsoleGlobals.hwndFrame,
|
|---|
| 778 | FID_VERTSCROLL);
|
|---|
| 779 |
|
|---|
| 780 | ConsoleGlobals.hwndHorzScroll = WinWindowFromID(ConsoleGlobals.hwndFrame,
|
|---|
| 781 | FID_HORZSCROLL);
|
|---|
| 782 |
|
|---|
| 783 | /* the initial state of the controls is DETACHED */
|
|---|
| 784 | WinSetParent(ConsoleGlobals.hwndHorzScroll, /* detach control */
|
|---|
| 785 | HWND_OBJECT,
|
|---|
| 786 | FALSE);
|
|---|
| 787 |
|
|---|
| 788 | WinSetParent(ConsoleGlobals.hwndVertScroll, /* detach control */
|
|---|
| 789 | HWND_OBJECT,
|
|---|
| 790 | FALSE);
|
|---|
| 791 |
|
|---|
| 792 |
|
|---|
| 793 | /* create AVIO presentation space */
|
|---|
| 794 | rc = VioCreatePS(&ConsoleGlobals.hvpsConsole,
|
|---|
| 795 | ConsoleGlobals.coordWindowSize.Y,
|
|---|
| 796 | ConsoleGlobals.coordWindowSize.X,
|
|---|
| 797 | 0, /* format, must be 0 */
|
|---|
| 798 | FORMAT_CGA,
|
|---|
| 799 | 0); /* template hvps, must be 0 */
|
|---|
| 800 | if (rc != NO_ERROR) /* check errors */
|
|---|
| 801 | WriteLog("KERNEL32/CONSOLE:VioCreatePS=%u\n",
|
|---|
| 802 | rc);
|
|---|
| 803 |
|
|---|
| 804 | /* PH 1998/02/12 this seems to be an OS/2 PM bug:
|
|---|
| 805 | when doing a WinOpenWindowDC here, PM hangs. Seems it never gets back into
|
|---|
| 806 | the message loop. To investigate and report to IBM
|
|---|
| 807 | */
|
|---|
| 808 |
|
|---|
| 809 | /* get a device context for the client window */
|
|---|
| 810 | ConsoleGlobals.hdcConsole = WinOpenWindowDC(hwnd);
|
|---|
| 811 | /* associate AVIO PS with the HDC */
|
|---|
| 812 | rc = VioAssociate(ConsoleGlobals.hdcConsole,
|
|---|
| 813 | ConsoleGlobals.hvpsConsole);
|
|---|
| 814 | if (rc != NO_ERROR) /* check errors */
|
|---|
| 815 | WriteLog("KERNEL32/CONSOLE:VioAssociate=%u\n",
|
|---|
| 816 | rc);
|
|---|
| 817 |
|
|---|
| 818 | iConsoleFontQuery(); /* query current cell sizes */
|
|---|
| 819 |
|
|---|
| 820 | /* adjust window size and position */
|
|---|
| 821 | HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
|
|---|
| 822 | DRQ_INTERNAL_CONSOLEADJUSTWINDOW,
|
|---|
| 823 | 0,
|
|---|
| 824 | 0,
|
|---|
| 825 | 0,
|
|---|
| 826 | 0);
|
|---|
| 827 |
|
|---|
| 828 | /* @@@PH if console is maximized - now switched on per default ! */
|
|---|
| 829 | WinSetWindowPos (ConsoleGlobals.hwndFrame,
|
|---|
| 830 | HWND_DESKTOP,
|
|---|
| 831 | 0,
|
|---|
| 832 | 0,
|
|---|
| 833 | ConsoleGlobals.Options.coordDefaultSize.X *
|
|---|
| 834 | ConsoleGlobals.sCellCX +
|
|---|
| 835 | 2 * WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER),
|
|---|
| 836 | ConsoleGlobals.Options.coordDefaultSize.Y *
|
|---|
| 837 | ConsoleGlobals.sCellCY +
|
|---|
| 838 | WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR) +
|
|---|
| 839 | 2 * WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER),
|
|---|
| 840 | SWP_SIZE);
|
|---|
| 841 |
|
|---|
| 842 | /* do we have to set the window position also ? */
|
|---|
| 843 | if (ConsoleGlobals.Options.fSetWindowPosition == TRUE)
|
|---|
| 844 | WinSetWindowPos (ConsoleGlobals.hwndFrame,
|
|---|
| 845 | HWND_DESKTOP,
|
|---|
| 846 | ConsoleGlobals.Options.coordDefaultPosition.X,
|
|---|
| 847 | ConsoleGlobals.Options.coordDefaultPosition.Y,
|
|---|
| 848 | 0,
|
|---|
| 849 | 0,
|
|---|
| 850 | SWP_MOVE);
|
|---|
| 851 |
|
|---|
| 852 | /* start timer service for blitting and cursor blinking */
|
|---|
| 853 | ConsoleGlobals.idTimer = WinStartTimer (ConsoleGlobals.hab,
|
|---|
| 854 | hwnd,
|
|---|
| 855 | CONSOLE_TIMER_ID, /* timer id */
|
|---|
| 856 | ConsoleGlobals.ulTimerFrequency);
|
|---|
| 857 |
|
|---|
| 858 | WinPostMsg (hwnd, /* send myself a start message so we get the first */
|
|---|
| 859 | WM_TIMER, /* frame immediately */
|
|---|
| 860 | (MPARAM)NULL,
|
|---|
| 861 | (MPARAM)NULL);
|
|---|
| 862 | }
|
|---|
| 863 | break;
|
|---|
| 864 |
|
|---|
| 865 |
|
|---|
| 866 | /*************************************************************************
|
|---|
| 867 | * WM_DESTROY window destruction *
|
|---|
| 868 | *************************************************************************/
|
|---|
| 869 |
|
|---|
| 870 | case WM_DESTROY:
|
|---|
| 871 | WinStopTimer (ConsoleGlobals.hab, /* anchor block */
|
|---|
| 872 | hwnd,
|
|---|
| 873 | ConsoleGlobals.idTimer); /* timer ID */
|
|---|
| 874 |
|
|---|
| 875 | VioAssociate(NULL,
|
|---|
| 876 | ConsoleGlobals.hvpsConsole); /* disassociates the AVIO PS */
|
|---|
| 877 | VioDestroyPS(ConsoleGlobals.hvpsConsole); /* destroys the AVIO PS */
|
|---|
| 878 |
|
|---|
| 879 | WinDestroyWindow(ConsoleGlobals.hwndMenuConsole);
|
|---|
| 880 | WinDestroyPointer(ConsoleGlobals.hPtrConsole);
|
|---|
| 881 | break;
|
|---|
| 882 |
|
|---|
| 883 |
|
|---|
| 884 | /*************************************************************************
|
|---|
| 885 | * WM_TIMER display cursor and update AVIO PS if required *
|
|---|
| 886 | *************************************************************************/
|
|---|
| 887 |
|
|---|
| 888 | case WM_TIMER:
|
|---|
| 889 | /* check if console has to be updated */
|
|---|
| 890 | if (ConsoleGlobals.fUpdateRequired == TRUE)
|
|---|
| 891 | {
|
|---|
| 892 | ConsoleGlobals.fUpdateRequired = FALSE; /* as soon as possible ! */
|
|---|
| 893 |
|
|---|
| 894 | /* as device to map itself to the VIO buffer */
|
|---|
| 895 | HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
|
|---|
| 896 | DRQ_INTERNAL_CONSOLEBUFFERMAP,
|
|---|
| 897 | 0,
|
|---|
| 898 | 0,
|
|---|
| 899 | 0,
|
|---|
| 900 | 0);
|
|---|
| 901 |
|
|---|
| 902 | { /* DEBUG */
|
|---|
| 903 | APIRET rc;
|
|---|
| 904 | /* and now bring it to the screen */
|
|---|
| 905 | rc = VioShowPS(ConsoleGlobals.coordWindowSize.Y,
|
|---|
| 906 | ConsoleGlobals.coordWindowSize.X,
|
|---|
| 907 | 0,
|
|---|
| 908 | ConsoleGlobals.hvpsConsole);
|
|---|
| 909 |
|
|---|
| 910 | dprintf(("KERNEL32::Console::1 VioShowPS(%u,%u,%u)=%u\n",
|
|---|
| 911 | ConsoleGlobals.coordWindowSize.Y,
|
|---|
| 912 | ConsoleGlobals.coordWindowSize.X,
|
|---|
| 913 | ConsoleGlobals.hvpsConsole,
|
|---|
| 914 | rc));
|
|---|
| 915 | }
|
|---|
| 916 |
|
|---|
| 917 | /* cursor is overwritten here ! */
|
|---|
| 918 | HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
|
|---|
| 919 | DRQ_INTERNAL_CONSOLECURSORSHOW,
|
|---|
| 920 | CONSOLECURSOR_OVERWRITTEN,
|
|---|
| 921 | 0,
|
|---|
| 922 | 0,
|
|---|
| 923 | 0);
|
|---|
| 924 | }
|
|---|
| 925 | else
|
|---|
| 926 | {
|
|---|
| 927 | ConsoleGlobals.ulTimerCursor++; /* increase counter */
|
|---|
| 928 | if (ConsoleGlobals.ulTimerCursor > ConsoleGlobals.Options.ucCursorDivisor)
|
|---|
| 929 | {
|
|---|
| 930 | ConsoleGlobals.ulTimerCursor = 0; /* reset counter */
|
|---|
| 931 | /* let our cursor blink */
|
|---|
| 932 | HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
|
|---|
| 933 | DRQ_INTERNAL_CONSOLECURSORSHOW,
|
|---|
| 934 | CONSOLECURSOR_BLINK,
|
|---|
| 935 | 0,
|
|---|
| 936 | 0,
|
|---|
| 937 | 0);
|
|---|
| 938 | }
|
|---|
| 939 | }
|
|---|
| 940 | break;
|
|---|
| 941 |
|
|---|
| 942 |
|
|---|
| 943 | /*************************************************************************
|
|---|
| 944 | * WM_MINMAXFRAME handle window repaint in case of iconized window *
|
|---|
| 945 | *************************************************************************/
|
|---|
| 946 |
|
|---|
| 947 | case WM_MINMAXFRAME :
|
|---|
| 948 | {
|
|---|
| 949 | BOOL fShow = ! (((PSWP) mp1)->fl & SWP_MINIMIZE);
|
|---|
| 950 | HENUM henum;
|
|---|
| 951 | HWND hwndChild;
|
|---|
| 952 |
|
|---|
| 953 | WinEnableWindowUpdate ( hwnd, FALSE );
|
|---|
| 954 |
|
|---|
| 955 | for (henum=WinBeginEnumWindows(hwnd);
|
|---|
| 956 | (hwndChild = WinGetNextWindow (henum)) != 0; )
|
|---|
| 957 | WinShowWindow ( hwndChild, fShow );
|
|---|
| 958 |
|
|---|
| 959 | WinEndEnumWindows ( henum );
|
|---|
| 960 | WinEnableWindowUpdate ( hwnd, TRUE );
|
|---|
| 961 | }
|
|---|
| 962 | break;
|
|---|
| 963 |
|
|---|
| 964 |
|
|---|
| 965 | /*************************************************************************
|
|---|
| 966 | * WM_PAINT repaint the window *
|
|---|
| 967 | *************************************************************************/
|
|---|
| 968 | case WM_PAINT:
|
|---|
| 969 | hps = WinBeginPaint(hwnd,
|
|---|
| 970 | (HPS)NULL,
|
|---|
| 971 | &rcl);
|
|---|
| 972 | /* blit the whole AVIO presentation space */
|
|---|
| 973 | { /* DEBUG */
|
|---|
| 974 | APIRET rc;
|
|---|
| 975 | /* and now bring it to the screen */
|
|---|
| 976 | rc = VioShowPS(ConsoleGlobals.coordWindowSize.Y,
|
|---|
| 977 | ConsoleGlobals.coordWindowSize.X,
|
|---|
| 978 | 0,
|
|---|
| 979 | ConsoleGlobals.hvpsConsole);
|
|---|
| 980 |
|
|---|
| 981 | dprintf(("KERNEL32::Console::2 VioShowPS(%u,%u,%u)=%u\n",
|
|---|
| 982 | ConsoleGlobals.coordWindowSize.Y,
|
|---|
| 983 | ConsoleGlobals.coordWindowSize.X,
|
|---|
| 984 | ConsoleGlobals.hvpsConsole,
|
|---|
| 985 | rc));
|
|---|
| 986 | }
|
|---|
| 987 |
|
|---|
| 988 | WinEndPaint(hps);
|
|---|
| 989 | break;
|
|---|
| 990 |
|
|---|
| 991 |
|
|---|
| 992 | /*************************************************************************
|
|---|
| 993 | * WM_SIZE resize the window *
|
|---|
| 994 | *************************************************************************/
|
|---|
| 995 | case WM_SIZE:
|
|---|
| 996 | {
|
|---|
| 997 | /* calculate scrollbars if neccessary */
|
|---|
| 998 | HMDeviceRequest(ConsoleGlobals.hConsoleBuffer,
|
|---|
| 999 | DRQ_INTERNAL_CONSOLEADJUSTWINDOW,
|
|---|
| 1000 | 0,
|
|---|
| 1001 | 0,
|
|---|
| 1002 | 0,
|
|---|
| 1003 | 0);
|
|---|
| 1004 |
|
|---|
| 1005 | return WinDefAVioWindowProc(hwnd,
|
|---|
| 1006 | (USHORT)msg,
|
|---|
| 1007 | (ULONG)mp1,
|
|---|
| 1008 | (ULONG)mp2);
|
|---|
| 1009 | }
|
|---|
| 1010 |
|
|---|
| 1011 |
|
|---|
| 1012 | /*************************************************************************
|
|---|
| 1013 | * context menue *
|
|---|
| 1014 | *************************************************************************/
|
|---|
| 1015 | case WM_CONTEXTMENU:
|
|---|
| 1016 | {
|
|---|
| 1017 | WinPopupMenu (hwnd,
|
|---|
| 1018 | hwnd,
|
|---|
| 1019 | ConsoleGlobals.hwndMenuConsole,
|
|---|
| 1020 | SHORT1FROMMP(mp1),
|
|---|
| 1021 | SHORT2FROMMP(mp1),
|
|---|
| 1022 | CM_CONSOLE_PROPERTIES, /* item id */
|
|---|
| 1023 | PU_HCONSTRAIN |
|
|---|
| 1024 | PU_VCONSTRAIN |
|
|---|
| 1025 | PU_KEYBOARD |
|
|---|
| 1026 | PU_MOUSEBUTTON1 |
|
|---|
| 1027 | PU_MOUSEBUTTON2 |
|
|---|
| 1028 | PU_POSITIONONITEM);
|
|---|
| 1029 | }
|
|---|
| 1030 | return (MPARAM)FALSE;
|
|---|
| 1031 |
|
|---|
| 1032 |
|
|---|
| 1033 | /*************************************************************************
|
|---|
| 1034 | * WM_COMMAND command processing *
|
|---|
| 1035 | *************************************************************************/
|
|---|
| 1036 | case WM_COMMAND:
|
|---|
| 1037 | {
|
|---|
| 1038 | switch(SHORT1FROMMP(mp1)) /* select appropriate identifier */
|
|---|
| 1039 | {
|
|---|
| 1040 | /* close console window, however we can't call ConsoleTerminate here!*/
|
|---|
| 1041 | case CM_CONSOLE_EXIT:
|
|---|
| 1042 | WinPostMsg (ConsoleGlobals.hwndFrame,
|
|---|
| 1043 | WM_CLOSE,
|
|---|
| 1044 | (MPARAM)NULL,
|
|---|
| 1045 | (MPARAM)NULL);
|
|---|
| 1046 |
|
|---|
| 1047 | return (MPARAM)FALSE;
|
|---|
| 1048 |
|
|---|
| 1049 |
|
|---|
| 1050 | case CM_CONSOLE_REPAINT:
|
|---|
| 1051 | WinInvalidateRect(ConsoleGlobals.hwndClient,/* redraw frame window */
|
|---|
| 1052 | NULL,
|
|---|
| 1053 | TRUE);
|
|---|
| 1054 | return (MPARAM)FALSE;
|
|---|
| 1055 |
|
|---|
| 1056 | /* open the properties dialog */
|
|---|
| 1057 | case CM_CONSOLE_PROPERTIES:
|
|---|
| 1058 | {
|
|---|
| 1059 | ULONG ulResult; /* response from user */
|
|---|
| 1060 |
|
|---|
| 1061 | ConsoleGlobals.Options.hmodResources = /* save module handle */
|
|---|
| 1062 | ConsoleGlobals.hmodResource;
|
|---|
| 1063 |
|
|---|
| 1064 | ulResult = WinDlgBox(HWND_DESKTOP,
|
|---|
| 1065 | ConsoleGlobals.hwndClient,
|
|---|
| 1066 | &ConsolePropertyDlgProc,
|
|---|
| 1067 | ConsoleGlobals.hmodResource,
|
|---|
| 1068 | DLG_CONSOLE_PROPERTIES,
|
|---|
| 1069 | (PVOID)&ConsoleGlobals.Options);
|
|---|
| 1070 | switch (ulResult)
|
|---|
| 1071 | {
|
|---|
| 1072 | case ID_BTN_SAVE:
|
|---|
| 1073 | ConsolePropertySave(&ConsoleGlobals.Options);
|
|---|
| 1074 | ConsolePropertyApply(&ConsoleGlobals.Options);
|
|---|
| 1075 | break;
|
|---|
| 1076 |
|
|---|
| 1077 | case ID_BTN_APPLY:
|
|---|
| 1078 | ConsolePropertyApply(&ConsoleGlobals.Options);
|
|---|
| 1079 | break;
|
|---|
| 1080 |
|
|---|
| 1081 | default: break;
|
|---|
| 1082 | }
|
|---|
| 1083 |
|
|---|
| 1084 | return (MPARAM) FALSE;
|
|---|
| 1085 | }
|
|---|
| 1086 | }
|
|---|
| 1087 | }
|
|---|
| 1088 | break;
|
|---|
| 1089 |
|
|---|
| 1090 |
|
|---|
| 1091 | /*************************************************************************
|
|---|
| 1092 | * WM_CHAR keyboard char processing *
|
|---|
| 1093 | *************************************************************************/
|
|---|
| 1094 |
|
|---|
| 1095 | case WM_CHAR:
|
|---|
| 1096 | iConsoleInputEventPushKey(mp1, /* push event into queue */
|
|---|
| 1097 | mp2);
|
|---|
| 1098 | break; /* enable further processing ! */
|
|---|
| 1099 |
|
|---|
| 1100 |
|
|---|
| 1101 | /*************************************************************************
|
|---|
| 1102 | * WM_SETFOCUS focus changing processing *
|
|---|
| 1103 | *************************************************************************/
|
|---|
| 1104 |
|
|---|
| 1105 | case WM_SETFOCUS:
|
|---|
| 1106 | iConsoleInputEventPushFocus((BOOL)mp2); /* push event into queue */
|
|---|
| 1107 | break; /* enable further processing ! */
|
|---|
| 1108 |
|
|---|
| 1109 |
|
|---|
| 1110 | /*************************************************************************
|
|---|
| 1111 | * WM_MOUSEMOVE mouse event processing *
|
|---|
| 1112 | *************************************************************************/
|
|---|
| 1113 |
|
|---|
| 1114 | case WM_MOUSEMOVE:
|
|---|
| 1115 | case WM_BUTTON1UP:
|
|---|
| 1116 | case WM_BUTTON1DOWN:
|
|---|
| 1117 | case WM_BUTTON2UP:
|
|---|
| 1118 | case WM_BUTTON2DOWN:
|
|---|
| 1119 | case WM_BUTTON3UP:
|
|---|
| 1120 | case WM_BUTTON3DOWN:
|
|---|
| 1121 | case WM_BUTTON1DBLCLK:
|
|---|
| 1122 | case WM_BUTTON2DBLCLK:
|
|---|
| 1123 | case WM_BUTTON3DBLCLK:
|
|---|
| 1124 | iConsoleInputEventPushMouse(msg,
|
|---|
| 1125 | mp1, /* push event into queue */
|
|---|
| 1126 | mp2);
|
|---|
| 1127 | break; /* enable further processing ! */
|
|---|
| 1128 | }
|
|---|
| 1129 |
|
|---|
| 1130 | return WinDefWindowProc(hwnd, /* to default processing */
|
|---|
| 1131 | msg,
|
|---|
| 1132 | mp1,
|
|---|
| 1133 | mp2);
|
|---|
| 1134 | }
|
|---|
| 1135 |
|
|---|
| 1136 |
|
|---|
| 1137 | /*****************************************************************************
|
|---|
| 1138 | * Name : static MRESULT EXPENTRY ConsoleFrameWindowProc
|
|---|
| 1139 | * Purpose : Window Procedure for OUR console frame window
|
|---|
| 1140 | * Parameters: HWND hwnd - window handle
|
|---|
| 1141 | * ULONG msg - message identifier
|
|---|
| 1142 | * MPARAM mp1 - message parameter 1
|
|---|
| 1143 | * MPARAM mp2 - message parameter 2
|
|---|
| 1144 | * Variables :
|
|---|
| 1145 | * Result : MRESULT for PM
|
|---|
| 1146 | * Remark :
|
|---|
| 1147 | * Status :
|
|---|
| 1148 | *
|
|---|
| 1149 | * Author : Patrick Haller [Tue, 1998/02/10 03:24]
|
|---|
| 1150 | *****************************************************************************/
|
|---|
| 1151 |
|
|---|
| 1152 | MRESULT EXPENTRY iConsoleFrameWindowProc(HWND hwnd,
|
|---|
| 1153 | ULONG msg,
|
|---|
| 1154 | MPARAM mp1,
|
|---|
| 1155 | MPARAM mp2)
|
|---|
| 1156 | {
|
|---|
| 1157 | switch(msg)
|
|---|
| 1158 | {
|
|---|
| 1159 | /*************************************************************************
|
|---|
| 1160 | * WM_QUERYTRACKINFO handling *
|
|---|
| 1161 | *************************************************************************/
|
|---|
| 1162 | case WM_QUERYTRACKINFO:
|
|---|
| 1163 | {
|
|---|
| 1164 | MRESULT mr; /* message result */
|
|---|
| 1165 | PTRACKINFO pTrackInfo; /* frame window tracking information */
|
|---|
| 1166 |
|
|---|
| 1167 | /* let the original code do the hard work first */
|
|---|
| 1168 | mr = ConsoleGlobals.pfnwpFrameOriginal(hwnd,
|
|---|
| 1169 | msg,
|
|---|
| 1170 | mp1,
|
|---|
| 1171 | mp2);
|
|---|
| 1172 |
|
|---|
| 1173 | pTrackInfo = (PTRACKINFO)mp2; /* get track information */
|
|---|
| 1174 |
|
|---|
| 1175 | /* @@@PH */
|
|---|
| 1176 | pTrackInfo->ptlMinTrackSize.x = max(pTrackInfo->ptlMinTrackSize.x, 200);
|
|---|
| 1177 | pTrackInfo->ptlMinTrackSize.y = max(pTrackInfo->ptlMinTrackSize.y, 100);
|
|---|
| 1178 | pTrackInfo->ptlMaxTrackSize.x = min(pTrackInfo->ptlMaxTrackSize.x, ConsoleGlobals.coordMaxWindowPels.X);
|
|---|
| 1179 | pTrackInfo->ptlMaxTrackSize.y = min(pTrackInfo->ptlMaxTrackSize.y, ConsoleGlobals.coordMaxWindowPels.Y);
|
|---|
| 1180 |
|
|---|
| 1181 | return (mr); /* deliver result */
|
|---|
| 1182 | }
|
|---|
| 1183 | }
|
|---|
| 1184 |
|
|---|
| 1185 | /* call original frame window procedure code */
|
|---|
| 1186 | return (ConsoleGlobals.pfnwpFrameOriginal(hwnd,
|
|---|
| 1187 | msg,
|
|---|
| 1188 | mp1,
|
|---|
| 1189 | mp2));
|
|---|
| 1190 | }
|
|---|
| 1191 |
|
|---|
| 1192 |
|
|---|
| 1193 | /*****************************************************************************
|
|---|
| 1194 | * Name : static void ConsoleBufferMap
|
|---|
| 1195 | * Purpose : draw a whole consolebuffer into the VIO space
|
|---|
| 1196 | * Parameters: PCONSOLEBUFFER pConsoleBuffer
|
|---|
| 1197 | * Variables :
|
|---|
| 1198 | * Result : none
|
|---|
| 1199 | * Remark :
|
|---|
| 1200 | * Status :
|
|---|
| 1201 | *
|
|---|
| 1202 | * Author : Patrick Haller [Tue, 1998/02/17 12:57]
|
|---|
| 1203 | *****************************************************************************/
|
|---|
| 1204 |
|
|---|
| 1205 | void iConsoleBufferMap(PCONSOLEBUFFER pConsoleBuffer)
|
|---|
| 1206 | {
|
|---|
| 1207 | ULONG ulLine;
|
|---|
| 1208 |
|
|---|
| 1209 | ULONG ulSizeX; /* blitting length and height */
|
|---|
| 1210 | ULONG ulSizeY;
|
|---|
| 1211 |
|
|---|
| 1212 | ulSizeX = 2 * min(ConsoleGlobals.coordWindowSize.X,
|
|---|
| 1213 | pConsoleBuffer->coordBufferSize.X -
|
|---|
| 1214 | ConsoleGlobals.coordWindowPos.X);
|
|---|
| 1215 |
|
|---|
| 1216 | ulSizeY = min(ConsoleGlobals.coordWindowSize.Y,
|
|---|
| 1217 | pConsoleBuffer->coordBufferSize.Y -
|
|---|
| 1218 | ConsoleGlobals.coordWindowPos.Y);
|
|---|
| 1219 |
|
|---|
| 1220 | /* check if we're called with non-existing line buffer */
|
|---|
| 1221 | if (pConsoleBuffer->ppszLine == NULL)
|
|---|
| 1222 | return;
|
|---|
| 1223 |
|
|---|
| 1224 | for (ulLine = ConsoleGlobals.coordWindowPos.Y;
|
|---|
| 1225 | ulLine < ulSizeY;
|
|---|
| 1226 | ulLine++)
|
|---|
| 1227 | VioWrtCellStr(pConsoleBuffer->ppszLine[ulLine] +
|
|---|
| 1228 | ConsoleGlobals.coordWindowPos.X,
|
|---|
| 1229 | ulSizeX,
|
|---|
| 1230 | ulLine,
|
|---|
| 1231 | 0,
|
|---|
| 1232 | ConsoleGlobals.hvpsConsole);
|
|---|
| 1233 | }
|
|---|
| 1234 |
|
|---|
| 1235 |
|
|---|
| 1236 | /*****************************************************************************
|
|---|
| 1237 | * Name : static void ConsoleBufferFillLine
|
|---|
| 1238 | * Purpose : fills a line with a certain output pattern
|
|---|
| 1239 | * Parameters: ULONG ulPattern, PUSHORT pusTarget, ULONG ulSize
|
|---|
| 1240 | * Variables :
|
|---|
| 1241 | * Result : none
|
|---|
| 1242 | * Remark :
|
|---|
| 1243 | * Status :
|
|---|
| 1244 | *
|
|---|
| 1245 | * Author : Patrick Haller [Tue, 1998/02/17 12:57]
|
|---|
| 1246 | *****************************************************************************/
|
|---|
| 1247 |
|
|---|
| 1248 | void iConsoleBufferFillLine(ULONG ulPattern,
|
|---|
| 1249 | PUSHORT pusTarget,
|
|---|
| 1250 | ULONG ulSize)
|
|---|
| 1251 | {
|
|---|
| 1252 | ULONG ulCounter;
|
|---|
| 1253 |
|
|---|
| 1254 | for (ulCounter = 0;
|
|---|
| 1255 | ulCounter < (ulSize >> 1);
|
|---|
| 1256 | ulCounter++,
|
|---|
| 1257 | pusTarget+=2)
|
|---|
| 1258 | *(PULONG)pusTarget = ulPattern;
|
|---|
| 1259 |
|
|---|
| 1260 | if (ulSize & 0x00000001)
|
|---|
| 1261 | *pusTarget = (USHORT)ulPattern;
|
|---|
| 1262 | }
|
|---|
| 1263 |
|
|---|
| 1264 |
|
|---|
| 1265 | /*****************************************************************************
|
|---|
| 1266 | * Name : static void ConsoleBufferScrollUp
|
|---|
| 1267 | * Purpose : scroll whole buffer n lines up,
|
|---|
| 1268 | * fill new lines with default attribute
|
|---|
| 1269 | * Parameters: PCONSOLEBUFFER pConsoleBuffer
|
|---|
| 1270 | * ULONG ulLines
|
|---|
| 1271 | * Variables :
|
|---|
| 1272 | * Result : none
|
|---|
| 1273 | * Remark :
|
|---|
| 1274 | * Status :
|
|---|
| 1275 | *
|
|---|
| 1276 | * Author : Patrick Haller [Tue, 1998/02/17 12:57]
|
|---|
| 1277 | *****************************************************************************/
|
|---|
| 1278 |
|
|---|
| 1279 | void iConsoleBufferScrollUp(PCONSOLEBUFFER pConsoleBuffer,
|
|---|
| 1280 | ULONG ulLines)
|
|---|
| 1281 | {
|
|---|
| 1282 | ULONG ulLine;
|
|---|
| 1283 | ULONG ulPosition;
|
|---|
| 1284 | ULONG ulScrollLine;
|
|---|
| 1285 |
|
|---|
| 1286 | static ULONG ulUpdateCounter; /* counter for jump-scrolling */
|
|---|
| 1287 |
|
|---|
| 1288 | /* calculate new line offset to the first line */
|
|---|
| 1289 | pConsoleBuffer->ulScrollLineOffset += ulLines;
|
|---|
| 1290 | pConsoleBuffer->ulScrollLineOffset %= pConsoleBuffer->coordBufferSize.Y;
|
|---|
| 1291 |
|
|---|
| 1292 | /* do we have to scroll ? */
|
|---|
| 1293 | if (ulLines < pConsoleBuffer->coordBufferSize.Y)
|
|---|
| 1294 | {
|
|---|
| 1295 | for (ulLine = 0; /* do the scrolling */
|
|---|
| 1296 | ulLine < ConsoleGlobals.coordWindowSize.Y;
|
|---|
| 1297 | ulLine++)
|
|---|
| 1298 | {
|
|---|
| 1299 | ulScrollLine = (ulLine + pConsoleBuffer->ulScrollLineOffset)
|
|---|
| 1300 | % pConsoleBuffer->coordBufferSize.Y;
|
|---|
| 1301 |
|
|---|
| 1302 | ulPosition = (ULONG)pConsoleBuffer->ppszLine
|
|---|
| 1303 | + (pConsoleBuffer->coordBufferSize.Y * sizeof (PSZ) )
|
|---|
| 1304 | + (pConsoleBuffer->coordBufferSize.X * 2 * ulScrollLine);
|
|---|
| 1305 |
|
|---|
| 1306 | pConsoleBuffer->ppszLine[ulLine] = (PSZ)ulPosition;
|
|---|
| 1307 | }
|
|---|
| 1308 | }
|
|---|
| 1309 |
|
|---|
| 1310 | /* enforce the upper limit */
|
|---|
| 1311 | if (ulLines > pConsoleBuffer->coordBufferSize.Y)
|
|---|
| 1312 | ulLines = pConsoleBuffer->coordBufferSize.Y;
|
|---|
| 1313 |
|
|---|
| 1314 | ulPosition = ( ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 8) +
|
|---|
| 1315 | ((ULONG)' ') +
|
|---|
| 1316 | ((ULONG)(pConsoleBuffer->ucDefaultAttribute) << 24) +
|
|---|
| 1317 | ((ULONG)' ' << 16) );
|
|---|
| 1318 |
|
|---|
| 1319 | /* scroll the line index */
|
|---|
| 1320 | for (ulLine = pConsoleBuffer->coordBufferSize.Y - ulLines;
|
|---|
| 1321 | ulLine < pConsoleBuffer->coordBufferSize.Y;
|
|---|
| 1322 | ulLine++)
|
|---|
| 1323 | iConsoleBufferFillLine(ulPosition,
|
|---|
| 1324 | (PUSHORT)(pConsoleBuffer->ppszLine[ulLine]),
|
|---|
| 1325 | pConsoleBuffer->coordBufferSize.X);
|
|---|
| 1326 |
|
|---|
| 1327 | /* this code ensures frequent screen updating, even if the timer prooves */
|
|---|
| 1328 | /* to be to slow */
|
|---|
| 1329 | ulUpdateCounter++;
|
|---|
| 1330 | if (ulUpdateCounter > ConsoleGlobals.Options.ulUpdateLimit)
|
|---|
| 1331 | {
|
|---|
| 1332 | ulUpdateCounter = 0; /* reset the counter */
|
|---|
| 1333 | iConsoleBufferMap(pConsoleBuffer);
|
|---|
| 1334 | VioShowPS(ConsoleGlobals.coordWindowSize.Y,
|
|---|
| 1335 | ConsoleGlobals.coordWindowSize.X,
|
|---|
| 1336 | 0,
|
|---|
| 1337 | ConsoleGlobals.hvpsConsole);
|
|---|
| 1338 |
|
|---|
| 1339 | ConsoleGlobals.fUpdateRequired = FALSE; /* no more required ... */
|
|---|
| 1340 | }
|
|---|
| 1341 | }
|
|---|
| 1342 |
|
|---|
| 1343 |
|
|---|
| 1344 | /*****************************************************************************
|
|---|
| 1345 | * Name : static APIRET ConsoleInputEventPush
|
|---|
| 1346 | * Purpose : add an element to the console input queue
|
|---|
| 1347 | * Parameters: PINPUT_RECORD pInputRecord
|
|---|
| 1348 | * Variables :
|
|---|
| 1349 | * Result : API returncode
|
|---|
| 1350 | * Remark :
|
|---|
| 1351 | * Status :
|
|---|
| 1352 | *
|
|---|
| 1353 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1354 | *****************************************************************************/
|
|---|
| 1355 |
|
|---|
| 1356 | APIRET iConsoleInputEventPush(PINPUT_RECORD pInputRecord)
|
|---|
| 1357 | {
|
|---|
| 1358 | PINPUT_RECORD pirFree; /* pointer to free record */
|
|---|
| 1359 | APIRET rc; /* API-returncode */
|
|---|
| 1360 |
|
|---|
| 1361 | #ifdef DEBUG_LOCAL2
|
|---|
| 1362 | dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPush(%08x).\n",
|
|---|
| 1363 | pInputRecord));
|
|---|
| 1364 | #endif
|
|---|
| 1365 |
|
|---|
| 1366 | iConsoleInputQueueLock();
|
|---|
| 1367 | /* get free event */
|
|---|
| 1368 | pirFree = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexFree];
|
|---|
| 1369 | if (pirFree->EventType != 0x0000)
|
|---|
| 1370 | {
|
|---|
| 1371 | iConsoleInputQueueUnlock();
|
|---|
| 1372 | return (ERROR_QUE_NO_MEMORY); /* queue is full ! */
|
|---|
| 1373 | }
|
|---|
| 1374 | /* put event in queue */
|
|---|
| 1375 |
|
|---|
| 1376 | ConsoleInput.ulIndexFree++; /* update index counter */
|
|---|
| 1377 | if (ConsoleInput.ulIndexFree >= CONSOLE_INPUTQUEUESIZE)
|
|---|
| 1378 | ConsoleInput.ulIndexFree = 0;
|
|---|
| 1379 |
|
|---|
| 1380 | ConsoleInput.ulEvents++; /* increate queue event counter */
|
|---|
| 1381 |
|
|---|
| 1382 | iConsoleInputQueueUnlock();
|
|---|
| 1383 |
|
|---|
| 1384 | memcpy(pirFree, /* copy data */
|
|---|
| 1385 | pInputRecord,
|
|---|
| 1386 | sizeof (INPUT_RECORD) );
|
|---|
| 1387 |
|
|---|
| 1388 | if(flVioConsole == FALSE)
|
|---|
| 1389 | { /* unblock reading threads */
|
|---|
| 1390 | rc = DosPostEventSem(ConsoleInput.hevInputQueue);
|
|---|
| 1391 | }
|
|---|
| 1392 | else rc = 0;
|
|---|
| 1393 | return (rc); /* OK */
|
|---|
| 1394 | }
|
|---|
| 1395 |
|
|---|
| 1396 |
|
|---|
| 1397 | /*****************************************************************************
|
|---|
| 1398 | * Name : static APIRET ConsoleInputEventPop
|
|---|
| 1399 | * Purpose : read first element from the console input queue
|
|---|
| 1400 | * Parameters: PINPUT_RECORD pInputRecord
|
|---|
| 1401 | * Variables :
|
|---|
| 1402 | * Result : API returncode
|
|---|
| 1403 | * Remark :
|
|---|
| 1404 | * Status :
|
|---|
| 1405 | *
|
|---|
| 1406 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1407 | *****************************************************************************/
|
|---|
| 1408 |
|
|---|
| 1409 | APIRET iConsoleInputEventPop(PINPUT_RECORD pInputRecord)
|
|---|
| 1410 | {
|
|---|
| 1411 | PINPUT_RECORD pirEvent; /* pointer to event record */
|
|---|
| 1412 | APIRET rc; /* API-returncode */
|
|---|
| 1413 |
|
|---|
| 1414 | #ifdef DEBUG_LOCAL2
|
|---|
| 1415 | dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPop(%08x).\n",
|
|---|
| 1416 | pInputRecord));
|
|---|
| 1417 | #endif
|
|---|
| 1418 |
|
|---|
| 1419 | if (ConsoleInput.ulEvents == 0) /* empty console ? */
|
|---|
| 1420 | return (ERROR_QUE_EMPTY); /* queue is empty ! */
|
|---|
| 1421 |
|
|---|
| 1422 | iConsoleInputQueueLock();
|
|---|
| 1423 | /* get first event */
|
|---|
| 1424 | pirEvent = &ConsoleInput.arrInputRecord[ConsoleInput.ulIndexEvent];
|
|---|
| 1425 | if (pirEvent->EventType == 0x0000)
|
|---|
| 1426 | {
|
|---|
| 1427 | iConsoleInputQueueUnlock();
|
|---|
| 1428 | return (ERROR_QUE_EMPTY); /* queue is empty ! */
|
|---|
| 1429 | }
|
|---|
| 1430 |
|
|---|
| 1431 | if (ConsoleInput.ulEvents >= 0) /* decrease number of console events */
|
|---|
| 1432 | ConsoleInput.ulEvents--;
|
|---|
| 1433 |
|
|---|
| 1434 | ConsoleInput.ulIndexEvent++; /* update index counter */
|
|---|
| 1435 | if (ConsoleInput.ulIndexEvent >= CONSOLE_INPUTQUEUESIZE)
|
|---|
| 1436 | ConsoleInput.ulIndexEvent = 0;
|
|---|
| 1437 |
|
|---|
| 1438 | /* put event in queue */
|
|---|
| 1439 | memcpy(pInputRecord, /* copy data */
|
|---|
| 1440 | pirEvent,
|
|---|
| 1441 | sizeof (INPUT_RECORD) );
|
|---|
| 1442 |
|
|---|
| 1443 | pirEvent->EventType = 0x0000; /* mark event as read = free */
|
|---|
| 1444 |
|
|---|
| 1445 | iConsoleInputQueueUnlock();
|
|---|
| 1446 |
|
|---|
| 1447 | return (NO_ERROR); /* OK */
|
|---|
| 1448 | }
|
|---|
| 1449 |
|
|---|
| 1450 |
|
|---|
| 1451 | /*****************************************************************************
|
|---|
| 1452 | * Name : static APIRET ConsoleInputEventPushKey
|
|---|
| 1453 | * Purpose : push key event into the queue
|
|---|
| 1454 | * Parameters: MPARAM mp1, MPARAM mp2 from WM_CHAR processing
|
|---|
| 1455 | * Variables :
|
|---|
| 1456 | * Result : API returncode
|
|---|
| 1457 | * Remark : @@@PH: 2nd table that learns codes automatically from "down"
|
|---|
| 1458 | * messages from PM. With Alt-a, etc. it is 0 for "up" ?
|
|---|
| 1459 | * Status :
|
|---|
| 1460 | *
|
|---|
| 1461 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1462 | *****************************************************************************/
|
|---|
| 1463 |
|
|---|
| 1464 | char tabVirtualKeyCodes[TABVIRTUALKEYCODES] =
|
|---|
| 1465 | {
|
|---|
| 1466 | /* --- PM key -- NT key --- */
|
|---|
| 1467 | /* 0x00 */ 0,
|
|---|
| 1468 | /* VK_BUTTON1 0x01 */ 0x01, /* WIN_VK_LBUTTON ??? */
|
|---|
| 1469 | /* VK_BUTTON2 0x02 */ 0x02, /* WIN_VK_RBUTTON ??? */
|
|---|
| 1470 | /* VK_BUTTON3 0x03 */ 0x04, /* WIN_VK_MBUTTON ??? */
|
|---|
| 1471 | /* VK_BREAK 0x04 */ 0x03, /* WIN_VK_CANCEL ??? */
|
|---|
| 1472 | /* VK_BACKSPACE 0x05 */ 0x08, /* WIN_VK_BACK */
|
|---|
| 1473 | /* VK_TAB 0x06 */ 0x09, /* WIN_VK_TAB */
|
|---|
| 1474 | /* VK_BACKTAB 0x07 */ 0,
|
|---|
| 1475 | /* VK_NEWLINE 0x08 */ 0,
|
|---|
| 1476 | /* VK_SHIFT 0x09 */ 0x10, /* WIN_VK_SHIFT */
|
|---|
| 1477 | /* VK_CTRL 0x0A */ 0x11, /* WIN_VK_CONTROL */
|
|---|
| 1478 | /* VK_ALT 0x0B */ 0x12, /* WIN_VK_MENU */
|
|---|
| 1479 | /* VK_ALTGRAF 0x0C */ 0,
|
|---|
| 1480 | /* VK_PAUSE 0x0D */ 0x13, /* WIN_VK_PAUSE */
|
|---|
| 1481 | /* VK_CAPSLOCK 0x0E */ 0x14, /* WIN_VK_CAPITAL ??? */
|
|---|
| 1482 | /* VK_ESC 0x0F */ 0x1b, /* WIN_VK_ESCAPE */
|
|---|
| 1483 | /* VK_SPACE 0x10 */ 0x20, /* WIN_VK_SPACE */
|
|---|
| 1484 | /* VK_PAGEUP 0x11 */ 0x21, /* WIN_VK_PRIOR ??? */
|
|---|
| 1485 | /* VK_PAGEDOWN 0x12 */ 0x22, /* WIN_VK_NEXT ??? */
|
|---|
| 1486 | /* VK_END 0x13 */ 0x23, /* WIN_VK_END */
|
|---|
| 1487 | /* VK_HOME 0x14 */ 0x24, /* WIN_VK_HOME */
|
|---|
| 1488 | /* VK_LEFT 0x15 */ 0x25, /* WIN_VK_LEFT */
|
|---|
| 1489 | /* VK_UP 0x16 */ 0x26, /* WIN_VK_UP */
|
|---|
| 1490 | /* VK_RIGHT 0x17 */ 0x27, /* WIN_VK_RIGHT */
|
|---|
| 1491 | /* VK_DOWN 0x18 */ 0x28, /* WIN_VK_DOWN */
|
|---|
| 1492 | /* VK_PRINTSCRN 0x19 */ 0x2A, /* WIN_VK_PRINT */
|
|---|
| 1493 | /* VK_INSERT 0x1A */ 0x2D, /* WIN_VK_INSERT */
|
|---|
| 1494 | /* VK_DELETE 0x1B */ 0x2E, /* WIN_VK_DELETE */
|
|---|
| 1495 | /* VK_SCRLLOCK 0x1C */ 0x91, /* WIN_VK_SCROLL */
|
|---|
| 1496 | /* VK_NUMLOCK 0x1D */ 0x90, /* WIN_VK_NUMLOCK */
|
|---|
| 1497 | /* VK_ENTER 0x1E */ 0x0D, /* WIN_VK_RETURN */
|
|---|
| 1498 | /* VK_SYSRQ 0x1F */ 0,
|
|---|
| 1499 | /* VK_F1 0x20 */ 0x70, /* WIN_VK_F1 */
|
|---|
| 1500 | /* VK_F2 0x21 */ 0x71, /* WIN_VK_F2 */
|
|---|
| 1501 | /* VK_F3 0x22 */ 0x72, /* WIN_VK_F3 */
|
|---|
| 1502 | /* VK_F4 0x23 */ 0x73, /* WIN_VK_F4 */
|
|---|
| 1503 | /* VK_F5 0x24 */ 0x74, /* WIN_VK_F5 */
|
|---|
| 1504 | /* VK_F6 0x25 */ 0x75, /* WIN_VK_F6 */
|
|---|
| 1505 | /* VK_F7 0x26 */ 0x76, /* WIN_VK_F7 */
|
|---|
| 1506 | /* VK_F8 0x27 */ 0x77, /* WIN_VK_F8 */
|
|---|
| 1507 | /* VK_F9 0x28 */ 0x78, /* WIN_VK_F9 */
|
|---|
| 1508 | /* VK_F10 0x29 */ 0x79, /* WIN_VK_F10 */
|
|---|
| 1509 | /* VK_F11 0x2A */ 0x7A, /* WIN_VK_F11 */
|
|---|
| 1510 | /* VK_F12 0x2B */ 0x7B, /* WIN_VK_F12 */
|
|---|
| 1511 | /* VK_F13 0x2C */ 0x7C, /* WIN_VK_F13 */
|
|---|
| 1512 | /* VK_F14 0x2D */ 0x7D, /* WIN_VK_F14 */
|
|---|
| 1513 | /* VK_F15 0x2E */ 0x7E, /* WIN_VK_F15 */
|
|---|
| 1514 | /* VK_F16 0x2F */ 0x7F, /* WIN_VK_F16 */
|
|---|
| 1515 | /* VK_F17 0x30 */ 0x80, /* WIN_VK_F17 */
|
|---|
| 1516 | /* VK_F18 0x31 */ 0x81, /* WIN_VK_F18 */
|
|---|
| 1517 | /* VK_F19 0x32 */ 0x82, /* WIN_VK_F19 */
|
|---|
| 1518 | /* VK_F20 0x33 */ 0x83, /* WIN_VK_F20 */
|
|---|
| 1519 | /* VK_F21 0x34 */ 0x84, /* WIN_VK_F21 */
|
|---|
| 1520 | /* VK_F22 0x35 */ 0x85, /* WIN_VK_F22 */
|
|---|
| 1521 | /* VK_F23 0x36 */ 0x86, /* WIN_VK_F23 */
|
|---|
| 1522 | /* VK_F24 0x37 */ 0x87, /* WIN_VK_F24 */
|
|---|
| 1523 | /* VK_ENDDRAG 0x38 */ 0,
|
|---|
| 1524 | /* VK_CLEAR 0x39 */ 0x0C, /* WIN_VK_CLEAR */
|
|---|
| 1525 | /* VK_EREOF 0x3A */ 0xF9, /* WIN_VK_EREOF */
|
|---|
| 1526 | /* VK_PA1 0x3B */ 0xFD, /* WIN_VK_PA1 */
|
|---|
| 1527 | /* VK_ATTN 0x3C */ 0xF6, /* WIN_VK_ATTN */
|
|---|
| 1528 | /* VK_CRSEL 0x3D */ 0xF7, /* WIN_VK_CRSEL */
|
|---|
| 1529 | /* VK_EXSEL 0x3E */ 0xF8, /* WIN_VK_EXSEL */
|
|---|
| 1530 | /* VK_COPY 0x3F */ 0,
|
|---|
| 1531 | /* VK_BLK1 0x40 */ 0,
|
|---|
| 1532 | /* VK_BLK2 0x41 */ 0,
|
|---|
| 1533 | /* 0x42 */ 0,
|
|---|
| 1534 | /* 0x43 */ 0,
|
|---|
| 1535 | /* 0x44 */ 0,
|
|---|
| 1536 | /* 0x45 */ 0,
|
|---|
| 1537 | /* 0x46 */ 0,
|
|---|
| 1538 | /* 0x47 */ 0,
|
|---|
| 1539 | /* 0x48 */ 0,
|
|---|
| 1540 | /* 0x49 */ 0,
|
|---|
| 1541 | /* 0x4A */ 0,
|
|---|
| 1542 | /* 0x4B */ 0,
|
|---|
| 1543 | /* 0x4C */ 0,
|
|---|
| 1544 | /* 0x4D */ 0,
|
|---|
| 1545 | /* 0x4E */ 0,
|
|---|
| 1546 | /* 0x4F */ 0,
|
|---|
| 1547 | /* from UNIKBD.H: */
|
|---|
| 1548 | /* VK_PA2 0x0050 */ 0,
|
|---|
| 1549 | /* VK_PA3 0x0051 */ 0,
|
|---|
| 1550 | /* VK_GROUP 0x0052 */ 0,
|
|---|
| 1551 | /* VK_GROUPLOCK 0x0053 */ 0,
|
|---|
| 1552 | /* VK_APPL 0x0054 */ 0x5D, /* WIN_VK_APPS ??? */
|
|---|
| 1553 | /* VK_WINLEFT 0x0055 */ 0x5B, /* WIN_VK_LWIN */
|
|---|
| 1554 | /* VK_WINRIGHT 0x0056 */ 0x5C, /* WIN_VK_RWIN */
|
|---|
| 1555 | /* 0x0057 */ 0,
|
|---|
| 1556 | /* 0x0058 */ 0,
|
|---|
| 1557 | /* 0x0059 */ 0,
|
|---|
| 1558 | /* 0x005A */ 0,
|
|---|
| 1559 | /* 0x005B */ 0,
|
|---|
| 1560 | /* 0x005C */ 0,
|
|---|
| 1561 | /* 0x005D */ 0,
|
|---|
| 1562 | /* 0x005E */ 0,
|
|---|
| 1563 | /* 0x005F */ 0,
|
|---|
| 1564 | /* 0x0060 */ 0,
|
|---|
| 1565 | /* VK_M_DOWNLEFT 0x0061 */ 0,
|
|---|
| 1566 | /* VK_M_DOWN 0x0062 */ 0,
|
|---|
| 1567 | /* VK_M_DOWNRIGHT 0x0063 */ 0,
|
|---|
| 1568 | /* VK_M_LEFT 0x0064 */ 0,
|
|---|
| 1569 | /* VK_M_CENTER 0x0065 */ 0,
|
|---|
| 1570 | /* VK_M_RIGHT 0x0066 */ 0,
|
|---|
| 1571 | /* VK_M_UPLEFT 0x0067 */ 0,
|
|---|
| 1572 | /* VK_M_UP 0x0068 */ 0,
|
|---|
| 1573 | /* VK_M_UPRIGHT 0x0069 */ 0,
|
|---|
| 1574 | /* VK_M_BUTTONLOCK 0x006A */ 0,
|
|---|
| 1575 | /* VK_M_BUTTONRELEASE 0x006B */ 0,
|
|---|
| 1576 | /* VK_M_DOUBLECLICK 0x006C */ 0,
|
|---|
| 1577 |
|
|---|
| 1578 | #if 0
|
|---|
| 1579 | 0xA4, /* WIN_VK_LMENU ??? */
|
|---|
| 1580 | 0xA5, /* WIN_VK_RMENU ??? */
|
|---|
| 1581 | #define VK_SELECT 0x29
|
|---|
| 1582 | #define VK_EXECUTE 0x2B
|
|---|
| 1583 | #define VK_SNAPSHOT 0x2C
|
|---|
| 1584 | #define VK_HELP 0x2F
|
|---|
| 1585 | #define VK_NUMPAD0 0x60
|
|---|
| 1586 | #define VK_NUMPAD1 0x61
|
|---|
| 1587 | #define VK_NUMPAD2 0x62
|
|---|
| 1588 | #define VK_NUMPAD3 0x63
|
|---|
| 1589 | #define VK_NUMPAD4 0x64
|
|---|
| 1590 | #define VK_NUMPAD5 0x65
|
|---|
| 1591 | #define VK_NUMPAD6 0x66
|
|---|
| 1592 | #define VK_NUMPAD7 0x67
|
|---|
| 1593 | #define VK_NUMPAD8 0x68
|
|---|
| 1594 | #define VK_NUMPAD9 0x69
|
|---|
| 1595 | #define VK_MULTIPLY 0x6A
|
|---|
| 1596 | #define VK_ADD 0x6B
|
|---|
| 1597 | #define VK_SEPARATOR 0x6C
|
|---|
| 1598 | #define VK_SUBTRACT 0x6D
|
|---|
| 1599 | #define VK_DECIMAL 0x6E
|
|---|
| 1600 | #define VK_DIVIDE 0x6F
|
|---|
| 1601 | #define VK_LSHIFT 0xA0
|
|---|
| 1602 | #define VK_RSHIFT 0xA1
|
|---|
| 1603 | #define VK_LCONTROL 0xA2
|
|---|
| 1604 | #define VK_RCONTROL 0xA3
|
|---|
| 1605 | #define VK_PROCESSKEY 0xE5
|
|---|
| 1606 | #define VK_PLAY 0xFA
|
|---|
| 1607 | #define VK_ZOOM 0xFB
|
|---|
| 1608 | #define VK_NONAME 0xFC
|
|---|
| 1609 | #define VK_OEM_CLEAR 0xFE
|
|---|
| 1610 | #endif
|
|---|
| 1611 |
|
|---|
| 1612 | };
|
|---|
| 1613 |
|
|---|
| 1614 |
|
|---|
| 1615 | APIRET iConsoleInputEventPushKey(MPARAM mp1,
|
|---|
| 1616 | MPARAM mp2)
|
|---|
| 1617 | {
|
|---|
| 1618 | INPUT_RECORD InputRecord; /* the input record structure */
|
|---|
| 1619 | APIRET rc; /* API-returncode */
|
|---|
| 1620 | USHORT fsFlags = ((ULONG)mp1 & 0x0000ffff); /* get key flags */
|
|---|
| 1621 | UCHAR ucRepeat = ((ULONG)mp1 & 0x00ff0000) >> 16;
|
|---|
| 1622 | UCHAR ucScanCode = ((ULONG)mp1 & 0xff000000) >> 24;
|
|---|
| 1623 | UCHAR usCh = ((ULONG)mp2 & 0x0000ffff);
|
|---|
| 1624 | USHORT usVk = ((ULONG)mp2 & 0xffff0000) >> 16;
|
|---|
| 1625 | UCHAR ucChar = usCh & 0x00ff;
|
|---|
| 1626 |
|
|---|
| 1627 | #ifdef DEBUG_LOCAL2
|
|---|
| 1628 | dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushKey(%08x,%08x).\n",
|
|---|
| 1629 | mp1,
|
|---|
| 1630 | mp2));
|
|---|
| 1631 | #endif
|
|---|
| 1632 |
|
|---|
| 1633 |
|
|---|
| 1634 | InputRecord.EventType = KEY_EVENT; /* fill event structure */
|
|---|
| 1635 | InputRecord.Event.KeyEvent.dwControlKeyState = 0;
|
|---|
| 1636 |
|
|---|
| 1637 | if (fsFlags & KC_SHIFT) InputRecord.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED;
|
|---|
| 1638 | if (fsFlags & KC_ALT) InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
|
|---|
| 1639 | if (fsFlags & KC_CTRL) InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
|
|---|
| 1640 |
|
|---|
| 1641 | /* @@@PH no support for RIGHT_ALT_PRESSED,
|
|---|
| 1642 | RIGHT_CTRL_PRESSED,
|
|---|
| 1643 | NUMLOCK_ON,
|
|---|
| 1644 | SCROLLLOCK_ON,
|
|---|
| 1645 | CAPSLOCK_ON,
|
|---|
| 1646 | ENHANCED_KEY
|
|---|
| 1647 | */
|
|---|
| 1648 |
|
|---|
| 1649 | InputRecord.Event.KeyEvent.bKeyDown = !(fsFlags & KC_KEYUP);
|
|---|
| 1650 | InputRecord.Event.KeyEvent.wRepeatCount = ucRepeat;
|
|---|
| 1651 | InputRecord.Event.KeyEvent.wVirtualKeyCode = usVk;
|
|---|
| 1652 | InputRecord.Event.KeyEvent.wVirtualScanCode = ucScanCode;
|
|---|
| 1653 |
|
|---|
| 1654 | /* check if ascii is valid, if so then wVirtualKeyCode = ascii, */
|
|---|
| 1655 | /* else go through the table */
|
|---|
| 1656 | if (fsFlags & KC_CHAR) /* usCh valid ? */
|
|---|
| 1657 | {
|
|---|
| 1658 | /* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
|
|---|
| 1659 | /* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
|
|---|
| 1660 | if ( ( (usCh >= 'a') && (usCh <= 'z') ) || /* lowercase ? */
|
|---|
| 1661 | ( (usCh >= '0') && (usCh <= '9') )
|
|---|
| 1662 | )
|
|---|
| 1663 | InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF;
|
|---|
| 1664 | else
|
|---|
| 1665 | InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;
|
|---|
| 1666 | }
|
|---|
| 1667 | else
|
|---|
| 1668 | if (fsFlags & KC_VIRTUALKEY) /* translate OS/2 virtual key code */
|
|---|
| 1669 | {
|
|---|
| 1670 | if (usVk < TABVIRTUALKEYCODES) /* limit to table size */
|
|---|
| 1671 | InputRecord.Event.KeyEvent.wVirtualKeyCode =
|
|---|
| 1672 | tabVirtualKeyCodes[usVk]; /* translate keycode */
|
|---|
| 1673 | }
|
|---|
| 1674 |
|
|---|
| 1675 | /* this is a workaround for empty / invalid wVirtualKeyCodes */
|
|---|
| 1676 | if (InputRecord.Event.KeyEvent.wVirtualKeyCode == 0x0000)
|
|---|
| 1677 | {
|
|---|
| 1678 | if ( ( (usCh >= 'a') && (usCh <= 'z') ) || /* lowercase ? */
|
|---|
| 1679 | ( (usCh >= '0') && (usCh <= '9') )
|
|---|
| 1680 | )
|
|---|
| 1681 | InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh & 0xDF;
|
|---|
| 1682 | else
|
|---|
| 1683 | InputRecord.Event.KeyEvent.wVirtualKeyCode = usCh;
|
|---|
| 1684 | }
|
|---|
| 1685 |
|
|---|
| 1686 |
|
|---|
| 1687 | /* @@@PH handle special keys */
|
|---|
| 1688 | if ( (ucChar != 0xe0) && (ucChar != 0x00) )
|
|---|
| 1689 | InputRecord.Event.KeyEvent.uChar.AsciiChar = ucChar;
|
|---|
| 1690 | else
|
|---|
| 1691 | {
|
|---|
| 1692 | /* extended key ! */
|
|---|
| 1693 | InputRecord.Event.KeyEvent.dwControlKeyState |= ENHANCED_KEY;
|
|---|
| 1694 | InputRecord.Event.KeyEvent.uChar.AsciiChar = (ucChar >> 8);
|
|---|
| 1695 | }
|
|---|
| 1696 |
|
|---|
| 1697 | /* further processing according the current input console mode */
|
|---|
| 1698 | if (ConsoleInput.dwConsoleMode & ENABLE_PROCESSED_INPUT)
|
|---|
| 1699 | {
|
|---|
| 1700 | /* filter ctrl-c, etc. */
|
|---|
| 1701 | }
|
|---|
| 1702 |
|
|---|
| 1703 | #if 0
|
|---|
| 1704 | /* DEBUG */
|
|---|
| 1705 | dprintf(("DEBUG: mp1=%08x mp2=%08x\n",
|
|---|
| 1706 | mp1,
|
|---|
| 1707 | mp2));
|
|---|
| 1708 | dprintf(("DEBUG: fsFlags = %04x repeat=%u hwscan=%2x",
|
|---|
| 1709 | fsFlags,
|
|---|
| 1710 | ucRepeat,
|
|---|
| 1711 | ucScanCode ));
|
|---|
| 1712 | dprintf((" uscc=%04x usvk=%04x\n",
|
|---|
| 1713 | SHORT1FROMMP(mp2),
|
|---|
| 1714 | SHORT2FROMMP(mp2)));
|
|---|
| 1715 |
|
|---|
| 1716 | dprintf(("DEBUG: ascii=[%c] (%02x)",
|
|---|
| 1717 | InputRecord.Event.KeyEvent.uChar.AsciiChar,
|
|---|
| 1718 | InputRecord.Event.KeyEvent.uChar.AsciiChar));
|
|---|
| 1719 | #endif
|
|---|
| 1720 |
|
|---|
| 1721 | rc = iConsoleInputEventPush(&InputRecord); /* add it to the queue */
|
|---|
| 1722 | return (rc); /* OK */
|
|---|
| 1723 | }
|
|---|
| 1724 |
|
|---|
| 1725 |
|
|---|
| 1726 | /*****************************************************************************
|
|---|
| 1727 | * Name : static APIRET ConsoleInputEventPushMouse
|
|---|
| 1728 | * Purpose : push mouse event into the queue
|
|---|
| 1729 | * Parameters: MPARAM mp1, MPARAM mp2 from WM_MOUSEMOVE processing
|
|---|
| 1730 | * Variables :
|
|---|
| 1731 | * Result : API returncode
|
|---|
| 1732 | * Remark :
|
|---|
| 1733 | * Status :
|
|---|
| 1734 | *
|
|---|
| 1735 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1736 | *****************************************************************************/
|
|---|
| 1737 |
|
|---|
| 1738 | APIRET iConsoleInputEventPushMouse(ULONG ulMessage,
|
|---|
| 1739 | MPARAM mp1,
|
|---|
| 1740 | MPARAM mp2)
|
|---|
| 1741 | {
|
|---|
| 1742 | INPUT_RECORD InputRecord; /* the input record structure */
|
|---|
| 1743 | APIRET rc; /* API-returncode */
|
|---|
| 1744 | USHORT fsFlags = SHORT2FROMMP(mp2); /* get key flags */
|
|---|
| 1745 | static USHORT usButtonState; /* keeps track of mouse button state */
|
|---|
| 1746 |
|
|---|
| 1747 | /* do we have to process mouse input ? */
|
|---|
| 1748 | if ( !(ConsoleInput.dwConsoleMode & ENABLE_MOUSE_INPUT))
|
|---|
| 1749 | return (NO_ERROR); /* return immediately */
|
|---|
| 1750 |
|
|---|
| 1751 | dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMouse(%08x,%08x,%08x).\n",
|
|---|
| 1752 | ulMessage,
|
|---|
| 1753 | mp1,
|
|---|
| 1754 | mp2));
|
|---|
| 1755 |
|
|---|
| 1756 | memset(&InputRecord, /* zero the structure */
|
|---|
| 1757 | 0,
|
|---|
| 1758 | sizeof (INPUT_RECORD) );
|
|---|
| 1759 |
|
|---|
| 1760 | InputRecord.EventType = MOUSE_EVENT; /* fill event structure */
|
|---|
| 1761 |
|
|---|
| 1762 | switch (ulMessage)
|
|---|
| 1763 | {
|
|---|
| 1764 | case WM_MOUSEMOVE:
|
|---|
| 1765 | InputRecord.Event.MouseEvent.dwEventFlags = MOUSE_MOVED;
|
|---|
| 1766 | InputRecord.Event.MouseEvent.dwMousePosition.X = SHORT1FROMMP(mp1);
|
|---|
| 1767 | InputRecord.Event.MouseEvent.dwMousePosition.Y = SHORT2FROMMP(mp1);
|
|---|
| 1768 |
|
|---|
| 1769 | InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
|
|---|
| 1770 |
|
|---|
| 1771 | if (fsFlags & KC_SHIFT) InputRecord.Event.MouseEvent.dwControlKeyState |= SHIFT_PRESSED;
|
|---|
| 1772 | if (fsFlags & KC_ALT) InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
|
|---|
| 1773 | if (fsFlags & KC_CTRL) InputRecord.Event.MouseEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
|
|---|
| 1774 |
|
|---|
| 1775 | /* @@@PH no support for RIGHT_ALT_PRESSED,
|
|---|
| 1776 | RIGHT_CTRL_PRESSED,
|
|---|
| 1777 | NUMLOCK_ON,
|
|---|
| 1778 | SCROLLLOCK_ON,
|
|---|
| 1779 | CAPSLOCK_ON,
|
|---|
| 1780 | ENHANCED_KEY
|
|---|
| 1781 | */
|
|---|
| 1782 | break;
|
|---|
| 1783 |
|
|---|
| 1784 | case WM_BUTTON1UP:
|
|---|
| 1785 | usButtonState &= ~FROM_LEFT_1ST_BUTTON_PRESSED;
|
|---|
| 1786 | InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
|
|---|
| 1787 | break;
|
|---|
| 1788 |
|
|---|
| 1789 | case WM_BUTTON1DOWN:
|
|---|
| 1790 | usButtonState |= FROM_LEFT_1ST_BUTTON_PRESSED;
|
|---|
| 1791 | InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
|
|---|
| 1792 | break;
|
|---|
| 1793 |
|
|---|
| 1794 | case WM_BUTTON2UP:
|
|---|
| 1795 | usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED;
|
|---|
| 1796 | InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
|
|---|
| 1797 | break;
|
|---|
| 1798 |
|
|---|
| 1799 | case WM_BUTTON2DOWN:
|
|---|
| 1800 | usButtonState |= FROM_LEFT_2ND_BUTTON_PRESSED;
|
|---|
| 1801 | InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
|
|---|
| 1802 | break;
|
|---|
| 1803 |
|
|---|
| 1804 | case WM_BUTTON3UP:
|
|---|
| 1805 | usButtonState &= ~FROM_LEFT_3RD_BUTTON_PRESSED;
|
|---|
| 1806 | InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
|
|---|
| 1807 | break;
|
|---|
| 1808 |
|
|---|
| 1809 | case WM_BUTTON3DOWN:
|
|---|
| 1810 | usButtonState |= FROM_LEFT_3RD_BUTTON_PRESSED;
|
|---|
| 1811 | InputRecord.Event.MouseEvent.dwButtonState = usButtonState;
|
|---|
| 1812 | break;
|
|---|
| 1813 |
|
|---|
| 1814 | case WM_BUTTON1DBLCLK:
|
|---|
| 1815 | InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK;
|
|---|
| 1816 | InputRecord.Event.MouseEvent.dwButtonState = FROM_LEFT_1ST_BUTTON_PRESSED;
|
|---|
| 1817 | usButtonState &= ~FROM_LEFT_1ST_BUTTON_PRESSED;
|
|---|
| 1818 | break;
|
|---|
| 1819 |
|
|---|
| 1820 | case WM_BUTTON2DBLCLK:
|
|---|
| 1821 | InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK;
|
|---|
| 1822 | InputRecord.Event.MouseEvent.dwButtonState = FROM_LEFT_2ND_BUTTON_PRESSED;
|
|---|
| 1823 | usButtonState &= ~FROM_LEFT_2ND_BUTTON_PRESSED;
|
|---|
| 1824 | break;
|
|---|
| 1825 |
|
|---|
| 1826 | case WM_BUTTON3DBLCLK:
|
|---|
| 1827 | InputRecord.Event.MouseEvent.dwEventFlags = DOUBLE_CLICK;
|
|---|
| 1828 | InputRecord.Event.MouseEvent.dwButtonState = FROM_LEFT_3RD_BUTTON_PRESSED;
|
|---|
| 1829 | usButtonState &= ~FROM_LEFT_3RD_BUTTON_PRESSED;
|
|---|
| 1830 | break;
|
|---|
| 1831 | }
|
|---|
| 1832 |
|
|---|
| 1833 | /* @@@PH pseudo-support for RIGHTMOST_BUTTON_PRESSED */
|
|---|
| 1834 | if (InputRecord.Event.MouseEvent.dwButtonState & FROM_LEFT_3RD_BUTTON_PRESSED)
|
|---|
| 1835 | InputRecord.Event.MouseEvent.dwButtonState |= RIGHTMOST_BUTTON_PRESSED;
|
|---|
| 1836 |
|
|---|
| 1837 | rc = iConsoleInputEventPush(&InputRecord); /* add it to the queue */
|
|---|
| 1838 | return (rc); /* OK */
|
|---|
| 1839 | }
|
|---|
| 1840 |
|
|---|
| 1841 |
|
|---|
| 1842 | /*****************************************************************************
|
|---|
| 1843 | * Name : static APIRET ConsoleInputEventPushWindow
|
|---|
| 1844 | * Purpose : push menu event into the queue
|
|---|
| 1845 | * Parameters: DWORD dwCommandId
|
|---|
| 1846 | * Variables :
|
|---|
| 1847 | * Result : API returncode
|
|---|
| 1848 | * Remark :
|
|---|
| 1849 | * Status :
|
|---|
| 1850 | *
|
|---|
| 1851 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1852 | *****************************************************************************/
|
|---|
| 1853 |
|
|---|
| 1854 | APIRET iConsoleInputEventPushWindow(COORD coordWindowSize)
|
|---|
| 1855 | {
|
|---|
| 1856 | INPUT_RECORD InputRecord; /* the input record structure */
|
|---|
| 1857 | APIRET rc; /* API-returncode */
|
|---|
| 1858 |
|
|---|
| 1859 | /* do we have to process window input ? */
|
|---|
| 1860 | if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
|
|---|
| 1861 | return (NO_ERROR); /* return immediately */
|
|---|
| 1862 |
|
|---|
| 1863 | dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushWindow(x = %u, y = %u).\n",
|
|---|
| 1864 | coordWindowSize.X,
|
|---|
| 1865 | coordWindowSize.Y));
|
|---|
| 1866 |
|
|---|
| 1867 | InputRecord.EventType = WINDOW_BUFFER_SIZE_EVENT; /* fill event structure */
|
|---|
| 1868 |
|
|---|
| 1869 | InputRecord.Event.WindowBufferSizeEvent.dwSize = coordWindowSize;
|
|---|
| 1870 |
|
|---|
| 1871 | rc = iConsoleInputEventPush(&InputRecord); /* add it to the queue */
|
|---|
| 1872 | return (rc); /* OK */
|
|---|
| 1873 | }
|
|---|
| 1874 |
|
|---|
| 1875 |
|
|---|
| 1876 | /*****************************************************************************
|
|---|
| 1877 | * Name : static APIRET ConsoleInputEventPushMenu
|
|---|
| 1878 | * Purpose : push window event into the queue
|
|---|
| 1879 | * Parameters: COORD coordWindowSize
|
|---|
| 1880 | * Variables :
|
|---|
| 1881 | * Result : API returncode
|
|---|
| 1882 | * Remark :
|
|---|
| 1883 | * Status :
|
|---|
| 1884 | *
|
|---|
| 1885 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1886 | *****************************************************************************/
|
|---|
| 1887 |
|
|---|
| 1888 | APIRET iConsoleInputEventPushMenu(DWORD dwCommandId)
|
|---|
| 1889 | {
|
|---|
| 1890 | INPUT_RECORD InputRecord; /* the input record structure */
|
|---|
| 1891 | APIRET rc; /* API-returncode */
|
|---|
| 1892 |
|
|---|
| 1893 | /* @@@PH this is unknown to me - there's no separate bit for menu events ? */
|
|---|
| 1894 | /* do we have to process window input ? */
|
|---|
| 1895 | if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
|
|---|
| 1896 | return (NO_ERROR); /* return immediately */
|
|---|
| 1897 |
|
|---|
| 1898 | dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushMenu(%08x).\n",
|
|---|
| 1899 | dwCommandId));
|
|---|
| 1900 |
|
|---|
| 1901 | InputRecord.EventType = MENU_EVENT; /* fill event structure */
|
|---|
| 1902 |
|
|---|
| 1903 | InputRecord.Event.MenuEvent.dwCommandId = dwCommandId;
|
|---|
| 1904 |
|
|---|
| 1905 | rc = iConsoleInputEventPush(&InputRecord); /* add it to the queue */
|
|---|
| 1906 | return (rc); /* OK */
|
|---|
| 1907 | }
|
|---|
| 1908 |
|
|---|
| 1909 |
|
|---|
| 1910 | /*****************************************************************************
|
|---|
| 1911 | * Name : static APIRET ConsoleInputEventPushFocus
|
|---|
| 1912 | * Purpose : push focus event into the queue
|
|---|
| 1913 | * Parameters: BOOL bSetFocus
|
|---|
| 1914 | * Variables :
|
|---|
| 1915 | * Result : API returncode
|
|---|
| 1916 | * Remark :
|
|---|
| 1917 | * Status :
|
|---|
| 1918 | *
|
|---|
| 1919 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1920 | *****************************************************************************/
|
|---|
| 1921 |
|
|---|
| 1922 | APIRET iConsoleInputEventPushFocus(BOOL bSetFocus)
|
|---|
| 1923 | {
|
|---|
| 1924 | INPUT_RECORD InputRecord; /* the input record structure */
|
|---|
| 1925 | APIRET rc; /* API-returncode */
|
|---|
| 1926 |
|
|---|
| 1927 | /* @@@PH this is unknown to me - there's no separate bit for menu events ? */
|
|---|
| 1928 | /* do we have to process window input ? */
|
|---|
| 1929 | if ( !(ConsoleInput.dwConsoleMode & ENABLE_WINDOW_INPUT))
|
|---|
| 1930 | return (NO_ERROR); /* return immediately */
|
|---|
| 1931 |
|
|---|
| 1932 | dprintf(("KERNEL32/CONSOLE:ConsoleInputEventPushFocus(%08x).\n",
|
|---|
| 1933 | bSetFocus));
|
|---|
| 1934 |
|
|---|
| 1935 | InputRecord.EventType = FOCUS_EVENT; /* fill event structure */
|
|---|
| 1936 |
|
|---|
| 1937 | InputRecord.Event.FocusEvent.bSetFocus = bSetFocus;
|
|---|
| 1938 |
|
|---|
| 1939 | rc = iConsoleInputEventPush(&InputRecord); /* add it to the queue */
|
|---|
| 1940 | return (rc); /* OK */
|
|---|
| 1941 | }
|
|---|
| 1942 |
|
|---|
| 1943 |
|
|---|
| 1944 | /*****************************************************************************
|
|---|
| 1945 | * Name : static ULONG ConsoleInputQueueEvents
|
|---|
| 1946 | * Purpose : query number of events in the queue
|
|---|
| 1947 | * Parameters:
|
|---|
| 1948 | * Variables :
|
|---|
| 1949 | * Result : number of events
|
|---|
| 1950 | * Remark :
|
|---|
| 1951 | * Status :
|
|---|
| 1952 | *
|
|---|
| 1953 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 1954 | *****************************************************************************/
|
|---|
| 1955 |
|
|---|
| 1956 | ULONG iConsoleInputQueryEvents(PICONSOLEINPUT pConsoleInput, int fWait)
|
|---|
| 1957 | {
|
|---|
| 1958 | ULONG ulPostCounter; /* semaphore post counter - ignored */
|
|---|
| 1959 | APIRET rc; /* API returncode */
|
|---|
| 1960 |
|
|---|
| 1961 | if(flVioConsole)
|
|---|
| 1962 | {
|
|---|
| 1963 | KBDKEYINFO keyinfo;
|
|---|
| 1964 |
|
|---|
| 1965 | rc = KbdCharIn(&keyinfo, IO_NOWAIT, 0); //grab key if present; don't wait
|
|---|
| 1966 | if((rc || !(keyinfo.fbStatus & 0x40)) && fWait == QUERY_EVENT_WAIT && ConsoleInput.ulEvents == 0) {
|
|---|
| 1967 | rc = KbdCharIn(&keyinfo, IO_WAIT, 0);
|
|---|
| 1968 | }
|
|---|
| 1969 | while(rc == 0 && (keyinfo.fbStatus & 0x40))
|
|---|
| 1970 | {
|
|---|
| 1971 | INPUT_RECORD InputRecord = {0};
|
|---|
| 1972 |
|
|---|
| 1973 | InputRecord.EventType = KEY_EVENT;
|
|---|
| 1974 | InputRecord.Event.KeyEvent.wRepeatCount = 1;
|
|---|
| 1975 | InputRecord.Event.KeyEvent.bKeyDown = 1;
|
|---|
| 1976 | InputRecord.Event.KeyEvent.dwControlKeyState = 0;
|
|---|
| 1977 |
|
|---|
| 1978 | if(keyinfo.fbStatus & 2)
|
|---|
| 1979 | InputRecord.Event.KeyEvent.dwControlKeyState |= ENHANCED_KEY;
|
|---|
| 1980 |
|
|---|
| 1981 | if(keyinfo.fsState & (KBDSTF_RIGHTSHIFT|KBDSTF_LEFTSHIFT))
|
|---|
| 1982 | InputRecord.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED;
|
|---|
| 1983 |
|
|---|
| 1984 | if(keyinfo.fsState & KBDSTF_LEFTALT)
|
|---|
| 1985 | InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
|
|---|
| 1986 |
|
|---|
| 1987 | if(keyinfo.fsState & KBDSTF_RIGHTALT)
|
|---|
| 1988 | InputRecord.Event.KeyEvent.dwControlKeyState |= RIGHT_ALT_PRESSED;
|
|---|
| 1989 |
|
|---|
| 1990 | if(keyinfo.fsState & KBDSTF_LEFTCONTROL)
|
|---|
| 1991 | InputRecord.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
|
|---|
| 1992 |
|
|---|
| 1993 | if(keyinfo.fsState & KBDSTF_RIGHTCONTROL)
|
|---|
| 1994 | InputRecord.Event.KeyEvent.dwControlKeyState |= RIGHT_CTRL_PRESSED;
|
|---|
| 1995 |
|
|---|
| 1996 | if(keyinfo.fsState & KBDSTF_CAPSLOCK_ON)
|
|---|
| 1997 | InputRecord.Event.KeyEvent.dwControlKeyState |= CAPSLOCK_ON;
|
|---|
| 1998 |
|
|---|
| 1999 | if(keyinfo.fsState & KBDSTF_SCROLLLOCK_ON)
|
|---|
| 2000 | InputRecord.Event.KeyEvent.dwControlKeyState |= SCROLLLOCK_ON;
|
|---|
| 2001 |
|
|---|
| 2002 | if(keyinfo.fsState & KBDSTF_NUMLOCK_ON)
|
|---|
| 2003 | InputRecord.Event.KeyEvent.dwControlKeyState |= NUMLOCK_ON;
|
|---|
| 2004 |
|
|---|
| 2005 | InputRecord.Event.KeyEvent.wVirtualKeyCode = 0;
|
|---|
| 2006 | InputRecord.Event.KeyEvent.wVirtualScanCode = keyinfo.chScan;
|
|---|
| 2007 | InputRecord.Event.KeyEvent.uChar.AsciiChar = keyinfo.chChar;
|
|---|
| 2008 |
|
|---|
| 2009 | rc = iConsoleInputEventPush(&InputRecord); /* add it to the queue */
|
|---|
| 2010 | if(rc) {
|
|---|
| 2011 | dprintf(("WARNING: lost key!!"));
|
|---|
| 2012 | break;
|
|---|
| 2013 | }
|
|---|
| 2014 |
|
|---|
| 2015 | rc = KbdCharIn(&keyinfo, IO_NOWAIT, 0); //grab key if present; don't wait
|
|---|
| 2016 | }
|
|---|
| 2017 | }
|
|---|
| 2018 | else
|
|---|
| 2019 | if(fWait == QUERY_EVENT_WAIT && ConsoleInput.ulEvents == 0)
|
|---|
| 2020 | {
|
|---|
| 2021 | rc = DosWaitEventSem(pConsoleInput->hevInputQueue, /* wait for input */
|
|---|
| 2022 | SEM_INDEFINITE_WAIT);
|
|---|
| 2023 | DosResetEventSem(pConsoleInput->hevInputQueue, /* reset semaphore */
|
|---|
| 2024 | &ulPostCounter); /* post counter - ignored */
|
|---|
| 2025 | }
|
|---|
| 2026 | return (ConsoleInput.ulEvents); /* return number of events in queue */
|
|---|
| 2027 | }
|
|---|
| 2028 |
|
|---|
| 2029 |
|
|---|
| 2030 | /*****************************************************************************
|
|---|
| 2031 | * Name : static void ConsoleCursorShow
|
|---|
| 2032 | * Purpose : query number of events in the queue
|
|---|
| 2033 | * Parameters:
|
|---|
| 2034 | * Variables :
|
|---|
| 2035 | * Result : number of events
|
|---|
| 2036 | * Remark :
|
|---|
| 2037 | * Status :
|
|---|
| 2038 | *
|
|---|
| 2039 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 2040 | *****************************************************************************/
|
|---|
| 2041 |
|
|---|
| 2042 | void iConsoleCursorShow (PCONSOLEBUFFER pConsoleBuffer,
|
|---|
| 2043 | ULONG ulCursorMode)
|
|---|
| 2044 | {
|
|---|
| 2045 | HPS hps; /* presentation space handle */
|
|---|
| 2046 | RECTL rclCursor; /* the cursor rectangle */
|
|---|
| 2047 | static BOOL fState; /* current cursor state */
|
|---|
| 2048 | RECTL rclWindow; /* current window size */
|
|---|
| 2049 |
|
|---|
| 2050 | #ifdef DEBUG_LOCAL2
|
|---|
| 2051 | dprintf(("KERNEL32:Console:ConsoleCursorShow(%u)\n",
|
|---|
| 2052 | ulCursorMode));
|
|---|
| 2053 | #endif
|
|---|
| 2054 |
|
|---|
| 2055 | if (pConsoleBuffer->CursorInfo.bVisible == FALSE)/* cursor is switched off */
|
|---|
| 2056 | return; /* return immediately */
|
|---|
| 2057 |
|
|---|
| 2058 | switch (ulCursorMode)
|
|---|
| 2059 | {
|
|---|
| 2060 | case CONSOLECURSOR_HIDE:
|
|---|
| 2061 | if (fState == FALSE) /* cursor currently shown ? */
|
|---|
| 2062 | return; /* no, abort immediately */
|
|---|
| 2063 | else
|
|---|
| 2064 | fState = FALSE; /* set to invisible and invert our cursor rect */
|
|---|
| 2065 | break;
|
|---|
| 2066 |
|
|---|
| 2067 | case CONSOLECURSOR_SHOW:
|
|---|
| 2068 | if (fState == TRUE) /* cursor currently shown ? */
|
|---|
| 2069 | return; /* yes,abort immediately */
|
|---|
| 2070 | else
|
|---|
| 2071 | fState = TRUE; /* set to visible and invert our cursor rect */
|
|---|
| 2072 | break;
|
|---|
| 2073 |
|
|---|
| 2074 | case CONSOLECURSOR_BLINK:
|
|---|
| 2075 | fState = !fState; /* let there be on off on off on off on off ... */
|
|---|
| 2076 | break;
|
|---|
| 2077 |
|
|---|
| 2078 | case CONSOLECURSOR_OVERWRITTEN: /* our cursor has been overwritten */
|
|---|
| 2079 | fState = TRUE; /* so show the cursor immediately */
|
|---|
| 2080 | break;
|
|---|
| 2081 | }
|
|---|
| 2082 |
|
|---|
| 2083 |
|
|---|
| 2084 | /* query current window's size */
|
|---|
| 2085 | WinQueryWindowRect(ConsoleGlobals.hwndClient,
|
|---|
| 2086 | &rclWindow);
|
|---|
| 2087 |
|
|---|
| 2088 | /* calculate coordinates of the cursor */
|
|---|
| 2089 | rclCursor.xLeft = ConsoleGlobals.sCellCX * pConsoleBuffer->coordCursorPosition.X;
|
|---|
| 2090 | rclCursor.xRight = rclCursor.xLeft + ConsoleGlobals.sCellCX;
|
|---|
| 2091 |
|
|---|
| 2092 | //@@@PH top calculation is wrong!
|
|---|
| 2093 | rclCursor.yBottom = rclWindow.yTop
|
|---|
| 2094 | - ConsoleGlobals.sCellCY * (pConsoleBuffer->coordCursorPosition.Y + 1);
|
|---|
| 2095 | rclCursor.yTop = rclCursor.yBottom + /* cursor height in percent */
|
|---|
| 2096 | (ConsoleGlobals.sCellCY *
|
|---|
| 2097 | pConsoleBuffer->CursorInfo.dwSize /
|
|---|
| 2098 | 100);
|
|---|
| 2099 |
|
|---|
| 2100 | hps = WinGetPS(ConsoleGlobals.hwndClient); /* get HPS */
|
|---|
| 2101 |
|
|---|
| 2102 | /* @@@PH invert coordinates here ... */
|
|---|
| 2103 | WinInvertRect(hps, /* our cursor is an inverted rectangle */
|
|---|
| 2104 | &rclCursor);
|
|---|
| 2105 |
|
|---|
| 2106 | WinReleasePS(hps); /* release the hps again */
|
|---|
| 2107 | }
|
|---|
| 2108 |
|
|---|
| 2109 |
|
|---|
| 2110 | /*****************************************************************************
|
|---|
| 2111 | * Name : static APIRET ConsoleFontQuery
|
|---|
| 2112 | * Purpose : queries the current font cell sizes
|
|---|
| 2113 | * Parameters:
|
|---|
| 2114 | * Variables :
|
|---|
| 2115 | * Result : API returncode
|
|---|
| 2116 | * Remark :
|
|---|
| 2117 | * Status :
|
|---|
| 2118 | *
|
|---|
| 2119 | * Author : Patrick Haller [Tue, 1998/03/07 16:55]
|
|---|
| 2120 | *****************************************************************************/
|
|---|
| 2121 |
|
|---|
| 2122 | APIRET iConsoleFontQuery (void)
|
|---|
| 2123 | {
|
|---|
| 2124 | return(VioGetDeviceCellSize(&ConsoleGlobals.sCellCY, /* query VIO manager */
|
|---|
| 2125 | &ConsoleGlobals.sCellCX,
|
|---|
| 2126 | ConsoleGlobals.hvpsConsole));
|
|---|
| 2127 | }
|
|---|
| 2128 |
|
|---|
| 2129 |
|
|---|
| 2130 | /*****************************************************************************
|
|---|
| 2131 | * Name : static void ConsoleCursorShow
|
|---|
| 2132 | * Purpose : query number of events in the queue
|
|---|
| 2133 | * Parameters:
|
|---|
| 2134 | * Variables :
|
|---|
| 2135 | * Result : number of events
|
|---|
| 2136 | * Remark : called during INIT, FONTCHANGE, RESIZE, BUFFERCHANGE
|
|---|
| 2137 | * Status :
|
|---|
| 2138 | *
|
|---|
| 2139 | * Author : Patrick Haller [Wed, 1998/04/29 16:55]
|
|---|
| 2140 | *****************************************************************************/
|
|---|
| 2141 |
|
|---|
| 2142 | void iConsoleAdjustWindow (PCONSOLEBUFFER pConsoleBuffer)
|
|---|
| 2143 | {
|
|---|
| 2144 | LONG lX, lY; /* temporary long values */
|
|---|
| 2145 | RECTL rcl;
|
|---|
| 2146 | PRECTL pRcl = &rcl;
|
|---|
| 2147 | ULONG flStyle; /* window frame control style */
|
|---|
| 2148 |
|
|---|
| 2149 | BOOL fNeedVertScroll; /* indicates need of scrollbars */
|
|---|
| 2150 | BOOL fNeedHorzScroll;
|
|---|
| 2151 |
|
|---|
| 2152 | LONG lScrollX; /* width and height of scrollbars */
|
|---|
| 2153 | LONG lScrollY;
|
|---|
| 2154 |
|
|---|
| 2155 | /* now calculate actual window size */
|
|---|
| 2156 | lX = ConsoleGlobals.sCellCX * ConsoleGlobals.coordWindowSize.X;
|
|---|
| 2157 | lY = ConsoleGlobals.sCellCY * ConsoleGlobals.coordWindowSize.Y;
|
|---|
| 2158 |
|
|---|
| 2159 | if ( (ConsoleGlobals.sCellCX == 0) || /* prevent division by zero */
|
|---|
| 2160 | (ConsoleGlobals.sCellCY == 0) )
|
|---|
| 2161 | return;
|
|---|
| 2162 |
|
|---|
| 2163 | /* calculate maximum console window size in pixels for the tracking */
|
|---|
| 2164 | ConsoleGlobals.coordMaxWindowPels.X = ConsoleGlobals.sCellCX * pConsoleBuffer->coordWindowSize.X
|
|---|
| 2165 | + WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) * 2;
|
|---|
| 2166 |
|
|---|
| 2167 | ConsoleGlobals.coordMaxWindowPels.Y = ConsoleGlobals.sCellCY * pConsoleBuffer->coordWindowSize.Y
|
|---|
| 2168 | + WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) * 2
|
|---|
| 2169 | + WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
|
|---|
| 2170 |
|
|---|
| 2171 | /***************************/
|
|---|
| 2172 | /* @@@PH broken code below */
|
|---|
| 2173 | /***************************/
|
|---|
| 2174 | return;
|
|---|
| 2175 |
|
|---|
| 2176 | /* add the window border height and width, etc. */
|
|---|
| 2177 | WinQueryWindowRect (ConsoleGlobals.hwndClient,
|
|---|
| 2178 | pRcl);
|
|---|
| 2179 |
|
|---|
| 2180 | /* calculate visible area */
|
|---|
| 2181 | /* calculate real client window rectangle and take care of the scrollbars */
|
|---|
| 2182 | lScrollX = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
|
|---|
| 2183 | lScrollY = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
|
|---|
| 2184 | if (ConsoleGlobals.fHasHorzScroll)
|
|---|
| 2185 | {
|
|---|
| 2186 | lY += lScrollY;
|
|---|
| 2187 | ConsoleGlobals.coordMaxWindowPels.Y += lScrollY;
|
|---|
| 2188 | }
|
|---|
| 2189 |
|
|---|
| 2190 | if (ConsoleGlobals.fHasVertScroll)
|
|---|
| 2191 | {
|
|---|
| 2192 | lX += lScrollX;
|
|---|
| 2193 | ConsoleGlobals.coordMaxWindowPels.X += lScrollX;
|
|---|
| 2194 | }
|
|---|
| 2195 |
|
|---|
| 2196 | /* @@@PH might NOT exceed maximum VioPS size ! */
|
|---|
| 2197 | ConsoleGlobals.coordWindowSize.X = (pRcl->xRight - pRcl->xLeft)
|
|---|
| 2198 | / ConsoleGlobals.sCellCX;
|
|---|
| 2199 |
|
|---|
| 2200 | ConsoleGlobals.coordWindowSize.Y = (pRcl->yTop - pRcl->yBottom)
|
|---|
| 2201 | / ConsoleGlobals.sCellCY;
|
|---|
| 2202 |
|
|---|
| 2203 | /* do we have to enable the scrollbars ? */
|
|---|
| 2204 | fNeedHorzScroll = lX < pConsoleBuffer->coordWindowSize.X * ConsoleGlobals.sCellCX;
|
|---|
| 2205 | fNeedVertScroll = lY < pConsoleBuffer->coordWindowSize.Y * ConsoleGlobals.sCellCY;
|
|---|
| 2206 |
|
|---|
| 2207 |
|
|---|
| 2208 | if ( (ConsoleGlobals.fHasVertScroll != fNeedVertScroll) ||
|
|---|
| 2209 | (ConsoleGlobals.fHasHorzScroll != fNeedHorzScroll) )
|
|---|
| 2210 | {
|
|---|
| 2211 | flStyle = WinQueryWindowULong(ConsoleGlobals.hwndFrame,
|
|---|
| 2212 | QWL_STYLE);
|
|---|
| 2213 |
|
|---|
| 2214 | /* now set or remove the controls */
|
|---|
| 2215 | if (ConsoleGlobals.fHasHorzScroll != fNeedHorzScroll)
|
|---|
| 2216 | if (fNeedHorzScroll)
|
|---|
| 2217 | {
|
|---|
| 2218 | flStyle |= FCF_HORZSCROLL;
|
|---|
| 2219 | WinSetParent(ConsoleGlobals.hwndHorzScroll, /* attach control */
|
|---|
| 2220 | ConsoleGlobals.hwndFrame,
|
|---|
| 2221 | FALSE);
|
|---|
| 2222 | }
|
|---|
| 2223 | else
|
|---|
| 2224 | {
|
|---|
| 2225 | flStyle &= ~FCF_HORZSCROLL;
|
|---|
| 2226 | WinSetParent(ConsoleGlobals.hwndHorzScroll, /* detach control */
|
|---|
| 2227 | HWND_OBJECT,
|
|---|
| 2228 | FALSE);
|
|---|
| 2229 | ConsoleGlobals.coordWindowPos.X = 0; /* we can see the whole buffer */
|
|---|
| 2230 | }
|
|---|
| 2231 |
|
|---|
| 2232 | if (ConsoleGlobals.fHasVertScroll != fNeedVertScroll)
|
|---|
| 2233 | if (fNeedVertScroll)
|
|---|
| 2234 | {
|
|---|
| 2235 | flStyle |= FCF_VERTSCROLL;
|
|---|
| 2236 | WinSetParent(ConsoleGlobals.hwndVertScroll, /* attach control */
|
|---|
| 2237 | ConsoleGlobals.hwndFrame,
|
|---|
| 2238 | FALSE);
|
|---|
| 2239 | }
|
|---|
| 2240 | else
|
|---|
| 2241 | {
|
|---|
| 2242 | flStyle &= ~FCF_VERTSCROLL;
|
|---|
| 2243 | WinSetParent(ConsoleGlobals.hwndVertScroll, /* detach control */
|
|---|
| 2244 | HWND_OBJECT,
|
|---|
| 2245 | FALSE);
|
|---|
| 2246 | ConsoleGlobals.coordWindowPos.Y = 0; /* we can see the whole buffer */
|
|---|
| 2247 | }
|
|---|
| 2248 |
|
|---|
| 2249 |
|
|---|
| 2250 | WinSendMsg(ConsoleGlobals.hwndFrame, /* update frame */
|
|---|
| 2251 | WM_UPDATEFRAME,
|
|---|
| 2252 | MPFROMLONG(flStyle),
|
|---|
| 2253 | MPVOID);
|
|---|
| 2254 |
|
|---|
| 2255 | WinInvalidateRect(ConsoleGlobals.hwndFrame, /* redraw frame window */
|
|---|
| 2256 | NULL,
|
|---|
| 2257 | TRUE);
|
|---|
| 2258 |
|
|---|
| 2259 | ConsoleGlobals.fHasVertScroll = fNeedVertScroll; /* update globals */
|
|---|
| 2260 | ConsoleGlobals.fHasHorzScroll = fNeedHorzScroll; /* update globals */
|
|---|
| 2261 | }
|
|---|
| 2262 |
|
|---|
| 2263 |
|
|---|
| 2264 | /* setup the scrollbars and scrollranges */
|
|---|
| 2265 | if (ConsoleGlobals.fHasVertScroll)
|
|---|
| 2266 | {
|
|---|
| 2267 | /* setup vertical scrollbar */
|
|---|
| 2268 | }
|
|---|
| 2269 |
|
|---|
| 2270 |
|
|---|
| 2271 | if (ConsoleGlobals.fHasHorzScroll)
|
|---|
| 2272 | {
|
|---|
| 2273 | /* setup horizonal scrollbar */
|
|---|
| 2274 | }
|
|---|
| 2275 |
|
|---|
| 2276 |
|
|---|
| 2277 | WinCalcFrameRect(ConsoleGlobals.hwndFrame, /* calculate frame rectangle */
|
|---|
| 2278 | pRcl,
|
|---|
| 2279 | FALSE);
|
|---|
| 2280 |
|
|---|
| 2281 | /* @@@PH client may not overlap frame ! */
|
|---|
| 2282 | /* @@@PH write values to TRACKINFO */
|
|---|
| 2283 |
|
|---|
| 2284 | #if 0
|
|---|
| 2285 | /* @@@PH this results in recursion */
|
|---|
| 2286 | WinSetWindowPos (ConsoleGlobals.hwndClient, /* adjust client window size */
|
|---|
| 2287 | ConsoleGlobals.hwndFrame,
|
|---|
| 2288 | 0,
|
|---|
| 2289 | 0,
|
|---|
| 2290 | lX,
|
|---|
| 2291 | lY,
|
|---|
| 2292 | SWP_SIZE);
|
|---|
| 2293 |
|
|---|
| 2294 | WinSetWindowPos (ConsoleGlobals.hwndFrame, /* adjust client window size */
|
|---|
| 2295 | HWND_DESKTOP,
|
|---|
| 2296 | pRcl->xLeft,
|
|---|
| 2297 | pRcl->yBottom,
|
|---|
| 2298 | pRcl->xRight,
|
|---|
| 2299 | pRcl->yTop,
|
|---|
| 2300 | SWP_SIZE);
|
|---|
| 2301 | #endif
|
|---|
| 2302 | }
|
|---|
| 2303 |
|
|---|
| 2304 |
|
|---|
| 2305 | /*****************************************************************************
|
|---|
| 2306 | * Name : BOOL WIN32API AllocConsole
|
|---|
| 2307 | * Purpose : The AllocConsole function allocates a new console
|
|---|
| 2308 | * for the calling process
|
|---|
| 2309 | * Parameters: VOID
|
|---|
| 2310 | * Variables :
|
|---|
| 2311 | * Result : BOOL: TRUE - function succeeded
|
|---|
| 2312 | * FALSE - function failed. Extended error information
|
|---|
| 2313 | * obtainable via GetLastError
|
|---|
| 2314 | * Remark :
|
|---|
| 2315 | * Status : REWRITTEN UNTESTED
|
|---|
| 2316 | *
|
|---|
| 2317 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2318 | *****************************************************************************/
|
|---|
| 2319 |
|
|---|
| 2320 | BOOL WIN32API AllocConsole(VOID)
|
|---|
| 2321 | {
|
|---|
| 2322 | APIRET rc; /* API returncode */
|
|---|
| 2323 |
|
|---|
| 2324 | #ifdef DEBUG_LOCAL2
|
|---|
| 2325 | WriteLog("KERNEL32/CONSOLE: OS2AllocConsole() called.\n");
|
|---|
| 2326 | #endif
|
|---|
| 2327 |
|
|---|
| 2328 | rc = iConsoleInit(flVioConsole); /* initialize subsystem if required */
|
|---|
| 2329 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 2330 | {
|
|---|
| 2331 | SetLastError(rc); /* pass thru the error code */
|
|---|
| 2332 | return FALSE; /* signal failure */
|
|---|
| 2333 | }
|
|---|
| 2334 | else
|
|---|
| 2335 | return TRUE; /* Fine ! :) */
|
|---|
| 2336 | }
|
|---|
| 2337 |
|
|---|
| 2338 |
|
|---|
| 2339 | /*****************************************************************************
|
|---|
| 2340 | * Name : HANDLE WIN32API CreateConsoleScreenBuffer
|
|---|
| 2341 | * Purpose : The CreateConsoleScreenBuffer function creates a console
|
|---|
| 2342 | * screen buffer and returns a handle of it.
|
|---|
| 2343 | * Parameters: DWORD dwDesiredAccess - access flag
|
|---|
| 2344 | * DWORD dwShareMode - buffer share more
|
|---|
| 2345 | * PVOID pIgnored - LPSECURITY_ATTRIBUTES -> NT
|
|---|
| 2346 | * DWORD dwFlags - type of buffer to create
|
|---|
| 2347 | * LPVOID lpScreenBufferData - reserved
|
|---|
| 2348 | * Variables :
|
|---|
| 2349 | * Result :
|
|---|
| 2350 | * Remark : a console buffer is a kernel heap object equipped with
|
|---|
| 2351 | * share modes, access rights, etc.
|
|---|
| 2352 | * we can't really map this to OS/2 unless we build a
|
|---|
| 2353 | * console device driver for it ... maybe this turns out to
|
|---|
| 2354 | * be necessary since we've got to handle CONIN$ and CONOUT$, too.
|
|---|
| 2355 | * Status :
|
|---|
| 2356 | *
|
|---|
| 2357 | * Author : Patrick Haller [Tue, 1998/02/10 03:55]
|
|---|
| 2358 | *****************************************************************************/
|
|---|
| 2359 |
|
|---|
| 2360 | HANDLE WIN32API CreateConsoleScreenBuffer(DWORD dwDesiredAccess,
|
|---|
| 2361 | DWORD dwShareMode,
|
|---|
| 2362 | LPVOID lpSecurityAttributes,
|
|---|
| 2363 | DWORD dwFlags,
|
|---|
| 2364 | LPVOID lpScreenBufferData)
|
|---|
| 2365 | {
|
|---|
| 2366 | HANDLE hResult;
|
|---|
| 2367 |
|
|---|
| 2368 | #ifdef DEBUG_LOCAL2
|
|---|
| 2369 | WriteLog("KERNEL32/CONSOLE:OS2CreateConsoleScreenBuffer(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 2370 | dwDesiredAccess,
|
|---|
| 2371 | dwShareMode,
|
|---|
| 2372 | lpSecurityAttributes,
|
|---|
| 2373 | dwFlags,
|
|---|
| 2374 | lpScreenBufferData);
|
|---|
| 2375 | #endif
|
|---|
| 2376 |
|
|---|
| 2377 | hResult = HMCreateFile("CONBUFFER$", /* create a new buffer handle */
|
|---|
| 2378 | dwDesiredAccess,
|
|---|
| 2379 | dwShareMode,
|
|---|
| 2380 | (LPSECURITY_ATTRIBUTES)lpSecurityAttributes,
|
|---|
| 2381 | 0,
|
|---|
| 2382 | dwFlags,
|
|---|
| 2383 | INVALID_HANDLE_VALUE);
|
|---|
| 2384 |
|
|---|
| 2385 | return hResult;
|
|---|
| 2386 | }
|
|---|
| 2387 |
|
|---|
| 2388 |
|
|---|
| 2389 | /*****************************************************************************
|
|---|
| 2390 | * Name :
|
|---|
| 2391 | * Purpose :
|
|---|
| 2392 | * Parameters:
|
|---|
| 2393 | * Variables :
|
|---|
| 2394 | * Result :
|
|---|
| 2395 | * Remark :
|
|---|
| 2396 | * Status :
|
|---|
| 2397 | *
|
|---|
| 2398 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2399 | *****************************************************************************/
|
|---|
| 2400 |
|
|---|
| 2401 | BOOL WIN32API FillConsoleOutputAttribute(HANDLE hConsoleOutput,
|
|---|
| 2402 | WORD wAttribute,
|
|---|
| 2403 | DWORD nLength,
|
|---|
| 2404 | COORD dwWriteCoord,
|
|---|
| 2405 | LPDWORD lpNumberOfAttrsWritten)
|
|---|
| 2406 | {
|
|---|
| 2407 | BOOL fResult;
|
|---|
| 2408 |
|
|---|
| 2409 | #ifdef DEBUG_LOCAL2
|
|---|
| 2410 | WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputAttribute(%08x,%04x,%08x,%08x,%08x).\n",
|
|---|
| 2411 | hConsoleOutput,
|
|---|
| 2412 | wAttribute,
|
|---|
| 2413 | nLength,
|
|---|
| 2414 | dwWriteCoord,
|
|---|
| 2415 | lpNumberOfAttrsWritten);
|
|---|
| 2416 | #endif
|
|---|
| 2417 |
|
|---|
| 2418 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 2419 | DRQ_FILLCONSOLEOUTPUTATTRIBUTE,
|
|---|
| 2420 | (ULONG)wAttribute,
|
|---|
| 2421 | (ULONG)nLength,
|
|---|
| 2422 | COORD2ULONG(dwWriteCoord),
|
|---|
| 2423 | (ULONG)lpNumberOfAttrsWritten);
|
|---|
| 2424 |
|
|---|
| 2425 | return fResult;
|
|---|
| 2426 | }
|
|---|
| 2427 |
|
|---|
| 2428 |
|
|---|
| 2429 | /*****************************************************************************
|
|---|
| 2430 | * Name :
|
|---|
| 2431 | * Purpose :
|
|---|
| 2432 | * Parameters:
|
|---|
| 2433 | * Variables :
|
|---|
| 2434 | * Result :
|
|---|
| 2435 | * Remark :
|
|---|
| 2436 | * Status :
|
|---|
| 2437 | *
|
|---|
| 2438 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2439 | *****************************************************************************/
|
|---|
| 2440 |
|
|---|
| 2441 | BOOL WIN32API FillConsoleOutputCharacterA(HANDLE hConsoleOutput,
|
|---|
| 2442 | UCHAR cCharacter,
|
|---|
| 2443 | DWORD nLength,
|
|---|
| 2444 | COORD dwWriteCoord,
|
|---|
| 2445 | LPDWORD lpNumberOfCharsWritten )
|
|---|
| 2446 | {
|
|---|
| 2447 | BOOL fResult;
|
|---|
| 2448 |
|
|---|
| 2449 | #ifdef DEBUG_LOCAL2
|
|---|
| 2450 | WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterA(%08x,%c,%08x,%08x,%08x).\n",
|
|---|
| 2451 | hConsoleOutput,
|
|---|
| 2452 | cCharacter,
|
|---|
| 2453 | nLength,
|
|---|
| 2454 | dwWriteCoord,
|
|---|
| 2455 | lpNumberOfCharsWritten);
|
|---|
| 2456 | #endif
|
|---|
| 2457 |
|
|---|
| 2458 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 2459 | DRQ_FILLCONSOLEOUTPUTCHARACTERA,
|
|---|
| 2460 | (ULONG)cCharacter,
|
|---|
| 2461 | (ULONG)nLength,
|
|---|
| 2462 | COORD2ULONG(dwWriteCoord),
|
|---|
| 2463 | (ULONG)lpNumberOfCharsWritten);
|
|---|
| 2464 |
|
|---|
| 2465 | return fResult;
|
|---|
| 2466 | }
|
|---|
| 2467 |
|
|---|
| 2468 |
|
|---|
| 2469 | /*****************************************************************************
|
|---|
| 2470 | * Name :
|
|---|
| 2471 | * Purpose :
|
|---|
| 2472 | * Parameters:
|
|---|
| 2473 | * Variables :
|
|---|
| 2474 | * Result :
|
|---|
| 2475 | * Remark :
|
|---|
| 2476 | * Status :
|
|---|
| 2477 | *
|
|---|
| 2478 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2479 | *****************************************************************************/
|
|---|
| 2480 |
|
|---|
| 2481 | BOOL WIN32API FillConsoleOutputCharacterW(HANDLE hConsoleOutput,
|
|---|
| 2482 | WCHAR cCharacter,
|
|---|
| 2483 | DWORD nLength,
|
|---|
| 2484 | COORD dwWriteCoord,
|
|---|
| 2485 | LPDWORD lpNumberOfCharsWritten )
|
|---|
| 2486 | {
|
|---|
| 2487 | BOOL fResult;
|
|---|
| 2488 |
|
|---|
| 2489 | #ifdef DEBUG_LOCAL2
|
|---|
| 2490 | WriteLog("KERNEL32/CONSOLE: OS2FillConsoleOutputCharacterW(%08x,%c,%08x,%08x,%08x) .\n",
|
|---|
| 2491 | hConsoleOutput,
|
|---|
| 2492 | cCharacter,
|
|---|
| 2493 | nLength,
|
|---|
| 2494 | dwWriteCoord,
|
|---|
| 2495 | lpNumberOfCharsWritten);
|
|---|
| 2496 | #endif
|
|---|
| 2497 |
|
|---|
| 2498 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 2499 | DRQ_FILLCONSOLEOUTPUTCHARACTERW,
|
|---|
| 2500 | (ULONG)cCharacter,
|
|---|
| 2501 | (ULONG)nLength,
|
|---|
| 2502 | COORD2ULONG(dwWriteCoord),
|
|---|
| 2503 | (ULONG)lpNumberOfCharsWritten);
|
|---|
| 2504 |
|
|---|
| 2505 | return fResult;
|
|---|
| 2506 | }
|
|---|
| 2507 |
|
|---|
| 2508 |
|
|---|
| 2509 | /*****************************************************************************
|
|---|
| 2510 | * Name :
|
|---|
| 2511 | * Purpose :
|
|---|
| 2512 | * Parameters:
|
|---|
| 2513 | * Variables :
|
|---|
| 2514 | * Result :
|
|---|
| 2515 | * Remark :
|
|---|
| 2516 | * Status :
|
|---|
| 2517 | *
|
|---|
| 2518 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2519 | *****************************************************************************/
|
|---|
| 2520 |
|
|---|
| 2521 | BOOL WIN32API FlushConsoleInputBuffer( HANDLE hConsoleInput )
|
|---|
| 2522 | {
|
|---|
| 2523 | BOOL fResult;
|
|---|
| 2524 |
|
|---|
| 2525 | #ifdef DEBUG_LOCAL2
|
|---|
| 2526 | WriteLog("KERNEL32/CONSOLE: OS2FlushConsoleInputBuffer(%08x).\n",
|
|---|
| 2527 | hConsoleInput);
|
|---|
| 2528 | #endif
|
|---|
| 2529 |
|
|---|
| 2530 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 2531 | DRQ_FLUSHCONSOLEINPUTBUFFER,
|
|---|
| 2532 | 0,
|
|---|
| 2533 | 0,
|
|---|
| 2534 | 0,
|
|---|
| 2535 | 0);
|
|---|
| 2536 |
|
|---|
| 2537 | return fResult;
|
|---|
| 2538 | }
|
|---|
| 2539 |
|
|---|
| 2540 |
|
|---|
| 2541 | /*****************************************************************************
|
|---|
| 2542 | * Name : BOOL WIN32API FreeConsole
|
|---|
| 2543 | * Purpose : The FreeConsole function detaches the calling process
|
|---|
| 2544 | * from its console.
|
|---|
| 2545 | * Parameters: VOID
|
|---|
| 2546 | * Variables :
|
|---|
| 2547 | * Result : BOOL: TRUE - function succeeded
|
|---|
| 2548 | * FALSE - function failed. Extended error information
|
|---|
| 2549 | * obtainable via GetLastError
|
|---|
| 2550 | * Remark :
|
|---|
| 2551 | * Status : REWRITTEN UNTESTED
|
|---|
| 2552 | *
|
|---|
| 2553 | * Author : Patrick Haller [Tue, 1998/02/10 03:35]
|
|---|
| 2554 | *****************************************************************************/
|
|---|
| 2555 |
|
|---|
| 2556 | BOOL WIN32API FreeConsole( VOID )
|
|---|
| 2557 | {
|
|---|
| 2558 | APIRET rc; /* API returncode */
|
|---|
| 2559 |
|
|---|
| 2560 | #ifdef DEBUG_LOCAL2
|
|---|
| 2561 | WriteLog("KERNEL32/CONSOLE: OS2FreeConsole() called.\n");
|
|---|
| 2562 | #endif
|
|---|
| 2563 |
|
|---|
| 2564 | rc = iConsoleTerminate(); /* terminate subsystem if required */
|
|---|
| 2565 | if (rc != NO_ERROR) /* check for errors */
|
|---|
| 2566 | {
|
|---|
| 2567 | SetLastError(rc); /* pass thru the error code */
|
|---|
| 2568 | return FALSE; /* signal failure */
|
|---|
| 2569 | }
|
|---|
| 2570 | else
|
|---|
| 2571 | return TRUE; /* Fine ! :) */
|
|---|
| 2572 |
|
|---|
| 2573 | return TRUE;
|
|---|
| 2574 | }
|
|---|
| 2575 |
|
|---|
| 2576 |
|
|---|
| 2577 | /*****************************************************************************
|
|---|
| 2578 | * Name :
|
|---|
| 2579 | * Purpose :
|
|---|
| 2580 | * Parameters:
|
|---|
| 2581 | * Variables :
|
|---|
| 2582 | * Result :
|
|---|
| 2583 | * Remark :
|
|---|
| 2584 | * Status :
|
|---|
| 2585 | *
|
|---|
| 2586 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2587 | *****************************************************************************/
|
|---|
| 2588 |
|
|---|
| 2589 | BOOL WIN32API GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,
|
|---|
| 2590 | DWORD dwProcessGroupId)
|
|---|
| 2591 | {
|
|---|
| 2592 | #ifdef DEBUG_LOCAL2
|
|---|
| 2593 | WriteLog("KERNEL32/CONSOLE: OS2GenerateConsoleCtrlEvent(%08x,%08x) not implemented.\n",
|
|---|
| 2594 | dwCtrlEvent,
|
|---|
| 2595 | dwProcessGroupId);
|
|---|
| 2596 | #endif
|
|---|
| 2597 |
|
|---|
| 2598 | return TRUE;
|
|---|
| 2599 | }
|
|---|
| 2600 |
|
|---|
| 2601 |
|
|---|
| 2602 | /*****************************************************************************
|
|---|
| 2603 | * Name :
|
|---|
| 2604 | * Purpose :
|
|---|
| 2605 | * Parameters:
|
|---|
| 2606 | * Variables :
|
|---|
| 2607 | * Result :
|
|---|
| 2608 | * Remark :
|
|---|
| 2609 | * Status :
|
|---|
| 2610 | *
|
|---|
| 2611 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2612 | *****************************************************************************/
|
|---|
| 2613 |
|
|---|
| 2614 | UINT WIN32API GetConsoleCP(VOID)
|
|---|
| 2615 | {
|
|---|
| 2616 | #ifdef DEBUG_LOCAL2
|
|---|
| 2617 | WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCP not implemented.\n");
|
|---|
| 2618 | #endif
|
|---|
| 2619 |
|
|---|
| 2620 | return 1;
|
|---|
| 2621 | }
|
|---|
| 2622 |
|
|---|
| 2623 |
|
|---|
| 2624 | /*****************************************************************************
|
|---|
| 2625 | * Name :
|
|---|
| 2626 | * Purpose :
|
|---|
| 2627 | * Parameters:
|
|---|
| 2628 | * Variables :
|
|---|
| 2629 | * Result :
|
|---|
| 2630 | * Remark :
|
|---|
| 2631 | * Status :
|
|---|
| 2632 | *
|
|---|
| 2633 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2634 | *****************************************************************************/
|
|---|
| 2635 |
|
|---|
| 2636 | BOOL WIN32API GetConsoleCursorInfo(HANDLE hConsoleOutput,
|
|---|
| 2637 | PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
|
|---|
| 2638 | {
|
|---|
| 2639 | BOOL fResult;
|
|---|
| 2640 |
|
|---|
| 2641 | #ifdef DEBUG_LOCAL2
|
|---|
| 2642 | WriteLog("KERNEL32/CONSOLE: OS2GetConsoleCursorInfo(%08x,%08x).\n",
|
|---|
| 2643 | hConsoleOutput,
|
|---|
| 2644 | lpConsoleCursorInfo);
|
|---|
| 2645 | #endif
|
|---|
| 2646 |
|
|---|
| 2647 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 2648 | DRQ_GETCONSOLECURSORINFO,
|
|---|
| 2649 | (ULONG)lpConsoleCursorInfo,
|
|---|
| 2650 | 0,
|
|---|
| 2651 | 0,
|
|---|
| 2652 | 0);
|
|---|
| 2653 |
|
|---|
| 2654 | return fResult;
|
|---|
| 2655 | }
|
|---|
| 2656 |
|
|---|
| 2657 |
|
|---|
| 2658 | /*****************************************************************************
|
|---|
| 2659 | * Name :
|
|---|
| 2660 | * Purpose :
|
|---|
| 2661 | * Parameters:
|
|---|
| 2662 | * Variables :
|
|---|
| 2663 | * Result :
|
|---|
| 2664 | * Remark :
|
|---|
| 2665 | * Status :
|
|---|
| 2666 | *
|
|---|
| 2667 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2668 | *****************************************************************************/
|
|---|
| 2669 |
|
|---|
| 2670 | BOOL WIN32API GetConsoleMode(HANDLE hConsole,
|
|---|
| 2671 | LPDWORD lpMode)
|
|---|
| 2672 | {
|
|---|
| 2673 | BOOL fResult;
|
|---|
| 2674 |
|
|---|
| 2675 | #ifdef DEBUG_LOCAL2
|
|---|
| 2676 | WriteLog("KERNEL32/CONSOLE: OS2GetConsoleMode(%08x,%08x).\n",
|
|---|
| 2677 | hConsole,
|
|---|
| 2678 | lpMode);
|
|---|
| 2679 | #endif
|
|---|
| 2680 |
|
|---|
| 2681 | fResult = (BOOL)HMDeviceRequest(hConsole,
|
|---|
| 2682 | DRQ_GETCONSOLEMODE,
|
|---|
| 2683 | (ULONG) lpMode,
|
|---|
| 2684 | 0,
|
|---|
| 2685 | 0,
|
|---|
| 2686 | 0);
|
|---|
| 2687 |
|
|---|
| 2688 | return fResult;
|
|---|
| 2689 | }
|
|---|
| 2690 |
|
|---|
| 2691 |
|
|---|
| 2692 | /*****************************************************************************
|
|---|
| 2693 | * Name :
|
|---|
| 2694 | * Purpose :
|
|---|
| 2695 | * Parameters:
|
|---|
| 2696 | * Variables :
|
|---|
| 2697 | * Result :
|
|---|
| 2698 | * Remark :
|
|---|
| 2699 | * Status :
|
|---|
| 2700 | *
|
|---|
| 2701 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2702 | *****************************************************************************/
|
|---|
| 2703 |
|
|---|
| 2704 | UINT WIN32API GetConsoleOutputCP(VOID)
|
|---|
| 2705 | {
|
|---|
| 2706 | #ifdef DEBUG_LOCAL2
|
|---|
| 2707 | WriteLog("KERNEL32/CONSOLE: OS2GetConsoleOutputCP not implemented.\n");
|
|---|
| 2708 | #endif
|
|---|
| 2709 |
|
|---|
| 2710 | return 1;
|
|---|
| 2711 | }
|
|---|
| 2712 |
|
|---|
| 2713 |
|
|---|
| 2714 | /*****************************************************************************
|
|---|
| 2715 | * Name :
|
|---|
| 2716 | * Purpose :
|
|---|
| 2717 | * Parameters:
|
|---|
| 2718 | * Variables :
|
|---|
| 2719 | * Result :
|
|---|
| 2720 | * Remark :
|
|---|
| 2721 | * Status :
|
|---|
| 2722 | *
|
|---|
| 2723 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2724 | *****************************************************************************/
|
|---|
| 2725 |
|
|---|
| 2726 | BOOL WIN32API GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,
|
|---|
| 2727 | PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
|
|---|
| 2728 | {
|
|---|
| 2729 | BOOL fResult;
|
|---|
| 2730 |
|
|---|
| 2731 | #ifdef DEBUG_LOCAL2
|
|---|
| 2732 | WriteLog("KERNEL32/CONSOLE: OS2GetConsoleScreenBufferInfo(%08x,%08x).\n",
|
|---|
| 2733 | hConsoleOutput,
|
|---|
| 2734 | lpConsoleScreenBufferInfo);
|
|---|
| 2735 | #endif
|
|---|
| 2736 |
|
|---|
| 2737 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 2738 | DRQ_GETCONSOLESCREENBUFFERINFO,
|
|---|
| 2739 | (ULONG)lpConsoleScreenBufferInfo,
|
|---|
| 2740 | 0,
|
|---|
| 2741 | 0,
|
|---|
| 2742 | 0);
|
|---|
| 2743 |
|
|---|
| 2744 | return fResult;
|
|---|
| 2745 | }
|
|---|
| 2746 |
|
|---|
| 2747 |
|
|---|
| 2748 | /*****************************************************************************
|
|---|
| 2749 | * Name : DWORD WIN32API GetConsoleTitle
|
|---|
| 2750 | * Purpose : Query the current console window title
|
|---|
| 2751 | * Parameters: LPTSTR lpConsoleTitle
|
|---|
| 2752 | * DWORD nSize
|
|---|
| 2753 | * Variables :
|
|---|
| 2754 | * Result : number of copied bytes
|
|---|
| 2755 | * Remark :
|
|---|
| 2756 | * Status : REWRITTEN UNTESTED
|
|---|
| 2757 | *
|
|---|
| 2758 | * Author : Patrick Haller [Thu, 1998/02/12 23:31]
|
|---|
| 2759 | *****************************************************************************/
|
|---|
| 2760 |
|
|---|
| 2761 | DWORD WIN32API GetConsoleTitleA(LPTSTR lpConsoleTitle,
|
|---|
| 2762 | DWORD nSize)
|
|---|
| 2763 | {
|
|---|
| 2764 | ULONG ulLength; /* length of text */
|
|---|
| 2765 |
|
|---|
| 2766 | #ifdef DEBUG_LOCAL2
|
|---|
| 2767 | WriteLog("KERNEL32/CONSOLE: OS2GetConsoleTitleA(%08x,%08x).\n",
|
|---|
| 2768 | lpConsoleTitle,
|
|---|
| 2769 | nSize);
|
|---|
| 2770 | #endif
|
|---|
| 2771 |
|
|---|
| 2772 | if (ConsoleGlobals.pszWindowTitle == NULL) /* is there a window title ? */
|
|---|
| 2773 | return 0; /* abort immediately */
|
|---|
| 2774 |
|
|---|
| 2775 | ulLength = strlen(ConsoleGlobals.pszWindowTitle); /* length of text */
|
|---|
| 2776 |
|
|---|
| 2777 | strncpy(lpConsoleTitle,
|
|---|
| 2778 | ConsoleGlobals.pszWindowTitle,
|
|---|
| 2779 | nSize);
|
|---|
| 2780 | lpConsoleTitle[nSize-1] = 0;
|
|---|
| 2781 |
|
|---|
| 2782 | return (nSize < ulLength) ? nSize : ulLength;
|
|---|
| 2783 | }
|
|---|
| 2784 |
|
|---|
| 2785 |
|
|---|
| 2786 | /*****************************************************************************
|
|---|
| 2787 | * Name : DWORD WIN32API GetConsoleTitle
|
|---|
| 2788 | * Purpose : Query the current console window title
|
|---|
| 2789 | * Parameters: LPTSTR lpConsoleTitle
|
|---|
| 2790 | * DWORD nSize
|
|---|
| 2791 | * Variables :
|
|---|
| 2792 | * Result : number of copied bytes
|
|---|
| 2793 | * Remark :
|
|---|
| 2794 | * Status : REWRITTEN UNTESTED
|
|---|
| 2795 | *
|
|---|
| 2796 | * Author : Patrick Haller [Thu, 1998/02/12 23:31]
|
|---|
| 2797 | *****************************************************************************/
|
|---|
| 2798 |
|
|---|
| 2799 | DWORD WIN32API GetConsoleTitleW(LPWSTR lpConsoleTitle,
|
|---|
| 2800 | DWORD nSize)
|
|---|
| 2801 | {
|
|---|
| 2802 | ULONG ulLength; /* length of text */
|
|---|
| 2803 |
|
|---|
| 2804 | #ifdef DEBUG_LOCAL2
|
|---|
| 2805 | WriteLog("KERNEL32/CONSOLE: GetConsoleTitleW(%08x,%08x)",
|
|---|
| 2806 | lpConsoleTitle,
|
|---|
| 2807 | nSize);
|
|---|
| 2808 | #endif
|
|---|
| 2809 |
|
|---|
| 2810 | if (ConsoleGlobals.pszWindowTitle == NULL) /* is there a window title ? */
|
|---|
| 2811 | return 0; /* abort immediately */
|
|---|
| 2812 |
|
|---|
| 2813 | ulLength = strlen(ConsoleGlobals.pszWindowTitle); /* length of text */
|
|---|
| 2814 |
|
|---|
| 2815 | lstrcpynAtoW(lpConsoleTitle,
|
|---|
| 2816 | ConsoleGlobals.pszWindowTitle,
|
|---|
| 2817 | nSize);
|
|---|
| 2818 |
|
|---|
| 2819 | return (nSize < ulLength) ? nSize : ulLength;
|
|---|
| 2820 | }
|
|---|
| 2821 |
|
|---|
| 2822 |
|
|---|
| 2823 | /*****************************************************************************
|
|---|
| 2824 | * Name : COORD WIN32API GetLargestConsoleWindowSize
|
|---|
| 2825 | * Purpose : Determine maximum AVIO size
|
|---|
| 2826 | * Parameters:
|
|---|
| 2827 | * Variables :
|
|---|
| 2828 | * Result :
|
|---|
| 2829 | * Remark :
|
|---|
| 2830 | * Status :
|
|---|
| 2831 | *
|
|---|
| 2832 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2833 | *****************************************************************************/
|
|---|
| 2834 |
|
|---|
| 2835 | COORD WIN32API GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
|
|---|
| 2836 | {
|
|---|
| 2837 | DWORD dwResult;
|
|---|
| 2838 | COORD coordResult;
|
|---|
| 2839 |
|
|---|
| 2840 | #ifdef DEBUG_LOCAL2
|
|---|
| 2841 | WriteLog("KERNEL32/CONSOLE: OS2GetLargestConsoleWindowSize(%08x).\n",
|
|---|
| 2842 | hConsoleOutput);
|
|---|
| 2843 | #endif
|
|---|
| 2844 |
|
|---|
| 2845 | dwResult = HMDeviceRequest(hConsoleOutput,
|
|---|
| 2846 | DRQ_GETLARGESTCONSOLEWINDOWSIZE,
|
|---|
| 2847 | 0,
|
|---|
| 2848 | 0,
|
|---|
| 2849 | 0,
|
|---|
| 2850 | 0);
|
|---|
| 2851 |
|
|---|
| 2852 | ULONG2COORD(coordResult,dwResult)
|
|---|
| 2853 | return ( coordResult );
|
|---|
| 2854 | }
|
|---|
| 2855 |
|
|---|
| 2856 |
|
|---|
| 2857 | /*****************************************************************************
|
|---|
| 2858 | * Name :
|
|---|
| 2859 | * Purpose :
|
|---|
| 2860 | * Parameters:
|
|---|
| 2861 | * Variables :
|
|---|
| 2862 | * Result :
|
|---|
| 2863 | * Remark :
|
|---|
| 2864 | * Status :
|
|---|
| 2865 | *
|
|---|
| 2866 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2867 | *****************************************************************************/
|
|---|
| 2868 |
|
|---|
| 2869 | BOOL WIN32API GetNumberOfConsoleInputEvents(HANDLE hConsoleInput,
|
|---|
| 2870 | LPDWORD lpNumberOfEvents)
|
|---|
| 2871 | {
|
|---|
| 2872 | BOOL fResult;
|
|---|
| 2873 |
|
|---|
| 2874 | #ifdef DEBUG_LOCAL2
|
|---|
| 2875 | WriteLog("KERNEL32/CONSOLE: OS2GetNumberOfConsoleInputEvents(%08x,%08x).\n",
|
|---|
| 2876 | hConsoleInput,
|
|---|
| 2877 | lpNumberOfEvents);
|
|---|
| 2878 | #endif
|
|---|
| 2879 |
|
|---|
| 2880 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 2881 | DRQ_GETNUMBEROFCONSOLEINPUTEVENTS,
|
|---|
| 2882 | (ULONG)lpNumberOfEvents,
|
|---|
| 2883 | 0,
|
|---|
| 2884 | 0,
|
|---|
| 2885 | 0);
|
|---|
| 2886 |
|
|---|
| 2887 | return fResult;
|
|---|
| 2888 | }
|
|---|
| 2889 |
|
|---|
| 2890 |
|
|---|
| 2891 | /*****************************************************************************
|
|---|
| 2892 | * Name :
|
|---|
| 2893 | * Purpose :
|
|---|
| 2894 | * Parameters:
|
|---|
| 2895 | * Variables :
|
|---|
| 2896 | * Result :
|
|---|
| 2897 | * Remark :
|
|---|
| 2898 | * Status :
|
|---|
| 2899 | *
|
|---|
| 2900 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2901 | *****************************************************************************/
|
|---|
| 2902 |
|
|---|
| 2903 | BOOL WIN32API GetNumberOfConsoleMouseButtons(LPDWORD lpcNumberOfMouseButtons)
|
|---|
| 2904 | {
|
|---|
| 2905 | LONG lMouseButtons;
|
|---|
| 2906 |
|
|---|
| 2907 | #ifdef DEBUG_LOCAL2
|
|---|
| 2908 | WriteLog("KERNEL32/CONSOLE: OS2GetNumberOfConsoleMouseButtons(%08x).\n",
|
|---|
| 2909 | lpcNumberOfMouseButtons);
|
|---|
| 2910 | #endif
|
|---|
| 2911 |
|
|---|
| 2912 | lMouseButtons = WinQuerySysValue(HWND_DESKTOP, /* query PM for that */
|
|---|
| 2913 | SV_CMOUSEBUTTONS);
|
|---|
| 2914 |
|
|---|
| 2915 | *lpcNumberOfMouseButtons = (DWORD)lMouseButtons;
|
|---|
| 2916 |
|
|---|
| 2917 | return TRUE;
|
|---|
| 2918 | }
|
|---|
| 2919 |
|
|---|
| 2920 |
|
|---|
| 2921 | /*****************************************************************************
|
|---|
| 2922 | * Name :
|
|---|
| 2923 | * Purpose :
|
|---|
| 2924 | * Parameters:
|
|---|
| 2925 | * Variables :
|
|---|
| 2926 | * Result :
|
|---|
| 2927 | * Remark :
|
|---|
| 2928 | * Status :
|
|---|
| 2929 | *
|
|---|
| 2930 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2931 | *****************************************************************************/
|
|---|
| 2932 |
|
|---|
| 2933 | BOOL WIN32API PeekConsoleInputW(HANDLE hConsoleInput,
|
|---|
| 2934 | PINPUT_RECORD pirBuffer,
|
|---|
| 2935 | DWORD cInRecords,
|
|---|
| 2936 | LPDWORD lpcRead)
|
|---|
| 2937 | {
|
|---|
| 2938 | BOOL fResult;
|
|---|
| 2939 |
|
|---|
| 2940 | #ifdef DEBUG_LOCAL2
|
|---|
| 2941 | WriteLog("KERNEL32/CONSOLE: OS2PeekConsoleInputW(%08x,%08x,%08x,%08x).\n",
|
|---|
| 2942 | hConsoleInput,
|
|---|
| 2943 | pirBuffer,
|
|---|
| 2944 | cInRecords,
|
|---|
| 2945 | lpcRead);
|
|---|
| 2946 | #endif
|
|---|
| 2947 |
|
|---|
| 2948 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 2949 | DRQ_PEEKCONSOLEINPUTW,
|
|---|
| 2950 | (ULONG)pirBuffer,
|
|---|
| 2951 | (ULONG)cInRecords,
|
|---|
| 2952 | (ULONG)lpcRead,
|
|---|
| 2953 | 0);
|
|---|
| 2954 |
|
|---|
| 2955 | return fResult;
|
|---|
| 2956 | }
|
|---|
| 2957 |
|
|---|
| 2958 |
|
|---|
| 2959 | /*****************************************************************************
|
|---|
| 2960 | * Name :
|
|---|
| 2961 | * Purpose :
|
|---|
| 2962 | * Parameters:
|
|---|
| 2963 | * Variables :
|
|---|
| 2964 | * Result :
|
|---|
| 2965 | * Remark :
|
|---|
| 2966 | * Status :
|
|---|
| 2967 | *
|
|---|
| 2968 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 2969 | *****************************************************************************/
|
|---|
| 2970 |
|
|---|
| 2971 | BOOL WIN32API PeekConsoleInputA(HANDLE hConsoleInput,
|
|---|
| 2972 | PINPUT_RECORD pirBuffer,
|
|---|
| 2973 | DWORD cInRecords,
|
|---|
| 2974 | LPDWORD lpcRead)
|
|---|
| 2975 | {
|
|---|
| 2976 | BOOL fResult;
|
|---|
| 2977 |
|
|---|
| 2978 | #ifdef DEBUG_LOCAL2
|
|---|
| 2979 | WriteLog("KERNEL32/CONSOLE: OS2PeekConsoleInputA(%08x,%08x,%08x,%08x).\n",
|
|---|
| 2980 | hConsoleInput,
|
|---|
| 2981 | pirBuffer,
|
|---|
| 2982 | cInRecords,
|
|---|
| 2983 | lpcRead);
|
|---|
| 2984 | #endif
|
|---|
| 2985 |
|
|---|
| 2986 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 2987 | DRQ_PEEKCONSOLEINPUTA,
|
|---|
| 2988 | (ULONG)pirBuffer,
|
|---|
| 2989 | (ULONG)cInRecords,
|
|---|
| 2990 | (ULONG)lpcRead,
|
|---|
| 2991 | 0);
|
|---|
| 2992 |
|
|---|
| 2993 | return fResult;
|
|---|
| 2994 | }
|
|---|
| 2995 |
|
|---|
| 2996 |
|
|---|
| 2997 | /*****************************************************************************
|
|---|
| 2998 | * Name :
|
|---|
| 2999 | * Purpose :
|
|---|
| 3000 | * Parameters:
|
|---|
| 3001 | * Variables :
|
|---|
| 3002 | * Result :
|
|---|
| 3003 | * Remark :
|
|---|
| 3004 | * Status :
|
|---|
| 3005 | *
|
|---|
| 3006 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3007 | *****************************************************************************/
|
|---|
| 3008 |
|
|---|
| 3009 | BOOL WIN32API ReadConsoleA(HANDLE hConsoleInput,
|
|---|
| 3010 | LPVOID lpvBuffer,
|
|---|
| 3011 | DWORD cchToRead,
|
|---|
| 3012 | LPDWORD lpcchRead,
|
|---|
| 3013 | LPVOID lpvReserved)
|
|---|
| 3014 | {
|
|---|
| 3015 | BOOL fResult;
|
|---|
| 3016 |
|
|---|
| 3017 | #ifdef DEBUG_LOCAL2
|
|---|
| 3018 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleA(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3019 | hConsoleInput,
|
|---|
| 3020 | lpvBuffer,
|
|---|
| 3021 | cchToRead,
|
|---|
| 3022 | lpcchRead,
|
|---|
| 3023 | lpvReserved);
|
|---|
| 3024 | #endif
|
|---|
| 3025 |
|
|---|
| 3026 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 3027 | DRQ_READCONSOLEA,
|
|---|
| 3028 | (ULONG)lpvBuffer,
|
|---|
| 3029 | (ULONG)cchToRead,
|
|---|
| 3030 | (ULONG)lpcchRead,
|
|---|
| 3031 | (ULONG)lpvReserved);
|
|---|
| 3032 |
|
|---|
| 3033 | return fResult;
|
|---|
| 3034 | }
|
|---|
| 3035 |
|
|---|
| 3036 |
|
|---|
| 3037 | /*****************************************************************************
|
|---|
| 3038 | * Name :
|
|---|
| 3039 | * Purpose :
|
|---|
| 3040 | * Parameters:
|
|---|
| 3041 | * Variables :
|
|---|
| 3042 | * Result :
|
|---|
| 3043 | * Remark :
|
|---|
| 3044 | * Status :
|
|---|
| 3045 | *
|
|---|
| 3046 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3047 | *****************************************************************************/
|
|---|
| 3048 |
|
|---|
| 3049 | BOOL WIN32API ReadConsoleW(HANDLE hConsoleInput,
|
|---|
| 3050 | LPVOID lpvBuffer,
|
|---|
| 3051 | DWORD cchToRead,
|
|---|
| 3052 | LPDWORD lpcchRead,
|
|---|
| 3053 | LPVOID lpvReserved)
|
|---|
| 3054 | {
|
|---|
| 3055 | BOOL fResult;
|
|---|
| 3056 |
|
|---|
| 3057 | #ifdef DEBUG_LOCAL2
|
|---|
| 3058 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleW(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3059 | hConsoleInput,
|
|---|
| 3060 | lpvBuffer,
|
|---|
| 3061 | cchToRead,
|
|---|
| 3062 | lpcchRead,
|
|---|
| 3063 | lpvReserved);
|
|---|
| 3064 | #endif
|
|---|
| 3065 |
|
|---|
| 3066 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 3067 | DRQ_READCONSOLEW,
|
|---|
| 3068 | (ULONG)lpvBuffer,
|
|---|
| 3069 | (ULONG)cchToRead,
|
|---|
| 3070 | (ULONG)lpcchRead,
|
|---|
| 3071 | (ULONG)lpvReserved);
|
|---|
| 3072 |
|
|---|
| 3073 | return fResult;
|
|---|
| 3074 | }
|
|---|
| 3075 |
|
|---|
| 3076 |
|
|---|
| 3077 | /*****************************************************************************
|
|---|
| 3078 | * Name :
|
|---|
| 3079 | * Purpose :
|
|---|
| 3080 | * Parameters:
|
|---|
| 3081 | * Variables :
|
|---|
| 3082 | * Result :
|
|---|
| 3083 | * Remark :
|
|---|
| 3084 | * Status :
|
|---|
| 3085 | *
|
|---|
| 3086 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3087 | *****************************************************************************/
|
|---|
| 3088 |
|
|---|
| 3089 | BOOL WIN32API ReadConsoleInputA(HANDLE hConsoleInput,
|
|---|
| 3090 | PINPUT_RECORD pirBuffer,
|
|---|
| 3091 | DWORD cInRecords,
|
|---|
| 3092 | LPDWORD lpcRead)
|
|---|
| 3093 | {
|
|---|
| 3094 | BOOL fResult;
|
|---|
| 3095 |
|
|---|
| 3096 | #ifdef DEBUG_LOCAL2
|
|---|
| 3097 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputA(%08x,%08x,%08x,%08x).\n",
|
|---|
| 3098 | hConsoleInput,
|
|---|
| 3099 | pirBuffer,
|
|---|
| 3100 | cInRecords,
|
|---|
| 3101 | lpcRead);
|
|---|
| 3102 | #endif
|
|---|
| 3103 |
|
|---|
| 3104 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 3105 | DRQ_READCONSOLEINPUTA,
|
|---|
| 3106 | (ULONG)pirBuffer,
|
|---|
| 3107 | (ULONG)cInRecords,
|
|---|
| 3108 | (ULONG)lpcRead,
|
|---|
| 3109 | 0);
|
|---|
| 3110 |
|
|---|
| 3111 | return fResult;
|
|---|
| 3112 | }
|
|---|
| 3113 |
|
|---|
| 3114 |
|
|---|
| 3115 | /*****************************************************************************
|
|---|
| 3116 | * Name :
|
|---|
| 3117 | * Purpose :
|
|---|
| 3118 | * Parameters:
|
|---|
| 3119 | * Variables :
|
|---|
| 3120 | * Result :
|
|---|
| 3121 | * Remark :
|
|---|
| 3122 | * Status :
|
|---|
| 3123 | *
|
|---|
| 3124 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3125 | *****************************************************************************/
|
|---|
| 3126 |
|
|---|
| 3127 | BOOL WIN32API ReadConsoleInputW(HANDLE hConsoleInput,
|
|---|
| 3128 | PINPUT_RECORD pirBuffer,
|
|---|
| 3129 | DWORD cInRecords,
|
|---|
| 3130 | LPDWORD lpcRead)
|
|---|
| 3131 | {
|
|---|
| 3132 | BOOL fResult;
|
|---|
| 3133 |
|
|---|
| 3134 | #ifdef DEBUG_LOCAL2
|
|---|
| 3135 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleInputW(%08x,%08x,%08x,%08x).\n",
|
|---|
| 3136 | hConsoleInput,
|
|---|
| 3137 | pirBuffer,
|
|---|
| 3138 | cInRecords,
|
|---|
| 3139 | lpcRead);
|
|---|
| 3140 | #endif
|
|---|
| 3141 |
|
|---|
| 3142 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 3143 | DRQ_READCONSOLEINPUTW,
|
|---|
| 3144 | (ULONG)pirBuffer,
|
|---|
| 3145 | (ULONG)cInRecords,
|
|---|
| 3146 | (ULONG)lpcRead,
|
|---|
| 3147 | 0);
|
|---|
| 3148 |
|
|---|
| 3149 | return fResult;
|
|---|
| 3150 | }
|
|---|
| 3151 |
|
|---|
| 3152 |
|
|---|
| 3153 | /*****************************************************************************
|
|---|
| 3154 | * Name :
|
|---|
| 3155 | * Purpose :
|
|---|
| 3156 | * Parameters:
|
|---|
| 3157 | * Variables :
|
|---|
| 3158 | * Result :
|
|---|
| 3159 | * Remark :
|
|---|
| 3160 | * Status :
|
|---|
| 3161 | *
|
|---|
| 3162 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3163 | *****************************************************************************/
|
|---|
| 3164 |
|
|---|
| 3165 | BOOL WIN32API ReadConsoleOutputA(HANDLE hConsoleOutput,
|
|---|
| 3166 | PCHAR_INFO pchiDestBuffer,
|
|---|
| 3167 | COORD coordDestBufferSize,
|
|---|
| 3168 | COORD coordDestBufferCoord,
|
|---|
| 3169 | PSMALL_RECT psrctSourceRect)
|
|---|
| 3170 | {
|
|---|
| 3171 | BOOL fResult;
|
|---|
| 3172 |
|
|---|
| 3173 | #ifdef DEBUG_LOCAL2
|
|---|
| 3174 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3175 | hConsoleOutput,
|
|---|
| 3176 | pchiDestBuffer,
|
|---|
| 3177 | coordDestBufferSize,
|
|---|
| 3178 | coordDestBufferCoord,
|
|---|
| 3179 | psrctSourceRect);
|
|---|
| 3180 | #endif
|
|---|
| 3181 |
|
|---|
| 3182 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3183 | DRQ_READCONSOLEOUTPUTA,
|
|---|
| 3184 | (ULONG)pchiDestBuffer,
|
|---|
| 3185 | COORD2ULONG(coordDestBufferSize),
|
|---|
| 3186 | COORD2ULONG(coordDestBufferCoord),
|
|---|
| 3187 | (ULONG)psrctSourceRect);
|
|---|
| 3188 |
|
|---|
| 3189 | return fResult;
|
|---|
| 3190 | }
|
|---|
| 3191 |
|
|---|
| 3192 |
|
|---|
| 3193 | /*****************************************************************************
|
|---|
| 3194 | * Name :
|
|---|
| 3195 | * Purpose :
|
|---|
| 3196 | * Parameters:
|
|---|
| 3197 | * Variables :
|
|---|
| 3198 | * Result :
|
|---|
| 3199 | * Remark :
|
|---|
| 3200 | * Status :
|
|---|
| 3201 | *
|
|---|
| 3202 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3203 | *****************************************************************************/
|
|---|
| 3204 |
|
|---|
| 3205 | BOOL WIN32API ReadConsoleOutputW(HANDLE hConsoleOutput,
|
|---|
| 3206 | PCHAR_INFO pchiDestBuffer,
|
|---|
| 3207 | COORD coordDestBufferSize,
|
|---|
| 3208 | COORD coordDestBufferCoord,
|
|---|
| 3209 | PSMALL_RECT psrctSourceRect)
|
|---|
| 3210 | {
|
|---|
| 3211 | BOOL fResult;
|
|---|
| 3212 |
|
|---|
| 3213 | #ifdef DEBUG_LOCAL2
|
|---|
| 3214 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3215 | hConsoleOutput,
|
|---|
| 3216 | pchiDestBuffer,
|
|---|
| 3217 | coordDestBufferSize,
|
|---|
| 3218 | coordDestBufferCoord,
|
|---|
| 3219 | psrctSourceRect);
|
|---|
| 3220 | #endif
|
|---|
| 3221 |
|
|---|
| 3222 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3223 | DRQ_READCONSOLEOUTPUTW,
|
|---|
| 3224 | (ULONG)pchiDestBuffer,
|
|---|
| 3225 | COORD2ULONG(coordDestBufferSize),
|
|---|
| 3226 | COORD2ULONG(coordDestBufferCoord),
|
|---|
| 3227 | (ULONG)psrctSourceRect);
|
|---|
| 3228 |
|
|---|
| 3229 | return fResult;
|
|---|
| 3230 | }
|
|---|
| 3231 |
|
|---|
| 3232 |
|
|---|
| 3233 | /*****************************************************************************
|
|---|
| 3234 | * Name :
|
|---|
| 3235 | * Purpose :
|
|---|
| 3236 | * Parameters:
|
|---|
| 3237 | * Variables :
|
|---|
| 3238 | * Result :
|
|---|
| 3239 | * Remark :
|
|---|
| 3240 | * Status :
|
|---|
| 3241 | *
|
|---|
| 3242 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3243 | *****************************************************************************/
|
|---|
| 3244 |
|
|---|
| 3245 | BOOL WIN32API ReadConsoleOutputAttribute(HANDLE hConsoleOutput,
|
|---|
| 3246 | LPWORD lpwAttribute,
|
|---|
| 3247 | DWORD cReadCells,
|
|---|
| 3248 | COORD coordReadCoord,
|
|---|
| 3249 | LPDWORD lpcNumberRead)
|
|---|
| 3250 | {
|
|---|
| 3251 | BOOL fResult;
|
|---|
| 3252 |
|
|---|
| 3253 | #ifdef DEBUG_LOCAL2
|
|---|
| 3254 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3255 | hConsoleOutput,
|
|---|
| 3256 | lpwAttribute,
|
|---|
| 3257 | cReadCells,
|
|---|
| 3258 | coordReadCoord,
|
|---|
| 3259 | lpcNumberRead);
|
|---|
| 3260 | #endif
|
|---|
| 3261 |
|
|---|
| 3262 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3263 | DRQ_READCONSOLEOUTPUTATTRIBUTE,
|
|---|
| 3264 | (ULONG)lpwAttribute,
|
|---|
| 3265 | (ULONG)cReadCells,
|
|---|
| 3266 | COORD2ULONG(coordReadCoord),
|
|---|
| 3267 | (ULONG)lpcNumberRead);
|
|---|
| 3268 |
|
|---|
| 3269 | return fResult;
|
|---|
| 3270 | }
|
|---|
| 3271 |
|
|---|
| 3272 |
|
|---|
| 3273 | /*****************************************************************************
|
|---|
| 3274 | * Name :
|
|---|
| 3275 | * Purpose :
|
|---|
| 3276 | * Parameters:
|
|---|
| 3277 | * Variables :
|
|---|
| 3278 | * Result :
|
|---|
| 3279 | * Remark :
|
|---|
| 3280 | * Status :
|
|---|
| 3281 | *
|
|---|
| 3282 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3283 | *****************************************************************************/
|
|---|
| 3284 |
|
|---|
| 3285 | BOOL WIN32API ReadConsoleOutputCharacterA(HANDLE hConsoleOutput,
|
|---|
| 3286 | LPTSTR lpReadBuffer,
|
|---|
| 3287 | DWORD cchRead,
|
|---|
| 3288 | COORD coordReadCoord,
|
|---|
| 3289 | LPDWORD lpcNumberRead)
|
|---|
| 3290 | {
|
|---|
| 3291 | BOOL fResult;
|
|---|
| 3292 |
|
|---|
| 3293 | #ifdef DEBUG_LOCAL2
|
|---|
| 3294 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3295 | hConsoleOutput,
|
|---|
| 3296 | lpReadBuffer,
|
|---|
| 3297 | cchRead,
|
|---|
| 3298 | coordReadCoord,
|
|---|
| 3299 | lpcNumberRead);
|
|---|
| 3300 | #endif
|
|---|
| 3301 |
|
|---|
| 3302 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3303 | DRQ_READCONSOLEOUTPUTCHARACTERA,
|
|---|
| 3304 | (ULONG)lpReadBuffer,
|
|---|
| 3305 | (ULONG)cchRead,
|
|---|
| 3306 | COORD2ULONG(coordReadCoord),
|
|---|
| 3307 | (ULONG)lpcNumberRead);
|
|---|
| 3308 |
|
|---|
| 3309 | return fResult;
|
|---|
| 3310 | }
|
|---|
| 3311 |
|
|---|
| 3312 |
|
|---|
| 3313 | /*****************************************************************************
|
|---|
| 3314 | * Name :
|
|---|
| 3315 | * Purpose :
|
|---|
| 3316 | * Parameters:
|
|---|
| 3317 | * Variables :
|
|---|
| 3318 | * Result :
|
|---|
| 3319 | * Remark :
|
|---|
| 3320 | * Status :
|
|---|
| 3321 | *
|
|---|
| 3322 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3323 | *****************************************************************************/
|
|---|
| 3324 |
|
|---|
| 3325 | BOOL WIN32API ReadConsoleOutputCharacterW(HANDLE hConsoleOutput,
|
|---|
| 3326 | LPTSTR lpReadBuffer,
|
|---|
| 3327 | DWORD cchRead,
|
|---|
| 3328 | COORD coordReadCoord,
|
|---|
| 3329 | LPDWORD lpcNumberRead)
|
|---|
| 3330 | {
|
|---|
| 3331 | BOOL fResult;
|
|---|
| 3332 |
|
|---|
| 3333 | #ifdef DEBUG_LOCAL2
|
|---|
| 3334 | WriteLog("KERNEL32/CONSOLE: OS2ReadConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3335 | hConsoleOutput,
|
|---|
| 3336 | lpReadBuffer,
|
|---|
| 3337 | cchRead,
|
|---|
| 3338 | coordReadCoord,
|
|---|
| 3339 | lpcNumberRead);
|
|---|
| 3340 | #endif
|
|---|
| 3341 |
|
|---|
| 3342 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3343 | DRQ_READCONSOLEOUTPUTCHARACTERW,
|
|---|
| 3344 | (ULONG)lpReadBuffer,
|
|---|
| 3345 | (ULONG)cchRead,
|
|---|
| 3346 | COORD2ULONG(coordReadCoord),
|
|---|
| 3347 | (ULONG)lpcNumberRead);
|
|---|
| 3348 |
|
|---|
| 3349 | return fResult;
|
|---|
| 3350 | }
|
|---|
| 3351 |
|
|---|
| 3352 |
|
|---|
| 3353 | /*****************************************************************************
|
|---|
| 3354 | * Name :
|
|---|
| 3355 | * Purpose :
|
|---|
| 3356 | * Parameters:
|
|---|
| 3357 | * Variables :
|
|---|
| 3358 | * Result :
|
|---|
| 3359 | * Remark :
|
|---|
| 3360 | * Status :
|
|---|
| 3361 | *
|
|---|
| 3362 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3363 | *****************************************************************************/
|
|---|
| 3364 |
|
|---|
| 3365 | BOOL WIN32API ScrollConsoleScreenBufferA(HANDLE hConsoleOutput,
|
|---|
| 3366 | PSMALL_RECT psrctSourceRect,
|
|---|
| 3367 | PSMALL_RECT psrctClipRect,
|
|---|
| 3368 | COORD coordDestOrigin,
|
|---|
| 3369 | PCHAR_INFO pchiFill)
|
|---|
| 3370 | {
|
|---|
| 3371 | BOOL fResult;
|
|---|
| 3372 |
|
|---|
| 3373 | #ifdef DEBUG_LOCAL2
|
|---|
| 3374 | WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferA(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3375 | hConsoleOutput,
|
|---|
| 3376 | psrctSourceRect,
|
|---|
| 3377 | psrctClipRect,
|
|---|
| 3378 | coordDestOrigin,
|
|---|
| 3379 | pchiFill);
|
|---|
| 3380 | #endif
|
|---|
| 3381 |
|
|---|
| 3382 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3383 | DRQ_SCROLLCONSOLESCREENBUFFERA,
|
|---|
| 3384 | (ULONG)psrctSourceRect,
|
|---|
| 3385 | (ULONG)psrctClipRect,
|
|---|
| 3386 | COORD2ULONG(coordDestOrigin),
|
|---|
| 3387 | (ULONG)pchiFill);
|
|---|
| 3388 |
|
|---|
| 3389 | return fResult;
|
|---|
| 3390 | }
|
|---|
| 3391 |
|
|---|
| 3392 |
|
|---|
| 3393 | /*****************************************************************************
|
|---|
| 3394 | * Name :
|
|---|
| 3395 | * Purpose :
|
|---|
| 3396 | * Parameters:
|
|---|
| 3397 | * Variables :
|
|---|
| 3398 | * Result :
|
|---|
| 3399 | * Remark :
|
|---|
| 3400 | * Status :
|
|---|
| 3401 | *
|
|---|
| 3402 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3403 | *****************************************************************************/
|
|---|
| 3404 |
|
|---|
| 3405 | BOOL WIN32API ScrollConsoleScreenBufferW(HANDLE hConsoleOutput,
|
|---|
| 3406 | PSMALL_RECT psrctSourceRect,
|
|---|
| 3407 | PSMALL_RECT psrctClipRect,
|
|---|
| 3408 | COORD coordDestOrigin,
|
|---|
| 3409 | PCHAR_INFO pchiFill)
|
|---|
| 3410 | {
|
|---|
| 3411 | BOOL fResult;
|
|---|
| 3412 |
|
|---|
| 3413 | #ifdef DEBUG_LOCAL2
|
|---|
| 3414 | WriteLog("KERNEL32/CONSOLE: OS2ScrollConsoleScreenBufferW(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3415 | hConsoleOutput,
|
|---|
| 3416 | psrctSourceRect,
|
|---|
| 3417 | psrctClipRect,
|
|---|
| 3418 | coordDestOrigin,
|
|---|
| 3419 | pchiFill);
|
|---|
| 3420 | #endif
|
|---|
| 3421 |
|
|---|
| 3422 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3423 | DRQ_SCROLLCONSOLESCREENBUFFERW,
|
|---|
| 3424 | (ULONG)psrctSourceRect,
|
|---|
| 3425 | (ULONG)psrctClipRect,
|
|---|
| 3426 | COORD2ULONG(coordDestOrigin),
|
|---|
| 3427 | (ULONG)pchiFill);
|
|---|
| 3428 |
|
|---|
| 3429 | return fResult;
|
|---|
| 3430 | }
|
|---|
| 3431 |
|
|---|
| 3432 | /*****************************************************************************
|
|---|
| 3433 | * Name :
|
|---|
| 3434 | * Purpose :
|
|---|
| 3435 | * Parameters:
|
|---|
| 3436 | * Variables :
|
|---|
| 3437 | * Result :
|
|---|
| 3438 | * Remark :
|
|---|
| 3439 | * Status :
|
|---|
| 3440 | *
|
|---|
| 3441 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3442 | *****************************************************************************/
|
|---|
| 3443 |
|
|---|
| 3444 | BOOL WIN32API SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
|
|---|
| 3445 | {
|
|---|
| 3446 | BOOL fResult;
|
|---|
| 3447 |
|
|---|
| 3448 | #ifdef DEBUG_LOCAL2
|
|---|
| 3449 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleActiveScreenBuffer(%08x).\n",
|
|---|
| 3450 | hConsoleOutput);
|
|---|
| 3451 | #endif
|
|---|
| 3452 |
|
|---|
| 3453 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3454 | DRQ_SETCONSOLEACTIVESCREENBUFFER,
|
|---|
| 3455 | 0,
|
|---|
| 3456 | 0,
|
|---|
| 3457 | 0,
|
|---|
| 3458 | 0);
|
|---|
| 3459 |
|
|---|
| 3460 | return fResult;
|
|---|
| 3461 | }
|
|---|
| 3462 |
|
|---|
| 3463 |
|
|---|
| 3464 | /*****************************************************************************
|
|---|
| 3465 | * Name :
|
|---|
| 3466 | * Purpose :
|
|---|
| 3467 | * Parameters:
|
|---|
| 3468 | * Variables :
|
|---|
| 3469 | * Result :
|
|---|
| 3470 | * Remark :
|
|---|
| 3471 | * Status :
|
|---|
| 3472 | *
|
|---|
| 3473 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3474 | *****************************************************************************/
|
|---|
| 3475 |
|
|---|
| 3476 | BOOL WIN32API SetConsoleCP(UINT IDCodePage)
|
|---|
| 3477 | {
|
|---|
| 3478 | #ifdef DEBUG_LOCAL2
|
|---|
| 3479 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCP(%08x) not implemented.\n",
|
|---|
| 3480 | IDCodePage);
|
|---|
| 3481 | #endif
|
|---|
| 3482 |
|
|---|
| 3483 | return TRUE;
|
|---|
| 3484 | }
|
|---|
| 3485 |
|
|---|
| 3486 |
|
|---|
| 3487 | /*****************************************************************************
|
|---|
| 3488 | * Name :
|
|---|
| 3489 | * Purpose :
|
|---|
| 3490 | * Parameters:
|
|---|
| 3491 | * Variables :
|
|---|
| 3492 | * Result :
|
|---|
| 3493 | * Remark :
|
|---|
| 3494 | * Status :
|
|---|
| 3495 | *
|
|---|
| 3496 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3497 | *****************************************************************************/
|
|---|
| 3498 |
|
|---|
| 3499 | BOOL WIN32API SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine,
|
|---|
| 3500 | BOOL fAdd)
|
|---|
| 3501 | {
|
|---|
| 3502 | #ifdef DEBUG_LOCAL2
|
|---|
| 3503 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCtrlHandler(%08x,%08x) not implemented.\n",
|
|---|
| 3504 | pHandlerRoutine,
|
|---|
| 3505 | fAdd);
|
|---|
| 3506 | #endif
|
|---|
| 3507 |
|
|---|
| 3508 | return TRUE;
|
|---|
| 3509 | }
|
|---|
| 3510 |
|
|---|
| 3511 |
|
|---|
| 3512 | /*****************************************************************************
|
|---|
| 3513 | * Name :
|
|---|
| 3514 | * Purpose :
|
|---|
| 3515 | * Parameters:
|
|---|
| 3516 | * Variables :
|
|---|
| 3517 | * Result :
|
|---|
| 3518 | * Remark :
|
|---|
| 3519 | * Status :
|
|---|
| 3520 | *
|
|---|
| 3521 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3522 | *****************************************************************************/
|
|---|
| 3523 |
|
|---|
| 3524 | BOOL WIN32API SetConsoleCursorInfo(HANDLE hConsoleOutput,
|
|---|
| 3525 | PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
|
|---|
| 3526 | {
|
|---|
| 3527 | BOOL fResult;
|
|---|
| 3528 |
|
|---|
| 3529 | #ifdef DEBUG_LOCAL2
|
|---|
| 3530 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorInfo(%08x,%08x).\n",
|
|---|
| 3531 | hConsoleOutput,
|
|---|
| 3532 | lpConsoleCursorInfo);
|
|---|
| 3533 | #endif
|
|---|
| 3534 |
|
|---|
| 3535 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3536 | DRQ_SETCONSOLECURSORINFO,
|
|---|
| 3537 | (ULONG)lpConsoleCursorInfo,
|
|---|
| 3538 | 0,
|
|---|
| 3539 | 0,
|
|---|
| 3540 | 0);
|
|---|
| 3541 |
|
|---|
| 3542 | return fResult;
|
|---|
| 3543 | }
|
|---|
| 3544 |
|
|---|
| 3545 |
|
|---|
| 3546 | /*****************************************************************************
|
|---|
| 3547 | * Name :
|
|---|
| 3548 | * Purpose :
|
|---|
| 3549 | * Parameters:
|
|---|
| 3550 | * Variables :
|
|---|
| 3551 | * Result :
|
|---|
| 3552 | * Remark :
|
|---|
| 3553 | * Status :
|
|---|
| 3554 | *
|
|---|
| 3555 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3556 |
|
|---|
| 3557 | *****************************************************************************/
|
|---|
| 3558 |
|
|---|
| 3559 | BOOL WIN32API SetConsoleCursorPosition(HANDLE hConsoleOutput,
|
|---|
| 3560 | COORD coordCursor)
|
|---|
| 3561 | {
|
|---|
| 3562 | BOOL fResult;
|
|---|
| 3563 |
|
|---|
| 3564 | #ifdef DEBUG_LOCAL2
|
|---|
| 3565 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCursorPosition(%08x,%08x).\n",
|
|---|
| 3566 | hConsoleOutput,
|
|---|
| 3567 | coordCursor);
|
|---|
| 3568 | #endif
|
|---|
| 3569 |
|
|---|
| 3570 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3571 | DRQ_SETCONSOLECURSORPOSITION,
|
|---|
| 3572 | COORD2ULONG(coordCursor),
|
|---|
| 3573 | 0,
|
|---|
| 3574 | 0,
|
|---|
| 3575 | 0);
|
|---|
| 3576 |
|
|---|
| 3577 | return fResult;
|
|---|
| 3578 | }
|
|---|
| 3579 |
|
|---|
| 3580 |
|
|---|
| 3581 | /*****************************************************************************
|
|---|
| 3582 | * Name :
|
|---|
| 3583 | * Purpose :
|
|---|
| 3584 | * Parameters:
|
|---|
| 3585 | * Variables :
|
|---|
| 3586 | * Result :
|
|---|
| 3587 | * Remark :
|
|---|
| 3588 | * Status :
|
|---|
| 3589 | *
|
|---|
| 3590 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3591 | *****************************************************************************/
|
|---|
| 3592 |
|
|---|
| 3593 | BOOL WIN32API SetConsoleMode(HANDLE hConsole,
|
|---|
| 3594 | DWORD fdwMode)
|
|---|
| 3595 | {
|
|---|
| 3596 | BOOL fResult;
|
|---|
| 3597 |
|
|---|
| 3598 | #ifdef DEBUG_LOCAL2
|
|---|
| 3599 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleMode(%08x,%08x).\n",
|
|---|
| 3600 | hConsole,
|
|---|
| 3601 | fdwMode);
|
|---|
| 3602 | #endif
|
|---|
| 3603 |
|
|---|
| 3604 | fResult = (BOOL)HMDeviceRequest(hConsole,
|
|---|
| 3605 | DRQ_SETCONSOLEMODE,
|
|---|
| 3606 | (ULONG)fdwMode,
|
|---|
| 3607 | 0,
|
|---|
| 3608 | 0,
|
|---|
| 3609 | 0);
|
|---|
| 3610 |
|
|---|
| 3611 | return fResult;
|
|---|
| 3612 | }
|
|---|
| 3613 |
|
|---|
| 3614 |
|
|---|
| 3615 | /*****************************************************************************
|
|---|
| 3616 | * Name :
|
|---|
| 3617 | * Purpose :
|
|---|
| 3618 | * Parameters:
|
|---|
| 3619 | * Variables :
|
|---|
| 3620 | * Result :
|
|---|
| 3621 | * Remark :
|
|---|
| 3622 | * Status :
|
|---|
| 3623 | *
|
|---|
| 3624 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3625 | *****************************************************************************/
|
|---|
| 3626 |
|
|---|
| 3627 | BOOL WIN32API SetConsoleOutputCP(UINT IDCodePage)
|
|---|
| 3628 | {
|
|---|
| 3629 | #ifdef DEBUG_LOCAL2
|
|---|
| 3630 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleOutputCP(%08x) not implemented.\n",
|
|---|
| 3631 | IDCodePage);
|
|---|
| 3632 | #endif
|
|---|
| 3633 |
|
|---|
| 3634 | return TRUE;
|
|---|
| 3635 | }
|
|---|
| 3636 |
|
|---|
| 3637 |
|
|---|
| 3638 | /*****************************************************************************
|
|---|
| 3639 | * Name :
|
|---|
| 3640 | * Purpose :
|
|---|
| 3641 | * Parameters:
|
|---|
| 3642 | * Variables :
|
|---|
| 3643 | * Result :
|
|---|
| 3644 | * Remark :
|
|---|
| 3645 | * Status :
|
|---|
| 3646 | *
|
|---|
| 3647 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3648 | *****************************************************************************/
|
|---|
| 3649 |
|
|---|
| 3650 | BOOL WIN32API SetConsoleScreenBufferSize(HANDLE hConsoleOutput,
|
|---|
| 3651 | COORD coordSize)
|
|---|
| 3652 | {
|
|---|
| 3653 | BOOL fResult;
|
|---|
| 3654 |
|
|---|
| 3655 | #ifdef DEBUG_LOCAL2
|
|---|
| 3656 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleScreenBufferSize(%08x,%08x).\n",
|
|---|
| 3657 | hConsoleOutput,
|
|---|
| 3658 | coordSize);
|
|---|
| 3659 | #endif
|
|---|
| 3660 |
|
|---|
| 3661 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3662 | DRQ_SETCONSOLESCREENBUFFERSIZE,
|
|---|
| 3663 | COORD2ULONG(coordSize),
|
|---|
| 3664 | 0,
|
|---|
| 3665 | 0,
|
|---|
| 3666 | 0);
|
|---|
| 3667 |
|
|---|
| 3668 | return fResult;
|
|---|
| 3669 | }
|
|---|
| 3670 |
|
|---|
| 3671 |
|
|---|
| 3672 | /*****************************************************************************
|
|---|
| 3673 | * Name :
|
|---|
| 3674 | * Purpose :
|
|---|
| 3675 | * Parameters:
|
|---|
| 3676 | * Variables :
|
|---|
| 3677 | * Result :
|
|---|
| 3678 | * Remark :
|
|---|
| 3679 | * Status :
|
|---|
| 3680 | *
|
|---|
| 3681 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3682 | *****************************************************************************/
|
|---|
| 3683 |
|
|---|
| 3684 | BOOL WIN32API SetConsoleTextAttribute(HANDLE hConsoleOutput,
|
|---|
| 3685 | WORD wAttr)
|
|---|
| 3686 | {
|
|---|
| 3687 | BOOL fResult;
|
|---|
| 3688 |
|
|---|
| 3689 | #ifdef DEBUG_LOCAL2
|
|---|
| 3690 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleTextAttribute(%08x,%04x).\n",
|
|---|
| 3691 | hConsoleOutput,
|
|---|
| 3692 | wAttr);
|
|---|
| 3693 | #endif
|
|---|
| 3694 |
|
|---|
| 3695 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3696 | DRQ_SETCONSOLETEXTATTRIBUTE,
|
|---|
| 3697 | (ULONG)wAttr,
|
|---|
| 3698 | 0,
|
|---|
| 3699 | 0,
|
|---|
| 3700 | 0);
|
|---|
| 3701 |
|
|---|
| 3702 | return fResult;
|
|---|
| 3703 | }
|
|---|
| 3704 |
|
|---|
| 3705 |
|
|---|
| 3706 | /*****************************************************************************
|
|---|
| 3707 | * Name : BOOL WIN32API SetConsoleTitleA
|
|---|
| 3708 | * Purpose : Set new title text for the console window
|
|---|
| 3709 | * Parameters: LPTSTR lpszTitle
|
|---|
| 3710 | * Variables :
|
|---|
| 3711 | * Result :
|
|---|
| 3712 | * Remark :
|
|---|
| 3713 | * Status : REWRITTEN UNTESTED
|
|---|
| 3714 | *
|
|---|
| 3715 | * Author : Patrick Haller [Tue, 1998/02/12 23:28]
|
|---|
| 3716 | *****************************************************************************/
|
|---|
| 3717 |
|
|---|
| 3718 | BOOL WIN32API SetConsoleTitleA(LPTSTR lpszTitle)
|
|---|
| 3719 | {
|
|---|
| 3720 | #ifdef DEBUG_LOCAL2
|
|---|
| 3721 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleTitleA(%s).\n",
|
|---|
| 3722 | lpszTitle);
|
|---|
| 3723 | #endif
|
|---|
| 3724 |
|
|---|
| 3725 | if (ConsoleGlobals.pszWindowTitle != NULL) /* previously set name */
|
|---|
| 3726 | free (ConsoleGlobals.pszWindowTitle); /* then free it */
|
|---|
| 3727 |
|
|---|
| 3728 | ConsoleGlobals.pszWindowTitle = strdup(lpszTitle); /* copy the new name */
|
|---|
| 3729 |
|
|---|
| 3730 | WinSetWindowText(ConsoleGlobals.hwndFrame, /* set new title text */
|
|---|
| 3731 | ConsoleGlobals.pszWindowTitle);
|
|---|
| 3732 |
|
|---|
| 3733 | return TRUE;
|
|---|
| 3734 | }
|
|---|
| 3735 |
|
|---|
| 3736 |
|
|---|
| 3737 | /*****************************************************************************
|
|---|
| 3738 | * Name : BOOL WIN32API SetConsoleTitleW
|
|---|
| 3739 | * Purpose : Set new title text for the console window
|
|---|
| 3740 | * Parameters: LPTSTR lpszTitle
|
|---|
| 3741 | * Variables :
|
|---|
| 3742 | * Result :
|
|---|
| 3743 | * Remark :
|
|---|
| 3744 | * Status : REWRITTEN UNTESTED
|
|---|
| 3745 | *
|
|---|
| 3746 | * Author : Patrick Haller [Tue, 1998/02/12 23:28]
|
|---|
| 3747 | *****************************************************************************/
|
|---|
| 3748 |
|
|---|
| 3749 | BOOL WIN32API SetConsoleTitleW(LPWSTR lpszTitle)
|
|---|
| 3750 | {
|
|---|
| 3751 | #ifdef DEBUG_LOCAL2
|
|---|
| 3752 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleTitleW(%s) not implemented.\n",
|
|---|
| 3753 | lpszTitle);
|
|---|
| 3754 | #endif
|
|---|
| 3755 |
|
|---|
| 3756 | if (lpszTitle == NULL) /* check parameters */
|
|---|
| 3757 | return FALSE;
|
|---|
| 3758 |
|
|---|
| 3759 | if (ConsoleGlobals.pszWindowTitle != NULL) /* previously set name */
|
|---|
| 3760 | free (ConsoleGlobals.pszWindowTitle); /* then free it */
|
|---|
| 3761 |
|
|---|
| 3762 | /* create an ascii copy of the lpszTitle */
|
|---|
| 3763 | int iLength = lstrlenW(lpszTitle);
|
|---|
| 3764 |
|
|---|
| 3765 | ConsoleGlobals.pszWindowTitle = (PSZ)malloc(iLength+1);
|
|---|
| 3766 | ConsoleGlobals.pszWindowTitle[iLength] = 0;
|
|---|
| 3767 | lstrcpynWtoA(ConsoleGlobals.pszWindowTitle,
|
|---|
| 3768 | lpszTitle,
|
|---|
| 3769 | iLength+1); //must add one (lstrcpynWtoA terminates string)
|
|---|
| 3770 |
|
|---|
| 3771 | WinSetWindowText(ConsoleGlobals.hwndFrame, /* set new title text */
|
|---|
| 3772 | ConsoleGlobals.pszWindowTitle);
|
|---|
| 3773 |
|
|---|
| 3774 | return TRUE;
|
|---|
| 3775 | }
|
|---|
| 3776 |
|
|---|
| 3777 |
|
|---|
| 3778 | /*****************************************************************************
|
|---|
| 3779 | * Name :
|
|---|
| 3780 | * Purpose :
|
|---|
| 3781 | * Parameters:
|
|---|
| 3782 | * Variables :
|
|---|
| 3783 | * Result :
|
|---|
| 3784 | * Remark :
|
|---|
| 3785 | * Status :
|
|---|
| 3786 | *
|
|---|
| 3787 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3788 | *****************************************************************************/
|
|---|
| 3789 |
|
|---|
| 3790 | BOOL WIN32API SetConsoleWindowInfo(HANDLE hConsoleOutput,
|
|---|
| 3791 | BOOL fAbsolute,
|
|---|
| 3792 | PSMALL_RECT psrctWindowRect)
|
|---|
| 3793 | {
|
|---|
| 3794 | BOOL fResult;
|
|---|
| 3795 |
|
|---|
| 3796 | #ifdef DEBUG_LOCAL2
|
|---|
| 3797 | WriteLog("KERNEL32/CONSOLE: OS2SetConsoleWindowInfo(%08x,%08x,%08x).\n",
|
|---|
| 3798 | hConsoleOutput,
|
|---|
| 3799 | fAbsolute,
|
|---|
| 3800 | psrctWindowRect);
|
|---|
| 3801 | #endif
|
|---|
| 3802 |
|
|---|
| 3803 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3804 | DRQ_SETCONSOLEWINDOWINFO,
|
|---|
| 3805 | (ULONG)fAbsolute,
|
|---|
| 3806 | (ULONG)psrctWindowRect,
|
|---|
| 3807 | 0,
|
|---|
| 3808 | 0);
|
|---|
| 3809 |
|
|---|
| 3810 | return fResult;
|
|---|
| 3811 | }
|
|---|
| 3812 |
|
|---|
| 3813 |
|
|---|
| 3814 | /*****************************************************************************
|
|---|
| 3815 | * Name :
|
|---|
| 3816 | * Purpose :
|
|---|
| 3817 | * Parameters:
|
|---|
| 3818 | * Variables :
|
|---|
| 3819 | * Result :
|
|---|
| 3820 | * Remark :
|
|---|
| 3821 | * Status :
|
|---|
| 3822 | *
|
|---|
| 3823 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3824 | *****************************************************************************/
|
|---|
| 3825 |
|
|---|
| 3826 | BOOL WIN32API WriteConsoleA(HANDLE hConsoleOutput,
|
|---|
| 3827 | CONST VOID* lpvBuffer,
|
|---|
| 3828 | DWORD cchToWrite,
|
|---|
| 3829 | LPDWORD lpcchWritten,
|
|---|
| 3830 | LPVOID lpvReserved)
|
|---|
| 3831 | {
|
|---|
| 3832 | BOOL fResult;
|
|---|
| 3833 |
|
|---|
| 3834 | #ifdef DEBUG_LOCAL2
|
|---|
| 3835 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleA(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3836 | hConsoleOutput,
|
|---|
| 3837 | lpvBuffer,
|
|---|
| 3838 | cchToWrite,
|
|---|
| 3839 | lpcchWritten,
|
|---|
| 3840 | lpvReserved);
|
|---|
| 3841 | #endif
|
|---|
| 3842 |
|
|---|
| 3843 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3844 | DRQ_WRITECONSOLEA,
|
|---|
| 3845 | (ULONG)lpvBuffer,
|
|---|
| 3846 | (ULONG)cchToWrite,
|
|---|
| 3847 | (ULONG)lpcchWritten,
|
|---|
| 3848 | (ULONG)lpvReserved);
|
|---|
| 3849 |
|
|---|
| 3850 | return fResult;
|
|---|
| 3851 | }
|
|---|
| 3852 |
|
|---|
| 3853 |
|
|---|
| 3854 | /*****************************************************************************
|
|---|
| 3855 | * Name :
|
|---|
| 3856 | * Purpose :
|
|---|
| 3857 | * Parameters:
|
|---|
| 3858 | * Variables :
|
|---|
| 3859 | * Result :
|
|---|
| 3860 | * Remark :
|
|---|
| 3861 | * Status :
|
|---|
| 3862 | *
|
|---|
| 3863 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3864 | *****************************************************************************/
|
|---|
| 3865 |
|
|---|
| 3866 | BOOL WIN32API WriteConsoleW(HANDLE hConsoleOutput,
|
|---|
| 3867 | CONST VOID* lpvBuffer,
|
|---|
| 3868 | DWORD cchToWrite,
|
|---|
| 3869 | LPDWORD lpcchWritten,
|
|---|
| 3870 | LPVOID lpvReserved)
|
|---|
| 3871 | {
|
|---|
| 3872 | BOOL fResult;
|
|---|
| 3873 |
|
|---|
| 3874 | #ifdef DEBUG_LOCAL2
|
|---|
| 3875 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleW(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3876 | hConsoleOutput,
|
|---|
| 3877 | lpvBuffer,
|
|---|
| 3878 | cchToWrite,
|
|---|
| 3879 | lpcchWritten,
|
|---|
| 3880 | lpvReserved);
|
|---|
| 3881 | #endif
|
|---|
| 3882 |
|
|---|
| 3883 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 3884 | DRQ_WRITECONSOLEW,
|
|---|
| 3885 | (ULONG)lpvBuffer,
|
|---|
| 3886 | (ULONG)cchToWrite,
|
|---|
| 3887 | (ULONG)lpcchWritten,
|
|---|
| 3888 | (ULONG)lpvReserved);
|
|---|
| 3889 |
|
|---|
| 3890 | return fResult;
|
|---|
| 3891 | }
|
|---|
| 3892 |
|
|---|
| 3893 |
|
|---|
| 3894 | /*****************************************************************************
|
|---|
| 3895 | * Name :
|
|---|
| 3896 | * Purpose :
|
|---|
| 3897 | * Parameters:
|
|---|
| 3898 | * Variables :
|
|---|
| 3899 | * Result :
|
|---|
| 3900 | * Remark :
|
|---|
| 3901 | * Status :
|
|---|
| 3902 | *
|
|---|
| 3903 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3904 | *****************************************************************************/
|
|---|
| 3905 |
|
|---|
| 3906 | BOOL WIN32API WriteConsoleInputA(HANDLE hConsoleInput,
|
|---|
| 3907 | PINPUT_RECORD pirBuffer,
|
|---|
| 3908 | DWORD cInRecords,
|
|---|
| 3909 | LPDWORD lpcWritten)
|
|---|
| 3910 | {
|
|---|
| 3911 | BOOL fResult;
|
|---|
| 3912 |
|
|---|
| 3913 | #ifdef DEBUG_LOCAL2
|
|---|
| 3914 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputA(%08x,%08x,%08x,%08x).\n",
|
|---|
| 3915 | hConsoleInput,
|
|---|
| 3916 | pirBuffer,
|
|---|
| 3917 | cInRecords,
|
|---|
| 3918 | lpcWritten);
|
|---|
| 3919 | #endif
|
|---|
| 3920 |
|
|---|
| 3921 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 3922 | DRQ_WRITECONSOLEINPUTA,
|
|---|
| 3923 | (ULONG)pirBuffer,
|
|---|
| 3924 | (ULONG)cInRecords,
|
|---|
| 3925 | (ULONG)lpcWritten,
|
|---|
| 3926 | 0);
|
|---|
| 3927 |
|
|---|
| 3928 | return fResult;
|
|---|
| 3929 | }
|
|---|
| 3930 |
|
|---|
| 3931 |
|
|---|
| 3932 | /*****************************************************************************
|
|---|
| 3933 | * Name :
|
|---|
| 3934 | * Purpose :
|
|---|
| 3935 | * Parameters:
|
|---|
| 3936 | * Variables :
|
|---|
| 3937 | * Result :
|
|---|
| 3938 | * Remark :
|
|---|
| 3939 | * Status :
|
|---|
| 3940 | *
|
|---|
| 3941 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3942 | *****************************************************************************/
|
|---|
| 3943 |
|
|---|
| 3944 | BOOL WIN32API WriteConsoleInputW(HANDLE hConsoleInput,
|
|---|
| 3945 | PINPUT_RECORD pirBuffer,
|
|---|
| 3946 | DWORD cInRecords,
|
|---|
| 3947 | LPDWORD lpcWritten)
|
|---|
| 3948 | {
|
|---|
| 3949 | BOOL fResult;
|
|---|
| 3950 |
|
|---|
| 3951 | #ifdef DEBUG_LOCAL2
|
|---|
| 3952 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleInputW(%08x,%08x,%08x,%08x).\n",
|
|---|
| 3953 | hConsoleInput,
|
|---|
| 3954 | pirBuffer,
|
|---|
| 3955 | cInRecords,
|
|---|
| 3956 | lpcWritten);
|
|---|
| 3957 | #endif
|
|---|
| 3958 |
|
|---|
| 3959 | fResult = (BOOL)HMDeviceRequest(hConsoleInput,
|
|---|
| 3960 | DRQ_WRITECONSOLEINPUTW,
|
|---|
| 3961 | (ULONG)pirBuffer,
|
|---|
| 3962 | (ULONG)cInRecords,
|
|---|
| 3963 | (ULONG)lpcWritten,
|
|---|
| 3964 | 0);
|
|---|
| 3965 |
|
|---|
| 3966 | return fResult;
|
|---|
| 3967 | }
|
|---|
| 3968 |
|
|---|
| 3969 |
|
|---|
| 3970 | /*****************************************************************************
|
|---|
| 3971 | * Name :
|
|---|
| 3972 | * Purpose :
|
|---|
| 3973 | * Parameters:
|
|---|
| 3974 | * Variables :
|
|---|
| 3975 | * Result :
|
|---|
| 3976 | * Remark :
|
|---|
| 3977 | * Status :
|
|---|
| 3978 | *
|
|---|
| 3979 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 3980 | *****************************************************************************/
|
|---|
| 3981 |
|
|---|
| 3982 | BOOL WIN32API WriteConsoleOutputA(HANDLE hConsoleOutput,
|
|---|
| 3983 | PCHAR_INFO pchiSrcBuffer,
|
|---|
| 3984 | COORD coordSrcBufferSize,
|
|---|
| 3985 | COORD coordSrcBufferCoord,
|
|---|
| 3986 | PSMALL_RECT psrctDestRect)
|
|---|
| 3987 | {
|
|---|
| 3988 | BOOL fResult;
|
|---|
| 3989 |
|
|---|
| 3990 | #ifdef DEBUG_LOCAL2
|
|---|
| 3991 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputA(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 3992 | hConsoleOutput,
|
|---|
| 3993 | pchiSrcBuffer,
|
|---|
| 3994 | coordSrcBufferSize,
|
|---|
| 3995 | coordSrcBufferCoord,
|
|---|
| 3996 | psrctDestRect);
|
|---|
| 3997 | #endif
|
|---|
| 3998 |
|
|---|
| 3999 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 4000 | DRQ_WRITECONSOLEOUTPUTA,
|
|---|
| 4001 | (ULONG)pchiSrcBuffer,
|
|---|
| 4002 | COORD2ULONG(coordSrcBufferSize),
|
|---|
| 4003 | COORD2ULONG(coordSrcBufferCoord),
|
|---|
| 4004 | (ULONG)psrctDestRect);
|
|---|
| 4005 |
|
|---|
| 4006 | return fResult;
|
|---|
| 4007 | }
|
|---|
| 4008 |
|
|---|
| 4009 |
|
|---|
| 4010 | /*****************************************************************************
|
|---|
| 4011 | * Name :
|
|---|
| 4012 | * Purpose :
|
|---|
| 4013 | * Parameters:
|
|---|
| 4014 | * Variables :
|
|---|
| 4015 | * Result :
|
|---|
| 4016 | * Remark :
|
|---|
| 4017 | * Status :
|
|---|
| 4018 | *
|
|---|
| 4019 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 4020 | *****************************************************************************/
|
|---|
| 4021 |
|
|---|
| 4022 | BOOL WIN32API WriteConsoleOutputW(HANDLE hConsoleOutput,
|
|---|
| 4023 | PCHAR_INFO pchiSrcBuffer,
|
|---|
| 4024 | COORD coordSrcBufferSize,
|
|---|
| 4025 | COORD coordSrcBufferCoord,
|
|---|
| 4026 | PSMALL_RECT psrctDestRect)
|
|---|
| 4027 | {
|
|---|
| 4028 | BOOL fResult;
|
|---|
| 4029 |
|
|---|
| 4030 | #ifdef DEBUG_LOCAL2
|
|---|
| 4031 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputW(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 4032 | hConsoleOutput,
|
|---|
| 4033 | pchiSrcBuffer,
|
|---|
| 4034 | coordSrcBufferSize,
|
|---|
| 4035 | coordSrcBufferCoord,
|
|---|
| 4036 | psrctDestRect);
|
|---|
| 4037 | #endif
|
|---|
| 4038 |
|
|---|
| 4039 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 4040 | DRQ_WRITECONSOLEOUTPUTW,
|
|---|
| 4041 | (ULONG)pchiSrcBuffer,
|
|---|
| 4042 | COORD2ULONG(coordSrcBufferSize),
|
|---|
| 4043 | COORD2ULONG(coordSrcBufferCoord),
|
|---|
| 4044 | (ULONG)psrctDestRect);
|
|---|
| 4045 |
|
|---|
| 4046 | return fResult;
|
|---|
| 4047 | }
|
|---|
| 4048 |
|
|---|
| 4049 | /*****************************************************************************
|
|---|
| 4050 | * Name :
|
|---|
| 4051 | * Purpose :
|
|---|
| 4052 | * Parameters:
|
|---|
| 4053 | * Variables :
|
|---|
| 4054 | * Result :
|
|---|
| 4055 | * Remark :
|
|---|
| 4056 | * Status :
|
|---|
| 4057 | *
|
|---|
| 4058 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 4059 | *****************************************************************************/
|
|---|
| 4060 |
|
|---|
| 4061 | BOOL WIN32API WriteConsoleOutputAttribute(HANDLE hConsoleOutput,
|
|---|
| 4062 | LPWORD lpwAttribute,
|
|---|
| 4063 | DWORD cWriteCells,
|
|---|
| 4064 | COORD coordWriteCoord,
|
|---|
| 4065 | LPDWORD lpcNumberWritten)
|
|---|
| 4066 | {
|
|---|
| 4067 | BOOL fResult;
|
|---|
| 4068 |
|
|---|
| 4069 | #ifdef DEBUG_LOCAL2
|
|---|
| 4070 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputAttribute(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 4071 | hConsoleOutput,
|
|---|
| 4072 | lpwAttribute,
|
|---|
| 4073 | cWriteCells,
|
|---|
| 4074 | coordWriteCoord,
|
|---|
| 4075 | lpcNumberWritten);
|
|---|
| 4076 | #endif
|
|---|
| 4077 |
|
|---|
| 4078 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 4079 | DRQ_WRITECONSOLEOUTPUTATTRIBUTE,
|
|---|
| 4080 | (ULONG)lpwAttribute,
|
|---|
| 4081 | (ULONG)cWriteCells,
|
|---|
| 4082 | COORD2ULONG(coordWriteCoord),
|
|---|
| 4083 | (ULONG)lpcNumberWritten);
|
|---|
| 4084 |
|
|---|
| 4085 | return fResult;
|
|---|
| 4086 | }
|
|---|
| 4087 |
|
|---|
| 4088 |
|
|---|
| 4089 | /*****************************************************************************
|
|---|
| 4090 | * Name :
|
|---|
| 4091 | * Purpose :
|
|---|
| 4092 | * Parameters:
|
|---|
| 4093 | * Variables :
|
|---|
| 4094 | * Result :
|
|---|
| 4095 | * Remark :
|
|---|
| 4096 | * Status :
|
|---|
| 4097 | *
|
|---|
| 4098 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 4099 | *****************************************************************************/
|
|---|
| 4100 |
|
|---|
| 4101 | BOOL WIN32API WriteConsoleOutputCharacterA(HANDLE hConsoleOutput,
|
|---|
| 4102 | LPTSTR lpWriteBuffer,
|
|---|
| 4103 | DWORD cchWrite,
|
|---|
| 4104 | COORD coordWriteCoord,
|
|---|
| 4105 | LPDWORD lpcWritten)
|
|---|
| 4106 | {
|
|---|
| 4107 | BOOL fResult;
|
|---|
| 4108 |
|
|---|
| 4109 | #ifdef DEBUG_LOCAL2
|
|---|
| 4110 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterA(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 4111 | hConsoleOutput,
|
|---|
| 4112 | lpWriteBuffer,
|
|---|
| 4113 | cchWrite,
|
|---|
| 4114 | coordWriteCoord,
|
|---|
| 4115 | lpcWritten);
|
|---|
| 4116 | #endif
|
|---|
| 4117 |
|
|---|
| 4118 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 4119 | DRQ_WRITECONSOLEOUTPUTCHARACTERA,
|
|---|
| 4120 | (ULONG)lpWriteBuffer,
|
|---|
| 4121 | (ULONG)cchWrite,
|
|---|
| 4122 | COORD2ULONG(coordWriteCoord),
|
|---|
| 4123 | (ULONG)lpcWritten);
|
|---|
| 4124 |
|
|---|
| 4125 | return fResult;
|
|---|
| 4126 | }
|
|---|
| 4127 |
|
|---|
| 4128 |
|
|---|
| 4129 | /*****************************************************************************
|
|---|
| 4130 | * Name :
|
|---|
| 4131 | * Purpose :
|
|---|
| 4132 | * Parameters:
|
|---|
| 4133 | * Variables :
|
|---|
| 4134 | * Result :
|
|---|
| 4135 | * Remark :
|
|---|
| 4136 | * Status :
|
|---|
| 4137 | *
|
|---|
| 4138 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 4139 | *****************************************************************************/
|
|---|
| 4140 |
|
|---|
| 4141 | BOOL WIN32API WriteConsoleOutputCharacterW(HANDLE hConsoleOutput,
|
|---|
| 4142 | LPTSTR lpWriteBuffer,
|
|---|
| 4143 | DWORD cchWrite,
|
|---|
| 4144 | COORD coordWriteCoord,
|
|---|
| 4145 | LPDWORD lpcWritten)
|
|---|
| 4146 | {
|
|---|
| 4147 | BOOL fResult;
|
|---|
| 4148 |
|
|---|
| 4149 | #ifdef DEBUG_LOCAL2
|
|---|
| 4150 | WriteLog("KERNEL32/CONSOLE: OS2WriteConsoleOutputCharacterW(%08x,%08x,%08x,%08x,%08x).\n",
|
|---|
| 4151 | hConsoleOutput,
|
|---|
| 4152 | lpWriteBuffer,
|
|---|
| 4153 | cchWrite,
|
|---|
| 4154 | coordWriteCoord,
|
|---|
| 4155 | lpcWritten);
|
|---|
| 4156 | #endif
|
|---|
| 4157 |
|
|---|
| 4158 | fResult = (BOOL)HMDeviceRequest(hConsoleOutput,
|
|---|
| 4159 | DRQ_WRITECONSOLEOUTPUTCHARACTERW,
|
|---|
| 4160 | (ULONG)lpWriteBuffer,
|
|---|
| 4161 | (ULONG)cchWrite,
|
|---|
| 4162 | COORD2ULONG(coordWriteCoord),
|
|---|
| 4163 | (ULONG)lpcWritten);
|
|---|
| 4164 |
|
|---|
| 4165 | return fResult;
|
|---|
| 4166 | }
|
|---|