Mega Shutdown and Restart Troubleshooting Guide
"ShutMeDown" REGISTRY PATCH
Download the "ShutMeDown" Registry patch. Please follow sensible Registry editing protocol. Backup your Registry before the change (or run System Restore to create a restore point). This is not the appropriate fix for most machines, but does help a significant number. After installing, test Windows shutdown. If the fix does not work for you, remove it by restoring the Registry to its prior state.
For those who want a little more background information, the fix provided by this patch is based on a Microsoft Knowledge Base article Q155117 for Windows NT 4.0. It apparently still works in NT 5.1; that is, in Windows XP.