The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

More undocumented behavior and the people who rely on it: Output buffers
Sep 1, 2005
Post comments count 0
Post likes count 0

More undocumented behavior and the people who rely on it: Output buffers

Raymond Chen
Raymond Chen

For functions that return data, the contents of the output buffer if the function fails are typically left unspecified. If the function fails, callers should assume nothing about the contents. But that doesn't stop them from assuming it anyway. I was reminded of this topic after reading Michael Kaplan's story of one customer who wanted the output buffer contents to be defined even on failure. The reason the buffer is left untouched is because many programs assume that the buffer is unchanged on failure, even though there is no documentation supporting this behavior. Here's one example of code I've seen (r...

Hoping the worst-case scenario doesn’t come to pass
Aug 31, 2005
Post comments count 0
Post likes count 0

Hoping the worst-case scenario doesn’t come to pass

Raymond Chen
Raymond Chen

A few years ago, NPR and American RadioWorks ran a story on the consequences to New Orleans of a Category 5 hurricane [NPR part 1] [NPR part 2]. I had been hoping that the city would escape the worst-case scenario of the water topping the levees and submerging the city in twenty feet of water, but yesterday's levee breaches appear to have taken us one step closer... As you probably know, I'm fascinated by language, particularly the slang terms of various professions, such as the rich acronym soup of the emergency medical field (my sick favorite being "CTD"). In the hurricane story, we hear the dir...

Understanding hash codes
Aug 31, 2005
Post comments count 0
Post likes count 0

Understanding hash codes

Raymond Chen
Raymond Chen

On more than one occasion, I've seen someone ask a question like this: I have some procedure that generates strings dynamically, and I want a formula that takes a string and produces a small unique identifer for that string (a hash code), such that two identical strings have the same identifier, and that if two strings are different, then they will have different identifiers. I tried String.GetHashCode(), but there were occasional collisions. Is there a way to generate a hash code that guarantees uniqueness? If you can restrict the domain of the strings you're hashing, you can sometimes squeak out uniqueness...

On the adult appeal of dodgeball
Aug 30, 2005
Post comments count 0
Post likes count 0

On the adult appeal of dodgeball

Raymond Chen
Raymond Chen

NPR's Only a Game recently covered the rise of adult dodgeball. At MSN's tenth birthday party last week, there was a wide variety of entertainment options, the highlight of which appeared to be an organized dodgeball tournament. It was very well attended and didn't have the ego-damaging overtones you got from elementary school. A good time was had by all. The Senior Vice President of MSN happens also to have been the development manager of Windows 95, so he made the generous gesture of inviting the members of the Windows 95 team to his group's birthday party. (Since the remaining members of the ...

Program names in file type handlers need to be fully-qualified
Aug 30, 2005
Post comments count 0
Post likes count 0

Program names in file type handlers need to be fully-qualified

Raymond Chen
Raymond Chen

Most people probably haven't noticed this, but there was a change to the requirements for file type handlers that arrived with Windows XP SP 2: Paths to programs now must be fully-qualified if they reside in a directory outside of the Windows directory and the System directory. The reason for this is security with a touch of predictability thrown in. Security, because one of the places that the function searches is the current directory, and it searches the current directory before searching standard system directories or the PATH. This means that somebody can attack you by creating a file like s...

What program did you get, Danny?
Aug 29, 2005
Post comments count 0
Post likes count 0

What program did you get, Danny?

Raymond Chen
Raymond Chen

Danny Glasser piles on.

Why is the default console codepage called “OEM”?
Aug 29, 2005
Post comments count 0
Post likes count 1

Why is the default console codepage called “OEM”?

Raymond Chen
Raymond Chen

Because it once was, though no longer is.

If you squint you might be able to make out my name
Aug 26, 2005
Post comments count 0
Post likes count 0

If you squint you might be able to make out my name

Raymond Chen
Raymond Chen

Late Tuesday night, Jenny Lam, the creative director for this year's PDC, came by our hallway and asked for permission to rummage through our offices for "stuff". They were looking for props to use to decorate a developer's cubicle in a video they were filming for the conference. I was able to loan her a framed letter of appreciation and my pass to the Windows 2000 launch. I used to have a lot more junk in my office, but I went on a cleaning binge during our last office move and the really cool mementos ended up at my house. If you watch the movie and squint you might be able to make out my name on the pers...

Free bicycles to borrow at Marymoor Park
Aug 26, 2005
Post comments count 0
Post likes count 0

Free bicycles to borrow at Marymoor Park

Raymond Chen
Raymond Chen

Marymoor Park just keeps getting better. Just this year, they added a little Subway sandwich shop, so you don't even have to pack for a picnic in the park. Next, free Wi-Fi (sponsored by MSN). Then movies in the park (sponsored by First Tech Credit Union). The latest addition is free bicycles (sponsored by Dasani). Show a photo ID and you get a cardkey that gives you access to one-speed coaster-brake bicycles you can borrow for the day.