The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Holy cow, those TechReady attendees really love their tchotchkes
Jul 29, 2010
Post comments count 0
Post likes count 0

Holy cow, those TechReady attendees really love their tchotchkes

Raymond Chen
Raymond Chen

I was at the Ask the Experts event last night at TechReady11, and if I didn't know better, I would have thought the purpose of Ask the Experts was for attendees to wander the room collecting the coolest swag they could get their hands on as quickly as possible. My table was equipped with about two dozen Windows 7 frisbees, and the moment they came out of the box, they disappeared into the hands of passers-by, most of whom didn't even bother reading the sign on the table much less make eye contact with me. The table next to mine started with a mountain of mugs, but it wasn't long before it was reduced to a m...

Why is my icon being drawn at the wrong size when I call DrawIcon?
Jul 29, 2010
Post comments count 0
Post likes count 0

Why is my icon being drawn at the wrong size when I call DrawIcon?

Raymond Chen
Raymond Chen

Some time ago I had a problem with icon drawing. When I tried to draw an icon with it ended up being drawn at the wrong size. A call to confirmed that the icon was 48×48, but it drew at 32×32. The answer is documented in a backwards sort of way in the function, which says at the bottom, To duplicate DrawIcon (hDC, X, Y, hIcon), call DrawIconEx as follows: Aha, if you use , then the icon size is ignored and it is drawn with . The fix, therefore, was to switch to the function so I could remove the flag, thereby permitting the icon to be drawn at its actual size. A bonus quirk of the ...

The frustration of people who have already decided on the solution and won't let you derail them with your annoying questions
Jul 28, 2010
Post comments count 0
Post likes count 0

The frustration of people who have already decided on the solution and won't let you derail them with your annoying questions

Raymond Chen
Raymond Chen

I illustrate this frustration with an actual mail thread (suitably redacted) which I was an observer to. It's a long thread because that's part of the frustration. From: Adam I am looking for some expert advice here on finding a better solution to our performance problem with Product P. Here are the details. [Here follow the details on a problem and three proposed solutions. Feature F is mentioned briefly and rejected because "it will be a problem because of Condition C."] From: Bob This approach is prone to a lot of trouble. Please be more specific about what was wrong with Feature&n...

Hardware backward compatibility: The finicky floppy drive
Jul 27, 2010
Post comments count 0
Post likes count 0

Hardware backward compatibility: The finicky floppy drive

Raymond Chen
Raymond Chen

I think the behavior is more petulant than finicky, but finicky is alliterative. Back in the days of Windows 95, I was talking with the person responsible for, among other things, the floppy disk driver, and I learned about a particular driver hack that was needed to work around a flaw in a very common motherboard chipset. Apparently the floppy disk controller in this chipset was very picky about how you talked to it. If the very first command it receives after power-on is a read request, and there is no disk in the drive, the controller chip hangs unrecoverably. Issuing a reset to the chip has no effect. ...

Why didn't Windows XP auto-elevate programs beyond those named setup.exe?
Jul 26, 2010
Post comments count 0
Post likes count 0

Why didn't Windows XP auto-elevate programs beyond those named setup.exe?

Raymond Chen
Raymond Chen

Commenter J-F has a friend who wonders why Windows XP didn't auto-elevate all installers but rather only the ones named setup.exe. (Perhaps that friend's name is Josh, who repeated the question twelve days later.) Remember what the starting point was. In Windows 2000, nothing was auto-elevated. Before adding a feature, you have to know what problem the feature is trying to solve. The problem is improving the experience for non-administrators who want to install software. When they try to install a program and forget to use the Run as feature, then instead of proceeding halfway through the installer ...

MSDN content is also available as a Web service
Jul 23, 2010
Post comments count 0
Post likes count 0

MSDN content is also available as a Web service

Raymond Chen
Raymond Chen

Unless you've been living under a rock, by now you know about MSDN's low bandwidth view (aka ScriptFree) and lightweight view. But there are other views too, like PDA view (for when you want to look up MSDN documentation on your phone?), Robot view, printer-friendly view, unstyled HTML view... (See that first link above for more details.) But in addition to all the views, you can go directly to the back-end that drives all the data: The MSDN/TechNet Publish System (MTPS) Content Service. With that interface, you can request the back-end data and format it any way you like. Here's an MSDN Magazine article wh...

If I'm not supposed to call IsBadXxxPtr, how can I check if a pointer is bad?
Jul 23, 2010
Post comments count 0
Post likes count 1

If I'm not supposed to call IsBadXxxPtr, how can I check if a pointer is bad?

Raymond Chen
Raymond Chen

Some time ago, I opined that should really be called and you really should just let the program crash if somebody passes you a bad pointer. It is common to put pointer validation code at the start of functions for debugging purposes (as long as you don't make logic decisions based on whether the pointer is valid). But if you can't use , how can you validate the pointer? Well, to validate a write pointer, write to it. To validate a read pointer, read from it. If the pointer is invalid, you'll crash, and at a predictable location, before the function has gotten halfway through its processing (making post-mort...

I will be speaking at TechReady11
Jul 22, 2010
Post comments count 0
Post likes count 0

I will be speaking at TechReady11

Raymond Chen
Raymond Chen

This year, it's advanced debugging.

Things I've written that have amused other people, Episode 7
Jul 22, 2010
Post comments count 0
Post likes count 0

Things I've written that have amused other people, Episode 7

Raymond Chen
Raymond Chen

A customer asked for advice on how to accomplish something, the details of which are not important, except to say that what they were trying to do was far more complicated than the twenty-word summary would suggest. And I wasn't convinced that it was a good idea, sort of like asking for advice on how to catch a baseball in your teeth or pick all the cheese off your cheeseburger. I explained several of the pitfalls of their approach, the ones that I could think of off the top of my head, things they need to watch out for or take precautions against, and I concluded with the sentence, "This idea is fraught with p...