The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
And… that cadence means it's halftime, concert-goers!
In college, one of my classmates (who is now the conductor of an orchestra, so I guess that whole music thing worked out for him) coined the term halftime to refer to a resounding cadence in the first half of a piece, the type of cadence that might fool an inattentive or unseasoned listener into thinking that the piece is over, when in fact it's just getting started. We're not talking about a false ending, which is comparatively easy to find, but rather a "big finish" when we're nowhere near the finish. Also sprach Zarathustra has a big halftime cadence, complete with a reprise of the opening fanfare, at the en...
Be careful when redirecting both a process’s stdin and stdout to pipes, for you can easily deadlock
Pipe in, pipe out.
The historical struggle over control of the Portuguese language
Portugal has been going through a rough patch. Its international stature has diminished over the years, its economy has always struggled to remain competitive, the government had to accept a bailout to avoid defaulting on its debt, and on top of it all, it is losing control of its own language. In Portugal, the latest round of Portuguese spelling reform takes effect over a six-year transition period, leaving the Portuguese dismayed that the spelling of their language is being driven by Brazil, a former colony. I sympathize with the plight of the Portuguese, although I also understand the value of consistent sp...
Looking at the problem at the wrong level: Closing a process's stdin
A customer was having trouble manipulating the stdin stream that was given to a process. How do you simulate sending Ctrl+Z to a hidden console process programmatically? I am using and want to send the console a Ctrl+Z. I've tried sending ASCII code 26, but that doesn't work. supports Ctrl+C and Ctrl+Break but not Ctrl+Z. Here's what I'm doing, but it doesn't work: The customer was kind enough to do more than simply ask the question. The customer set up the scenario and even provided a code fragment that illustrates the problem. Which is good, because the original question was the wrong question. ...
Microspeak: Reporting through
I'll start with the citation from a hypothetical conversation: "This is being handled by Jonathan Swift." — Who does he report through? "He reports up through Jane Austen's org." The Microspeak term report through (or report up through) comes up often in situations where people from different groups are working together. In its most literal meaning, to report through someone is to have that person as your manager, or your manager's manager, or your manager's manager's manager, etc. (Not that any of those people beyond two levels actually reads any of the reports you've written!) Usually, when some...
A handful of trips through the time machine
A few trips through the time machine: In the Internet Explorer time machine video, I was struck by the remark, "Appearance-wise, very little had changed [in Internet Explorer 4] since IE3. Not much changed in terms of functionality, either." In fact, Internet Explorer 4 was probably the most significant revision of Internet Explorer in its history, because that's the version that completely replaced the old layout engine with a new one code-named Trident, the layout engine that continues to power Internet Explorer today. Another case of "When you change the insides, nobody notices."
The list of heaps returned by GetProcessHeaps is valid when it returns, but who knows what happens later
A customer had a problem involving heap corruption. In our code, we call and then for each heap, we call to enable the low fragmentation heap. However, the application crashes due to an invalid heap handle. My question is, why do we need to allocate an array of size 1025 even though we pass 1024 to ? Ha, faked you out with that question, eh? (It sure faked me out.) It's not clear why the code under-reports the buffer size to . So let's ignore the customer's stated question and move on to the more obvious question: Why does this code crash due to an invalid heap handle? Well, for one thing, the cod...
2011 mid-year link clearance
Another round of the semi-annual link clearance. And, as always, the obligatory plug for my column in TechNet Magazine:
The UseUrl attribute in the App Paths key indicates that your application can accept a URL on the command line
Setting the attribute in your key indicates that your application can accept a URL on the command line as the document to be opened. The documentation for this attribute is a confusing blend of raw documentation, guidance, history, and an example. Let's tease the parts apart so you won't confuse the example with the contract. The raw documentation is simple: Setting indicates that your application can accept URLs on the command line. The guidance is that programs like Web browsers should set this attribute because opening URLs is the primary reason for their existence. But it's not just Web browsers; any pr...