Did you happen to lose something in the Amstel River? Say within the past 500...
Did you accidentally drop your Bolta-Hardrubber comb into the river? They found it. Or your red Pocketline Swing HD1 mobile telephone? They found that too. Or your keychain? Yup. They found it. As...
View ArticleThe Windows Calculator no longer generates tiny errors when calculating the...
Some time ago, I explained why the Windows Calculator generates tiny errors when calculating the square root of a perfect square. Good news! Square roots of perfect squares are now exact! In fact,...
View ArticleHow can I detect whether the user is logging off?
There may be cases where you want to know whether the user is logging off. For example, your program might be responding to external events by (say) launching a helper program, but you don't want to...
View ArticleThe case of the very large memory blocks of the same size, mostly zero, but...
A program was exhibiting very high memory usage. It had reached 600MB by the time the memory dump was created. The program did not appear to be actively doing anything to explain the high memory...
View ArticleStop merging if you need to cherry-pick
The VSTS team wrote a response to my series from a few months ago titled Stop cherry-picking, start merging. Stop merging if you need to cherry-pick As the stewards of Visual Studio Team Services's...
View ArticleHow do I change the password of another user without having to sign in as them?
Here's a quick trick: You are signed in as yourself, but you need to change the password for another account, say, a service account. You could change the account by doing this: Add the account to...
View ArticleConst methods don’t prevent a method from having side effects
In my musing on whether people write insane code with multiple overlapping side effects with a straight face, I noted that raising a warning on any code that depends on the order of evaluation would...
View ArticleWhy does a non-recursive ReadDirectoryChangesW still report files created...
A customer used the ReadDirectoryChangesW function to monitor a directory for changes, asking for notifications only for changes directly in the directory being monitored (bWatchSubtree = false)....
View ArticleWhen generating a random password, the result must still be a valid string
A customer had a problem with auto-generated random passwords. Their password generator generated a string by choosing each character randomly with a code unit from U+0001 to U+FFFF. (They avoided...
View ArticleWarning: Ruler is not to scale
Some time ago, I received a promotional can of powdered baby formula that included the following complimentary growth ruler. I display it here next to an actual ruler. Makes me wonder how accurate...
View ArticleInternal training video on expense reports contains inconsistency: Alert the...
I was watching an internal training video on proper handling of expense reports. The narrator says, "This is a small expense report, and everything looks good." But everything does not look good. The...
View ArticleWhat is this vmmem program that is using up all my CPU and memory?
Say you're minding your own business and you discover that this process called vmmem is using up all your memory and CPU. What is this guy and how do you make him stop? The vmmem process is a virtual...
View ArticleSure I can protect data with CryptProtectData, but how do I remove the...
A customer was using the CryptProtectData function to protect some information, and they used the corresponding function CryptUnprotectData to decrypt the buffer and recover the information. But...
View ArticleWhen is it appropriate to use the current processor number as an optimization...
Some time ago, on the topic of avoiding heap contention, I left an exercise that asked whether it would be appropriate to use the current processor number (as reported by GetCurrentProcessorNumber)...
View ArticleHow can I get the actual window procedure address and not a thunk?
We saw some time ago that the GetWindowLongPtr function returns a magic cookie if it needs to thunk the message. The CallWindowProc function understands this magic cookie and calls the original...
View ArticleHow do I trigger an EN_UPDATE notification for all of my edit controls when...
A customer had a dialog box with a bunch of edit controls. Some of these edit controls contained floating-point values, and the code parses them by calling a locale-sensitive parser, so that users in...
View ArticleThe heavy metal umlaut reaches baked goods
The Innkeeper's Bed & Breakfast brand of baked goods is sold exclusively at Costco. One of the varieties they offer is an apple-flavored bread which they call Apple Strudel. If you take a closer...
View ArticlePushing the boundaries of cryptography in a security vulnerability report
A security vulnerability report arrived that implied that the finder had made an earth-shattering breakthrough in cryptography. Specifically, the finder claimed to have found an efficient way to...
View ArticleWhy are my file write operations synchronous, even though I opened the file...
A customer found that even though they opened a file with the FILE_FLAG_OVERLAPPED, their calls to WriteFile were nevertheless synchronous. Why are their overlapped writes completing synchronously?...
View ArticleWhat happens to custom unhandled exception filters if a debugger is not running?
A customer wanted to know what happens to custom exception filters if a debugger is not running. They included this sample code fragment: #define CUSTOM_CODE 0x87654321 LONG CALLBACK...
View Article