1 | /* $Id: conin.cpp,v 1.9 2000-03-03 11:15:57 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 Console API Translation for OS/2
|
---|
5 | * 1998/02/10 Patrick Haller (haller@zebra.fh-weingarten.de)
|
---|
6 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
7 | */
|
---|
8 |
|
---|
9 |
|
---|
10 | #ifdef DEBUG
|
---|
11 | #define DEBUG_LOCAL
|
---|
12 | #define DEBUG_LOCAL2
|
---|
13 | #endif
|
---|
14 |
|
---|
15 |
|
---|
16 | /*****************************************************************************
|
---|
17 | * Remark *
|
---|
18 | *****************************************************************************
|
---|
19 | */
|
---|
20 |
|
---|
21 |
|
---|
22 | /*****************************************************************************
|
---|
23 | * Includes *
|
---|
24 | *****************************************************************************/
|
---|
25 |
|
---|
26 | #define INCL_WIN
|
---|
27 | #define INCL_DOSMEMMGR
|
---|
28 | #define INCL_DOSSEMAPHORES
|
---|
29 | #define INCL_DOSERRORS
|
---|
30 | #define INCL_DOSPROCESS
|
---|
31 | #define INCL_DOSMODULEMGR
|
---|
32 | #define INCL_VIO
|
---|
33 | #define INCL_AVIO
|
---|
34 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
35 |
|
---|
36 | #include <win32api.h>
|
---|
37 | #include <misc.h>
|
---|
38 | #include <string.h>
|
---|
39 |
|
---|
40 | #include "conwin.h" // Windows Header for console only
|
---|
41 | #include "HandleManager.h"
|
---|
42 | #include "HMDevice.h"
|
---|
43 | #include "Conin.H"
|
---|
44 | #include "Console2.h"
|
---|
45 | #include <heapstring.h>
|
---|
46 |
|
---|
47 | #define DBG_LOCALLOG DBG_conin
|
---|
48 | #include "dbglocal.h"
|
---|
49 |
|
---|
50 |
|
---|
51 | /*****************************************************************************
|
---|
52 | * Name : DWORD HMDeviceConsoleInClass::CreateFile
|
---|
53 | * Purpose : this is called from the handle manager if a CreateFile() is
|
---|
54 | * performed on a handle
|
---|
55 | * Parameters: LPCSTR lpFileName name of the file / device
|
---|
56 | * PHMHANDLEDATA pHMHandleData data of the NEW handle
|
---|
57 | * PVOID lpSecurityAttributes ignored
|
---|
58 | * PHMHANDLEDATA pHMHandleDataTemplate data of the template handle
|
---|
59 | * Variables :
|
---|
60 | * Result :
|
---|
61 | * Remark : @@@PH CONIN$ handles should be exclusive
|
---|
62 | * reject other requests to this device
|
---|
63 | * Status : NO_ERROR - API succeeded
|
---|
64 | * other - what is to be set in SetLastError
|
---|
65 | *
|
---|
66 | * Author : Patrick Haller [Wed, 1998/02/11 20:44]
|
---|
67 | *****************************************************************************/
|
---|
68 |
|
---|
69 | DWORD HMDeviceConsoleInClass::CreateFile (LPCSTR lpFileName,
|
---|
70 | PHMHANDLEDATA pHMHandleData,
|
---|
71 | PVOID lpSecurityAttributes,
|
---|
72 | PHMHANDLEDATA pHMHandleDataTemplate)
|
---|
73 | {
|
---|
74 | #ifdef DEBUG_LOCAL
|
---|
75 | WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass::CreateFile %s(%s,%08x,%08x,%08x)\n",
|
---|
76 | lpHMDeviceName,
|
---|
77 | lpFileName,
|
---|
78 | pHMHandleData->hHMHandle,
|
---|
79 | lpSecurityAttributes,
|
---|
80 | pHMHandleDataTemplate);
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | pHMHandleData->dwType = FILE_TYPE_CHAR; /* we're a character device */
|
---|
84 |
|
---|
85 | return(NO_ERROR);
|
---|
86 | }
|
---|
87 |
|
---|
88 |
|
---|
89 | /*****************************************************************************
|
---|
90 | * Name :
|
---|
91 | * Purpose :
|
---|
92 | * Parameters:
|
---|
93 | * Variables :
|
---|
94 | * Result :
|
---|
95 | * Remark :
|
---|
96 | * Status :
|
---|
97 | *
|
---|
98 | * Author : Patrick Haller [Wed, 1998/02/11 20:44]
|
---|
99 | *****************************************************************************/
|
---|
100 |
|
---|
101 | BOOL HMDeviceConsoleInClass::ReadFile(PHMHANDLEDATA pHMHandleData,
|
---|
102 | LPCVOID lpBuffer,
|
---|
103 | DWORD nNumberOfBytesToRead,
|
---|
104 | LPDWORD lpNumberOfBytesRead,
|
---|
105 | LPOVERLAPPED lpOverlapped)
|
---|
106 | {
|
---|
107 | ULONG ulCounter; /* character counter for the queue loop */
|
---|
108 | PSZ pszTarget; /* pointer to target buffer */
|
---|
109 | APIRET rc; /* API returncode */
|
---|
110 | INPUT_RECORD InputRecord; /* buffer for the event to be read */
|
---|
111 | ULONG ulPostCounter; /* semaphore post counter */
|
---|
112 | BOOL fLoop = TRUE; /* set to false if function may return to caller */
|
---|
113 |
|
---|
114 | #ifdef DEBUG_LOCAL
|
---|
115 | WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x)\n",
|
---|
116 | lpHMDeviceName,
|
---|
117 | pHMHandleData->hHMHandle,
|
---|
118 | lpBuffer,
|
---|
119 | nNumberOfBytesToRead,
|
---|
120 | lpNumberOfBytesRead,
|
---|
121 | lpOverlapped);
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | ulCounter = 0; /* read ascii chars from queue */
|
---|
125 | pszTarget = (PSZ)lpBuffer;
|
---|
126 |
|
---|
127 | /* block if no key events are in the queue */
|
---|
128 | for (;fLoop;) /* until we got some characters */
|
---|
129 | {
|
---|
130 | if (iConsoleInputQueryEvents() == 0) /* if queue is currently empty */
|
---|
131 | {
|
---|
132 | rc = DosWaitEventSem(pConsoleInput->hevInputQueue, /* wait for input */
|
---|
133 | SEM_INDEFINITE_WAIT);
|
---|
134 | DosResetEventSem(pConsoleInput->hevInputQueue, /* reset semaphore */
|
---|
135 | &ulPostCounter); /* post counter - ignored */
|
---|
136 | }
|
---|
137 |
|
---|
138 | do
|
---|
139 | {
|
---|
140 | rc = iConsoleInputEventPop(&InputRecord); /* get event from queue */
|
---|
141 | if (rc == NO_ERROR) /* if we've got a valid event in the queue */
|
---|
142 | {
|
---|
143 | //@@@PH other events are discarded!
|
---|
144 | if ( (InputRecord.EventType == KEY_EVENT) && /* check event type */
|
---|
145 | (InputRecord.Event.KeyEvent.bKeyDown == TRUE) )
|
---|
146 | {
|
---|
147 | // console in line input mode ?
|
---|
148 | if (pConsoleInput->dwConsoleMode & ENABLE_LINE_INPUT)
|
---|
149 | {
|
---|
150 | // continue until buffer full or CR entered
|
---|
151 | if (InputRecord.Event.KeyEvent.uChar.AsciiChar == 0x0d)
|
---|
152 | fLoop = FALSE;
|
---|
153 | }
|
---|
154 | else
|
---|
155 | fLoop = FALSE; // return on any single key in buffer :)
|
---|
156 |
|
---|
157 | // record key stroke
|
---|
158 | if (pConsoleInput->dwConsoleMode & ENABLE_PROCESSED_INPUT)
|
---|
159 | {
|
---|
160 | // filter special characters first
|
---|
161 | switch (InputRecord.Event.KeyEvent.uChar.AsciiChar)
|
---|
162 | {
|
---|
163 | case 0x03: // ctrl-c is filtered!
|
---|
164 | case 0x0a: // LF
|
---|
165 | case 0x0d: // CR
|
---|
166 | // do NOT insert those keys into the resulting buffer
|
---|
167 | break;
|
---|
168 |
|
---|
169 | case 0x08: // backspace
|
---|
170 | if (ulCounter > 0)
|
---|
171 | {
|
---|
172 | //@@@PH erase character on screen!
|
---|
173 | ulCounter--;
|
---|
174 | pszTarget--;
|
---|
175 | /* local echo enabled ? */
|
---|
176 | if (pConsoleInput->dwConsoleMode & ENABLE_ECHO_INPUT)
|
---|
177 | HMWriteFile(pConsoleGlobals->hConsoleBuffer,
|
---|
178 | &InputRecord.Event.KeyEvent.uChar.AsciiChar,
|
---|
179 | 1,
|
---|
180 | &ulPostCounter, /* dummy result */
|
---|
181 | NULL);
|
---|
182 | }
|
---|
183 | break;
|
---|
184 |
|
---|
185 | default:
|
---|
186 | // OK, for the rest ...
|
---|
187 | *pszTarget = InputRecord.Event.KeyEvent.uChar.AsciiChar;
|
---|
188 | dprintf(("KERNEL32:CONIN$: Debug: recorded key (%c - %02xh)\n",
|
---|
189 | *pszTarget,
|
---|
190 | *pszTarget));
|
---|
191 |
|
---|
192 | pszTarget++;
|
---|
193 | ulCounter++;
|
---|
194 | /* local echo enabled ? */
|
---|
195 | if (pConsoleInput->dwConsoleMode & ENABLE_ECHO_INPUT)
|
---|
196 | HMWriteFile(pConsoleGlobals->hConsoleBuffer,
|
---|
197 | &InputRecord.Event.KeyEvent.uChar.AsciiChar,
|
---|
198 | 1,
|
---|
199 | &ulPostCounter, /* dummy result */
|
---|
200 | NULL);
|
---|
201 |
|
---|
202 |
|
---|
203 | }
|
---|
204 | }
|
---|
205 | else
|
---|
206 | {
|
---|
207 | *pszTarget = InputRecord.Event.KeyEvent.uChar.AsciiChar;
|
---|
208 | dprintf(("KERNEL32:CONIN$: Debug: recorded key (%c - %02xh)\n",
|
---|
209 | *pszTarget,
|
---|
210 | *pszTarget));
|
---|
211 |
|
---|
212 | pszTarget++;
|
---|
213 | ulCounter++;
|
---|
214 |
|
---|
215 | /* local echo enabled ? */
|
---|
216 | if (pConsoleInput->dwConsoleMode & ENABLE_ECHO_INPUT)
|
---|
217 | HMWriteFile(pConsoleGlobals->hConsoleBuffer,
|
---|
218 | &InputRecord.Event.KeyEvent.uChar.AsciiChar,
|
---|
219 | 1,
|
---|
220 | &ulPostCounter, /* dummy result */
|
---|
221 | NULL);
|
---|
222 | }
|
---|
223 |
|
---|
224 | // buffer filled?
|
---|
225 | if (ulCounter >= nNumberOfBytesToRead) /* at buffer's end ? */
|
---|
226 | fLoop = FALSE;
|
---|
227 | }
|
---|
228 | /* Note: other events are discarded */
|
---|
229 | }
|
---|
230 | }
|
---|
231 | while (rc == NO_ERROR);
|
---|
232 | }
|
---|
233 |
|
---|
234 | *lpNumberOfBytesRead = ulCounter; /* write result */
|
---|
235 |
|
---|
236 | return(TRUE); /* OK */
|
---|
237 | }
|
---|
238 |
|
---|
239 |
|
---|
240 | /*****************************************************************************
|
---|
241 | * Name :
|
---|
242 | * Purpose :
|
---|
243 | * Parameters:
|
---|
244 | * Variables :
|
---|
245 | * Result :
|
---|
246 | * Remark :
|
---|
247 | * Status :
|
---|
248 | *
|
---|
249 | * Author : Patrick Haller [Wed, 1998/02/11 20:44]
|
---|
250 | *****************************************************************************/
|
---|
251 |
|
---|
252 | BOOL HMDeviceConsoleInClass::WriteFile(PHMHANDLEDATA pHMHandleData,
|
---|
253 | LPCVOID lpBuffer,
|
---|
254 | DWORD nNumberOfBytesToWrite,
|
---|
255 | LPDWORD lpNumberOfBytesWritten,
|
---|
256 | LPOVERLAPPED lpOverlapped)
|
---|
257 | {
|
---|
258 |
|
---|
259 | #ifdef DEBUG_LOCAL
|
---|
260 | WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass:WriteFile %s(%08x,%08x,%08x,%08x,%08x)\n",
|
---|
261 | lpHMDeviceName,
|
---|
262 | pHMHandleData->hHMHandle,
|
---|
263 | lpBuffer,
|
---|
264 | nNumberOfBytesToWrite,
|
---|
265 | lpNumberOfBytesWritten,
|
---|
266 | lpOverlapped);
|
---|
267 | #endif
|
---|
268 |
|
---|
269 | SetLastError(ERROR_ACCESS_DENIED_W);
|
---|
270 | return FALSE;
|
---|
271 | }
|
---|
272 |
|
---|
273 |
|
---|
274 | /*****************************************************************************
|
---|
275 | * Name :
|
---|
276 | * Purpose :
|
---|
277 | * Parameters:
|
---|
278 | * Variables :
|
---|
279 | * Result :
|
---|
280 | * Remark :
|
---|
281 | * Status :
|
---|
282 | *
|
---|
283 | * Author : Patrick Haller [Wed, 1998/02/11 20:44]
|
---|
284 | *****************************************************************************/
|
---|
285 |
|
---|
286 | DWORD HMDeviceConsoleInClass::_DeviceRequest (PHMHANDLEDATA pHMHandleData,
|
---|
287 | ULONG ulRequestCode,
|
---|
288 | ULONG arg1,
|
---|
289 | ULONG arg2,
|
---|
290 | ULONG arg3,
|
---|
291 | ULONG arg4)
|
---|
292 | {
|
---|
293 | switch (ulRequestCode)
|
---|
294 | {
|
---|
295 | case DRQ_FLUSHCONSOLEINPUTBUFFER:
|
---|
296 | return (HMDeviceConsoleInClass::
|
---|
297 | FlushConsoleInputBuffer(pHMHandleData));
|
---|
298 |
|
---|
299 | case DRQ_GETCONSOLEMODE:
|
---|
300 | return (HMDeviceConsoleInClass
|
---|
301 | ::GetConsoleMode(pHMHandleData,
|
---|
302 | (LPDWORD)arg1));
|
---|
303 |
|
---|
304 | case DRQ_GETNUMBEROFCONSOLEINPUTEVENTS:
|
---|
305 | return (HMDeviceConsoleInClass::
|
---|
306 | GetNumberOfConsoleInputEvents(pHMHandleData,
|
---|
307 | (LPDWORD)arg1));
|
---|
308 |
|
---|
309 | case DRQ_PEEKCONSOLEINPUTA:
|
---|
310 | return (HMDeviceConsoleInClass::
|
---|
311 | PeekConsoleInputA(pHMHandleData,
|
---|
312 | (PINPUT_RECORD)arg1,
|
---|
313 | (DWORD) arg2,
|
---|
314 | (LPDWORD) arg3));
|
---|
315 |
|
---|
316 | case DRQ_PEEKCONSOLEINPUTW:
|
---|
317 | return (HMDeviceConsoleInClass::
|
---|
318 | PeekConsoleInputW(pHMHandleData,
|
---|
319 | (PINPUT_RECORD)arg1,
|
---|
320 | (DWORD) arg2,
|
---|
321 | (LPDWORD) arg3));
|
---|
322 |
|
---|
323 |
|
---|
324 | case DRQ_READCONSOLEA:
|
---|
325 | return (HMDeviceConsoleInClass::
|
---|
326 | ReadConsoleA(pHMHandleData,
|
---|
327 | (CONST VOID*) arg1,
|
---|
328 | (DWORD) arg2,
|
---|
329 | (LPDWORD) arg3,
|
---|
330 | (LPVOID) arg4));
|
---|
331 |
|
---|
332 | case DRQ_READCONSOLEW:
|
---|
333 | return (HMDeviceConsoleInClass::
|
---|
334 | ReadConsoleW(pHMHandleData,
|
---|
335 | (CONST VOID*) arg1,
|
---|
336 | (DWORD) arg2,
|
---|
337 | (LPDWORD) arg3,
|
---|
338 | (LPVOID) arg4));
|
---|
339 |
|
---|
340 | case DRQ_READCONSOLEINPUTA:
|
---|
341 | return (HMDeviceConsoleInClass::
|
---|
342 | ReadConsoleInputA(pHMHandleData,
|
---|
343 | (PINPUT_RECORD)arg1,
|
---|
344 | (DWORD)arg2,
|
---|
345 | (LPDWORD)arg3));
|
---|
346 |
|
---|
347 | case DRQ_READCONSOLEINPUTW:
|
---|
348 | return (HMDeviceConsoleInClass::
|
---|
349 | ReadConsoleInputW(pHMHandleData,
|
---|
350 | (PINPUT_RECORD)arg1,
|
---|
351 | (DWORD)arg2,
|
---|
352 | (LPDWORD)arg3));
|
---|
353 |
|
---|
354 | case DRQ_SETCONSOLEMODE:
|
---|
355 | return (HMDeviceConsoleInClass
|
---|
356 | ::SetConsoleMode(pHMHandleData,
|
---|
357 | (DWORD)arg1));
|
---|
358 |
|
---|
359 | case DRQ_WRITECONSOLEINPUTA:
|
---|
360 | return (HMDeviceConsoleInClass::
|
---|
361 | WriteConsoleInputA(pHMHandleData,
|
---|
362 | (PINPUT_RECORD)arg1,
|
---|
363 | (DWORD)arg2,
|
---|
364 | (LPDWORD)arg3));
|
---|
365 |
|
---|
366 | case DRQ_WRITECONSOLEINPUTW:
|
---|
367 | return (HMDeviceConsoleInClass::
|
---|
368 | WriteConsoleInputW(pHMHandleData,
|
---|
369 | (PINPUT_RECORD)arg1,
|
---|
370 | (DWORD)arg2,
|
---|
371 | (LPDWORD)arg3));
|
---|
372 |
|
---|
373 | }
|
---|
374 |
|
---|
375 | #ifdef DEBUG_LOCAL
|
---|
376 | WriteLog("KERNEL32/CONSOLE:HMDeviceConsoleInClass:_DeviceRequest %s(%08x,%08x,%08x,%08x,%08x,%08x) unknown request\n",
|
---|
377 | lpHMDeviceName,
|
---|
378 | pHMHandleData->hHMHandle,
|
---|
379 | ulRequestCode,
|
---|
380 | arg1,
|
---|
381 | arg2,
|
---|
382 | arg3,
|
---|
383 | arg4);
|
---|
384 | #endif
|
---|
385 |
|
---|
386 | SetLastError(ERROR_INVALID_FUNCTION_W); /* request not implemented */
|
---|
387 | return(FALSE); /* we assume this indicates API call failed */
|
---|
388 | }
|
---|
389 |
|
---|
390 |
|
---|
391 | /*****************************************************************************
|
---|
392 | * Name : BOOL HMDeviceConsoleInClass::FlushConsoleInputBuffer
|
---|
393 | * Purpose : flushes all events from the input queue
|
---|
394 | * Parameters: PHMHANDLEDATA pHMHandleData - handle specific data
|
---|
395 | * Variables :
|
---|
396 | * Result :
|
---|
397 | * Remark :
|
---|
398 | * Status : UNTESTED
|
---|
399 | *
|
---|
400 | * Author : Patrick Haller [Wed, 1998/02/16 11:46]
|
---|
401 | *****************************************************************************/
|
---|
402 |
|
---|
403 | BOOL HMDeviceConsoleInClass::FlushConsoleInputBuffer(PHMHANDLEDATA pHMHandleData)
|
---|
404 | {
|
---|
405 | ULONG ulCounter; /* loop counter */
|
---|
406 |
|
---|
407 | #ifdef DEBUG_LOCAL2
|
---|
408 | WriteLog("KERNEL32/CONSOLE: CONIN$::FlushConsoleInputBuffer(%08x).\n",
|
---|
409 | pHMHandleData);
|
---|
410 | #endif
|
---|
411 |
|
---|
412 | pConsoleInput->ulIndexFree = 0;
|
---|
413 | pConsoleInput->ulIndexEvent = 0;
|
---|
414 | pConsoleInput->ulEvents = 0;
|
---|
415 |
|
---|
416 | for (ulCounter = 0;
|
---|
417 | ulCounter < CONSOLE_INPUTQUEUESIZE;
|
---|
418 | ulCounter++)
|
---|
419 | pConsoleInput->arrInputRecord[ulCounter].EventType = 0x0000; /* free event */
|
---|
420 |
|
---|
421 | return (TRUE);
|
---|
422 | }
|
---|
423 |
|
---|
424 |
|
---|
425 | /*****************************************************************************
|
---|
426 | * Name : DWORD HMDeviceConsoleInClass::GetConsoleMode
|
---|
427 | * Purpose : queries the current console mode
|
---|
428 | * Parameters: PHMHANDLEDATA pHMHandleData - handle specific data
|
---|
429 | * LPDWORD lpMode
|
---|
430 | * Variables :
|
---|
431 | * Result :
|
---|
432 |
|
---|
433 | * Remark :
|
---|
434 | * Status : UNTESTED
|
---|
435 | *
|
---|
436 | * Author : Patrick Haller [Wed, 1998/02/16 11:46]
|
---|
437 | *****************************************************************************/
|
---|
438 |
|
---|
439 | DWORD HMDeviceConsoleInClass::GetConsoleMode(PHMHANDLEDATA pHMHandleData,
|
---|
440 | LPDWORD lpMode)
|
---|
441 | {
|
---|
442 | #ifdef DEBUG_LOCAL2
|
---|
443 | WriteLog("KERNEL32/CONSOLE: CONIN$::GetConsoleMode(%08x,%08x).\n",
|
---|
444 | pHMHandleData,
|
---|
445 | lpMode);
|
---|
446 | #endif
|
---|
447 |
|
---|
448 | *lpMode = pConsoleInput->dwConsoleMode; /* return current console mode */
|
---|
449 |
|
---|
450 | return (TRUE);
|
---|
451 | }
|
---|
452 |
|
---|
453 |
|
---|
454 | /*****************************************************************************
|
---|
455 | * Name : DWORD HMDeviceConsoleInClass::GetNumberOfConsoleInputEvents
|
---|
456 | * Purpose : queries the current number of events in the input queue
|
---|
457 | * Parameters: PHMHANDLEDATA pHMHandleData - handle specific data
|
---|
458 | * LPDWORD lpNumberOfEvents - return number of events
|
---|
459 | * Variables :
|
---|
460 | * Result :
|
---|
461 | * Remark :
|
---|
462 | * Status : UNTESTED
|
---|
463 | *
|
---|
464 | * Author : Patrick Haller [Wed, 1998/02/16 11:46]
|
---|
465 | *****************************************************************************/
|
---|
466 |
|
---|
467 | BOOL HMDeviceConsoleInClass::GetNumberOfConsoleInputEvents(PHMHANDLEDATA pHMHandleData,
|
---|
468 | LPDWORD lpNumberOfEvents)
|
---|
469 | {
|
---|
470 | #ifdef DEBUG_LOCAL2
|
---|
471 | WriteLog("KERNEL32/CONSOLE: CONIN$::GetNumberOfConsoleInputEvents(%08x,%08x).\n",
|
---|
472 | pHMHandleData,
|
---|
473 | lpNumberOfEvents);
|
---|
474 | #endif
|
---|
475 |
|
---|
476 | *lpNumberOfEvents = pConsoleInput->ulEvents; /* return number of events */
|
---|
477 |
|
---|
478 | return (TRUE);
|
---|
479 | }
|
---|
480 |
|
---|
481 |
|
---|
482 | /*****************************************************************************
|
---|
483 | * Name : DWORD HMDeviceConsoleInClass::PeekConsoleInputA
|
---|
484 | * Purpose : peeks events placed in the console input queue
|
---|
485 | * Parameters: PHMHANDLEDATA pHMHandleData - current handle data
|
---|
486 | * PINPUT_RECORD pirBuffer - target buffer for events
|
---|
487 | * DWORD cInRecords - number of input records
|
---|
488 | * LPDWORD lpcRead - returns number of events stored
|
---|
489 | * Variables :
|
---|
490 | * Result : TRUE if successful, FALSE otherwise
|
---|
491 | * Remark : if queue is completely filled and no event is free,
|
---|
492 | * loop will scan over queue multiple times, until target
|
---|
493 | * buffer is filled. It does not check ulCounter to stop
|
---|
494 | * when one scan of the queue is complete.
|
---|
495 | * Status : UNTESTED
|
---|
496 | *
|
---|
497 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
---|
498 | *****************************************************************************/
|
---|
499 |
|
---|
500 | DWORD HMDeviceConsoleInClass::PeekConsoleInputA(PHMHANDLEDATA pHMHandleData,
|
---|
501 | PINPUT_RECORD pirBuffer,
|
---|
502 | DWORD cInRecords,
|
---|
503 | LPDWORD lpcRead)
|
---|
504 | {
|
---|
505 | ULONG ulCounter; /* loop counter */
|
---|
506 | ULONG ulCurrentEvent; /* index of current event in the queue */
|
---|
507 | PINPUT_RECORD pirEvent; /* pointer to current queue element */
|
---|
508 |
|
---|
509 | #ifdef DEBUG_LOCAL2
|
---|
510 | WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputA(%08x,%08x,%08x,%08x).\n",
|
---|
511 | pHMHandleData,
|
---|
512 | pirBuffer,
|
---|
513 | cInRecords,
|
---|
514 | lpcRead);
|
---|
515 | #endif
|
---|
516 |
|
---|
517 | if (iConsoleInputQueryEvents() == 0) /* if queue is currently empty */
|
---|
518 | {
|
---|
519 | *lpcRead = 0; /* no events read from queue */
|
---|
520 | return (TRUE); /* OK, we're done */
|
---|
521 | }
|
---|
522 |
|
---|
523 |
|
---|
524 | for (ulCounter = 0,
|
---|
525 | ulCurrentEvent = pConsoleInput->ulIndexEvent,
|
---|
526 | pirEvent = &pConsoleInput->arrInputRecord[pConsoleInput->ulIndexEvent];
|
---|
527 |
|
---|
528 | ulCounter < cInRecords;
|
---|
529 |
|
---|
530 | ulCounter++,
|
---|
531 | ulCurrentEvent++,
|
---|
532 | pirEvent++,
|
---|
533 | pirBuffer++)
|
---|
534 | {
|
---|
535 | if (ulCurrentEvent > CONSOLE_INPUTQUEUESIZE) /* reaching after end of que*/
|
---|
536 | {
|
---|
537 | ulCurrentEvent = 0; /* then start over from beginning of queue */
|
---|
538 | pirEvent = pConsoleInput->arrInputRecord;
|
---|
539 | }
|
---|
540 |
|
---|
541 | if (pirEvent->EventType == 0x0000) /* no more events ? */
|
---|
542 | break; /* leave loop then */
|
---|
543 |
|
---|
544 | memcpy(pirEvent, /* copy event data */
|
---|
545 | pirBuffer,
|
---|
546 | sizeof(INPUT_RECORD));
|
---|
547 | }
|
---|
548 |
|
---|
549 | *lpcRead = ulCounter; /* return number of events read */
|
---|
550 | return (TRUE); /* OK, we're done */
|
---|
551 | }
|
---|
552 |
|
---|
553 |
|
---|
554 | /*****************************************************************************
|
---|
555 | * Name : DWORD HMDeviceConsoleInClass::PeekConsoleInputW
|
---|
556 | * Purpose : peeks events placed in the console input queue
|
---|
557 | * Parameters: PHMHANDLEDATA pHMHandleData - current handle data
|
---|
558 | * PINPUT_RECORD pirBuffer - target buffer for events
|
---|
559 | * DWORD cInRecords - number of input records
|
---|
560 | * LPDWORD lpcRead - returns number of events stored
|
---|
561 | * Variables :
|
---|
562 | * Result : TRUE if successful, FALSE otherwise
|
---|
563 | * Remark : if queue is completely filled and no event is free,
|
---|
564 | * loop will scan over queue multiple times, until target
|
---|
565 | * buffer is filled. It does not check ulCounter to stop
|
---|
566 | * when one scan of the queue is complete.
|
---|
567 | * Status : UNTESTED
|
---|
568 | *
|
---|
569 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
---|
570 | *****************************************************************************/
|
---|
571 |
|
---|
572 | DWORD HMDeviceConsoleInClass::PeekConsoleInputW(PHMHANDLEDATA pHMHandleData,
|
---|
573 | PINPUT_RECORD pirBuffer,
|
---|
574 | DWORD cInRecords,
|
---|
575 | LPDWORD lpcRead)
|
---|
576 | {
|
---|
577 | ULONG ulCounter; /* loop counter */
|
---|
578 | ULONG ulCurrentEvent; /* index of current event in the queue */
|
---|
579 | PINPUT_RECORD pirEvent; /* pointer to current queue element */
|
---|
580 |
|
---|
581 | #ifdef DEBUG_LOCAL2
|
---|
582 | WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::PeekConsoleInputW(%08x,%08x,%08x,%08x).\n",
|
---|
583 | pHMHandleData,
|
---|
584 | pirBuffer,
|
---|
585 | cInRecords,
|
---|
586 | lpcRead);
|
---|
587 | #endif
|
---|
588 |
|
---|
589 | if (iConsoleInputQueryEvents() == 0) /* if queue is currently empty */
|
---|
590 | {
|
---|
591 | *lpcRead = 0; /* no events read from queue */
|
---|
592 | return (TRUE); /* OK, we're done */
|
---|
593 | }
|
---|
594 |
|
---|
595 |
|
---|
596 | for (ulCounter = 0,
|
---|
597 | ulCurrentEvent = pConsoleInput->ulIndexEvent,
|
---|
598 | pirEvent = &pConsoleInput->arrInputRecord[pConsoleInput->ulIndexEvent];
|
---|
599 |
|
---|
600 | ulCounter < cInRecords;
|
---|
601 |
|
---|
602 | ulCounter++,
|
---|
603 | ulCurrentEvent++,
|
---|
604 | pirEvent++,
|
---|
605 | pirBuffer++)
|
---|
606 | {
|
---|
607 | if (ulCurrentEvent > CONSOLE_INPUTQUEUESIZE) /* reaching after end of que*/
|
---|
608 | {
|
---|
609 | ulCurrentEvent = 0; /* then start over from beginning of queue */
|
---|
610 | pirEvent = pConsoleInput->arrInputRecord;
|
---|
611 | }
|
---|
612 |
|
---|
613 | if (pirEvent->EventType == 0x0000) /* no more events ? */
|
---|
614 | break; /* leave loop then */
|
---|
615 |
|
---|
616 | memcpy(pirEvent, /* copy event data */
|
---|
617 | pirBuffer,
|
---|
618 | sizeof(INPUT_RECORD));
|
---|
619 | }
|
---|
620 |
|
---|
621 | *lpcRead = ulCounter; /* return number of events read */
|
---|
622 | return (TRUE); /* OK, we're done */
|
---|
623 | }
|
---|
624 |
|
---|
625 |
|
---|
626 | /*****************************************************************************
|
---|
627 | * Name : DWORD HMDeviceConsoleInClass::ReadConsoleA
|
---|
628 | * Purpose : read a string from the console
|
---|
629 | * Parameters: PHMHANDLEDATA pHMHandleData - handle specific data
|
---|
630 | * LPWORD lpwAttribute
|
---|
631 | * DWORD cWriteCells
|
---|
632 | * COORD dwWriteCoord
|
---|
633 | * LPDWORD lpcWritten
|
---|
634 | * Variables :
|
---|
635 | * Result :
|
---|
636 | * Remark :
|
---|
637 | * Status : UNTESTED
|
---|
638 | *
|
---|
639 | * Author : Patrick Haller [Wed, 1998/02/16 11:46]
|
---|
640 | *****************************************************************************/
|
---|
641 |
|
---|
642 | DWORD HMDeviceConsoleInClass::ReadConsoleA(PHMHANDLEDATA pHMHandleData,
|
---|
643 | CONST VOID* lpvBuffer,
|
---|
644 | DWORD cchToRead,
|
---|
645 | LPDWORD lpcchRead,
|
---|
646 | LPVOID lpvReserved)
|
---|
647 | {
|
---|
648 | PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
|
---|
649 |
|
---|
650 | #ifdef DEBUG_LOCAL2
|
---|
651 | WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleA(%08x,%08x,%u,%08x,%08x).\n",
|
---|
652 | pHMHandleData,
|
---|
653 | lpvBuffer,
|
---|
654 | cchToRead,
|
---|
655 | lpcchRead,
|
---|
656 | lpvReserved);
|
---|
657 | #endif
|
---|
658 |
|
---|
659 | /* simply forward the request to that routine */
|
---|
660 | return (HMDeviceConsoleInClass::ReadFile(pHMHandleData,
|
---|
661 | lpvBuffer,
|
---|
662 | cchToRead,
|
---|
663 | lpcchRead,
|
---|
664 | NULL));
|
---|
665 | }
|
---|
666 |
|
---|
667 |
|
---|
668 | /*****************************************************************************
|
---|
669 | * Name : DWORD HMDeviceConsoleInClass::ReadConsoleW
|
---|
670 | * Purpose : write a string to the console
|
---|
671 | * Parameters: PHMHANDLEDATA pHMHandleData - handle specific data
|
---|
672 | * LPWORD lpwAttribute
|
---|
673 | * DWORD cWriteCells
|
---|
674 | * COORD dwWriteCoord
|
---|
675 | * LPDWORD lpcWritten
|
---|
676 | * Variables :
|
---|
677 | * Result :
|
---|
678 | * Remark :
|
---|
679 | * Status : UNTESTED
|
---|
680 | *
|
---|
681 | * Author : Patrick Haller [Wed, 1998/02/16 11:46]
|
---|
682 | *****************************************************************************/
|
---|
683 |
|
---|
684 | DWORD HMDeviceConsoleInClass::ReadConsoleW(PHMHANDLEDATA pHMHandleData,
|
---|
685 | CONST VOID* lpvBuffer,
|
---|
686 | DWORD cchToRead,
|
---|
687 | LPDWORD lpcchRead,
|
---|
688 | LPVOID lpvReserved)
|
---|
689 | {
|
---|
690 | PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
|
---|
691 | DWORD dwResult;
|
---|
692 | LPSTR lpstrAscii;
|
---|
693 |
|
---|
694 | #ifdef DEBUG_LOCAL2
|
---|
695 | WriteLog("KERNEL32/CONSOLE: CONIN$::ReadConsoleW(%08x,%08x,%u,%08x,%08x).\n",
|
---|
696 | pHMHandleData,
|
---|
697 | lpvBuffer,
|
---|
698 | cchToRead,
|
---|
699 | lpcchRead,
|
---|
700 | lpvReserved);
|
---|
701 | #endif
|
---|
702 |
|
---|
703 | // create ascii buffer
|
---|
704 | lpstrAscii = (LPSTR)HEAP_malloc(cchToRead);
|
---|
705 | if (lpstrAscii == NULL)
|
---|
706 | return ERROR_NOT_ENOUGH_MEMORY;
|
---|
707 |
|
---|
708 | /* simply forward the request to that routine */
|
---|
709 | dwResult = HMDeviceConsoleInClass::ReadFile(pHMHandleData,
|
---|
710 | lpstrAscii,
|
---|
711 | cchToRead,
|
---|
712 | lpcchRead,
|
---|
713 | NULL);
|
---|
714 | /* Ascii -> unicode translation */
|
---|
715 | if (dwResult == TRUE)
|
---|
716 | lstrcpynAtoW((LPWSTR)lpvBuffer, lpstrAscii, *lpcchRead);
|
---|
717 |
|
---|
718 | HEAP_free(lpstrAscii);
|
---|
719 |
|
---|
720 | return (dwResult); /* deliver return code */
|
---|
721 | }
|
---|
722 |
|
---|
723 |
|
---|
724 | /*****************************************************************************
|
---|
725 | * Name : DWORD HMDeviceConsoleInClass::ReadConsoleInputA
|
---|
726 | * Purpose : read events placed in the console input queue
|
---|
727 | * Parameters: PHMHANDLEDATA pHMHandleData - current handle data
|
---|
728 | * PINPUT_RECORD pirBuffer - target buffer for events
|
---|
729 | * DWORD cInRecords - number of input records
|
---|
730 | * LPDWORD lpcRead - returns number of events stored
|
---|
731 | * Variables :
|
---|
732 | * Result : TRUE if successful, FALSE otherwise
|
---|
733 | * Remark :
|
---|
734 | * Status : UNTESTED
|
---|
735 | *
|
---|
736 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
---|
737 | *****************************************************************************/
|
---|
738 |
|
---|
739 | DWORD HMDeviceConsoleInClass::ReadConsoleInputA(PHMHANDLEDATA pHMHandleData,
|
---|
740 | PINPUT_RECORD pirBuffer,
|
---|
741 | DWORD cInRecords,
|
---|
742 | LPDWORD lpcRead)
|
---|
743 | {
|
---|
744 | ULONG ulPostCounter; /* semaphore post counter - ignored */
|
---|
745 | APIRET rc; /* API returncode */
|
---|
746 |
|
---|
747 | #ifdef DEBUG_LOCAL2
|
---|
748 | WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputA(%08x,%08x,%08x,%08x).\n",
|
---|
749 | pHMHandleData,
|
---|
750 | pirBuffer,
|
---|
751 | cInRecords,
|
---|
752 | lpcRead);
|
---|
753 | #endif
|
---|
754 |
|
---|
755 | if (iConsoleInputQueryEvents() == 0) /* if queue is currently empty */
|
---|
756 | {
|
---|
757 | rc = DosWaitEventSem(pConsoleInput->hevInputQueue, /* wait for input */
|
---|
758 | SEM_INDEFINITE_WAIT);
|
---|
759 | DosResetEventSem(pConsoleInput->hevInputQueue, /* reset semaphore */
|
---|
760 | &ulPostCounter); /* post counter - ignored */
|
---|
761 | }
|
---|
762 |
|
---|
763 |
|
---|
764 | /* now read events into target buffer */
|
---|
765 | for (ulPostCounter = 0;
|
---|
766 | ulPostCounter < cInRecords;
|
---|
767 | ulPostCounter++,
|
---|
768 | pirBuffer++)
|
---|
769 | {
|
---|
770 | rc = iConsoleInputEventPop(pirBuffer); /* get event from queue */
|
---|
771 | if (rc != NO_ERROR) /* if read error occurs, break look */
|
---|
772 | break;
|
---|
773 | }
|
---|
774 |
|
---|
775 | *lpcRead = ulPostCounter; /* return number of records read */
|
---|
776 | return (TRUE); /* OK */
|
---|
777 | }
|
---|
778 |
|
---|
779 |
|
---|
780 | /*****************************************************************************
|
---|
781 | * Name : DWORD HMDeviceConsoleInClass::ReadConsoleInputW
|
---|
782 | * Purpose : read events placed in the console input queue
|
---|
783 | * Parameters: PHMHANDLEDATA pHMHandleData - current handle data
|
---|
784 | * PINPUT_RECORD pirBuffer - target buffer for events
|
---|
785 | * DWORD cInRecords - number of input records
|
---|
786 | * LPDWORD lpcRead - returns number of events stored
|
---|
787 | * Variables :
|
---|
788 | * Result : TRUE if successful, FALSE otherwise
|
---|
789 | * Remark :
|
---|
790 | * Status : UNTESTED
|
---|
791 | *
|
---|
792 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
---|
793 | *****************************************************************************/
|
---|
794 |
|
---|
795 | DWORD HMDeviceConsoleInClass::ReadConsoleInputW(PHMHANDLEDATA pHMHandleData,
|
---|
796 | PINPUT_RECORD pirBuffer,
|
---|
797 | DWORD cInRecords,
|
---|
798 | LPDWORD lpcRead)
|
---|
799 | {
|
---|
800 | ULONG ulPostCounter; /* semaphore post counter - ignored */
|
---|
801 | APIRET rc; /* API returncode */
|
---|
802 |
|
---|
803 | #ifdef DEBUG_LOCAL2
|
---|
804 | WriteLog("KERNEL32/CONSOLE: HMDeviceConsoleInClass::ReadConsoleInputW(%08x,%08x,%08x,%08x).\n",
|
---|
805 | pHMHandleData,
|
---|
806 | pirBuffer,
|
---|
807 | cInRecords,
|
---|
808 | lpcRead);
|
---|
809 | #endif
|
---|
810 |
|
---|
811 | if (iConsoleInputQueryEvents() == 0) /* if queue is currently empty */
|
---|
812 | {
|
---|
813 | rc = DosWaitEventSem(pConsoleInput->hevInputQueue, /* wait for input */
|
---|
814 | SEM_INDEFINITE_WAIT);
|
---|
815 | DosResetEventSem(pConsoleInput->hevInputQueue, /* reset semaphore */
|
---|
816 | &ulPostCounter); /* post counter - ignored */
|
---|
817 | }
|
---|
818 |
|
---|
819 |
|
---|
820 | /* now read events into target buffer */
|
---|
821 | for (ulPostCounter = 0;
|
---|
822 | ulPostCounter < cInRecords;
|
---|
823 | ulPostCounter++,
|
---|
824 | pirBuffer++)
|
---|
825 | {
|
---|
826 | rc = iConsoleInputEventPop(pirBuffer); /* get event from queue */
|
---|
827 | if (rc != NO_ERROR) /* if read error occurs, break look */
|
---|
828 | break;
|
---|
829 | }
|
---|
830 |
|
---|
831 | *lpcRead = ulPostCounter; /* return number of records read */
|
---|
832 | return (TRUE); /* OK */
|
---|
833 | }
|
---|
834 |
|
---|
835 |
|
---|
836 | /*****************************************************************************
|
---|
837 | * Name : DWORD HMDeviceConsoleInClass::SetConsoleMode
|
---|
838 | * Purpose : sets the current console mode
|
---|
839 | * Parameters: PHMHANDLEDATA pHMHandleData - handle specific data
|
---|
840 | * DWORD dwMode - console mode
|
---|
841 | * Variables :
|
---|
842 | * Result :
|
---|
843 | * Remark :
|
---|
844 | * Status : UNTESTED
|
---|
845 | *
|
---|
846 | * Author : Patrick Haller [Wed, 1998/02/16 11:46]
|
---|
847 | *****************************************************************************/
|
---|
848 |
|
---|
849 | DWORD HMDeviceConsoleInClass::SetConsoleMode(PHMHANDLEDATA pHMHandleData,
|
---|
850 | DWORD dwMode)
|
---|
851 | {
|
---|
852 | PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
|
---|
853 |
|
---|
854 | #ifdef DEBUG_LOCAL2
|
---|
855 | WriteLog("KERNEL32/CONSOLE: CONIN$::SetConsoleMode(%08x,%08x).\n",
|
---|
856 | pHMHandleData,
|
---|
857 | dwMode);
|
---|
858 | #endif
|
---|
859 |
|
---|
860 | pConsoleInput->dwConsoleMode = dwMode; /* set current console mode */
|
---|
861 |
|
---|
862 | return (TRUE);
|
---|
863 | }
|
---|
864 |
|
---|
865 |
|
---|
866 | /*****************************************************************************
|
---|
867 | * Name : DWORD HMDeviceConsoleInClass::WriteConsoleInputA
|
---|
868 | * Purpose : this writes event records directly into the queue
|
---|
869 | * Parameters: PHMHANDLEDATA pHMHandleData
|
---|
870 | * PINPUT_RECORD pirBuffer
|
---|
871 | * DWORD cInRecords
|
---|
872 | * LPDWORD lpcWritten
|
---|
873 | * Variables :
|
---|
874 | * Result :
|
---|
875 | * Remark :
|
---|
876 | * Status : NO_ERROR - API succeeded
|
---|
877 | * other - what is to be set in SetLastError
|
---|
878 | *
|
---|
879 | * Author : Patrick Haller [Wed, 1998/02/11 20:44]
|
---|
880 | *****************************************************************************/
|
---|
881 |
|
---|
882 | DWORD HMDeviceConsoleInClass::WriteConsoleInputA (PHMHANDLEDATA pHMHandleData,
|
---|
883 | PINPUT_RECORD pirBuffer,
|
---|
884 | DWORD cInRecords,
|
---|
885 | LPDWORD lpcWritten)
|
---|
886 | {
|
---|
887 | PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
|
---|
888 | APIRET rc; /* API returncode */
|
---|
889 | ULONG ulCounter; /* loop counter */
|
---|
890 |
|
---|
891 | #ifdef DEBUG_LOCAL2
|
---|
892 | WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputA(%08x,%08x,%u,%08x).\n",
|
---|
893 | pHMHandleData,
|
---|
894 | pirBuffer,
|
---|
895 | cInRecords,
|
---|
896 | lpcWritten);
|
---|
897 | #endif
|
---|
898 |
|
---|
899 | for (ulCounter = 0;
|
---|
900 | ulCounter < cInRecords;
|
---|
901 | ulCounter++,
|
---|
902 | pirBuffer++)
|
---|
903 | {
|
---|
904 | rc = iConsoleInputEventPush(pirBuffer); /* push current event */
|
---|
905 | if (rc != NO_ERROR) /* oops ? queue full ? problem ? */
|
---|
906 | break;
|
---|
907 | }
|
---|
908 |
|
---|
909 | *lpcWritten = ulCounter; /* return number of events written */
|
---|
910 | return (TRUE); /* OK */
|
---|
911 | }
|
---|
912 |
|
---|
913 |
|
---|
914 | /*****************************************************************************
|
---|
915 | * Name : DWORD HMDeviceConsoleInClass::WriteConsoleInputW
|
---|
916 | * Purpose : this writes event records directly into the queue
|
---|
917 | * Parameters: PHMHANDLEDATA pHMHandleData
|
---|
918 | * PINPUT_RECORD pirBuffer
|
---|
919 | * DWORD cInRecords
|
---|
920 | * LPDWORD lpcWritten
|
---|
921 | * Variables :
|
---|
922 | * Result :
|
---|
923 | * Remark :
|
---|
924 | * Status : NO_ERROR - API succeeded
|
---|
925 | * other - what is to be set in SetLastError
|
---|
926 | *
|
---|
927 | * Author : Patrick Haller [Wed, 1998/02/11 20:44]
|
---|
928 | *****************************************************************************/
|
---|
929 |
|
---|
930 | DWORD HMDeviceConsoleInClass::WriteConsoleInputW (PHMHANDLEDATA pHMHandleData,
|
---|
931 | PINPUT_RECORD pirBuffer,
|
---|
932 | DWORD cInRecords,
|
---|
933 | LPDWORD lpcWritten)
|
---|
934 | {
|
---|
935 | PCONSOLEBUFFER pConsoleBuffer = (PCONSOLEBUFFER)pHMHandleData->lpHandlerData;
|
---|
936 | APIRET rc; /* API returncode */
|
---|
937 | ULONG ulCounter; /* loop counter */
|
---|
938 |
|
---|
939 | #ifdef DEBUG_LOCAL2
|
---|
940 | WriteLog("KERNEL32/CONSOLE: CONIN$::WriteConsoleInputW(%08x,%08x,%u,%08x).\n",
|
---|
941 | pHMHandleData,
|
---|
942 | pirBuffer,
|
---|
943 | cInRecords,
|
---|
944 | lpcWritten);
|
---|
945 | #endif
|
---|
946 |
|
---|
947 | for (ulCounter = 0;
|
---|
948 | ulCounter < cInRecords;
|
---|
949 | ulCounter++,
|
---|
950 | pirBuffer++)
|
---|
951 | {
|
---|
952 | rc = iConsoleInputEventPush(pirBuffer); /* push current event */
|
---|
953 | if (rc != NO_ERROR) /* oops ? queue full ? problem ? */
|
---|
954 | break;
|
---|
955 | }
|
---|
956 |
|
---|
957 | *lpcWritten = ulCounter; /* return number of events written */
|
---|
958 | return (TRUE); /* OK */
|
---|
959 | }
|
---|
960 |
|
---|
961 |
|
---|