The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

But that's not all: The story of that cheesy Steve Ballmer Windows video
Jan 12, 2010
Post comments count 0
Post likes count 1

But that's not all: The story of that cheesy Steve Ballmer Windows video

Raymond Chen
Raymond Chen

While it's true that the cheesy Steve Ballmer Windows video had bad music, bad hair, and bad acting, it's also true that all that cheese was intentional. That video was produced for and shown at the Company Meeting, back when a mainstay of the Company Meeting was spoofs of popular television advertisements—what today would be called "virally popular"—with Bill Gates and other senior executives taking the starring roles. The "Crazy Steve" video was a spoof of late-night television advertisements, the most direct influence being the popular-at-the-time Crazy Eddie commercials. So enjoy the "Crazy St...

Weight Gain 4000, the competition
Jan 12, 2010
Post comments count 0
Post likes count 0

Weight Gain 4000, the competition

Raymond Chen
Raymond Chen

Some years ago, one of my colleagues mentioned at the lunch table, "I went hiking this weekend, and man, my backpack was so heavy. I weighed it, and it was like 35 pounds. And then I realized, wait a second, I'm overweight by 35 pounds. I'm carrying this heavy backpack all the time!" Thus began a collective weight loss competition we called Weight Gain 4000, named after an episode of South Park which had aired recently. ("I'm not fat; I'm big-boned!") I set up a Web page where people could enter their current weight, and it charted everyone's pounds over target weight as a function of time. Oh, and the goal was...

Pros and cons of using a four-year-old as your language instructor
Jan 11, 2010
Post comments count 0
Post likes count 0

Pros and cons of using a four-year-old as your language instructor

Raymond Chen
Raymond Chen

I have a niece who is a native speaker of Chinese. Playing with her is a free language lesson, and there are advantages and disadvantages. One advantage is that you will learn all the basic words, and you won't run the risk that your instructor will accidentally use some advanced vocabulary that will throw you off. (You also learn some words that are very important to young children like butt and fart.) Fortunately, my niece's pronunciation is very good, so it's not like I'm accidentally learning to speak with a lisp or a childhood speech impediment. One disadvantage is that you're learning kiddie-talk: My nie...

Why aren't compatibility workarounds disabled when a debugger is attached?
Jan 11, 2010
Post comments count 0
Post likes count 0

Why aren't compatibility workarounds disabled when a debugger is attached?

Raymond Chen
Raymond Chen

Ken Hagan wonders why compatibility workarounds aren't simply disabled when a debugger is attached. As I noted earlier, many compatibility workarounds are actually quicker than the code that detects whether the workaround would be needed. Now suppose you find a compatibility problem with some applications that expect the function to return exactly or . You then change the function to something like this: Now, we add code to enable the compatibility workaround only if the application is on the list of known applications which need this workaround: What was a simple flag test now includes a check to ...

What is the hSection parameter to CreateDIBSection for?
Jan 8, 2010
Post comments count 0
Post likes count 0

What is the hSection parameter to CreateDIBSection for?

Raymond Chen
Raymond Chen

The function creates a special type of bitmap known as a DIB section. We've worked with these guys before: The feature of DIB sections that is by far the most interesting is that the raw pixels in the bitmap are mapped into your process space as if they were normal memory, which you can read from and write to directly. But what is the deal with that funky parameter? Although the parameter receives "a pointer to the location of the DIB bit values," the documentation also says that if you pass , then "an application cannot later obtain a handle to this memory." That second part makes no sense. Why would I wan...

Learning how to cheat at Candy Land
Jan 7, 2010
Post comments count 0
Post likes count 0

Learning how to cheat at Candy Land

Raymond Chen
Raymond Chen

My young niece received the game Candy Land and wants to play it several times a day. Naturally, I am frequently drafted as an opponent. I discovered that my niece cheats rampantly. Sometimes, she will advance three green squares instead of two. Or if a yellow card will take her to a licorice square (lose a turn), she will ignore it and go to the yellow square after that. But the best cheating takes place when she draws a pink location card which sends her backward. My niece is always careful to draw the card and turn it so only she can see what it is. If the card is an unfavorable one, she will hide it under ...

How to change the debugger attached to a process
Jan 7, 2010
Post comments count 0
Post likes count 0

How to change the debugger attached to a process

Raymond Chen
Raymond Chen

Suppose your application crashes and debugger X is automatically connected because that's how the system happened to be configured. But you would prefer to use debugger Y. After installing debugger Y, how do you switch the debugger from X to Y? If you try to connect debugger Y to the process, you get the error code , because only one debugger can be connected to a process at a time. But if you disconnect the old debugger, the application will disappear with it. How do you escape from this Catch-22? Here's what you do. This trick works because the non-invasive mode of debugging do...

The wisdom of seventh graders: Success
Jan 6, 2010
Post comments count 0
Post likes count 0

The wisdom of seventh graders: Success

Raymond Chen
Raymond Chen

Seventh grade students (ages 12 to 13, roughly) were asked to write an essay on what success is and how you know when you've achieved it. The assignment was given under standardized test conditions: 90 minutes with nothing but pencil and paper, with an additional hour available upon request. (In practice, few students ask for the extra hour.) Remember, these are only the funny sentences/excerpts. Do not assume that all students write like this. On the nature of success Recognizing success Steps which do not lead to success The fleeting nature of success The recipe for success Personal stories of succ...

Can you get rotating an array to run faster than O(n²)?
Jan 6, 2010
Post comments count 0
Post likes count 0

Can you get rotating an array to run faster than O(n²)?

Raymond Chen
Raymond Chen

Some follow-up remarks to my old posting on rotating a two-dimensional array: Some people noticed that the article I linked to purporting to rotate the array actually transposes it. I was wondering how many people would pick up on that. I was surprised that people confused rotating an array (or matrix) with creating a rotation matrix. They are unrelated operations; the only thing they have in common are the letters r-o-t-a-t-i. A matrix is a representation of a linear transformation, and a rotation matrix is a linear transformation which rotates vectors. In other words, applying the rotation matrix to a vec...