The Old New Thing

Why does the debugger show me the wrong virtual function?

Pointers to virtual functions all look basically the same and therefore, as we learned last time, all end up merged into a single function. Here's a contrived example: If you take a look at and you'll see that the point to the same function: That's because the virtual functions and are both stored in the same location relative to ...

Why does the debugger show me the wrong function?

Often you'll be minding your own business debugging some code, and you decide to step into one function and the debugger shows that you're in some other function. How did that happen? You then step through code that does something like this: And when you step into the call to you find yourself in . What happened? What happened is ...

Psychic debugging: Why your expensive four-processor machine is ignoring three of its processors

On one of our internal mailing lists, someone was wondering why their expensive four-processor computer appeared to be using only one of its processors. From Task Manager's performance tab, the chart showed that the first processor was doing all the work and the other three processors were sitting idle. Using Task Manager to set each process's...

Confusion over whether you have Windows XP SP1 or SP2

Some support people have asked me why the "About" dialog seems to be kind of schizophrenic as to whether a machine has Windows XP SP1 or SP2. About Windows Microsoft® Windows Version 5.1 (Build 2600.xpsp2.040919-1003 : Service Pack 1) Copyright© 1981-2001 Microsoft Corporation Why does the version string say "xpsp2...

Competing to be the worst-dressed couple in America

The U.S. cable network TLC is putting on a special episode of What Not to Wear devoted to identifying the worst-dressed couple in America. It so happens that one of my friends knows one of the finalists, so we'll be rooting for them. Or is it against them? Are you supposed to hope that your favorite is in fact the worst-dressed? Or should ...

Your exception handler can encounter an exception

Consider the following code, written in C# just for kicks; the problem is generic to any environment that supports exception handling. Some time later, you find yourself facing an assertion failure from claiming that you are destroying the document while there are still active plugins. But there is your call to , and it's in a block, and...

The great Alaskan ice sculpture

NPR interviewed John Reeves, the artist behind a 160-foot-tall mountain of ice in Alaska. The man has a down-home aw-shucks kind of demeanor that I found quite charming. I'm a middle-aged guy that has a lot of time in the winter and a little bit of extra money to play with, so my hobby was to see how big an ice hill I could grow. I started ...

Windows NT Security in Theory and Practice

Today, I'm not writing anything new. Instead, I'm referring you to the series of articles by Ruediger Asche starting with Windows NT Security in Theory and Practice. These articles are quite old but the principles are still sound. Just bear in mind that the newer stuff won't be covered...

Windows are not cheap objects

Although Windows is centered around, well, windows, a window itself is not a cheap object. What's more, the tight memory constraints of systems of 1985 forced various design decisions. Let's take for example the design of the list box control. In a modern design, you might design the list box control as accepting a list of child windows, each...

Dot-Con Job: How InfoSpace took its investors for a ride

The Seattle Times ran an excellent series last week on the rise and fall of InfoSpace and its charismatic leader, Naveen Jain, who at one point even used the phrase "cult leader" to refer to himself. To set the tone, and perhaps to serve as a reference while you read the series, here's a list of reported Infospace earnings per share (...