The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Oct 3, 2008
Post comments count 0
Post likes count 1

Acquire and release sound like bass fishing terms, but they also apply to memory models

Raymond Chen

Many of the normal interlocked operations come with variants called InterlockedXxxAcquire and InterlockedXxxRelease. What do the terms Acquire and Release mean here? They have to do with the memory model and how aggressively the CPU can reorder operations around it. An operation with acquire semantics is one which does not permit subsequent memory operations to be advanced before it. Conversely, an operation with release semantics is one which does not permit preceding memory operations to be delayed past it. (This is pretty much the same thing that MSDN says on the subject of Acquire and Release Semantics....

Oct 2, 2008
Post comments count 0
Post likes count 1

The dangers of setting your double-click speed too short

Raymond Chen

After I noted how the window manager uses the double-click time as a basis for determining how good your reflexes are, people got all excited about reducing the double-click speed to make Windows feel peppier. But be careful not to go overboard. Back in the Windows 95 days, we got a bug from a beta tester that went roughly like this: Title: Double-clicks stop working after using mouse control panel Reproducibility: Consistent, hardware-independent Severity: Major loss of functionality Description: Result: Mouse double-clicks no longer recognized. We had to explain to the beta tester that, no,...

Oct 1, 2008
Post comments count 0
Post likes count 0

An artist’s conception of the new citizenship test

Raymond Chen

Today is the first day of the controversial redesigned United States citizenship examination. For the next year, candidates who applied before today can choose whether they want to use the old test or the new one. To help prepare for the new examination, I propose the following warm-up, which I tested (with the assistance of another United States citizen) on a foreign national, a Canadian from British Columbia, so there should be no language barrier as long as we are careful to avoid the word about. Here are the answers the Canadian gave, along with my response and additional commentary from my co-examiner ...

Oct 1, 2008
Post comments count 0
Post likes count 1

Why do maximized windows lose their title bar translucency?

Raymond Chen

If you have translucent title bars enabled,¹ you may have noticed that the translucency goes away when you maximize a window. Why is that? This is a performance optimization. Opaque title bars are more efficient than translucent ones, and when you maximize a window, you're saying,² "I want to focus entirely on this window and no other windows really matter to me right now." In that case, the desktop window manager doesn't bother with translucency because you're not paying any attention to it anyway. This may seem like a very minor change, but the difference is noticeable on benchmarks, and, like...

Sep 30, 2008
Post comments count 0
Post likes count 1

2008 Q3 link clearance: Microsoft blogger edition

Raymond Chen

It's that time again: Sending some link love to my colleagues. [Raymond is currently away; this message was pre-recorded.]

Sep 30, 2008
Post comments count 0
Post likes count 1

When computer programmers dabble in economics: Buying prepaid lunch vouchers

Raymond Chen

Several years ago, the Microsoft cafeterias phased out their prepaid lunch voucher system. Under the new system, you "load up" your security badge with money (either by paying cash at any register or by having the amount deducted from your paycheck) and then swipe your badge at card readers installed at each register. But in the old days, the system operated manually. Under the old system, you paid $25 cash for a voucher which, when folded in half, was about the size of a business card. On the card were boxes with various denominations ($1, 25¢, 10¢, 5¢), and when you bought something with your ...

Sep 29, 2008
Post comments count 0
Post likes count 0

Meet the authors: Mario Hewardt and Daniel Pravat, authors of Advanced Windows Debugging

Raymond Chen

My colleague Mario Hewart just let me know that he and Daniel Pravat will be presenting at the PDC pre-con. In case you don't recognize the names, they're the authors of Advanced Windows Debugging, a book which I reviewed late last year. So if you want to get your debugging tips directly from the source, you know where to go. Besides, Mario speaks Swedish, so he's already awesome by default. [Raymond is currently away; this message was pre-recorded.]

Sep 29, 2008
Post comments count 0
Post likes count 1

Anybody can make up a generic mapping

Raymond Chen

Each component that uses ACLs to control access has its own idea of what GENERIC_READ, GENERIC_WRITE, and GENERIC_EXECUTE mean. It's not like there's a master list that somebody can make that lists them all, because I can make up a new one right here. Watch me: #define GIZMO_QUERY_STATUS 0x0001 #define GIZMO_QUERY_MEMBERS 0x0002 #define GIZMO_START 0x0004 #define GIZMO_STOP 0x0008 #define GIZMO_ADD_CLIENT 0x0010 #define GIZMO_REMOVE_CLIENT 0x0020 #define GIZMO_GENERIC_READ (STANDARD_RIGHTS_READ | \ GIZMO_QUERY_STATUS | \ GI...

Sep 26, 2008
Post comments count 0
Post likes count 2

ERRORLEVEL is not %ERRORLEVEL%

Raymond Chen

The command interpreter cmd.exe has a concept known as the error level, which is the exit code of the program most recently run. You can test the error level with the IF ERRORLEVEL command: IF ERRORLEVEL 1 ECHO error level is 1 or more <sidebar> The IF ERRORLEVEL n test succeeds if the error level is n or more. This was presumably because there were programs that expressed different degrees of failure with higher and higher exit codes. For example, the diff program has three exit codes: 0 means the files are the same; 1 means the files are different; 2 means that something terrible happened. There are ...