Windows Performance Tools Kit

Windows Performance Team has released Windows Performance Tools Kit to the Windows SDK for Windows Server 2008 and .NET Framework 3.5. This is the same tool Windows team uses to diagnose Windows performance problem. Along with the tool comes with a 60-page Quick Start Guide. It offers significant details how the system works. Having…


From Unhandled Exception to Debugger Attach

I was always wondering what is happening between an application throws an unhandled exception, and a debugger attached to the process. Apparently the information is right under my nose, but I was blind. Windows Debugger’s documentation about post-mortem debugging has all the details you want to know. Enabling Postmortem Debugging The most common application errors…


Windows Vista Sxs Activation Context Cache

Sxs activation model is built on top of Actication Context. To create an activation context, use the API CreateActCtx. Activation Context is used very frequently in Windows. For example, a simple operation like start notepad, open the common file dialog, select a file, will call CreateActCtx many times (I measured 18 times in Vista). With…


advantages and disadvantages of delay load (LoadLibrary)

Some knowledgeable people posted the following wisdom about delay load. Archived here to share.    The advantages are that dlls get loaded only when they are used, and you can “statically” bind to an import that may not exist at runtime, and as long as you are careful not to call it, the program will…



RT_MANIFEST Since Windows XP, Windows reserves a new type of resource RT_MANIFEST for SxS manifests. Within the RT_MANIFEST resource, Windows reserves ID 1-16. A binary cannot have two IDs of resource type RT_MANIFEST within 1-16. Windows will refuse to load such binary in Windows XP/Windows Server 2003. Only three IDs are used today in Windows….


Diagnose SideBySide failures in Windows XP/Windows Server 2003

Since I published my article on how to diagnose SideBySide failures, I have received many feedbacks that since Sxstrace is not available in Windows XP/Windows Server 2003, it is hard to figure out what is wrong in Windows XP/Windows Server 2003.   This article intends to help people diagnose SideBySide failures in Windows XP/Windows Server 2003. SideBySide failures…


Activation Context Creation flow

The following describes how activation context is created currently in Windows XP/Windows Server 2003/Windows Vista. 1. CreateProcess/CreateActCtx is called. 2. CreateProcess/CreateActCtx does some validation, constructs a message, sends the message to CSRSS.exe, and waits for CSRSS.exe to return. 3. CSRSS.exe receives the message, and creates the activation context as described in 4. Once the…


Genman32 – A tool to generate Sxs manifest for managed assembly for Registration Free COM/.Net Interop

Attached to this article is GenMan32, a tool to generate sxs manifest for managed assembly to use in registration free COM/.Net Interop scenario. (For more information about registration free COM/.Net interop, please read GenMan32 uses reflection API to enumerate all the types in the assembly. For each type, if it requires registration (as determined by…


How to tell if the current user is in administrators group programmatically

You can use CheckTokenMembership ( to check whether a user is in administrators group.  There is an example in the MSDN document. The example will not work in Windows Vista. In Windows Vista, even if the user is in administrators group, the OS will create a filtered user token when user log on. The SID…


Debugging LoadLibrary Failures

LoadLibrary is one of the mostly used yet unbelieveably complex APIs in Windows, if not the one. Russ Osterlund has a full MSDN article discussing LoadLibrary, yet he only touches the surface of the problem (how it works under normal condition.) Mike Grier is one of the most talented developers I have worked with in Microsoft….