Auldfart's How To Guides

 

Registry editing

It’s at the heart of how your programs and settings work in Windows. Editing the keys in the Registry is the key to tweaking Windows.

    Any configuration utility you install just gives you a friendly front end to editing the most useful keys, but if you know what you’re doing it’s faster to make the changes in the Registry Editor (Start, Run, REGEDIT) directly.

       To change a key in the Registry Editor just double-click it. It usually takes longer to find the key you want in the tree, so if you expect to edit a key often save it as a Favorite so you can get back to it quickly.

What’s where?
Windows 95 replaced the various INI files that stored system information with a database.

        It’s still stored in multiple files, but the Registry Editor enables you to see all the settings in one place.

              The files and the structure change with each version of Windows, but for compatibility older keys are always stored in the same place so in Windows XP you’ll find both Windows and Windows NT key branches.

   The changes to the Registry in XP improve its performance: it’s less likely to become fragmented, keys for particular applications are pre-fetched when you run them and searches are cached.

 Yet they don’t affect the way you edit the Registry, even though the files that make it up change in each version of Windows.

      The only real difference you’ll see is that the HKEY_DYN_DATA root keys that Windows Me uses to store information about Plug and Play devices isn’t there in XP.

        The other five root keys remain the same, although what’s in them depends on the version of Windows and the software you have installed. HKEY_CLASSES_ROOT stores file associations and related information.

HKEY_USERS stores the individual preferences for all the users on your PC – this is mostly the contents of USER.DAT.

HKEY_CURRENT_USER is just the section of HKEY_USERS for whoever’s using the PC at the time.

         HKEY_LOCAL_MACHINE stores information about hardware, software and preferences from SYSTEM.DAT. and HKEY_CURRENT_CONFIG links to the section of HKEY_LOCAL_MACHINE for the current hardware configuration – primarily mainly graphics card and printer settings.

    Each root key is a hierarchical branch of keys and sub-keys. Both keys and sub-keys contain values which is where the settings are.

Each value has a name and the value might be text, raw binary data or a DWORD, which is a number (often 0 for off or 1 for on).

    In Windows 95 and 98 the Registry is stored in just two files in the Windows folder: SYSTEM.DAT and USER.DAT. Windows Me adds the CLASSES.DAT file.

             You can take copies of these files yourself but Windows 98 and Me back up the Registry at start up once a day and by default keeps the last five working copies as numbered files called RB00x.CAB in the hidden SYSBCKUP subdirectory inside the Windows folder.

     If you want to keep more than five copies, edit the C:\WINDOWS\SCANREG.INI file and change the value for MaxBackupCopies.

        You can save the Registry backups into a different file by adding a folder to the BackupDirectory line like BackupDirectory=C:\BACKUP, but it’s safest to leave the files where Windows can find them.

       If you want to backup other system files at the same time you can add them to SCANREG.INI as Files='folder code','file name'. Instead of giving the path to the file type a folder code: 10 for WINDOWS, 11 for WINDOWS\SYSTEM and 30 for C:\, followed by the file name.

         For example, to back up C:\BOOTLOG.TXT and the WinZip history file you’d include the following line: Files=30,BOOTLOG.TXT,WINZIP.LOG.

   If you’re making changes to the Registry, take a backup yourself first: click Start, Run and type SCANREGW to run the Windows Registry Checker. This checks the Registry for errors and assuming there aren’t any asks if you want to back up the Registry again.

  If you want to force Windows to check and back up the Registry every time you boot, choose Start, Run, Regedit, find the HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ CurrentVersion \ Run key and

       create a new String value called RegistryChecker with the value SCANREGW.EXE /AUTORUN.

    If there’s a problem with the Registry when you boot up Windows, the Registry Checker replaces it with the most recent back-up copy.

        You can also force it to use an older version of the Registry by pressing [F8] while Windows is booting, choosing Safe Mode Command Prompt and running SCANREG/RESTORE to choose which backup to use.

 

New technology – new trouble


       With Windows NT, 2000 and XP, the Registry files become more complicated and a lot harder to back up. In XP the files are scattered around the hard drive because there’s a different set for each user and for the system itself,

        with SECURITY, SOFTWARE, DEFAULT, SAM and USERCLASS files joining various versions of SYSTEM and NTUSER.DAT: get the definitive list from the Registry itself at HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Control \ HiveList.

    There are also .LOG files that store changes to the Registry that are in memory but haven’t yet been saved to the Registry files. If your PC crashes while the keys are being changed Windows can roll back to the original file or copy the changes from the .LOG file as necessary.

           You can’t just copy the files yourself any more because they’ll be in use by Windows. You can export a key, a branch or the whole Registry from File, Export but the Registry has to be running for you to import those settings so you have to be able to boot.

Furthermore, it merges the keys rather than overwriting them so if the problem is extra keys and values they’ll still be in the Registry.

     If you don’t want to rely on the Registry Backup taken by System Restore or using command-line REG utility in the Recovery Console, get a copy of ERUNT (http://home.t-online.de) to take a complete Registry backup in XP.

Cleaning the Registry


       It’s not unusual for one program to create 100 or more keys in the Registry, and Windows has plenty of keys of its own. The Registry ends up as a large set of files.

That leaves you with a huge file filling system memory and as you install and uninstall applications the Registry becomes fragmented, and Windows slows down even more while it waits for keys to load.

     Although Windows XP fixes those problems, if you’re using an earlier version of Windows then cleaning out unnecessary Registry keys can boost performance.

       Never delete a Registry key unless you know what it does, and always take a backup of the key first, just in case. Rather than looking for old keys yourself, download a Registry cleaner like the excellent, free RegCleaner (www.vtoy.fi).

This shows you orphan files and software that has keys in the Registry, so you can delete all the keys for packages you’ve uninstalled. In Windows 98 and Me you can compress the Registry afterwards (XP does it automatically).

    Restart in MS-DOS mode and run SCANREG /OPT to remove unused space and shrink the files. Spend half an hour spring cleaning your Registry and your whole PC will feel the benefit.