The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Why does SHFileOperation have internal error codes for DVD?
Mar 22, 2010
Post comments count 0
Post likes count 1

Why does SHFileOperation have internal error codes for DVD?

Raymond Chen
Raymond Chen

Because that's what you do when DVDs show up.

How many days long is a one-day sale? The answer might surprise you
Mar 19, 2010
Post comments count 0
Post likes count 0

How many days long is a one-day sale? The answer might surprise you

Raymond Chen
Raymond Chen

A friend of mine received a flyer for a major department store proudly proclaiming that they were having a One-Day-Only sale. Sale prices were in effect on Saturday and Sunday. Previously on the subject For large values of 1. If this keeps up, I may have to create a subcategory for it.

How does delay-loading use binding information?
Mar 19, 2010
Post comments count 0
Post likes count 0

How does delay-loading use binding information?

Raymond Chen
Raymond Chen

In the documentation for delay-loading, there's a remark that says that the call to can be avoided if there is binding information. A customer who received the explanation of why you can't delay-load pointed out that paragraph and asked whether this means that you can delay-load if you bind to it. (Getting around to answering this question was the point of the past few days.) Let's take another look at what that -avoidance optimization does. Actually, it's just another look at what the module loader does when it's time to resolve imports to a bound DLL: At build time, the actual function pointers are pre...

What is DLL import binding?
Mar 18, 2010
Post comments count 0
Post likes count 0

What is DLL import binding?

Raymond Chen
Raymond Chen

Last time, we saw how hinting is used to speed up the resolving of imported functions. Today, we'll look at binding. Recall that the module loader resolves imports by locating the function in the export table of the linked-to DLL and recording the results in the loaded module's table of imported function addresses so that code from the module can jump indirectly through the table and reach the target function. One of the consequences of this basic idea is that the table of imported function addresses is written to at module load time. Writeable data in a module is stored in the form of copy-on-write pages....

What is DLL import hinting?
Mar 17, 2010
Post comments count 0
Post likes count 0

What is DLL import hinting?

Raymond Chen
Raymond Chen

Binding and hinting are two types of optimizations to improve the load-time performance of a module (executable or DLL). We'll start with hinting, then look at binding, and then look at how it affects delay-loading. The import table for a module contains a list of DLLs and a list of functions from that DLL which the module wishes to link to. The basic idea is that for each target DLL, the linker loads the DLL and then obtains the address of each imported function and from that DLL, records the results in the loaded module's table of imported function addresses. Hinting is a technique for speeding up this look...

Raymond's highly scientific predictions for the 2010 NCAA men's basketball tournament
Mar 16, 2010
Post comments count 0
Post likes count 0

Raymond's highly scientific predictions for the 2010 NCAA men's basketball tournament

Raymond Chen
Raymond Chen

Once again, it's time for Raymond to come up with an absurd, arbitrary criterion for filling out his NCAA bracket. This year, we go to the well-known dispute arbiter Google Fight. The criterion is the number of Google hits for the quoted phrase "%s basketball", divided by the school's seed. (I would have used Bing hits, except Bing's numbers are highly erratic. Only 291 hits for "Arkansas-Pine Bluff basketball"? The results may be more meaningful, but I'm not looking for meaningful results; I'm looking for numbers I can plug into my bracket-o-matic.) Once the field has been narrowed to eight teams, the result...

Why does my control send its notifications to the wrong window after I reparent it?
Mar 16, 2010
Post comments count 0
Post likes count 0

Why does my control send its notifications to the wrong window after I reparent it?

Raymond Chen
Raymond Chen

Because it's still talking to the old parent.

Robots and humans coexisting, can it be done peacefully?
Mar 15, 2010
Post comments count 0
Post likes count 0

Robots and humans coexisting, can it be done peacefully?

Raymond Chen
Raymond Chen

Everybody who follows science fiction knows that if you have robots and humans living in the same world, eventually something bad happens to the humans.¹ But we're going to chance it one more time. Every so often, I stumble across a Web site that translates my articles into another language. I occasionally see a Japanese translation, and I think there's a Russian translation out there somewhere. In addition to those human translations, there are also robot translations available through your favorite online translation service. Now the two can coexist. There's a new widget on this page which generat...

A window can have a parent or an owner but not both
Mar 15, 2010
Post comments count 0
Post likes count 1

A window can have a parent or an owner but not both

Raymond Chen
Raymond Chen

One of the five things every Win32 programmer should know.