Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. kbdutil.c
  5. Abstract:
  6. This module contains the KBD utilities
  7. Author:
  8. Avi Nathan (avin) 17-Jul-1991
  9. Environment:
  10. User Mode Only
  11. Revision History:
  12. Ellen Aycock-Wright (ellena) 15-Sept-1991 - Modified for Posix
  13. --*/
  14. #define WIN32_ONLY
  15. #include "psxses.h"
  16. DWORD
  17. GetPsxChar(
  18. OUT PCHAR AsciiChar
  19. )
  20. {
  21. DWORD Rc;
  22. INPUT_RECORD In;
  23. DWORD cEvents;
  24. for(;;) {
  25. Rc = ReadConsoleInput(
  26. hConsoleInput,
  27. &In,
  28. 1L,
  29. &cEvents
  30. );
  31. if ( !Rc ) {
  32. return(GetLastError());
  33. }
  34. if ( In.EventType != KEY_EVENT ) {
  35. continue;
  36. }
  37. if ( !In.Event.KeyEvent.bKeyDown ) {
  38. continue;
  39. }
  40. if ( !In.Event.KeyEvent.uChar.AsciiChar ) {
  41. continue;
  42. }
  43. *AsciiChar = In.Event.KeyEvent.uChar.AsciiChar;
  44. break;
  45. }
  46. return(0L);
  47. }