Difference between revisions of "W343-3"

From NetHackWiki
Jump to navigation Jump to search
(Specific versions of Windows confirmed to have this bug)
(Bilious now has a patch for this bug. Going to have to drop the link to the screenshot, it hits the spam filter.)
Line 6: Line 6:
 
== Nature of the bug ==
 
== Nature of the bug ==
  
The bug has been reported on [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/4ba778741135464e Polish] and Russian editions of Windows 2000 and on a [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/8eea5ab560b85b7b Czech] version of Windows XP.  It has been [http://groups.google.com/group/rec.games.roguelike.nethack/browse_frm/thread/6bd4af64d16878f6 duplicated] on an American Windows XP by changing a language setting.  A [http://republika.pl/amiro/nethack/screen1.png screenshot] is available.
+
The bug has been reported on [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/4ba778741135464e Polish] and Russian editions of Windows 2000 and on a [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/8eea5ab560b85b7b Czech] version of Windows XP.  It has been [http://groups.google.com/group/rec.games.roguelike.nethack/browse_frm/thread/6bd4af64d16878f6 duplicated] on an American Windows XP by changing a language setting.  A screenshot is available by following a link from the Polish report; it cannot be linked from Wikihack because it currently hits the spam filter.
  
 
Bug W343-3 really comprises two distinct and unrelated bugs.  One is a simple character set issue:  many non-USA PCs are configured with different character sets, and seven symbols may look different.  This issue is more fully detailed in the [[IBMgraphics]] article.
 
Bug W343-3 really comprises two distinct and unrelated bugs.  One is a simple character set issue:  many non-USA PCs are configured with different character sets, and seven symbols may look different.  This issue is more fully detailed in the [[IBMgraphics]] article.
Line 41: Line 41:
 
* [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/1634242b9cc429e2 Part 3] contains the patch itself.
 
* [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/1634242b9cc429e2 Part 3] contains the patch itself.
 
* [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/8abe3cd0e85e5a09 Part 4] is a description of each change the patch makes.
 
* [http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/8abe3cd0e85e5a09 Part 4] is a description of each change the patch makes.
 +
 +
The [[Bilious Patch Database]] has a simpler form of this patch, that works around the faulty API but does not alter the IBMgraphics, [http://bilious.homelinux.org/?313 here].
  
 
[[Category:Bugs]]
 
[[Category:Bugs]]

Revision as of 04:18, 18 January 2008

W343-3 designates a bug that affects the Microsoft Windows version of NetHack 3.4.3. The DevTeam lists this bug as fixed in the next release. The bug is listed as:

Under the Polish version of Windows 2000 SP4, screen output with a raster font shows
wrong characters for many dungeon features

Nature of the bug

The bug has been reported on Polish and Russian editions of Windows 2000 and on a Czech version of Windows XP. It has been duplicated on an American Windows XP by changing a language setting. A screenshot is available by following a link from the Polish report; it cannot be linked from Wikihack because it currently hits the spam filter.

Bug W343-3 really comprises two distinct and unrelated bugs. One is a simple character set issue: many non-USA PCs are configured with different character sets, and seven symbols may look different. This issue is more fully detailed in the IBMgraphics article.

The more serious bug is that some characters appear as strange symbols or blank squares. This is not actually a bug in NetHack, but in Windows. The rest of this article will deal with this bug.

Cause of the bug

The bug is a flaw in the Windows WriteConsoleOutputCharacterA API. When its configured code page is other than 437 or 850, many non-ASCII characters can show up incorrectly.

The bug occurs when four conditions are met:

  • The version of Windows is Windows NT or one of its descendants. The bug is confirmed to exist on Windows 2000, Windows XP, and Windows Vista.
  • A bitmap font, rather than Lucida Console, is selected.
  • The command shell is running in a window, rather than full screen.
  • The language for non-Unicode programs is set to one whose OEM code page is anything other than 437 or 850. Basically this means any East European language, whether it uses Greek, Cyrillic or Latin writing.

No API other than WriteConsoleOutputCharacterA is known to be affected. In particular, the Unicode variant WriteConsoleOutputCharacterW works correctly.

Versions affected

NetHack 3.4.3 is known to have this bug. Because NetHack 3.1.1 through 3.1.3 also use the flawed API, it is likely that they have it as well. NetHack 3.2.0 through 3.4.2 use different APIs, and do not have this bug.

Patch

A patch is available to fix this bug; but no binaries or variants other than Spanish NetHack are known to incorporate it.

The patch fixes the API issue by detecting when it is running on an NT-based version of Windows, and using the Unicode API instead, avoiding the Windows bug. It fixes the character set issue as well (see IBMgraphics) by allowing less-extensive variants of IBMgraphics to be set, avoiding the characters that can vary among code pages.

The patch was posted to rec.games.roguelike.nethack as four articles:

  • Part 1 describes the API issue and provides detailed instructions to duplicate it, and a small test program to demonstrate the bug.
  • Part 2 describes the character set issue.
  • Part 3 contains the patch itself.
  • Part 4 is a description of each change the patch makes.

The Bilious Patch Database has a simpler form of this patch, that works around the faulty API but does not alter the IBMgraphics, here.