The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
The time one of my colleagues debugged a line-of-business application for a package delivery service
Back in the days of Windows 95 development, one of my colleagues debugged a line-of-business application for a major delivery service. This was a program that the company gave to its top-tier high-volume customers, so that they could place and track their orders directly. And by directly, I mean that the program dialed the modem (since that was how computers communicated with each other back then) to contact the delivery service's mainframe (it was all mainframes back then) and upload the new orders and download the status of existing orders.¹ Version 1.0 of the application had a notorious bug: Ninet...
Outdoor Trek: Mirror, Mirror starts this weekend
As previously noted, Outdoor Trek will be staging live performances of the Star Trek episode Mirror, Mirror. The schedule is up. Three weekends starting this Saturday at Blanche Lavizzo Park. Saturday performances are 7pm; Sunday performances are 2pm. Admission is free. Attend if you dare.
What does it mean when GetQueuedCompletionStatus return ERROR_SEM_TIMEOUT?
A customer asked for assistance interpreting a failure of the function. We are observing that is intermittently behaving as follows: That's all the information we have in our log files. We don't know the value of or , sorry. We realize that this is a rather vague question, but when this problem hits our machines, it causes our internal logic to go into a reset state since it doesn't know what the error means or how to recover. Resetting is expensive, and we would prefer to handle this error in a less drastic manner, if only we knew what it meant. The error code is a rather bad translation of the un...
How do I configure Windows Update programmatically?
First of all, normal programs shouldn't be messing with Windows Update configuration. That's something the user (or the user's administrator) decides. If you're an IT administrator, then you can use Group Policy to configure Windows Update on your network. But maybe you're a special case where the above remarks don't apply. Say you're a data center and all the systems are running inside of virtual machines and you don't want them installing updates or rebooting without your permission, so you want to run a script when you set up the image to disable updates. You can use the object, known to native code as ...
Why does Outlook map Ctrl+F to Forward instead of Find, like all right-thinking programs?
A feature request.
Enumerating integer compositions (the return of the binomial coefficients)
In number theory, a composition of an integer is an ordered sequence of positive integers which sum to the target value. For example, the value 3 can be written as 3, 1+2, 2+1, or 1+1+1. You can think about the target number as a string of stars, and a composition is a way of breaking the stars into groups. For example, here are the compositions of 3: How would you generate all compositions of a particular length? In the above example, the compositions of length 2 would be 1+2 and 2+1. Let's take a look at the last star in the composition. If it is immediately preceded by a space, then removing it results i...
If I duplicate a handle, can I keep using the duplicate after closing the original?
A customer asked whether it was okay to use a duplicated handle even after the original handle was closed. Yes. That's sort of why you would duplicate it. Duplicating a handle creates a second handle which refers to the same underlying object as the original. Once that's done, the two handles are completely equivalent. There's no way to know which was the original and which is the duplicate. Either handle can be used to access the underlying object, and the underlying object is not torn down until all handles to it have been closed. One tricky bit here is that since you have two ways to refer to the same thing...
Using the REFIID/void** pattern for returning COM objects for future-proofing and to avoid problems with dependencies
Suppose you have a function that creates a reference to a COM object: There are a few issues with this design. First of all, it requires that whoever uses your header file must have included first, since that's where is defined. You could solve that problem by putting at the top of , but that creates its own problems. For example, many header files alter their behavior based on symbols that have been d, and including that other header file as part of means that it's going to use the settings that were active at the time was included (which may not be what the clients of your header file are expecting)....
Why are only some of the Windows 7 system notification icons colorless?
Diminishing returns.