The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

You don't need to ask me a question the compiler can answer more accurately
Jul 27, 2011
Post comments count 0
Post likes count 0

You don't need to ask me a question the compiler can answer more accurately

Raymond Chen
Raymond Chen

A customer reported having problems developing the correct p/invoke signature for the structure. "The code works on 32-bit machines, but on 64-bit machines, the call to returns ." The sample code included the lines My response was simply, "I bet you are passing the wrong structure size. Note that on 64-bit Windows, the alignment of the inner structures is 8-byte rather than 4-byte. Write a C++ program that does the same thing and compare." The customer decided to read only the first sentence of my reply, possibly the second, and ignore the third. "So what size should the structure be on 64-bit machines...

No, we're not going to play Stairway to Heaven, and please tell everbody else in your area code to stop calling me
Jul 26, 2011
Post comments count 0
Post likes count 0

No, we're not going to play Stairway to Heaven, and please tell everbody else in your area code to stop calling me

Raymond Chen
Raymond Chen

Some time ago, I told the story of how one employee's phone received calls intended for a local radio station's contest line due to people dialing seven digits instead of ten and defaulting to the wrong area code. Upon reading that story, a colleague of mine pointed out that one of the conference rooms in his building has a similar problem. The direct line for the conference room is identical to the request line for a local radio station, save for the area code. People who work in the building know never to answer the phone in that conference room. (Although apparently there have been a couple of pranks involv...

How is it possible to run Wordpad by just typing its name even though it isn’t on the PATH?
Jul 25, 2011
Post comments count 0
Post likes count 0

How is it possible to run Wordpad by just typing its name even though it isn’t on the PATH?

Raymond Chen
Raymond Chen

It's in the App Paths.

How do I disable windowless control support in dialog boxes?
Jul 22, 2011
Post comments count 0
Post likes count 0

How do I disable windowless control support in dialog boxes?

Raymond Chen
Raymond Chen

A customer wanted to know how to disable windowless control support in dialog boxes. "The customer has a CommandButton ActiveX control on his dialog box, and using to get the window handle of the command button succeeded with VC 6.0, but when compiled with VC 9.0, it does not create a window. I'm guessing that this is caused by 's support for windowless controls. Is it possible to disable support for windowless controls?" The question on its face is somewhat puzzling, because dialog boxes don't "support" or "not support" windowless controls. It's like asking, "I want rice that doesn't support meat. My...

Why is secur32.dll called secur32.dll and not secure32.dll?
Jul 21, 2011
Post comments count 0
Post likes count 0

Why is secur32.dll called secur32.dll and not secure32.dll?

Raymond Chen
Raymond Chen

Many years ago, in a discussion of why you shouldn't name your DLL "security.dll", I dug a bit into the history behind the DLL. Here are some other useless tidbits about that file. Originally, there were two DLLs called . One was the 32-bit version and one was the 16-bit version. They could coexist because the 32-bit version was in the directory and the 16-bit version was in the directory. And then Windows 95 showed up and screwed up everything. Windows 95 did not have separate and directories. All the system files, both 16-bit and 32-bit, were lumped together in a single directory. When the Se...

How do I find the original name of a hard link?
Jul 20, 2011
Post comments count 0
Post likes count 0

How do I find the original name of a hard link?

Raymond Chen
Raymond Chen

A customer asked, "Given a hardlink name, is it possible to get the original file name used to create it in the first place?" Recall that hard links create an alternate name for a file. Once that alternate name is created, there is no way to tell which is the original name and which is the new name. The new file does not have a "link back to the original"; they are both links to the underlying file content. This is an old topic, so I won't go into further detail. Though this question does illustrate that many people continue to misunderstand what hard links are. Anyway, once you figure out what the customer...

Some mailing lists come with a negative service level agreement, but that's okay, because everybody is in on the joke
Jul 19, 2011
Post comments count 0
Post likes count 0

Some mailing lists come with a negative service level agreement, but that's okay, because everybody is in on the joke

Raymond Chen
Raymond Chen

As I noted some time ago, there's a mailing list devoted to chatting among people who work in a particular cluster of buildings. It's not a technical support mailing list, but people will often ask a technical question on the off chance that somebody can help, in the same way that you might ask your friends for some help with something. Of course, one consequence of this is that the quality of the responses is highly variable. While there's a good chance that somebody will help you with your problem, there's also a good chance that a technical question will receive a highly unhelpful response just for fun, in t...

The danger of making the chk build stricter is that nobody will run it
Jul 18, 2011
Post comments count 0
Post likes count 0

The danger of making the chk build stricter is that nobody will run it

Raymond Chen
Raymond Chen

Our old pal Norman Diamond suggested that Windows should go beyond merely detecting dubious behavior on debug builds and should kill the application when it misbehaves. The thing is, if you make an operating system so strict that the slightest misstep results in lightning bolts from the sky, then nobody would run it. Back in the days of 16-bit Windows, as today, there were two builds, the so-called retail build, which had assertions disabled, and the so-called debug build, which had assertions enabled and broke into the debugger if an application did something suspicious. (This is similar to today's terms che...

Using the wrong HINSTANCE in RegisterClass is like identity theft
Jul 15, 2011
Post comments count 0
Post likes count 0

Using the wrong HINSTANCE in RegisterClass is like identity theft

Raymond Chen
Raymond Chen

Use your own account.