The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

When studying performance, you need to watch out not only for performance degradation, but also unexpected performance improvement
Nov 23, 2012
Post comments count 0
Post likes count 0

When studying performance, you need to watch out not only for performance degradation, but also unexpected performance improvement

Raymond Chen
Raymond Chen

In addition to specific performance tests run by individual feature teams, Windows has a suite of automated performance tests operated by the performance team, and the results are collated across a lot of metrics. When a number is out of the ordinary, the test results are flagged for further investigation. The obvious thing that the performance metrics look for are sudden drops in performance. If an operation that used to consume 500KB of memory now consumes 750KB of memory, then you need to investigate why you're using so much memory all of a sudden. The reasons for the increase might be obvious, like "Oh, rats...

The resource compiler will helpfully add window styles for you, but if you're building a dialog template yourself, you don't get that help
Nov 22, 2012
Post comments count 0
Post likes count 0

The resource compiler will helpfully add window styles for you, but if you're building a dialog template yourself, you don't get that help

Raymond Chen
Raymond Chen

A customer was having trouble with nested dialogs. They were doing something very similar to a property sheet, with a main frame dialog, and then a collection of child dialogs that take turns appearing inside the frame dialog based on what the user is doing. The customer found that if they created the child dialogs with the function, everything worked great, but if they built the template at run-time, keyboard navigation wasn't working right. Specifically, one of their child dialogs contained an edit control, and while you could put focus on it with the mouse, it was not possible to tab to the control. On the...

It rather involved being on the other side of this airtight hatchway: Silently enabling features
Nov 21, 2012
Post comments count 0
Post likes count 0

It rather involved being on the other side of this airtight hatchway: Silently enabling features

Raymond Chen
Raymond Chen

A security vulnerability report arrived which went roughly like this: When you programmatically enable the XYZ feature, the user receives no visual alert that it is enabled. As a result, malware can enable this feature and use it as part of an attempt to turn the machine into a botnet zombie. The XYZ feature should notify the user when it is enabled, so that to presence of malware is more easily determined. Okay, first of all, before we get to the security part of this issue, let's look at the user interface design. The proposed change is that, when the XYZ feature is enabled programmatically, the user receive...

How do I use group policy to improve security of USB thumb drives in my organization?
Nov 20, 2012
Post comments count 0
Post likes count 0

How do I use group policy to improve security of USB thumb drives in my organization?

Raymond Chen
Raymond Chen

A customer wanted to know how they could improve the security of USB thumb drives in their organization. Specifically, they wanted to block access to removable media devices (primarily USB thumb drives), but provide a list of exceptions for specific thumb drives. Fortunately, there's a whitepaper that covers exactly this topic and explains how to set up your policies to accomplish this. Step-By-Step Guide to Controlling Device Installation Using Group Policy

Microspeak: touch base
Nov 20, 2012
Post comments count 0
Post likes count 0

Microspeak: touch base

Raymond Chen
Raymond Chen

The verb phrase touch base is in general business jargon use, but it's quite popular at Microsoft. To touch base with someone is to contact someone in a lightweight and mostly-informal sort of way. In other words, it takes the form of a piece of email or a brief office visit rather than a formal meeting with an agenda. Bob, can you touch base with the Nosebleed team to verify that this design change won't affect them? Bob is expected to contact a representative from the Nosebleed team, either by sending email, or by telephone, or by stopping by their office for a quick chat. If Bob sets up a one-hour meeting...

Raymond's podcast list (for 2011, at least)
Nov 19, 2012
Post comments count 0
Post likes count 0

Raymond's podcast list (for 2011, at least)

Raymond Chen
Raymond Chen

Ry Jones wants to know what other podcasts I subscribe to. Remember, I wrote this back in 2011. Here's what I listen to. Note that I am not averse to fast-forwarding over parts that don't interest me, such as when they discuss a movie that I simply don't care about.

How do I forward an exported function to an ordinal in another DLL?
Nov 16, 2012
Post comments count 0
Post likes count 0

How do I forward an exported function to an ordinal in another DLL?

Raymond Chen
Raymond Chen

The syntax for specifying that requests to import a function from your DLL should be forwarded to another DLL is This says that if somebody tries to call from , they are really calling in . This forwarding is done in the loader. Normally, when a client links to the function , the loader says, "Okay, let me get the address of the function in and store it into the variable." It's the logical equivalent of When you use a forwarder, the loader sees the forwarder entry and says, "Whoa, I'm not actually supposed to get the function from at all! I'm supposed to get the function from !" So it loads and g...

If you're going to write your own allocator, you need to respect the MEMORY_ALLOCATION_ALIGNMENT
Nov 15, 2012
Post comments count 0
Post likes count 0

If you're going to write your own allocator, you need to respect the MEMORY_ALLOCATION_ALIGNMENT

Raymond Chen
Raymond Chen

This time, I'm not going to set up a story. I'm just going to go straight to the punch line. A customer overrode the operator in order to add additional instrumentation. Something like this: This worked out okay on 32-bit systems because in 32-bit Windows, is 8, and is also 8. If you start with a value that is a multiple of 8, then add 8 to it, the result is still a multiple of 8, so the pointer returned by the custom remains properly aligned. But on 64-bit systems, things went awry. On 64-bit systems, is 16, As a result, the custom handed out guaranteed-misaligned memory. The misalignment went u...

Break it up, you two!: The zero width non-joiner
Nov 14, 2012
Post comments count 0
Post likes count 0

Break it up, you two!: The zero width non-joiner

Raymond Chen
Raymond Chen

Preventing characters from combining.