The more times you use the word "simply" in your instructions, the more I...
I was helping somebody look up how to enable frobbing for widgets, and I found one set of instructions on a blog somewhere. To be honest, this happened long enough ago that I forgot what it was...
View ArticleDubious security vulnerability: Copying a program and running the copy
This wasn't an actual security vulnerability report, but it was inspired by one. "If you take the program XYZ.EXE and you rename it or copy it to a new name that contains the letters XYX, then you can...
View ArticleUnder what conditions will the IUnknown::AddRef method return 0?
A customer was debugging their application and discovered that for one of the objects they were using, the IUnknown::AddRef method returns 0. How is that possible? That would imply that the object's...
View ArticleDebugging walkthrough: Access violation on nonsense instruction, episode 2
A colleague of mine asked for help debugging a strange failure. Execution halted on what appeared to be a nonsense instruction. eax=0079f850 ebx=00000000 ecx=00000113 edx=00000030 esi=33ee06ef...
View ArticleDoes the really CLR call CoInitializeEx on the first call to unmanaged code,...
Some time ago, I called out this part of the documentation regarding managed and unmanaged threading: On the first call to unmanaged code, the runtime calls CoInitializeEx to initialize the COM...
View ArticleMicrospeak: Headcount, req, and related personnel terms
For some reason, there are a lot of Microspeak terms related to personnel. (Maybe you folks can tell me how common these terms are outside Microsoft.) We start with a term that is not actually used...
View ArticleTravel tip: Don't forget your car on the ferry
One of my colleagues lives on Bainbridge Island and has quite a long commute to work each day. From his house, he walks to the bus stop, then takes the bus to the Winslow ferry terminal, then takes...
View ArticleSure, we have RegisterWindowMessage and RegisterClipboardFormat, but where...
The RegisterWindowMessage function lets you create your own custom messages that are globally unique. But how do you free the message format when you're done, so that the number can be reused for...
View ArticleFinding the constructor by scanning memory for the vtable
In Looking for leaked objects by their vtable, we used the object's constructor to locate the vtable, and then scanned the heap for the vtable to find the leaked object. But you can run this technique...
View ArticleCancelIoEx can cancel I/O on console input, which is kind of nice
Today's Little Program asks you to type something, but gives you only two seconds to do it. This is not interesting in and of itself, but it shows you how to cancel console I/O. There is no motivation...
View ArticleA Venn diagram demonstrating the dining options in one of the new cafeterias
Back in the early 2000s, a new building opened on the Microsoft main campus, and the food services department tried an experiment: Instead of creating a standard cafeteria, they decided to make the...
View ArticleWhat's the difference between PathIsSystemFolder and Protected Operating...
The way to detect weird directories that should be excluded from the user interface is to check for the FILE_ATTRIBUTE_HIDDEN and FILE_ATTRIBUTE_SYSTEM attributes being set simultaneously. This is the...
View ArticleSwitching on a tuple: Sneaky trick
This is a sneaky trick, but it's sometimes a handy sneaky trick. Suppose you have two values, and you want to switch on the tuple. In other words, you want a switch statement for something like this:...
View ArticleFlaw reported in Windows 95
One of my colleagues ran across this old news clipping from 20 years ago today. Flaw reported in Windows 95THE ASSOCIATED PRESS SAN MATEO, Calif. — Microsoft Corp.'s long-awaited Windows 95 operating...
View ArticleHow do I make a boldface item on a context menu?
Today's Little Program displays a context menu with a bold item. I sort of talked about this some time ago, but now I'm going to actually do it. Remember, the boldface item represents the default...
View ArticleI want you to chase your sisters until they throw up
A friend of mine grew up in a rural area. The family got their water from a well and had to fluoridate it manually with tablets. When my friend was a little girl, she was playing around the house with...
View ArticleWhat was the relationship between Outlook and Outlook Express?
Brian wonders whether project Stimpy became Outlook Express. As noted in the article, projects Ren and Stimpy were merged into a single project, which became Outlook. You could say that Stimpy became...
View ArticleUnder what circumstances will a dialog box not use the caption specified in...
Could it be space aliens? Under what circumstances will a dialog box not use the caption specified in the resource file? In particular, we have a modal dialog box that is not using the caption from...
View ArticleIt appears that some programmers think that Windows already ships with that...
There are some compatibility bugs we investigate where the root cause is that the application relied on time travel. Wait, let me explain. An application might issue an asynchronous request for a file...
View ArticleWhy is CreateToolhelp32Snapshot returning incorrect parent process IDs all of...
A customer reported a problem with the CreateToolhelp32Snapshot function. From a 32-bit process, the code uses CreateToolhelp32Snapshot and Process32First/Process32Next to identify parent...
View Article