The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
How do I prevent users from dragging and dropping files in Explorer?
More than once, I've had a customer ask, "How do I prevent users from dragging and dropping files in Explorer?" Actually, three of them in the past year phrased it in an even more provocative way: "I want to write a program that hooks Explorer and displays a prompt before every drag/drop operation." This is one of those cases where you have to figure out what the customer really wants. They've solved half of their problem and are asking you for help with the other half. In my experience so far, when customers ask this question, their real problem is always one of the following: First, they just want to preven...
Things the locals know: How to have lunch at El Brillante
One of my colleagues moved to Granada last year, and he kindly provided me some recommendations for places to eat in Madrid. We found El Brillante easily, positioned across the street from the Atoche train station, with its back door and terrace facing the Museo Nacional Centro de Arte Reina Sofia (which mercifully goes by the nickname Museo Reina Sofia). But once you step inside to order your lunch, you enter a crowded, cacophanous world with people yelling back and forth and nothing even resembling a line. Here is how to have lunch at El Brillante: As you can see, it's a well-choreographed zoo. Oh, and t...
Why can I type a lowercase s with caron with the numeric keypad, but not a lowercase r with caron?
For concreteness, let's assume that you are using 437 as your OEM code page (which as we all know is not actually provided by the OEM) and 1252 as your ANSI code page (which as we all known is not actually the product of the American National Standards Institute). You can use Alt+0154 to type a Latin small letter s with caron because position 154 in code page 1252 is the Latin small letter s with caron. On the other hand, lowercase r with caron does not exist in code page 1252, nor does it exist in code page 437, so if you want to type that character, you're out of luck. The Alt+nnn...
The problem with setting up a story is that people focus on the set-up and miss the point of the story
In writing, one of the steps you need to perform is motivating the discussion. Now, technically, you don't have to do that, but if you just dive into the guts of a topic right off the bat, people are going to say, "What the heck is going on and why should I care?" Consider, for example, an article I wrote a while back on how to use WMI to obtain computer configuration information. To motivate the discussion, I considered a customer who wanted to collect computer manufacturer information programmatically (presumably for asset inventory purposes). But really, the reason wasn't important. It was just something for...
It rather involved being on the other side of this airtight hatchway: Consequences of enabling the kernel debugger
In the category of dubious security vulnerability, I submit for consideration the following report: A machine with the kernel debugger enabled is vulnerable to a denial of service attack from an unprivileged user. The unprivileged user need only deference a null pointer. Once this occurs, the computer becomes completely unusable to all users. Um, yeah. That's sort of the whole point of the kernel debugger, to halt system execution as soon as a problem has been detected. Enabling the kernel debugger requires administrative privileges, so it's not like unprivileged users can force a system halt on their own; the...
On nearly getting pickpocketed in both Lisbon and Madrid
My trip to Lisbon introduced me to another tourist phenomenon: pickpockets. It was around 10:30 in the morning, and I got on the train to head into town, planning to climb the steps through the Alfama district to visit the castle which looms over the city. The morning rush was over, and the Metro car was nearly empty. Just before the doors closed, a group of about four twentysomething guys stumbled onto the train, walking unsteadily and talking quite loudly among themselves. I found this immediately suspicious. They are acting drunk, but who is drunk at 10:30 in the morning? At 10:30, you're hung over, not drun...
Why can programs empty the clipboard when they start up?
Via the Suggestion Box, Johan Almén asks, "What was the rationale behind the decision to let Excel empty the clipboard when launched?" Why can an application empty the clipboard? Because it's there. After all, the point of the clipboard is to hold information temporarily. Programs are permitted to empty the clipboard, add data to the clipboard, or retrieve data from the clipboard. That's why it's there. (I'm assuming that the naming of the program Excel was just an example of a program, and that the question wasn't "Why doesn't Windows have a specific check for the program and block its clipboard acc...
Words you've had wrong your entire life
As a child, my mother would always call out "banzai" when she wanted me to raise my arms above my head so she could put on or take off a pullover shirt. I assumed that banzai was the word for "stick your hands in the air!" It wasn't until well into my adult life that my mother explained to me that, no, banzai does not mean "stick your hands in the air." It's a Japanese word meaning "ten thousand years", shouted as a term of approbation and accompanied by (you guessed it) throwing one's hands into the air. My mother was using it as a play term; in the United States, when you get your child to throw his hands into...
The many ways of converting a string from one language to another
A customer asked, "I'm looking for a way to convert English characters to another language. For example, if the target language is Arabic and the string is the word Hello, I want it to convert to H(Arabic)e(Arabic)l(Arabic)l(Arabic)o(Arabic)." The question is still vague, even with the assistance of the example, since it's not clear what "H(Arabic)" means. There are a variety of ways of converting a string from one language to another. Here are a few I was able to think of. As it turns out, the customer wasn't interested in any of these! What the customer wanted was, "Take the word Hello and imagine how you...