Converting to Unicode usually involves, you know, some sort of conversion
A colleague was investigating a problem with a third party application and found an unusual window class name: L"整瑳整瑳". He remarked, "This looks quite odd and could be some problem with the...
View ArticleWhy can't I delete a file immediately after terminating the process that has...
A customer discovered a bug where terminating a process did not close the handles that the process had open, resulting in their emergency cleanup code not working: TerminateProcess(processHandle,...
View ArticleHow do I perform shell file operations while avoiding shell copy hooks?
Okay, the subject line of the article gives away the answer to the puzzle, but here's the puzzle anyway: A customer reported a problem with the SHFileOperation function: Consider the following...
View ArticleIf posting here is frequently frustrating and irritating, why do I keep doing...
Appreciator wonders, if I find posting here frequently frustrating and irritating, why I keep doing it anyway? Imagine I announced one day, "This is too frustrating and annoying. I'm going to stop...
View ArticleIntroducing the unrolled-switch anti-pattern
Over the years, I've seen a bunch of coding anti-patterns. I figured maybe I'll share a few. Today, I'll introduce what I'm calling the unrolled-switch anti-pattern, also known as "Specialization is...
View ArticleI totally presented to an executive the wrong way
Some time ago, Gray Knowlton wrote an article on how to present to an executive. As you might have guessed, I've done it completely the wrong way. Many years ago, I was part of a group presenting to a...
View ArticleYou can use an OVERLAPPED structure with synchronous I/O, too
Even if you didn't open a file with FILE_FLAG_OVERLAPPED, you can still use the OVERLAPPED structure when you issue reads and writes. Mind you, the I/O will still complete synchronously, but you can...
View ArticleRegistration-free COM the old-fashioned way: The car mp3 player
Windows XP introduced Registration-Free COM, permitting you to place your COM object registrations in a manifest rather than in the registry. Very handy when you want to support xcopy deployment or...
View ArticleThere's the interface contract, and there are the implementations of the...
Ivo wants to know whether it is legal to use NULL as the icon parameters to IExtractIcon::Extract. The documentation says that the parameters are optional, but some shell folder implementations treat...
View ArticleMicrospeak: scoped to
The Merriam-Webster dictionary gives as the meaning of scope as a verb to look at for evaluation, as in "to scope out the competition." But that's not how we use it at Microsoft. Here are some fake...
View ArticleI know that an overlapped file handle requires an lpOverlapped, but why does...
A customer observed that the formal requirements for the ReadFile function specify that if the handle was opened with FILE_FLAG_OVERLAPPED, then the lpOverlapped parameter is mandatory. But the...
View ArticleWhat is the real maximum length of a DNS name?
The maximum length of a DNS name is 255 octets. This is spelled out in RFC 1035 section 2.3.4. A customer didn't understand why the DnsValidateName was rejecting the following string: (63 letters).(63...
View ArticleYou already know the answer since you do it yourself
A customer was writing a program that performed virtual drag/drop. They were using the IStream technique but found that many applications don't support drag/drop of virtual content. They support only...
View ArticleWhy do we need IsDialogMessage at all?
alv wonders why we need the IsDialogMessage function at all. "All its activity could take place inside the window procedure of the modeless dialog itself", since when it doesn't have focus, it...
View ArticleThere's the kernel, and there's kernel mode - confusing historical terminology
A few weeks ago, I mentioned that the kernel folks decided not to expose bonus bytes to applications. Some people were confused by this statement, not for what it said, but for what it implied. "Wait,...
View ArticleWhy doesn't the Version tab show up for very large files?
If you have a really large file and try to view its properties in Explorer, you may find that the Version tab doesn't appear. What's going on? The Version tab uses the GetFileVersionInfo family of...
View ArticleWhy don't I get a Caps Lock warning balloon any more?
A customer asked for help diagnosing a problem they were experiencing on Windows XP: My customer reports that on their machines, they do not get the warning balloon that appears when Caps Lock is set...
View ArticleWhat does INIT_ONCE_CTX_RESERVED_BITS mean?
Windows Vista adds the One-Time Initialization family of functions which address a common coding pattern: I want a specific chunk of code to run exactly once, even in the face of multiple calls from...
View ArticleWhy are programs allowed to use normal characters as hotkeys?
alv wonders why programs are allowed to create hotkeys for normal characters. The example given is the famous AltGr modifier, equivalent to Ctrl+Alt. Programs which ignore the guidance and use...
View ArticleI thought I was so clever, salvaging an old floppy drive from a dead...
When one of the oldest computers at Microsoft still doing useful work finally died, I had the presence of mind to salvage the 5¼″ floppy drive from the machine, so that I could (someday) extract the...
View Article