Inadvertently becoming the change you wish to see in the world
(Note: The quote is fake, by the way.) It's the Labor Day holiday in the United States, so instead of technical content, I'm going to share this story.¹ You can hear it in Melinda Gates' own words,...
View ArticleWhy did my systems reboot into the Recovery Environment and how do I prevent...
Earlier this year, a customer reported that they had a cluster of systems running a mix of Windows Server 2003¹ and Windows Server 2008 R2 Service Pack 1. The cluster node crashed, causing the...
View ArticleDoes anybody know what really happened on August 25, 2017 at the Red...
It is reportedly the first time it has ever happened at a Major League Baseball game: A player who left a game came back in. This is disallowed by the rules, yet nobody noticed. But did it happen? The...
View ArticleCan I enable Large Address Awareness dynamically at runtime?
The /LARGEADDRESSAWARE flag is recorded in the header of the executable. A customer wanted to know if there was a way to select at runtime whether a process is large address aware. They were willing...
View ArticleWhat are anonymous structs, and more importantly, how do I tell windows.h to...
Windows header files take advantage of a language extension known as "anonymous structs" or "nameless structs". It looks like this: typedef struct _devicemode { TCHAR dmDeviceName[CCHDEVICENAME]; WORD...
View ArticleNasty gotcha: SetThreadUILanguage cannot be used to restore the thread UI...
Suppose you want to change the thread UI language temporarily. You might be tempted to do this: // Code in italics is wrong void Something() { // Save the original language. LANGID originalLanguage =...
View ArticleIf you configure a program to run in Windows 2000 compatibility mode, then it...
We received a security vulnerability report that said, basically, that if you apply Windows 2000 compatibility mode to an application, then it becomes vulnerable to Windows 2000 security issues. Well,...
View ArticleMicrospeak: Ripcord
Remember: General business jargon still qualifies as Microspeak if it is in wide enough use at Microsoft that you are expected to know what it means and how to use it. Today's Microspeak term is...
View ArticleWhat is the correct way of using the string buffer returned by the...
The most common way of creating an HSTRING is to call WindowsCreateString, but there is also a two-phase creation pattern: First you call WindowsPreallocateStringBuffer to create a buffer for a...
View ArticleWhy is my window unexpectedly becoming topmost?
A customer had a problem where one of their program's windows was somehow receiving the WS_EX_TOPMOST extended window style, thereby becoming topmost. The scenario was that they created a popup...
View ArticleHow can I diagnose why my FreeLibrary isn’t freeing the library?
A customer had some code that called FreeLibrary, and they expected the library to be freed, but it wasn't happening. They suspect that there was an unmatched call to LoadLibrary and was wondering...
View ArticleThe increasingly complex Kremlinology surrounding Windows
(If you prefer videos, here's a video version of basically the same question.) Everybody wants to know what the Windows team is up to, and the lack of official information won't stop them. As an...
View ArticleThe NET HELPMSG command will decode Windows error codes, at least the simple...
A quick and dirty way to convert Windows error codes to strings is to use the NET HELPMSG command. C:\> NET HELPMSG 2 The system cannot find the file specified. C:\> NET HELPMSG 8242 An invalid...
View ArticleWhat is the correct way of using SaveDC and RestoreDC?
There are these two functions SaveDC and RestoreDC. How do they work? Each device context (DC) maintains a stack of saved states. When you call SaveDC, the current state of the DC is saved and pushed...
View ArticleHow accurate are the various Windows time-querying functions?
Windows has a bunch of time-querying functions. One group of functions uses the system performance counter. These are as accurate as the hardware allows while still conforming to the basic...
View ArticleWhat does it mean when I get an access violation at a very low address when...
Warning: This article talks about implementation details which can change at any time. The information provided is for debugging and diagnostic purposes only. A customer found that their server...
View ArticleWhat happens if I wake a condition variable when nobody is waiting for it? Is...
Suppose you call WakeXxxConditionVariable to wake a CONDITION_VARIABLE, but nobody is waiting on the condition variable. What happens? In particular, is the wake saved for the next thread that...
View ArticleWho implemented the Windows NT blue screen of death?
Following up on the history of the Windows 3.1 and Windows 95 blue screen messages, John Vert admits that he wrote the Windows NT blue screen of death. In particular, he explains why it was white text...
View ArticleHow to check if a pointer is in a range of memory
Suppose you have a range of memory described by two variables, say, byte* regionStart; size_t regionSize; And suppose you want to check whether a pointers lies within that region. You might be tempted...
View ArticleCancelIoEx can cancel synchronous I/O, which is kind of nice
The CancelIoEx function can be used to cancel synchronous I/O. This is handy if you have a program that processes a file in large chunks and you want to give it a Cancel button. Without...
View Article