The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Now that version 4 of the .NET Framework supports in-process side-by-side runtimes, is it now okay to write shell extensions in managed code?
Feb 22, 2013
Post comments count 0
Post likes count 0

Now that version 4 of the .NET Framework supports in-process side-by-side runtimes, is it now okay to write shell extensions in managed code?

Raymond Chen
Raymond Chen

Many years ago, I wrote, "Do not write in-process shell extensions in managed code." Since I originally wrote that article, version 4 of the .NET Framework was released, and one of the features of that version is that it supports in-process side-by-side runtimes. Does that mean that it's now okay to write shell extensions in managed code? The answer is still no. The Guidance for implementing in-process extensions has been revised, and it continues the recommendation against writing shell extensions and Internet Explorer extensions (and other types of in-process extensions) in managed code, even if you're us...

Isn’t the CompletionKey parameter to CreateIoCompletionPort superfluous?
Feb 22, 2013
Post comments count 0
Post likes count 0

Isn’t the CompletionKey parameter to CreateIoCompletionPort superfluous?

Raymond Chen
Raymond Chen

When you associate a file handle with an I/O completion port with the function, you can pass an arbitrary pointer-sized integer called the which will be returned by the function for every I/O that completes against that file handle. But isn't that parameter superfluous? If somebody wanted to associated additional data with a file handle, they could just extend the structure to contain that additional data. Yes, they could, so in a purely information-theoretical sense, the parameter is superfluous. And heated seats in your car are superfluous, too. But they sure are nice! From a purely information-...

What does -1.#IND mean?: A survey of how the Visual C runtime library prints special floating point values
Feb 21, 2013
Post comments count 0
Post likes count 0

What does -1.#IND mean?: A survey of how the Visual C runtime library prints special floating point values

Raymond Chen
Raymond Chen

As every computer scientist knows, the IEEE floating point format reserves a number of representations for infinity and non-numeric values (collectively known as NaN, short for not a number). If you try to print one of these special values with the Visual C runtime library, you will get a corresponding special result: Positive and negative infinity are generated by arithmetic overflow, or when the mathematical result of an operation is infinite, such as taking the logarithm of positive zero. (Don't forget that IEEE floating point supports both positive and negative zero.) For math nerds: IEEE arithmetic uses...

You can ask the compiler to answer your calling convention questions
Feb 20, 2013
Post comments count 0
Post likes count 0

You can ask the compiler to answer your calling convention questions

Raymond Chen
Raymond Chen

If you want to figure out some quirks of a calling convention, you can always ask the compiler to do it for you, on the not unreasonable assumption that the compiler understands calling conventions. "When a __stdcall function returns a large structure by value, there is a hidden first parameter that specifies the address the return value should be stored. But if the function is a C++ instance method, then there is also a hidden this parameter. Which goes first, the return value parameter or the this pointer?" This is another case of You don't need to ask me a question the compiler can answer more accurately...

Microspeak: bubble up
Feb 19, 2013
Post comments count 0
Post likes count 0

Microspeak: bubble up

Raymond Chen
Raymond Chen

Bubble up is the name of a soft drink, but at Microsoft, it means something else. (Remember, Microspeak is not just terms used exclusively within Microsoft, but also terms used at Microsoft more often than in the general population.) To bubble up information is to expose the information at a higher reporting level. For example, you might have a local team report that goes into detail over all the work items the team is responsible for and the corresponding status of each item. The data from this report may bubble up into a group report, which summarizes the work item status across all teams. As another exam...

I speak German better in my dream than I do in real life
Feb 18, 2013
Post comments count 0
Post likes count 0

I speak German better in my dream than I do in real life

Raymond Chen
Raymond Chen

I dreamed that I was at a large trade show, where everybody had cleared the center of the main floor to make room for an impressive real-time holography demo. After the demo was over, everybody moved their chairs back, but the German delegation had difficulty returning their chairs to the exact position they took them from, because everybody else (not being German) just put the chairs in rows without regard for their original row and seat number. Next came dinner, and I had to help interpret for a German attendee (who in retrospect may have been Angela Merkel with dark hair) who had taken two appetizers and ...

Display control buttons on your taskbar preview window
Feb 18, 2013
Post comments count 0
Post likes count 0

Display control buttons on your taskbar preview window

Raymond Chen
Raymond Chen

A tiny control surface.

Debug session: Why is an LPC server not responding?
Feb 15, 2013
Post comments count 0
Post likes count 0

Debug session: Why is an LPC server not responding?

Raymond Chen
Raymond Chen

A particular scenario was hanging, and the team responsible for the scenario debugged it to the point where they saw that their X component was waiting for their Y component, which was waiting for Explorer, so they asked for help chasing the hang into Explorer. The team was kind enough to have shared what they've learned so far: kd> !alpc /m 9c14d020 Message 9c14d020 MessageID : 0x0274 (628) CallbackID : 0xCCA5 (52389) SequenceNumber : 0x00000016 (22) Type : LPC_REQUEST DataLength : 0x0094 (148) TotalLength : 0x00AC...

If you can’t find the function, find the caller and see what the caller jumps to
Feb 14, 2013
Post comments count 0
Post likes count 0

If you can’t find the function, find the caller and see what the caller jumps to

Raymond Chen
Raymond Chen

You're debugging a program and you want to set a breakpoint on some function, say, netapi32!Ds­Address­To­Site­NameW, but when you execute the bp netapi32!Ds­Address­To­Site­NameW command in the debugger, the debugger says that there is no such function. The Advanced Windows Debugging book says that the bp command should set a breakpoint on the function, but the debugger says that the symbol cannot be found. I used the x netapi32!* command to see that the debugger did find a whole bunch of symbols, and it says that the symbols were loaded (from the public symbol store), but ne...