I first described the Shutdown Event Tracker in How can I record the reason for shutting down a Windows XP computer?
To define a custom reason code for the Shutdown Event Tracker, you must add a structured Value Name and data value to the registry at:
For United States English, the key would be:
The structured Value Names have the following syntax:
Where the semicolons delimit the Flags (xxxxx) from the Major reason (nnn) and Minor reason (nnnnn):
Flags - From one to five control flags, using the following character, in any order: P - Planned shutdown; otherwise, an unplanned shutdown. C - A comment is required. This flag must be used with S. B - An ID is required. This flag must be used with D. S - Display the expected shutdown dialog box. Either S, D, or both S and D must be used. D - Display the unexpected shutdown dialog box. Either S, D, or both S and D must be used. Major reason - A number in the range from 64 - 255. Numbers 0 - 63 are defined by the system. Minor reason - A number in the range from 0 - 65535.NOTE: Major reason / Minor reason pairs must be unique, with the exception of planned ( P) versus un-planned pairs.
The structured data values for these Value Names use the following syntax:
The maximum <titlestring> size is 64 characters AND it must be unique. The <descriptionstring> is optional. If present, it is displayed in the shutdown dialog box, and has a maximum size is 256 characters.