The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Jun 1, 2009
Post comments count 0
Post likes count 1

Why does the CreateProcess function modify its input command line?

Raymond Chen

One of the nasty gotchas of the function is that the parameter must be a mutable pointer. If you pass a pointer to memory that cannot be written to (for example, a pointer to a page that is marked ), then you might crash. Commenter Ritchie wonders why this parameter is so weird. Basically, somebody back in the 1980's wanted to avoid allocating memory. (Another way of interpreting this is that somebody tried to be a bit too clever.) The temporarily modifies the string you pass as the in its attempt to figure out where the program name ends and the command line arguments begin. Now, it could have made a ...

May 29, 2009
Post comments count 0
Post likes count 0

Lessons from the state police, like what to do when they pull you over

Raymond Chen

NPR's Noah Adams rides along with the Idaho State Police and learns the answers to questions like what you should do when you are pulled over, and why the first thing the officer does is touch your car.

May 29, 2009
Post comments count 0
Post likes count 1

Alternatives to using the #error directive to check whether the compiler even sees you

Raymond Chen

In response to my description of how you can use the #error directive to check whether the compiler even sees you, some commenters proposed alternatives. I never claimed that my technique was the only one, just that it was another option available to you. Here are some other options. scott suggested merely typing asdasdasd into the header file and seeing if you get an error. This usually works, but it can be problematic if the code does not already compile. And of course it doesn't compile, because the reason why you're doing this investigation in the first place is that you can't get your code to compile and...

May 28, 2009
Post comments count 0
Post likes count 1

An unexpected application of the First Law of Thermodynamics

Raymond Chen

This past winter, my furnace failed catastrophically. (The furnace repair person told me that when furnaces fail, it tends to be catastrophic failure.) It was a few days before everything was back in order, and the very day everything was working again, the furnace belonging to one of my relatives stopped working. This was an application of the First Law of Thermodynamics with which I had previously been unfamiliar. Fortunately, the repair on the second furnace was very simple and was done in just a few hours. After I informed my friends of my discovery of this law of the universe, one of them wrote, "Our...

May 28, 2009
Post comments count 0
Post likes count 1

I’m sorry, you don’t have permission to know where this shortcut file should show up in the Explorer window

Raymond Chen

Commenter Gabe suggested that the shortcut file should contain a bit that indicates whether the target of the shortcut is a folder, so that shortcuts to folders can sort with real folders. "That would allow them to sort properly without doing any additional work beyond that required to see its icon." (Commenter Josh agreed that "The performance reason doesn't really apply here, since explorer is already looking at the target to get the icon," rejecting commenter AndyC's argument that performance may have been a concern.) Well, first of all, shortcuts do remember whether the target is a file or a folder, or at...

May 27, 2009
Post comments count 0
Post likes count 1

Before designing and implementing around an assumption, it helps to check that your assumption is true

Raymond Chen

When your component depends on another component in the project, and that other component is missing features you need, you have a few ways of resolving the situation. Most people would recommend working with the people responsible for the other component during the project planning phase and coming to some sort of understanding about what you require from them and when they might be able to provide it, if at all. And then there's this approach. This imaginary email conversation takes place about halfway through a project: From: David Doe Hello, widget team. I'm David Doe, from the doodad team. Do widgets...

May 26, 2009
Post comments count 0
Post likes count 0

How to hide privacy violations in a privacy disclosure statement, part 2

Raymond Chen

It seems that nearly every privacy statement somebody sends me doesn't actually protect my privacy. They start out saying all sorts of great things, like Company X is committed to maintaining the privacy of its customers. After the section listing what information they collect, there's the section describing who they will disclose it to. We do not share non-public personal information with outside parties except as permitted by law... Oh, gee, thanks. Your policy is not to do anything illegal. And you need a privacy statement for this? Actually, it's worse, The full sentence goes like this: ...

May 26, 2009
Post comments count 0
Post likes count 1

What do you call a gadget that is used for debugging which looks at the properties of other gadgets?

Raymond Chen

Why, the Inspector Gadget, of course. Computer geeks think they're so clever.

May 25, 2009
Post comments count 0
Post likes count 0

The latest installment of Wallace and Gromit coming to Seattle

Raymond Chen

The Seattle International Film Festival is under way, and you get only one chance to see Wallace and Gromit: A Matter of Loaf and Death, featuring our favorite inventor/cheese-aficionado and his trusty sidekick on their latest animated adventure. Be there on Saturday morning, but please leave the Stinking Bishop at home.