The Fix for Grayed Out Boxes

April 24, 2009

The File Types tab in Explorer's View / Options menu lets you edit most of your file types, but certain settings cannot be changed. The default action for a batch file, for instance, runs the batch file instead of opening it via Notepad or Wordpad. Thus, when you double-click on AUTOEXEC.BAT, a DOS window opens, and the file executes. If you want to change this default action and edit a batch file when you double-click on it, however, the File Types tab does not let you do so; the Set Default button for the file type called MS-DOS Batch File is always grayed out.

The button is grayed out because HKEY_CLASSES_ROOT's batfile key contains an EditFlag value entry. Such entries are used throughout the Registry to prevent novice users from altering certain system settings. The binary data in batfile's EditFlag reads d0 04 00 00. If you change this value to 00 00 00 00, you can then change any of the batch file settings. Do not, however, indiscriminately zero out EditFlag; if you do so in a system ProgID such as Drive or AudioCD, it completely disappears from the File Types list. For ProgIDs that are linked to extensions, set all EditFlags to 00 00 00 00. For system ProgIDs, replace EditFlag data with 02 00 00 00.

If you wish to have access to some buttons while leaving others grayed out, you must know the function of each EditFlag bit. The last two bytes of data are always zero, but most bits within the first two bytes have a specific effect:

  • Byte 1, bit 1: Removes the file type from the master list in the File Types tab (select View / Options under Explorer) if it has an associated extension.
  • Byte 1, bit 2: Adds the file type to the File Types tab if it does not have an associated extension.
  • Byte 1, bit 3: Identifies a type with no associated extension.
  • Byte 1, bit 4: Grays out the Edit button in the File Types tab.
  • Byte 1, bit 5: Grays out the Remove button in the File Types tab.
  • Byte 1, bit 6: Grays out the New button in the Edit File Type dialog (select the Edit button in the File Types tab).
  • Byte 1, bit 7: Grays out the Edit button in the Edit File Type dialog.
  • Byte 1, bit 8: Grays out the Remove button in the Edit File Type dialog.
  • Byte 2, bit 1: Prevents you from editing a file type's description in the Edit File Type dialog.
  • Byte 2, bit 2: Grays out the Change Icon button in the Edit File Type dialog.
  • Byte 2, bit 3: Grays out the SetDefault button in the Edit File Type dialog.
  • Byte 2, bit 4: Prevents you from editing an action's description in the Edit Action dialog (select the Edit button in the Edit File Type dialog).
  • Byte 2, bit 5: Prevents you from editing the command line in the Edit Action dialog.
  • Byte 2, bit 6: Prevents you from setting DDE (Dynamic Data Exchange) fields in the Edit Action dialog.

The EditFlags value for Drive, for instance, is d2 01 00 00 in Hex (1101 0010 0000 0001 in binary). Bits 2, 5, 7, and 8 are on in byte 1, and bit 1 is on in byte 2. The EditFlag for batfile is d0 04 00 00 in Hex or 1101 0000 0000 0100 in binary. In this case, bits 5, 7, and 8 are on in byte 1, and bit 3 is on in byte 2.

Bits 4, 5, and 6 of byte 2 apply only to actions that are protected. EditFlags with action keys (such as HKEY_CLASSES_ROOT\batfile\shell\open) determine protection. If byte 1, bit 1 of such an EditFlag is 0 (or if there is no EditFlag), then the action is protected. If byte 1, bit 1 is 1, then the action is unprotected.

Related Posts

Next Article
« Prev Post
Previous Article
Next Post »

No comments