Why does my thread handle suddenly go bad? All I did was wait on it!
A customer reported that they had a very strange bug, where waiting on a thread handle causes it to become invalid. Here's a code fragment: DWORD waitResult = WaitForSingleObject(hThread, INFINITE);...
View ArticleHow can I detect that my window is on the current virtual desktop?
Virtual desktops are a feature added in Windows 10 blah blah exposition. Here is how virtual desktops work, from a programmatic standpoint: To switch to a virtual desktop, the system shows the windows...
View ArticleAlas, Microsoft Building 109 Conference Room A is no more
Some time ago, I noted that "Building 109 Conference Room A" was a code word for the bar at the Azteca restaurant next to building 109. Alas, that code word is no more, because the Azteca restaurant...
View ArticleThe Resource Compiler’s preprocessor is not the same as the C preprocessor
A customer had a project written in Visual C++, and the Build step failed with an error from the Resource Compiler: Fatal error RC1015: cannot open include file 'vcruntime.h' For reasons known (or...
View ArticleReconciling yucky boys and gross kissing with the occasional dance
My niece was positioned to be at the right age when many members of her extended family reached marrying age. In one summer, she served as the flower girl in three weddings. If she had wanted to sit...
View ArticleEvaluating the security consequences of an instance of reading past the end...
A security vulnerability report came in that laid out the following scenario: By performing the correct sequence of operations in a program's UI, you can cause code to miscalculate the location of a...
View ArticleHow can I investigate the possibility of a lot of leaked window classes...
A customer reported that they are seeing intermittent failures from the RegisterClass function with the error ERROR_NOT_ENOUGH_MEMORY on some systems, typically after their program and other programs...
View ArticleWhy does NTVDM create empty IO.SYS and MSDOS.SYS files?
A:-)Brunuś asks why NTVDM creates empty IO.SYS and MSDOS.SYS every time it starts up. For compatibility, of course. Specifically, it was added for one particular program that searched for the MS-DOS...
View ArticleMicrospeak: Gardening
A lot of project management tasks are simply housekeeping: Maintenance tasks that keep things running smoothly. For a project, that could be doing things like closing out old work items that were...
View ArticleHow can I specify that my DLL should resolve a DLL dependency from the same...
A customer had a program that loaded two DLLs, let's call them A.DLL and B.DLL. Both of those DLLs use a common helper DLL called C.DLL. The catch is that the two DLLs want to use different...
View ArticleWhy does my program crash when I throw an exception from an APC?
Consider the following code fragment: class thread_exit_exception { }; DWORD CALLBACK WorkerThreadProc(void* parameter) { try { while (true) { SleepEx(INFINITE, TRUE); // alertable } } catch...
View ArticleExploring the problem: Create a file that only one process can write to
A customer liaison explained that they had a customer who wanted to create a file that only one process can write to. The customer has a program that writes important information to a file, and they...
View ArticleNasty gotcha: Powershell aliases that match commands you might want to run
PowerShell has a bunch of aliases, but some of them collide with programs you might want to run. PowerShell Get-Alias will print all the aliases. These two conflict with programs that come with...
View ArticleWhen a stopgap solution becomes an undocumented feature some people rely on
someone wants to know why you cannot run a separate 32-bit instance of Explorer on 64-bit Windows. This used to work in Windows Vista, but stopped working in Windows 7. The ability to run a 32-bit...
View ArticleI used WS_EX_COMPOSITED to get rid of my redrawing flicker, but it resulted...
A customer enabled the WS_EX_COMPOSITED extended window style in order to solve a flickering problem with their application. That worked great, but they found that it had an unwanted side effect: when...
View ArticleHow do I create a shortcut whose target is specified by a relative path?
Commenter Richard wonders if there's such a thing as a "relative" shortcut whose target is specified by a path relative to the shortcut itself. Let's start with a program that creates a normal...
View ArticleOn the gradual improvements in how the system deals with the failure to...
The documentation for the InitializeCriticalSection function says Return value This function does not return a value. Windows Server 2003 and Windows XP: In low memory situations,...
View ArticleA closer look at the complexity analysis of finding the k’th smallest element...
Given two sorted arrays of the same length, with unique elements, find the kth smallest element in the combined collection. One solution involves the double binary search. I'll let you go read the...
View ArticleWhen I use Alt+PrtSc to take a screen shot of a maximized window, why does it...
On a dual-monitor system, maximize a window onto one monitor, and then use the Alt+PrtSc hotkey to capture a screen shot of that window. The resulting bitmap captures a few pixels from the adjacent...
View ArticleWhy was the Windows 95 precursor project code-named Panther abandoned?
A long-ago discussion of the fates of the various cat-themed precursor projects that led to Windows 95 prompted Jack to ask whether the Panther project was abandoned because it was impossible or was...
View Article