The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Why is the FAT driver called FASTFAT? Why would anybody ever write SLOWFAT?
Oct 30, 2014
Post comments count 0
Post likes count 1

Why is the FAT driver called FASTFAT? Why would anybody ever write SLOWFAT?

Raymond Chen
Raymond Chen

Anon is interested in why the FAT driver is called FASTFAT.SYS. "Was there an earlier slower FAT driver? What could you possibly get so wrong with a FAT implementation that it needed to be chucked out?" The old FAT driver probably had a boring name like, um, FAT.SYS. At some point, somebody decided to write a newer, faster one, so they called it FASTFAT. And the name stuck. As for what you could possibly get so wrong with a FAT implementation that it needed to be improved: Remember that circumstances change over time. A design that works well under one set of conditions may start to buckle when placed under al...

The contents of the Start page are not programmatically accessible
Oct 29, 2014
Post comments count 0
Post likes count 0

The contents of the Start page are not programmatically accessible

Raymond Chen
Raymond Chen

A customer wanted to know if is possible for an application to edit the user's Start page. No, there is no interface for editing the user's Start page or even knowing what is on it. The Start page is the user's personal space and applications should not be messing with it. Imagine if it were possible. Every application would edit the Start page to put themselves at the front! It turns out that the customer wanted their application to make some changes to the user's Start page when it was installed. Specifically, they wanted to hunt down tiles belonging to their competitors and delete them, then insert a tile f...

A question about preventing the system from going to the idle state turns out to be misguided
Oct 28, 2014
Post comments count 0
Post likes count 0

A question about preventing the system from going to the idle state turns out to be misguided

Raymond Chen
Raymond Chen

A customer asked how they could have their program prevent the system from going to the idle state. Specifically, when the system goes idle, the application gets into a weird state where it starts leaking memory like crazy. The program normally uses around 100MB of memory, but when the system goes idle, something funky happens and the program's memory usage shoots up to 4GB. To avoid this problem, they want to prevent the system from entering the idle state. Now, if your application is a special-purpose program running on a dedicated computer, then blocking the entry into the idle state might be acceptable. Aft...

Enumerating the ways of distributing n balls into k boxes
Oct 27, 2014
Post comments count 0
Post likes count 0

Enumerating the ways of distributing n balls into k boxes

Raymond Chen
Raymond Chen

Suppose you had n indistinguishable balls and k distinguishable boxes. Enumerate the ways of distributing the balls into boxes. Some boxes may be empty. We can represent each distribution in the form of n stars and k − 1 vertical lines. The stars represent balls, and the vertical lines divide the balls into boxes. For example, here are the possible distributions for n = 3, k = 3: This visualization is known in combinatorics circles as stars and bars. From this visualization, we see that what we are doing is taking n + k − 1 slots, and in each slot placing a star or a bar, subject to the const...

Debugging a hang: Chasing the wait chain inside a process
Oct 24, 2014
Post comments count 0
Post likes count 2

Debugging a hang: Chasing the wait chain inside a process

Raymond Chen
Raymond Chen

Today we're going to debug a hang. Here are some of the (redacted) stacks of the process. I left some red herrings and other frustrations. Since debugging is an exercise in optimism, let's ignore the stacks that didn't come out properly. If we can't make any headway, we can try to fix them, but let's be hopeful that the stacks that are good will provide enough information. Generally speaking, the deeper the stack, the more interesting it is, because uninteresting threads tend to be hanging out in their message loop or event loop, whereas interesting threads are busy doing something and have a complex stack ...

How can I detect programmatically whether the /3GB switch is enabled?
Oct 23, 2014
Post comments count 0
Post likes count 0

How can I detect programmatically whether the /3GB switch is enabled?

Raymond Chen
Raymond Chen

A customer was doing some diagnostic work and wanted a way to detect whether the switch was enabled. (Remember that the switch is meaningful only for 32-bit versions of Windows.) The way to detect the setting is to call and look at the . Compile this as a 32-bit program and run it. On 32-bit systems, this reports the system-wide setting that specifies the maximum user-mode address space, regardless of how your application is marked. Note, however, that your application must be marked in order to take advantage of the space above 2GB. On the other hand, when you run a 32-bit application on 64-bit Wi...

How do I disable Windows 8 touch contact visualizations for my application?
Oct 22, 2014
Post comments count 0
Post likes count 0

How do I disable Windows 8 touch contact visualizations for my application?

Raymond Chen
Raymond Chen

You might have an application (like a game) where the default touch contact visualizations are a distraction. In WinRT, you can disable the contact visualizations by simply saying In Win32, you use the function. To demonstrate that, let's take our scratch program and make this simple change: The touch visualizations are white and the default window color is white, so the visualizations are hard to see in the scratch program. Let's change the color to something that the visualizations will be more visible against. Run the program, and you'll see that if you touch the window and drag your finger around,...

The great thing about regular expression languages is that there are so many to choose from!
Oct 21, 2014
Post comments count 0
Post likes count 0

The great thing about regular expression languages is that there are so many to choose from!

Raymond Chen
Raymond Chen

Before you ask a question about regular expressions, you should make sure you and your audience agree on which regular expression language you are talking about. Here is a handy table of which features are supported by which regular expression language. You can use that table to solve this customer's problem: I have a regular expression that works just fine when I test it in ⟨insert regular expression testing tool, like RegExr or RegexPlanet⟩, but I can't get it to work in real life. My goal is to find all lines that contain an not followed anywhere by a .

Scripting an Internet Explorer window
Oct 20, 2014
Post comments count 0
Post likes count 0

Scripting an Internet Explorer window

Raymond Chen
Raymond Chen

Today's Little Program takes a random walk through MSDN by starting at the page and randomly clicking links. The exercise is not as important as the technique it demonstrates. (I'm assuming the reader can figure out what language this script is written in. If you have to ask, then you probably won't understand this article at all. I am also not concerned with random number bias because Little Program.) To talk a random walk through MSDN, we ask for all the links in the element. Note that I'm taking an undocumented dependency on the structure of MSDN pages. This structure has changed in the past, so be awa...