This section describes tasks and tips for managing the registry, and for using the registry to manage your system.
The following tasks help you manage the registry itself.
The registry contains thousands of entries, so it can be difficult to find a desired key or value. Scrolling through the hierarchy could take some time. The most efficient approach to find data in the registry is to use Registry Editor.
To find information in the registry
The registry is critical to your Windows 98 – based computer because Windows 98 and Windows 98 – based applications store their configuration information in the registry. Therefore, it is crucial to back up the registry regularly and frequently so that this information can be recovered in the event that the registry is damaged. It is also a good idea to back up the registry before installing a new application or new hardware.
Registry Checker automatically backs up and restores the registry. You can also run it manually at any time using the following procedure.
To manually back up the registry using Registry Checker
First Registry Checker verifies that the registry is structurally sound. If the registry is sound, Registry Checker offers to back it up. Registry Checker will back up the registry and store the compressed CAB file in \Windows\Sysbckup (a hidden directory).
If the registry structure is sound but a content change is keeping the computer from booting, then you need to manually restore from a backup using the following procedure.
To restore the backup manually
Backed up, compressed registry files are listed with the name Rbxxx.cab. The files show the time and date of backup. Next to each CAB file are the words Started or Not Started. Started means that the file has successfully started Windows 98, and is a known good file. Not Started means that the file has never been used to start Windows 98, so it is not a known good file.
The Registry Checker scan and backup tools can be configured with the Scanreg.ini file. Table 31.5 includes some configurable settings in the Scanreg.ini file.
Table 31.5 Configurable settings in the Scanreg.ini file
Setting | Description |
---|---|
Backup= | Enables and disables Registry Checker. Backup=0 disables backups Backup=1 enables backups |
MaxBackupCopies= | Specifies the maximum number of backups to store in the backup folder. MaxBackupCopies=5 is the default. |
BackupDirectory= | Changes the location of the backup folder where the CAB files are stored. For example, BackupDirectory=C:\RegBackup. |
Files= | Adds system files to be backed up. |
Optimize= | Enables and disables automatic registry optimization. Optimize=0 disables optimization Optimize=1 enables optimization |
Table 31.6 describes command line options for the ScanReg and ScanRegW utilities of Registry Checker.
Table 31.6 Command line options for Registry Checker
Command line option | Description | Available for | ||||||
---|---|---|---|---|---|---|---|---|
/backup | Backs up the registry with no prompts to the user. | ScanReg and ScanRegW | ||||||
/restore | Displays a list of backup files available, sorted by date and time of the backup. | ScanReg | ||||||
"/comment=" | Specifies that a comment is attached to the backup, which is displayed with /restore. | ScanReg and ScanRegW | ||||||
/fix | Repairs the registry files. | ScanReg | ||||||
/autoscan | Scans the registry files every time it is run, but only backs up once per day. | ScanRegW | ||||||
/scanonly | Scans the registry files and returns an error level. Does not back up. | ScanRegW |
Table 31.7 identifies the error levels returned by ScanReg.
Table 31.7 ScanReg error levels
Error level | Error |
---|---|
2 | The registry is bad. |
0 | No problems found. |
-2 | Not enough memory; free some memory. In real mode, Registry Checker may require more memory, or high memory (HIMEM) needs to be installed (ScanReg does not work in Safe Mode command prompt only). In protected mode, the Windows drive may be full. |
-3 | File not found; one or both of the registry files are missing. |
-4 | Unable to create User.dat or System.dat. |
-5 | Reading the registry failed. |
-6 | Writing to the registry failed. |
-7 | Sharing violation (protect mode only); another application has the registry open. |
Caution
You may have backed up core configuration files using the Emergency Recovery utility and CfgBack utilities from the Windows 95 compact disc. If these Windows 95 backup registries are restored to the Windows 98 system, the computer will not boot.
For more information about Registry Checker, see Chapter 27, "General Troubleshooting."
The registry can be exported, imported, or recreated using the MS-DOS-based version of Registry Editor on either the Windows 98 startup disk or in the \Windows directory. By using the export capabilities of Registry Editor, a specific branch or the entire registry can be saved in text format as a REG file. A branch of or the entire registry can be restored by importing a REG file that was created by exporting the registry.
You can import and export using Registry Editor. All the information required to import the data must be in the imported file and the files need a REG extension. Valid Windows 98 REG files contain only ASCII characters in a predefined format and contain the word REGEDIT4 in the first line. The second line must be blank. The following format is valid for a REG file:
REGEDIT4
[HKEY_CLASSES_ROOT\.bmp]
@="Paint.Picture"
"Content Type"="image/bmp"
[HKEY_CLASSES_ROOT\.bmp\ShellNew]
"NullFile"=""
All the lines that follow the first blank line can contain entries for registry settings. Each entry starts with the name of the destination key enclosed in square brackets [].The next line or lines are used for the values of a key (which are the values shown later in the right pane of Registry Editor). The value names are included in quotation marks (for example, "NullFile"). Some lines start with @= followed by a value in quotes. The @ character indicates a default value for an entry. These entries are marked as Default in the right pane of the Registry Editor.
Caution
The Microsoft Windows 98 Resource Kit does not provide sufficient information to guide you through the process of editing a REG file, so it is recommended that you undertake editing a REG file only under the guidance of your product support representative.
Also, use the regedit /c option with extreme care, and only when you are sure that the specified REG file contains a complete image of the registry.
To import with Registry Editor
Tip
You can also just double-click a filename.reg file. The extension is associated with Regedit and will be imported automatically.
After a REG file is successfully imported, a message box informs you that the REG file was valid, indicating that it was formatted properly, that it was a valid Windows 98 REG file, and that all information contained in the file and entered into the registry is valid.
To export a REG file using Registry Editor
The Registry Editor creates a REG file containing the information of the selected branch. This REG file can now be imported as previously described.
By default, the Registry Editor exports only the active branch. You can export the whole registry by selecting All in the Export range section, but keep the file size in mind.
Registry Editor runs in MS-DOS real mode. If you can boot your computer to MS-DOS mode, you can access Registry Editor. The file Regedit.exe is on the Windows startup disk and in the \Windows folder. For more information about using Regedit, type Regedit with no command line options at the command prompt, and a help screen appears advising you how to use this tool.
To import a registry file into the registry in MS-DOS Registry Editor
REGEDIT /L:system /R:user filename
L:system is optional and specifies the location of the System.dat file.
/R:user is also optional and specifies the location of the User.dat file.
Filename is the name of the registry file that will be imported.
For example, the following command will import the contents of Global.reg into User.dat and System.dat:
REGEDIT /L:C:\Windows\ /R:C:\Windows\Profiles\ A:\Global.reg
This section describes tasks that you can use to manage your system with the registry, including disabling Registry Editor, disabling a user’s ability to use any computer but his or her own, and registering file name extensions.
You can disable the Registry Editor for a user so that the user cannot change entries that you have set to limit user access.
To disable Registry Editor for a user
Note
An experienced user can still change registry settings by importing a REG file.
You can keep a user from using any computer but his or her own.
To disable a user’s ability to roam
You can remove one or all existing user profiles so that all users of the Windows 98 – based system will see the same desktop and icons.
To remove existing user profiles
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Profilelst\<username>
– Or –
To remove all profiles, remove the \ProfileLst subkey.
When you select a file name in Windows 98, the file opens in an application associated with that file type. The file is opened with the appropriate application because the file extension is stored in the registry with an association to that application.
File types and their associations to specific applications are stored in the registry during the installation of new software. An application’s setup program registers the file extension of the file type and the commands that are applied to this type of file type. All this information is stored in the HKEY_CLASSES_ROOT branch of the registry.
Each file type must have two entries in HKEY_CLASSES_ROOT. The first entry defines the file extension and a name (name_ID) for this file type. This name is then used in a second entry to define the commands for this file type. In other words, one entry describes its extension and the other contains its properties.
The structure is as follows:
HKEY_CLASSES_ROOT.ext = "name_ID"
name_ID = <"Description">
shell
verb = <menu item text>
command = command string
...
Structure and Description for a BAT File The BAT key defines the file extension (BAT) and the associated value name_ID. The associated value name_ID is set to string "batfile," which is the unique name identifier for the second key. Although the BAT extension is registered by the inclusion of the BAT key, Windows 98 needs additional information about what to do with a BAT file, such as executable commands that enable the user to open the file by clicking it. This is handled by the second key, batfile. The default value that contains the description "MS-DOS Batch File" defines this type of file. The description is what you see in Microsoft Windows Explorer in the Type column and the Registered file types list on the File Types property page of the Folder Options dialog box. The EditFlags value enables and disables the edit options in the Edit File Type dialog box. The DefaultIcon subkey contains the value for the path and file name that contains the associated icon. The shell subkey contains information that Windows 98 retrieves about actions associated with the BAT file. The shellex subkey contains information about shell extensions that handle the BAT file. |
Registering a new file type lets you manipulate how you access and enable functions, applications, and so on.
The preferred methods to register a file type are listed below:
You can also use the Registry Editor to register a file type. Be sure to make a backup copy of the registry before you begin, and be sure to manage every component of the process correctly.
To register a file type with Registry Editor
Microsoft Internet Explorer 4 browsing software allows multiple users to use a single installation of Internet Explorer 4 browsing software, while retaining unique individual settings for each user.
In general, user settings are put in the HKEY_CURRENT_USER key, and machine settings go under HKEY_LOCAL_MACHINE. Per machine settings that might change when a portable computer is in its docking station versus when it is undocked go under the HKEY_CURRENT_CONFIG key.
When multiple users log on to a workstation, they each get their own profile. A profile is a folder for each user that contains user specific files and configuration information, including their own copy of the HKEY_CURRENT_USER registry key (User.dat). A user’s profile is in a folder with the user’s name, and has a subfolder of \Windows\Profiles.
If a network is used, this profile can roam, meaning the user’s copy of User.dat is stored on a central server and downloaded to any computer the user logs on to. This way the user can see the same environment no matter which computer he or she is logged on to on the network. It also allows administrators central control over individual user settings.
In addition to containing that user’s copy of User.dat, a browsing software profile contains folders for Cookies, Recent, History, Favorites, Desktop, and Application Data.
Setup does not initialize any components in HKEY_CURRENT_USER settings during installation. This happens when Internet Explorer browsing software is installed on a machine by a user, and another user (who has never used Internet Explorer browsing software before) logs on at a later time, their profile will have no Internet Explorer browsing software settings.
In addition to simply logging on with a new user name, there is a new way to create a user profile. You will notice a new "Users" icon in Control Panel. This is a new interface and wizard for adding and configuring user profiles. This is simply an alternative user interface for creating a new profile. A reboot is still required.
The first time you click on this icon a wizard will run.
After clicking Next, you will be prompted for a new user name and a password for that user. The machine will then reboot. The User Profile Wizard runs only once. After that, the User List is displayed when the User icon in Control Panel is clicked, and the correct supervisor password is entered.
The first user that logs on to a machine is automatically the administrator of all consecutive user profiles on that machine. Non-administrators need the administrator’s password to change the settings in their profile. The prompt for the supervisor’s password is displayed as soon as the User icon in Control Panel is clicked. The supervisor is specified in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProfileList\Supervisor
If the supervisor’s password in the PWL file is null, then no supervisor key is created. Registry Editor lets you set up for more than one supervisor.
Although the registry replaces the basic function of the initialization files used in earlier versions of Windows, the System.ini, Win.ini, and Winfile.ini files still appear in the \Windows directory. These files continue to be used for compatibility with earlier Windows-based applications and device drivers. For example, entries in Win.ini and System.ini created by Win16-based applications are not updated in the registry because such applications do not know how to access the Windows 98 registry.
If you install Windows 98 as an upgrade over Windows 3.x, some INI file settings are copied into the registry, including settings from Control.ini, Program.ini, System.ini, and Win.ini.
Some INI file entries are not moved to the registry, but remain in the INI file for compatibility with Win16-based applications. Most of these entries can be changed without editing the INI files by using the graphical tools provided with Windows 98. However, some INI entries cannot be set using the Windows 98 user interface. These entries are required for some applications to function properly, but should not require manual modification by users.
Win.ini Settings in the registry.
Windows 98 migrates settings from configuration files into the registry during Setup. Table 31.8 shows where Win.ini entries migrated to the registry.
Table 31.8 Registry paths for migrated Win.ini entries
Win.ini entry | Subkey in HKEY_CURRENT_USER |
---|---|
[desktop] | \Control Panel\Desktop |
[Windows] | \Control Panel\Desktop |
[sounds] | \AppEvents\Schemes\Apps\event\current |
The following lists show entries retained in Win.ini for compatibility with applications written for earlier versions of Windows. These values can be set using Control Panel and other tools in the Windows 98 interface.
Win.ini entries retained and supported in the user interface
[Windows]: | ||
CursorBlinkRate Device DoubleClickHeight DoubleClickSpeed |
DoubleClickWidth KeyboardDelay KeyboardSpeed |
MouseSpeed MouseTrails SwapMouseButtons |
[Intl]: | ||
iCountry iCurrDigits iCurrency iDate iDigits iLZero iMeasure |
iNegCurr iTime iTLZero s1159 s2359 sCountry sCurrency |
sDecimal sLanguage sList sLongDate sShortDate sThousand sTime |
[fonts]: font-name | ||
[ports]: portname | ||
[PrinterPorts]: device |
Win.ini entries retained but not supported in the user interface
[embedding]: object | |
[FontSubstitute]: font-name=font-name | |
[Mail]: MAPI | |
[mci extensions]: extension | |
[Windows]: Load and Run |
System.ini settings in the registry.
The following lists show System.ini entries that are migrated to the registry when Windows 98 is installed in the same directory as a previous version of Windows 3.x.
Registry paths for migrated System.ini entries
System.ini entry | Subkey in HKEY_LOCAL_MACHINE | ||||
---|---|---|---|---|---|
[386Enh]: | |||||
Network | System\CurrentControlSet\Services\VxD\Vnetsetup | ||||
Transport | Software\CurrentControlSet\Services\VxD\transport entry | ||||
[network]: | |||||
Comment | System\CurrentControlSet\Services\VxD\Vnetsetup | ||||
ComputerName | System\CurrentControlSet\Control\ComputerName | ||||
EnableSharing | System\CurrentControlSet\Services\VxD\Vnetsetup | ||||
LMAnnounce | System\CurrentControlSet\Services\VxD\Vnetsetup | ||||
LogonDomain | Network | ||||
LogonValidated | Network | ||||
MaintainServerList | System\CurrentControlSet\Services\VxD\Vnetsetup | ||||
Reshare | System\CurrentControlSet\Network\LanMan\sharename1 | ||||
Username | Network\Logon | ||||
WorkGroup | System\CurrentControlSet\Services\VxD\Vnetsetup | ||||
1 The equivalent of the Reconnect settings is stored in HKEY_CURRENT_USER\Persistent. |
The following lists show entries that are retained in System.ini for compatibility with applications written for earlier versions of Windows.
System.ini entries retained and supported in the user interface
[386Enh]: | ||||||||
AllEMSLocked AllXMSLocked AltKeyDelay AltPasteDelay Display DMABufferSize DOSPromptExitInstructions |
Keyboard KeyPasteCRSkipCount KeyPasteKeyDelay KeyPasteTimeout MaxDMAPGAddress MaxPagingFileSize MinPagingFileSize |
MinUserDiskSpace Mouse Paging PasteSkipCount PagingDrive ScrollFrequency |
||||||
[boot]: | ||||||||
display.drv keyboard.drv |
mouse.drv network.drv |
sound.drv |
||||||
[NonWindowsApps]: | ||||||||
CommandEnvSize | ||||||||
[386Enh]: | ||||||||
Device=filename KeybdPasswd Local Local Reboot |
MessageBackColor MessageTextColor PagingFile |
NetAsynchFallback NetAsyncTimeout NetDMASize |
||||||
[boot]: | ||||||||
386grabber=filename comm.drv=filename drivers=filename fixedfon.fon=filename |
fonts.fon=filename language.dll=library-name oemfonts.font=filename |
shell=filename system.drv=filename TaskMan.Exe=filename |
||||||
[drivers]: | ||||||||
alias=driver-filname | ||||||||
[mci]: | ||||||||
Entries written by applications |
Keys and values can be created either programmatically or by using the Registry Editor. The APIs for programmatically managing the registry are the Win32 registry APIs, which can be remotely invoked through the RPC (DCE-compliant) support built into Windows 98.
Windows 98 includes both the client and server portions of Microsoft RPC, making the registry manageable remotely from another computer running Windows 98. In this scenario, the network administrator’s system is the RPC client. It accesses the registry APIs on the target computer running Windows 98 through the RPC server running on the target machine. This RPC access to the registry is secure, and network administrators can limit access to specified users.
To access the Connect Network Registry command from the Registry Editor, you must install the Remote Registry service on both computers, enable user-level security, and then enable the Remote Administration feature.
To set up the Remote Registry service from the Windows 98 compact disc