The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Feb 22, 2010
Post comments count 0
Post likes count 0

On the Internet, everybody wants to know if you're a dog

Raymond Chen

On Slate, Michael Agger expounds on increasing pressure for people to provide pictures of themselves online. I've managed to resist so far. That article also tipped me off to a phenomenon I didn't even know had a name: MySpace angles.

Feb 22, 2010
Post comments count 0
Post likes count 0

Custom navigation in dialog boxes, redux

Raymond Chen

SuperBK asks, "What's the proper way to add keyboard support to a dialog box?" There are many options available to you. The most traditional way is to pick them off in the dialog loop, either hard-coding the keys in code or putting them into resources by moving them to an accelerator resource. Moving them to an accelerator resource is a good idea if the keys are subject to translation (for example, if they are mnemonic). On the other hand, picking them off in code is your only choice if the action you want to take cannot be mapped to a message (or if you simply don't feel like creating such a mapping). Super...

Feb 19, 2010
Post comments count 0
Post likes count 1

How many servings are there in a single-serve cup? The answer might surprise you

Raymond Chen

I was in the grocery store, and there was a sign advertising a new product. Delight in a cup Your favorite XYZ Ice Cream Now in convenient single-serve cups. I took a look at the cup. Seemed kind of big for a single serving. I picked one up to read the nutritional information. Servings per container: 2

Feb 19, 2010
Post comments count 0
Post likes count 1

The normal string manipulation functions stop on a null terminator, so be careful when manipulating double-null-terminated strings

Raymond Chen

One of the many gotchas of working with double-null-terminated strings is accidentally using functions on them which were designed to operate on single-null-terminated strings. Now, you do need to use those single-null-terminated strings, but you also need to know when they won't do what you want. One of the responses to my psychic detection that somebody passed a single-null-terminated string to is, "Oh, no, I double-null-terminated it. Look: See, I put an extra at the end." Well, yeah, you put an extra at the end, but all that does is terminate the format string. The function accepts its format st...

Feb 18, 2010
Post comments count 0
Post likes count 1

Don't forget to double-null-terminate those strings you pass to SHFileOperation

Raymond Chen

About once every two months for the past six months (I stopped checking further back), somebody reports a problem with the function. Often, they don't include very much information at all. They just say, "I call the function and it doesn't work." Here's an example: I'm hitting a problem with when using it to frob files in the gonzo directory when the user's SID ends in an odd number. The function returns file not found, but the file is definitely there. If you read the variable names carefully, you can see the problem. The and members of the structure are double-null-terminated strings. (There's...

Feb 17, 2010
Post comments count 0
Post likes count 1

Happy birthday, Windows 2000, and try not to get too hung over

Raymond Chen

On this date ten years ago, Windows 2000 launched in San Francisco. One of my colleagues was working as a staff member at the Windows 2000 Conference and Expo in San Francisco, an event which accompanied the Windows 2000 launch event. Also working at the event was his boss's boss, and the two shared a hotel room. Their flight back to Redmond wasn't until late in the afternoon, so they decided to spend their last day in San Francisco being tourists in their host city. Hopping on a cable car, walking down the crooked street, seeing the sights in Chinatown and Fisherman's Wharf, all the standard tou...

Feb 16, 2010
Post comments count 0
Post likes count 1

The fundamental rule of rocket science

Raymond Chen

Pretty straightforward.

Feb 16, 2010
Post comments count 0
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Dubious escalation

Raymond Chen

Consider this type of dubious security vulnerability: There is a buffer overflow bug in kernel driver X. To exploit it, call this function with these strange parameters. The exploit works only if you are logged on as administrator, because non-administrators will get . Yes, this is a bug, and yes it needs to be fixed, but it's not a security bug because of that only if you are logged on as an administrator clause. It's another variation of the dubious elevation to administrator vulnerability. After all, if you're already an administrator, then why bother attacking kernel mode in this complicated way? Ju...

Feb 15, 2010
Post comments count 0
Post likes count 1

Advocating the overthrow of the government of the United States by force or subversion

Raymond Chen

It has been widely reported that South Carolina now requires "subversive groups" to register with the Secretary of State (and pay a $5 filing fee). Curiously, the list of organizations which must register include "an organization subject to foreign control." I wonder if this means that all consulates have to register, and that when any foreign dignitary visits South Carolina, they have to pay a $5 filing fee. (Not to mention all foreign-owned companies like Shell Oil.) Actually, it has been pointed out that a "subversive organization" includes one which advocates, teaches, or practices the propriety of contro...