Note: This article and future SeriesArticleThe Windows XP registry is used as an example (the same as the windows. NET Server registry.
1.1 registry concept
The Windows Registry is essentially a huge database, which is used to store various configuration information of computer software and hardware. Its content has the following aspects:
- Software and Hardware configuration and status information, applicationProgramAnd the initial conditions, preferences, and uninstallation data of the Resource Manager shell.
- Settings and various licenses of the entire computer system, Association of file extensions with applications, hardware descriptions, statuses, and properties.
- Computer performance records, underlying system status information, and various other data.
1.2 differences between registry and earlier INI files
In earlier Windows operating systems (such as Windows 3.x), two files with the INI extension (system. ini and win. ini) were used to configure the hardware and software work environment. Among them, system. ini controls the software, while win. ini controls the desktop and applications. The disadvantage of INI files is that the size is limited to less than 64 KB. However, as the operating system becomes more powerful and applications keep increasing, new INI files have to be added to control applications. This makes the INI file bulky, the operating system operation speed is reduced, and the management and maintenance are not convenient. Moreover, the INI file is easily edited by a text editor, and the editing process is prone to errors, resulting in a weak system. In addition, the INI file is only stored on the local machine, and it is almost impossible to remotely access the file through the network.
To improve the above problems, we use the registry management configuration information method in Win 95 and later versions. The main differences between it and the INI file are as follows:
- The registry stores data in binary format.
- The Registry supports Primary keys. subkeys at all levels have their own "key-value items ".
- Key-value items in the Registry are not only simple strings, but also executableCode.
- On the same computer, the registry allows you to store features of multiple users.
1.3 registry functions
In Windows XP, the Registry is a database that stores all the settings and locations of the driver. It is closely related to Windows XP and drivers, acts as the operator and driver connector.
When the operating system accesses the hardware device, the BIOS setup program is reported to the device of Windows XP, Windows XP will install the appropriate driver in the system. These drivers are independent of the operating system. The operating system only needs their location, file name, and version number, and all the information is stored in the heky_local_machinehardware of the Registry.
At the same time, the Registry also bears the connection between the operating system and application software. When an application is installed, the installer writes relevant running settings to the Registry. When the application software runs, it reads the required setup data from the Registry to locate the required program or dynamic Connection Library.
We can customize a personalized desktop by modifying the Registry; manually modify some software and hardware parameters without restarting the system; by deleting junk information in the registry, we can improve the computer's running speed; restoring the damaged Registry can solve system faults and errors. The Registry can check system configurations and settings online to implement remote management.
1.4 location and composition of Windows XP Registry File
The data files of the winndows XP registry are stored in the default, Sam, security, system, software, and userdiff folders of c: \ windows \ system32 \ config. :
To open the Registry Editor, click [start] | [run], enter "Regedit" or "regedt32" in the command line, and click [OK] or press Enter.
The Registry structure consists of the Root Key, primary key, subkey, and key-value items ., The root key is a string prefixed with "hkey" in the left-side window of the Registry Editor. It is called the root key because it is at the top of the Registry, the Windows XP registry contains five root keys stored in the root directory "my computer", which are hkey_classes_root, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, and hkey_current_config.
A primary key is the key closest to the root key. A primary key usually contains one or more subkeys or value items. HKEY_CURRENT_USER contains 14 primary keys.
A subkey is a key that is contained under a primary key. Its name is relative to a primary key. Each primary key usually contains several subkeys. For example, the primary key appevents contains two subkeys.
A value entry is a variety of information displayed on the right of the Registry Editor. Each key value includes three parts: name, type, and data. The key-value item name can be composed of any characters, numbers, and spaces. However, a backslash is not allowed. Key-value items of different root keys, primary keys, and subkeys can have the same name, but key-value items of the same key cannot have the same name. The content defined by a key-value item is the value of this key-value item, and its data can occupy a maximum of 64 KB of space. The data type of a value can be a string, binary value, or DWORD (dubyte) value.