Showing results for History - The Old New Thing

Mar 26, 2004
Post comments count0
Post likes count0

The ways people mess up IUnknown::QueryInterface

Raymond Chen
Raymond Chen

When you're dealing with application compatibility, you discover all sorts of things that worked only by accident. Today, I'll talk about some of the "creative" ways people mess up the IUnknown::QueryInterface method. Now, you'd think, "This interface is so critical to COM, how could anybody possible mess it up?" Forgetting to respond to IUnk...

History
Mar 24, 2004
Post comments count0
Post likes count0

Some files come up strange in Notepad

Raymond Chen
Raymond Chen

David Cumps discovered that certain text files come up strange in Notepad. The reason is that Notepad has to edit files in a variety of encodings, and when its back against the wall, sometimes it's forced to guess. Here's the file "Hello" in various encodings: This is the traditional ANSI encoding. This is the Unicode (little-endian) ...

History
Mar 19, 2004
Post comments count0
Post likes count0

Why does the Resource Compiler complain about strings longer than 255 characters?

Raymond Chen
Raymond Chen

As we learned in a previous entry, string resources group strings into bundles of 16, each Unicode string in the bundle prefixed by a 16-bit length. Why does the Resource Compiler complain about strings longer than 255 characters? This is another leftover from 16-bit Windows. Back in the Win16 days, string resources were also grouped into bu...

History
Mar 18, 2004
Post comments count0
Post likes count0

Why is the line terminator CR+LF?

Raymond Chen
Raymond Chen

This protocol dates back to the days of teletypewriters. CR stands for "carriage return" - the CR control character returned the print head ("carriage") to column 0 without advancing the paper. LF stands for "linefeed" - the LF control character advanced the paper one line without moving the print head. So if you wanted to return the print head to ...

History
Mar 17, 2004
Post comments count0
Post likes count1

More on the AMD64 calling convention

Raymond Chen
Raymond Chen

Josh Williams picks up the 64-bit ball with an even deeper discussion of the AMD64 (aka x64) calling convention and things that go wrong when you misdeclare your function prototypes.

History
Mar 17, 2004
Post comments count0
Post likes count1

On a server, paging = death

Raymond Chen
Raymond Chen

Chris Brumme's latest treatise contained the sentence "Servers must not page". That's because on a server, paging = death. I had occasion to meet somebody from another division who told me this little story: They had a server that went into thrashing death every 10 hours, like clockwork, and had to be rebooted. To mask the problem, the server was c...

History
Mar 16, 2004
Post comments count0
Post likes count1

Why do text files end in Ctrl+Z?

Raymond Chen
Raymond Chen

Actually, text files don't need to end in Ctrl+Z, but the convention persists in certain circles. (Though, fortunately, those circles are awfully small nowadays.) This story requires us to go back to CP/M, the operating system that MS-DOS envisioned itself as a successor to. (Since the 8086 envisioned itself as the successor to the 8080, it was na...

History
Mar 11, 2004
Post comments count0
Post likes count0

Why are dialog boxes initially created hidden?

Raymond Chen
Raymond Chen

You may not have noticed it until you looked closely, but dialog boxes are actually created hidden initially, even if you specify WS_VISIBLE in the template. The reason for this is historical. Rewind back to the old days (we're talking Windows 1.0), graphics cards are slow and CPUs are slow and memory is slow. You can pick a menu option tha...

History
Mar 10, 2004
Post comments count0
Post likes count0

Why do operations on "byte" result in "int"?

Raymond Chen
Raymond Chen

(The following discussion applies equally to C/C++/C#, so I'll use C#, since I talk about it so rarely.) People complain that the following code elicits a warning: "The result of an operation on 'byte' should be another 'byte', not an 'int'," they claim. Be careful what you ask for. You might not like it. Suppose we lived in a fantasy world ...

History
Mar 5, 2004
Post comments count0
Post likes count0

Defrauding the WHQL driver certification process

Raymond Chen
Raymond Chen

In a comment to one of my earlier entries, someone mentioned a driver that bluescreened under normal conditions, but once you enabled the Driver Verifier (to try to catch the driver doing whatever bad thing it was doing), the problem went away. Another commenter bemoaned that WHQL certification didn't seem to improve the quality of the dri...

History