The Old New Thing

The case of the file that won't copy because of an Invalid Handle error message

A customer reported that they had a file that was "haunted" on their machine: Explorer was unable to copy the file. If you did a copy/paste, the copy dialog displayed an error. Okay, time to roll up your sleeves and get to work. This investigation took several hours, but you'll be able to read it in ten minutes because I'm deleting ...
Comments are closed.0 0
Code

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

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 ...

The contents of the Start page are not programmatically accessible

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 ...
Comments are closed.0 0
Code

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

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'...
Comments are closed.0 0
Code

Enumerating the ways of distributing n balls into k boxes

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 ...
Comments are closed.0 0
Code

Debugging a hang: Chasing the wait chain inside a process

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 ...
Comments are closed.0 1
Code

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

A customer was doing some diagnostic work and wanted a way to detect whether the /3GB switch was enabled. (Remember that the /3GB switch is meaningful only for 32-bit versions of Windows.) The way to detect the setting is to call Get­System­Info and look at the lp­Maximum­Application­Address. Compile this as a 32-bit ...
Comments are closed.0 0
Code

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

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 Set­Window­Feedback­Setting function. To demonstrate that, let's take our scratch program and make this simple change: The ...
Comments are closed.0 0
Code

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

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 ...
Comments are closed.0 0
Code

Scripting an Internet Explorer window

Today's Little Program takes a random walk through MSDN by starting at the Create­Process 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 ...
Comments are closed.0 0
Code