Showing tag results for Code

Feb 22, 2013
Post comments count0
Post likes count0

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 ans...

Code
Feb 22, 2013
Post comments count0
Post likes count0

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

Code
Feb 21, 2013
Post comments count0
Post likes count0

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 inf...

Code
Feb 20, 2013
Post comments count0
Post likes count0

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

Code
Feb 15, 2013
Post comments count0
Post likes count0

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&g...

Code
Feb 14, 2013
Post comments count0
Post likes count0

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 comman...

Code
Feb 13, 2013
Post comments count0
Post likes count0

How do I launch a file as if it were a text file, even though its extension is not .txt?

Raymond Chen
Raymond Chen

You might have a program that generates log files or other text content with an extension other than . You naturally might want to open these documents in the user's default text editor. You might decide to ask the Windows developer support team, "How can I figure out what program is the handler for text files?" The idea being that once you get t...

Code
Feb 11, 2013
Post comments count0
Post likes count0

Display an overlay on the taskbar button

Raymond Chen
Raymond Chen

Today's "Little Program" displays an overlay on the taskbar button. I've seen some people call this a "badge", but "overlay" is the official term. Start with our scratch program and make the following changes: #include <comip.h> #include <comdef.h> #include <shlobj.h> #include <shellapi.h> _COM_SMARTPTR_TYPEDEF(ITaskb...

Code