Flylib.com

Books Software

 
 
 

Controlling Registry Editor


Controlling Registry Editor

Registry Editor (Regedit) has a few features that most users like, but some prefer to disable. The following sections show you how to customize these features. First, you customize the default action for REG files: in other words, you can control what Regedit does when a file with the .reg extension is double-clicked. Second, you prevent Regedit from saving its settings when you close it. By doing so, Regedit opens the window to the same size and position every time.

Default Action for REG Files

When you double-click a file with the .reg extension and click Yes when it prompts you to merge the file's settings, Regedit imports the file's settings into the registry. If you edit REG files frequently, this behavior might concern you because you might accidentally import a REG file when you meant to edit it. Conversely, if you frequently import REG files, you might want to prevent Regedit from prompting you to merge the file's settings into the registry. Here are steps for accomplishing both tasks :

  • Prevent Regedit from automatically importing REG files.

    To do this, make the default action for REG files something other than opening the file, such as editing the file. To do that, set the default value of HKCR\regfile\shell to edit. The next time you double-click a REG file, it will open in Notepad.

  • Merge a REG file into the registry without prompting.

    To do this, change the command line that Windows executes when you open the file. Set the default value of HKCR\regfile\shell\open\command to regedit.exe /s "%1" .

Storing Window Position and Size

Each time you close Regedit, the program stores its view settings (window position and size, column sizes, last open key, and more) in the registry. The next time you run Regedit, it restores the window with those settings. Many users want Regedit to clear these settings, but Regedit doesn't provide an option to do that.

HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit is the key in which Regedit stores these settings. Set the key's Access Control List (ACL) so that you can't write to it, and then Regedit can't store its last view settings there. You can either delete the values in this key so that Regedit uses defaults every time it starts, or customize them so that Regedit uses your custom settings every time it starts. In either case, set the key's ACL so that you can read–but not write–values:

  1. In Regedit, click the key Applets\Regedit .

  2. On the Edit menu, click Permissions.

  3. Click Advanced, clear the check box that allows inheritable permissions, click Copy, and then click OK.

  4. In the Group Or User Names list, select each account and group; then clear the Full Control check box.

More Info
See Chapter 8, “Configuring Windows Security,” for more information about configuring keys' ACLs. In particular, if you decide that you don't like this customization, and you don't already own the key, you'll have to take ownership of the key to gain full control of it again.



Logging On Automatically

Some users don't like having to log on to Windows. When they restart the computer, they want it to boot all the way to the desktop without stopping at the Log On To Windows dialog box along the way. Before I tell you that this is possible (oops), let me add that you should never skip the logon process if your computer is connected to a business network. Obvious security concerns are present when you allow anyone with access to your computer to have full access to all of its contents and the network.

You configure the ability to log on to Windows automatically in HKLM\SOFTWARE\ Microsoft\Windows NT\CurrentVersion\Winlogon . First, you set the REG_SZ value AutoAdminLogon to 1 , which turns on this feature. You may need to create the described keys. Just remember that this is a REG_SZ value and not a REG_DWORD value. Next, set the values DefaultUserName and DefaultPassword to the user name and password that you want to use for logging on to the operating system. Both are REG_SZ values. Last, set the REG_SZ value DefaultDomainName to the name of the domain that's authenticating your user name and password. Table 4-8 summarizes these values, which you create if they don't already exist.

Table 4-8 Values in Winlogon

Name

Type

Data

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

AutoAdminLogon

REG_SZ

0 1

DefaultUserName

REG_SZ

Name

DefaultDomainName

REG_SZ

Domain

DefaultPassword

REG_SZ

Password