[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] select/poll Wine bug workaround

From: Paolo Bonzini
Subject: Re: [PATCH] select/poll Wine bug workaround
Date: Wed, 05 Aug 2009 08:01:13 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

Where have you seen a documentation of the bit patterns of handles?
This will not necessarily work in all implementations (Windows, Wine,

In Wine's source code and in http://www.winehq.org/docs/winedev-guide/x3500:

Console handles, on the other hand, are not multiple of four, but have the two lower bit set (being a multiple of four means having the two lower bits reset). When KERNEL32 sees a handle with the two lower bits set, it then knows it's a console handle and takes appropriate decisions. For example, in the various kernel32!WaitFor*() functions, it transforms any console handle (input and output - strangely enough handles to console's screen buffers are waitable) into a dedicated wait event for the targetted console. There's an (undocumented) KERNEL32 function GetConsoleInputWaitHandle() which returns the handle to this event in case you need it. Another interesting handling of those console's handles is in ReadFile() (resp. WriteFile()), which behavior, for console's handles, is transferred to ReadConsole() (resp. WriteConsole()). Note that's always the ANSI version of ReadConsole() / WriteConsole() which is called, hence using the default console's code page. There are some other spots affected, but you can look in dlls/kernel to find them all. All of this is implemented in Wine.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]