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