The Old New Thing

You can use backups for things other than restoring

A customer wanted to know the internal file format of Visual SourceSafe databases. (That wasn't the actual question, but I've translated it into something equivalent but which requires less explanation.) They explained why they wanted this information: We are doing some code engineering analysis on our project, so we need to extract data ...

From the research journal Duh: To lose weight, eat less

Researchers have determined that the key to losing weight is to consume fewer calories. Okay, it's actually more interesting than the summary suggests. The researchers compared a variety of different popular diets and found that it didn't matter what diet you were on; the weight loss (and regain) was the same. The controlling factor was how...

It must totally suck to live near Abbey Road

I feel sorry for the people who live near Abbey Road or who have to take that road as part of their daily routine, because tourists keep blocking traffic to recreate the cover of the eponymous Beatles album. The recording studio has a webcam on the intersection so you can watch the mayhem as it happens. Update: Just this morning, I checked...

Why did HeapFree fail with ERROR_POSSIBLE_DEADLOCK?

A customer reported that they were receiving some assertion failures because the function was failing with what they believed to be a valid heap block, and the function reported that the reason for failure was . What's going on? One of my colleagues asked the psychic question, "Is the process exiting?" "Why yes, in fact it is. How did you ...

A joke for mathematicians: On the Weyl schism

In one of my mathematics classes, the professor noted (and freely admitted that the joke was not original with him), "There are essentially two groups of mathematicians: Those that have read Weyl and those that have not. And once you enter the first group, you will never be understood by anyone in the second group." I guess it's only funny ...

When DLL_PROCESS_DETACH tells you that the process is exiting, your best bet is just to return without doing anything

When the function receives a reason code of , the increasingly-inaccurately-named parameter to is used to indicate whether the process is exiting. And if the process is exiting, then you should just return without doing anything. No, really. Don't worry about freeing memory; it will all go away when the process address space is destroyed...

Misleading advertisement: Passports or green cards?

I happened to spot an online advertisement for a company that will help you enter the lottery for a United States Permanent Resident Card, commonly known as a Green Card (even though they card isn't green any more). The advertisement was illustrated with a picture of a United States passport. Um, a Green Card is not the same as a passport, ...

Creating context menus on menus

Last week we looked at menu drag/drop. Another little-used menu feature added in Windows 2000 is the ability to show context menus on menus. The message is and the flag is . Let's demonstrate with a simple program. Start with the scratch program, and add the function just so our context menu can do something. When we receive ...