The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
The Ride to Rio: Bicycling from Los Angeles to Rio de Janeiro
An acquaintance of mine remarked that he sold his bicycle in Seattle a few months ago to some guy who explained, "I'm going to ride it to South America." "Okay," my acquaintance said, probably with some degree of skepticism. But it's a real project, and they head out soon! Ride to Rio: Four riders who "share a thirst for being stupid and finding adventure" bicycling through twelve countries and finishing in Rio with very sore butts.
Why aren't environment variables being expanded in my RGS file?
A customer was having trouble with their RGS file. I want to include the below line in a .rgs file: When I do this, registering of the dll fails with 80002009. Any help? If I change it to then the registration succeeds (but of course now contains a hard-coded path). A common problem people have when asking a question is assuming that the person reading your question has knowledge that is a strict superset of what you know. As a result, people omit details like the answer to the question "How did you register your RGS file?" If all else fails read the documentation (which happens to be the #1 hit for...
Sabotaging yourself: Closing a handle and then using it
A customer reported a problem with the function: I have a DLL with an function and an function. The code goes like this: Under certain conditions, the function is called twice, and the function is correspondingly called twice. Under these conditions, if I run the code on a single-processor system with hyperthreading disabled, then everything works fine. But if I enable hypethreading, then the second call to hangs in the call. (As you can see, it's waiting for a mutex handle which was closed by the previous call to .) Why does this happen only on a hyperthreaded machine? Shouldn't the return beca...
Why can't I set "Size all columns to fit" as the default?
A customer wanted to know how to set Size all columns to fit as the default for all Explorer windows. (I found an MSDN forum thread on the same subject, and apparently, the inability to set Size all columns to fit as the default is "an enormous oversight and usability problem.") The confusion stems from the phrasing of the option; it's not clear whether it is a state or a verb. The option could mean As it happens, the option is a verb, which means that it is not part of the state, and therefore can't be made the default. (The cue that it is a verb is that when you select it, you don't get a check-mark next t...
A classification of faces with eyes open and closed in Dr. Seuss's ABC based on the nature of the character
I brought this process into the world, and I can take it out!
Clipboard Gadget wants to know why normal processes can kill elevated processes via , yet they cannot do a trivial . "Only explorer seems to be able to do so somehow." There are several questions packed into this "suggestion." (As it happens, most of the suggestions are really questions; the suggestion is "I suggest that you answer my question." That's not really what I was looking for when I invited suggestions, but I accept that that's what I basically get.) First, why can normal processes kill elevated processes? The kernel-colored glasses answer is "because the security attributes for the process grants ...
In vollen Zügen genießen
One of my friends bought me a souvenir one one of his trips to Germany. It is a beer mug from Bayerischer Bahnhof, a restaurant and brewery at the Leipzig Bayerischer Bahnhof. The mug carries the brewery's slogan In vollen Zügen genießen, which is a German idiom meaning "to enjoy to the fullest." Literally, "Das Leben in vollen Zügen genießen" means "to enjoy life in full gulps", the idea being that instead of sipping your way through life, you're taking huge gulps of it. The slogan is a pun, though, for the Bayerischer Bahnhof, because the word Zug also means train. They come from the roo...
How can I implement SAFEARRAY.ToString() without going insane?
A colleague needed some help with manipulating s. I have some generic code to execute WMI queries and store the result as strings. Normally, does the work, but doesn't know how to convert arrays (e.g. ). And there doesn't seem to be an easy way to convert the array element-by-element because expects a pointer to an object of the underlying type, so I'd have to write a switch statement for each variant type. Surely there's an easier way? One suggestion was to use the ATL template, but since it's a template, the underlying type of the array needs to be known at compile time, but we don't know the underlyin...
How do I invoke a verb on an IShellItemArray?
A customer wanted to invoke a command on multiple items at once. I have an , and I want to invoke a verb with that array as the parameter. I know that I can invoke a verb on a single by the code below, but how do I pass an entire array? The function invokes the command by extracting the pidl, then asking to invoke the command on the pidl. A limitation of is that it can invoke on only one pidl. What if you want to invoke it on a bunch of pidls at once? (Doing it all at once gives the target program the opportunity to optimize the multi-target invoke.) As noted in the documentation, passing flag tel...