The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

When computer programmers dabble in making change
Nov 24, 2009
Post comments count 0
Post likes count 0

When computer programmers dabble in making change

Raymond Chen
Raymond Chen

My colleague who dabbled in economics when deciding how many lunch vouchers to buy had a number of other money-related quirks. One of the ones that I remember is that when paying for a purchase, my colleague would double the balance and give the cashier that much money. For example, if the total was $5.20, my colleague would hand over $10.40. Why? Just to see if the cashier reacted when pressing the Enter code appeared to have no effect. Total is $5.20. Cash tendered is $10.40. Change is $5.20. Most of the time, the cashier wouldn't pay any attention. Heck, the cashier wouldn't even question why my collea...

Can I talk to that William fellow? He was so helpful
Nov 23, 2009
Post comments count 0
Post likes count 0

Can I talk to that William fellow? He was so helpful

Raymond Chen
Raymond Chen

His friends call him Bill.

The difference between assignment and attachment with ATL smart pointers
Nov 20, 2009
Post comments count 0
Post likes count 0

The difference between assignment and attachment with ATL smart pointers

Raymond Chen
Raymond Chen

Last time, I presented a puzzle regarding a memory leak. Here's the relevant code fragment: The problem here is assigning the return value of to a smart pointer instead of attaching it. The function creates a memory stream and returns a pointer to it. That pointer has a reference count of one, in accordance with COM rules that a function which produces a reference calls , and the responsibility is placed upon the recipient to call . The assignment operator for is a copy operation: It s the pointer and saves it. You're still on the hook for the reference count of the original pointer. Observe that as...

We're using a smart pointer, so we can't possibly be the source of the leak
Nov 19, 2009
Post comments count 0
Post likes count 0

We're using a smart pointer, so we can't possibly be the source of the leak

Raymond Chen
Raymond Chen

A customer reported that there was a leak in the shell, and they included the output from Application Verifier as proof. And yup, the memory that was leaked was in fact allocated by the shell: On the other hand, is an object creation function, so it's natural that the function allocate some memory. The responsibility for freeing the memory belongs to the caller. We suggested that the customer appears to have leaked the interface pointer. Perhaps there's a hole where they called and managed to avoid the matching . "Oh no," the customer replied, "that's not possible. We call this function in only one pla...

News flash: Healthy people live longer
Nov 18, 2009
Post comments count 0
Post likes count 0

News flash: Healthy people live longer

Raymond Chen
Raymond Chen

Researchers have determined that people in good physical condition live longer. Who'd'a thunk it?

How do I move the Windows.edb and other search index files?
Nov 18, 2009
Post comments count 0
Post likes count 0

How do I move the Windows.edb and other search index files?

Raymond Chen
Raymond Chen

Nothing profound today, just a little tip. My customer is looking out for a way to change the location of the windows.edb file to another (larger) drive. From the Indexing Options Control Panel, click Advanced, and then under Index location, click Select new.

We found the author of Notepad, sorry you didn't go to the award ceremony
Nov 17, 2009
Post comments count 0
Post likes count 0

We found the author of Notepad, sorry you didn't go to the award ceremony

Raymond Chen
Raymond Chen

I've received independent confirmations as to the authorship of Notepad, so I'm inclined to believe it. Sorry you didn't get to go to the award ceremony. The original author of Notepad also served as the development manager for Windows 95. His job was to herd the cats that made up the programmers who worked on Windows 95, a job which you can imagine falls into the "not easy" category. After Windows 95, he retired from the software industry and became a high school science teacher. At a social event some years later, I met him again and asked about the transition from software development manager...

How to tell when your patent has been approved
Nov 17, 2009
Post comments count 0
Post likes count 0

How to tell when your patent has been approved

Raymond Chen
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.

How to pretend that you attended my talk at UIUC Reflections|Projections 2009
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
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...