The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Deftly solving compatibility problems by withholding information
Dec 21, 2011
Post comments count 0
Post likes count 0

Deftly solving compatibility problems by withholding information

Raymond Chen
Raymond Chen

One of the continuing compatibility problems that plagued Direct3D was the way it reported texture formats. Historically, the way an application checked which texture formats were available was by calling and passing a callback function which is called once for each supported format. The application's callback made some sort of decision based on the information it received. The problem was that any time a new format was added, a bunch of programs ended up not working. Either the new format confused them, or the change in the order of the formats violated some assumption. For example, they may have assumed that i...

Microspeak: Offline (noun)
Dec 20, 2011
Post comments count 0
Post likes count 0

Microspeak: Offline (noun)

Raymond Chen
Raymond Chen

Sure, any noun can be verbed, and any verb can be nouned. But today, we're going to noun an adjective. I have no written citations of this usage; the only report was via a colleague who overheard it in a hallway conversion. I had some offlines with Fred about that. In Microspeak, offline is an adjective which means "outside this meeting." In order to keep a meeting on track, the meeting organizer may advise the people engaged in the discussion of a side topic or a topic of limited interest to take it offline, please, meaning discuss this amongst yourselves after the meeting, please. In other words, "Let's not...

Paint messages will come in as fast as you let them
Dec 19, 2011
Post comments count 0
Post likes count 0

Paint messages will come in as fast as you let them

Raymond Chen
Raymond Chen

There is a class of messages which are generated on demand rather than explicitly posted into a message queue. If you call or and the queue is empty, then the window manager will look to see if one of these generated-on-demand messages is due, messages like , , and . Neil wonders, "In that program that called 100,000 times, how many paint messages were generated?" The Zen answer to this question is "Yes." A more practical answer is "As many as you can get." When somebody calls , the window manager adds the specified rectangle to the window's invalid region (or invalidates the entire client area if no recta...

Programmatically controlling which handles are inherited by new processes in Win32
Dec 16, 2011
Post comments count 0
Post likes count 1

Programmatically controlling which handles are inherited by new processes in Win32

Raymond Chen
Raymond Chen

In unix, file descriptors are inherited by child processes by default. This wasn't so much an active decision as it was a consequence of the fork/exec model. To exclude a file descriptor from being inherited by children, you set the flag on the file descriptor. Win32 sort of works like that, but backwards, and maybe a little upside-down. And in high heels. In Win32, handles default to not inherited. Ways to make a handle inherited during have grown during the evolution of Win32. As far as I can tell, back in the old days, inheritability of handles was established at handle creation time. For most handle...

Not even making it to the airtight hatchway: Execution even before you get there
Dec 15, 2011
Post comments count 0
Post likes count 0

Not even making it to the airtight hatchway: Execution even before you get there

Raymond Chen
Raymond Chen

Today's dubious security vulnerability comes from somebody who reported that the function had a security vulnerability which could lead to arbitrary code execution. This is a serious issue, but reading the report made us wonder if something was missing. According to the report, this sample program illustrates that the function will execute whatever you pass as its second parameter. In this case, the program chose to launch Notepad, but obviously an attacker could change the code to something more dangerous. We had trouble trying to figure out what the person was trying to say. After all, it's not the fun...

The peculiar cadence of executive mail messages
Dec 14, 2011
Post comments count 0
Post likes count 0

The peculiar cadence of executive mail messages

Raymond Chen
Raymond Chen

They follow a pattern that appears to be designed to hide information.

Online gift ordering + enthusiastic kids at the keyboard + Unicode, wait… Unicode?
Dec 13, 2011
Post comments count 0
Post likes count 0

Online gift ordering + enthusiastic kids at the keyboard + Unicode, wait… Unicode?

Raymond Chen
Raymond Chen

I was completing an online gift order for my young nephew's birthday, and I was in the middle of typing Happy birthday into the gift card message when an enthusiastic child reached for the keyboard and held down the "a" key as I typed the final "a" in "birthday". I wanted to capture the spontaneous enthusiasm in the gift tag, but I had no idea what font or format rectangle was going to be used, so I couldn't be sure where to put hyphens so that they will ensure line breaks at visually-pleasing locations. And if I didn't insert hyphens at all, then the line would just run off the end of the gift tag and end up t...

What is the API for accessing content on SkyDrive?
Dec 12, 2011
Post comments count 0
Post likes count 0

What is the API for accessing content on SkyDrive?

Raymond Chen
Raymond Chen

The last time I mentioned programmatic access to SkyDrive was last June, where I noted that the interface was given the confusing name Messenger Connect. At least now they renamed it to Live Connect, which is slightly less confusing. The SkyDrive folks have been pretty busy lately. A few days ago, Dare Obasanjo announced a new Live Connect SDK, which means that you now have even more ways of accessing your SkyDrive content programmatically. (I like how the block diagram screen shot still has the red underline squiggles under the word skydrive.) Check it out at the Live Connect Developer Center. You can wat...

How can I tell whether a window is modal?
Dec 12, 2011
Post comments count 0
Post likes count 0

How can I tell whether a window is modal?

Raymond Chen
Raymond Chen

A customer wanted a way to determine whether a particular window is modal. They listed a few methods they had tried but found that it didn't work and asked for assistance. As Eric Lippert is fond of saying, "First, write your spec." Until you know what you want, you won't know how to get it. First, you need to define what you mean by a modal window. There are multiple competing definitions. The customer decided that the definition of modal window they want is this one: A modal window is a child window that requires the user to interact with it before they can return to operating the parent application, ...