The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Dec 23, 2009
Post comments count 0
Post likes count 1

Why is it possible to destroy a critical section while it is in use?

Raymond Chen

Some time back, Stu wondered why it is possible to destroy a critical section while it is in use. Well, there's nothing stopping you from creating a file that contains these lines: and then telling your compiler to turn it into a program. It's not like a bolt of lightning is going to come out of the sky and zap you before you hit the Enter key. So obviously, it's possible. On the other hand, it's a bug, just like closing a handle to a file that another thread is reading from, or like closing an event handle that another thread is waiting on. Critical sections are one of those low-level I sure hope yo...

Dec 22, 2009
Post comments count 0
Post likes count 0

Tweeting Too Hard: Best of Twitter

Raymond Chen

We had Best of Craig's List. We had Lamebook. Now we have Tweeting Too Hard, "where self-important tweets get the recognition they deserve." Examples: The people who say I'm arrogant and shallow don't see me when I'm at home with my wife. Did I mention that she's a former swimsuit model? How was it I got invite to last yrs White House Xmas party when Bush was prez; and nothing this year? I guess I must try harder 2 be fab.

Dec 22, 2009
Post comments count 0
Post likes count 1

No, you can't lock icons to the user's desktop

Raymond Chen

In another installment of I bet somebody got a really nice bonus for that feature, I submit this question for your consideration. My customer wants to know how to lock a specific icon to the upper left hand corner of the desktop. This company must be writing the most awesome program to end all programs, a program so amazingly awesome that it should appear as the very first thing on the desktop so you won't forget how awesome it is. I think their users may disagree with that assessment. And the answer is, no, there is no supported way to force a particular icon to appear at a particular desktop position.

Dec 21, 2009
Post comments count 0
Post likes count 0

Christmas gift idea for your favorite Microsoft fanboy geek with no sense of fashion or taste

Raymond Chen

Then again, the "no sense of fashion or taste" may be redundant. Perhaps you are so enamored of the Microsoft-branded Snuggie you received at the Company Meeting that you can't keep your excitement to yourself and want to share the joy with a friend. No problem. You can now pick one up at the Microsoft Company Store in Redmond, right across the hall from the Visitor Center. (The Rapture Index ticks up another notch.) "You shouldn't have." Previously, in Christmas gift ideas.

Dec 21, 2009
Post comments count 0
Post likes count 1

What version of the compiler does Raymond use?

Raymond Chen

From the suggestion box, BrianK asks, "What compiler do you and other developers use? Are you using VS2005 yet?" To be honest, I don't know what compiler I use. There is a separate part of the team that worries about things like "What compiler should we use?" They deal with nitty-gritty details like "What version of the compiler should we use and what optimizations should we enable?" as well as higher-level planning like "How are we going to organize our source code so that different parts of the project can take advantage of each others' work while still not requiring all members of the Windows team to compil...

Dec 18, 2009
Post comments count 0
Post likes count 0

The economic inefficiency of gift-giving

Raymond Chen

Economist Joel Waldfogel explains why gift-giving is bad for the economy, and why a charity gift card is the best luxury gift of all. He goes into more detail in his new book, Scroogenomics, which you can buy somebody for Christmas just to tell Waldfogel where he can stick it. ("In the bank!" he'll say as he heads out with his royalty check.) Related: Economist Tim Harford writes an advice column called Dear Economist for the Financial Times. But instead of applying economic theory to economic problems, he applies economic theory to personal problems. As Harford himself explains, "Every advice columnist n...

Dec 18, 2009
Post comments count 0
Post likes count 1

I got an array with plenty of nuthin'

Raymond Chen

A customer reported a memory leak in the function : We found the following memory leak in the function . Please fix it immediately because it causes our program to run out of memory. If the 's type is , then the corresponding is leaked and not cleaned up. Right now, we are temporarily working around this in our program by inserting code before all calls to to free the , but this is clearly an unsatisfactory solution because it will merely result in double-free bugs once you fix the bug. Please give this defect your highest priority as it is holding up deployment of our system. The value is not a va...

Dec 17, 2009
Post comments count 0
Post likes count 0

Surprising things injected into Mozart cadenzas

Raymond Chen

This review of a Seattle Symphony concert from 2007 mentioned that back in 1998, soloist Jon Kimura Parker inserted the theme from The X-Files into one of his cadenzas. Cadenzas were originally points in a concerto at which soloists could improvise and show off their technical skills, but over the years, the contents of cadenzas have become more and more rehearsed, with most composers having switched over to fully-written-out cadenzas over a hundred years ago. That's why it's so exciting when an improvised cadenza reappears on the scene. All of a sudden, anything can happen. Reading the article reminded me of ...

Dec 17, 2009
Post comments count 0
Post likes count 3

What was the ShowCursor function intended to be used for?

Raymond Chen

Back in the days when Windows was introduced, a mouse was a fancy newfangled gadget which not everybody had on their machine. Windows acknowledged this and supported systems without a mouse by having keyboard accelerators for everything (or at least that was the intent). But if the design stopped there, you'd have a dead cursor in the middle of your screen all the time, which you could move around if you had a mouse, which you didn't. Enter the function. The function takes a parameter that indicates whether you want to show or hide the cursor. (It would perhaps be more verbosely named .) If you call then ...