The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Nov 17, 2009
Post comments count 0
Post likes count 1

How to tell when your patent has been approved

Raymond Chen

There are a variety of ways of finding out when your patent is granted, but the quickest mechanism is to check your mailbox. But the thing to look for is not what you might think. Even before you receive word from your company's patent department, you will start receiving junk mail delivered to your home address from companies that sell patent-related novelties, pointless trinkets like pencils and mugs with your patent number on it. Nevermind that you can probably order personalized pencils for much less than what the patent-chasers were offering.

Nov 16, 2009
Post comments count 0
Post likes count 0

How to pretend that you attended my talk at UIUC Reflections|Projections 2009

Raymond Chen

Step 1: Buy a 1.55-ounce Hershey's Milk Chocolate Bar from a convenience store, supermarket, or (if truly desperate) online. Step 2: Print out this candy bar wrapper. Step 3: Trim wrapper on registration marks and wrap around candy bar. Step 4: Stay up late the night before you plan on watching the video by partying with Ryan North and teaching him how to play beer pong. Step 5: Force yourself to wake up the next morning and watch the recorded video of my talk while trying desperately to stay awake. The candy bar might help. Note: Although most steps are optional, they are essential if you want a...

Nov 16, 2009
Post comments count 0
Post likes count 1

Why does shlwapi import a nonexistent function?

Raymond Chen

Commenter charless asks why shlwapi.dll imports a nonexistent function from mpr.dll, which shows up in dependency tools as a broken import. Because that function did exist at one point, although it doesn't exist any more. The function in question was available only on Windows 95-series versions of Windows. It never existed on Windows NT or any of its successors. But remember that was originally developed for Internet Explorer, which ran on Windows 95 as well as Windows NT. Internet Explorer checked the operating system and called the Windows 95-only function only after verifying that ...

Nov 13, 2009
Post comments count 0
Post likes count 0

What a drag: You can be a drag in managed code, too

Raymond Chen

David Anson digests my earlier series on virtual drag/drop and translates it into managed code. His example of dragging his entire RSS feed is an excellent illustration of dragging dynamically-generated virtual content. (I didn't use an example like that because the purpose of the What a drag series was to get something done in the least amount of code, and generating a stream from a URL takes an awful lot of code when doing it from the unmanaged side, which would ultimately detract from the point of the example.) Bonus: He takes the example further by adding asynchronous support.

Nov 13, 2009
Post comments count 0
Post likes count 1

You thought reasoning about signals was bad, reasoning about a total breakdown of normal functioning is even worse

Raymond Chen

When things are bad, don't be surprised that they don't work.

Nov 12, 2009
Post comments count 0
Post likes count 1

Why can you create a PIF file that points to something that isn't an MS-DOS program?

Raymond Chen

James MAstros asked why it's possible to create a PIF file that refers to a program that isn't an MS-DOS program. (That's only part of the question; I addressed other parts last year.) Well, for one thing, there was indeed code to prevent you from setting PIF properties for something that isn't an MS-DOS program, so the precaution was already there. But it didn't stop anybody who was really determined to try. All you had to do was create an MS-DOS program, then create a PIF file for it, and then overwrite the MS-DOS program file with something else. Since time travel has not been invented, the PIF creator code...

Nov 11, 2009
Post comments count 0
Post likes count 0

Leave it to the Taiwanese to think of wrapping a donut inside another donut

Raymond Chen

The food known in Mandarin Chinese as 油條 (yóutiáo), but which in Taiwanese goes by the name 油炸粿, is basically a fried stick of dough, similar to a cruller, but puffier rather than cakey. The traditional way of eating it is to wrap it inside a 燒餅 (a sesame-coated flatbread), and dip the entire combination into a bowl of hot soy milk. I prefer salty soy milk, but some people prefer sweet. (Those people who prefer the sweet version are clearly wrong.) Obviously, the donut sandwich was invented before the low-carb diet craze. Sidebar: Salty soy milk (...

Nov 11, 2009
Post comments count 0
Post likes count 1

Trying to avoid double-destruction and inadvertently triggering it

Raymond Chen

We saw some time ago the importance of artificially bumping an object's reference count during destruction to avoid double-destruction. However, one person's attempt to avoid this problem ended up triggering it. The explanation for the line was that it was done to avoid the double-destruction problem if the object receives a temporary during destruction. While it's true that you should set the reference count to an artificial non-zero value, choosing has its own problem: integer overflow. Suppose that during the object's destruction, the reference count is temporarily incremented twice and decremented...

Nov 10, 2009
Post comments count 0
Post likes count 1

I reorganized your kitchen for you, sweetie

Raymond Chen

I suspect most people are familiar with the It may be a mess, but it's my mess and I know where everything is phenomenon. That doesn't necessarily mean that items are in the best location, but at least you know which suboptimal location you chose. :: Wendy :: told me a story some time ago about something that happened while her parents were visiting. When she returned from work, her mother said, "Oh, Wendy, darling, I reorganized your kitchen for you. You had everything in the wrong place." Wendy's mother was trying to be helpful, but of course it was a net loss for poor Wendy, who couldn't find an...