[GHC] #1198: Windows: hWaitForInput returns False for file handles, and doesn't work properly for consoles

GHC trac at galois.com
Mon Jun 23 07:35:35 EDT 2008


#1198: Windows: hWaitForInput returns False for file handles, and doesn't work
properly for consoles
-------------------------------------+--------------------------------------
 Reporter:  igloo                    |          Owner:  simonmar
     Type:  bug                      |         Status:  new     
 Priority:  low                      |      Milestone:  6.10.1  
Component:  libraries/base           |        Version:  6.6     
 Severity:  normal                   |     Resolution:          
 Keywords:                           |     Difficulty:  Unknown 
 Testcase:  readwrite002, hReady001  |   Architecture:  Unknown 
       Os:  Windows                  |  
-------------------------------------+--------------------------------------
Changes (by simonmar):

  * owner:  => simonmar
  * milestone:  _|_ => 6.10.1

Comment:

 Replying to [comment:6 judah]:
 > Simon, assuming you're calling `ReadConsoleInput` to get the console
 event, I've found the following to work well.  An `INPUT_RECORD` named `e`
 corresponds to actual character input when these are all true:
 >  - {{{e.EventType == KEY_EVENT}}}
 >  - {{{e.KeyEvent.bKeyDown == TRUE}}}
 >  - {{{e.KeyEvent.uChar.AsciiChar != '\0'}}}
 >
 > The third condition filters out modifier keys like "shift".

 Interesting, so all I was missing was the third condition.  Thanks for
 that, I'll revive my code and try to get it into GHC 6.10.

 Incedentally, since you seem to know a fair bit about the Win32 API, is
 there a good way to find out whether a given `HANDLE` corresponds to a
 console?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1198#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list