|
|
|
|
Additional Registry Education Most people do not want too get too involved in learning the registry system and about the repair of Windows registry problems. Instead they just want the computer to run at a higher performance level. One might say, "I don't need to know how electricity works in order to flick the switch to turn on the lights." This section goes into additional details about the Windows registry for people who want to know more. If you are overwhelmed just by reading the information below, just choose a registry cleaner from the best registry cleaner section and fix the issue quickly and easily. All of the information below is quoted directly from Microsoft and can be found at available at http://msdn2.microsoft.com/en-us/library/ms724871.aspx if you would like the full access to registry information. What is the Windows Registry? The registry is a system-defined database in which applications and system components store and retrieve configuration data. The data stored in the registry varies according to the version of Microsoft Windows. Applications use the registry API to retrieve, modify, or delete registry data.” You should not edit registry data that does not belong to your application unless it is absolutely necessary. If there is an error in the registry, your system may not function properly. How is the Registry Structured? The registry stores data in a tree format. Each node in the tree is called a key. Each key can contain both subkeys and data entries called values. Sometimes, the presence of a key is all the data that an application requires; other times, an application opens a key and uses the values associated with the key. A key can have any number of values, and the values can be in any form. For more information, see Registry Value Types and Registry Element Size Limits. Each key has a name consisting of one or more printable characters. Key names are not case sensitive. Key names cannot include a backslash (\), but any other printable or unprintable character can be used. The name of each sub-key is unique with respect to the key that is immediately above it in the hierarchy. Key names are not localized into other languages, although values may be. The following figure is an example registry key structure as displayed by the Registry Editor. Below is a Screen Print of the Windows Registry Editor Each of the trees under My Computer is a key. The HKEY_LOCAL_MACHINE key has the following subkeys: HARDWARE, SAM, SECURITY, SOFTWARE, and SYSTEM. Each value consists of a value name and its associated data, if any. MaxObjectNumber and VgaCompatible are values under the DEVICEMAP\VIDEO subkey that contain data. A registry tree can be 512 levels deep. You can create up to 32 levels at a time through a single registry API call.” What are the Categories of Data in the Registry? “Before putting data into the registry, an application should divide the data into two categories: computer-specific data and user-specific data. By making this distinction, an application can support multiple users, and yet locate user-specific data over a network and use that data in different locations, allowing location-independent user profile data. (A user profile is a set of configuration data saved for every user.) When the application is installed, it should record the computer-specific data under the HKEY_LOCAL_MACHINE key. In particular, it should create keys for the company name, product name, and version number, as shown in the following example: HKEY_LOCAL_MACHINE\Software\MyCompany\MyProduct\1.0 If the application supports COM, it should record that data under HKEY_LOCAL_MACHINE\Software\Classes. An application should record user-specific data under the HKEY_CURRENT_USER key, as shown in the following example: HKEY_CURRENT_USER\Software\MyCompany\MyProduct\1.0” Registry Value Types: A registry value can store data in various formats. When you store data under a registry value, for instance by calling the RegSetValueEx function, you can specify one of the following values to indicate the type of data being stored. When you retrieve a registry value, functions such as RegQueryValueEx use these values to indicate the type of data retrieved. The following registry value types are defined in Winnt.h.
String Values:If data has the REG_SZ, REG_MULTI_SZ, or REG_EXPAND_SZ type, the string may not have been stored with the proper terminating null characters. Therefore, when reading a string from the registry, you must ensure that the string is properly terminated before using it; otherwise, it may overwrite a buffer. (Note that REG_MULTI_SZ strings should have two terminating null characters.) When writing a
string to the registry, you must specify the length of the string, including the
terminating null character (\0). A common error is to use the strlen
function to determine the length of the string, but to forget that strlen
returns only the number of characters in the string, not including the
terminating null. Therefore, the length of the string should be calculated as
follows: A REG_MULTI_SZ string ends with a string of length 0. Therefore, it is not possible to include a zero-length string in the sequence. An empty sequence would be defined as follows: \0. The following example walks a REG_MULTI_SZ string. Copy Code #include <windows.h> #include <tchar.h> #include <stdio.h> void SampleSzz(PTSTR pszz) { _tprintf(_TEXT("\tBegin multi-sz string\n")); while (*pszz) { _tprintf(_TEXT("\t\t%s\n"), pszz); pszz = pszz + _tcslen(pszz) + 1; } _tprintf(_TEXT("\tEnd multi-sz\n")); } int __cdecl main(int argc, char **argv) { // Because the compiler adds a \0 at the end of quoted strings, // there are two \0 terminators at the end. _tprintf(_TEXT("Conventional multi-sz string:\n")); SampleSzz(_TEXT("String1\0String2\0String3\0LastString\0")); _tprintf(_TEXT("\nTest case with no strings:\n")); SampleSzz(_TEXT("")); return 0; } Byte Formats:In little-endian format, a multi-byte value is stored in memory from the lowest byte (the "little end") to the highest byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format. In big-endian format, a multi-byte value is stored in memory from the highest byte (the "big end") to the lowest byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format. Registry Element Size Limits: The following table identifies the size limits for the various registry elements.
Long values (more than 2,048 bytes) should be stored as files with the file names stored in the registry. This helps the registry perform efficiently. Registry Storage Space: Although there are few technical limits to the type and size of data an application can store in the registry, certain practical guidelines exist to promote system efficiency. An application should store configuration and initialization data in the registry, and store other kinds of data elsewhere. Generally, data consisting of more than one or two kilobytes (K) should be stored as a file and referred to by using a key in the registry rather than being stored as a value. Instead of duplicating large pieces of data in the registry, an application should save the data as a file and refer to the file. Executable binary code should never be stored in the registry. A value entry uses much less registry space than a key. To save space, an application should group similar data together as a structure and store the structure as a value rather than storing each of the structure members as a separate key. (Storing the data in binary form allows an application to store data in one value that would otherwise be made up of several incompatible types.) Views of the registry files are mapped in the computer cache address space. Therefore, regardless of the size of the registry data, it is not charged more than 4 megabytes (MB). There are no longer any explicit limits on the total amount of space that may be consumed by hives in paged pool memory, and in disk space. The size of the system hive is limited only by physical memory. Windows 2000 and Windows NT:Registry data is stored in the paged pool, an area of physical memory used for system data that can be written to disk when not in use. The RegistrySizeLimit value establishes the maximum amount of paged pool that can be consumed by registry data from all applications. This value is located in the following registry key:
HKEY_LOCAL_MACHINE By default, the registry size limit is 25 percent of the paged pool. (The default size of the paged pool is 32 MB, so this is 8 MB.) The system ensures that the minimum value of RegistrySizeLimit is 4 MB and the maximum is approximately 80 percent of the PagedPoolSize value. If the value of this entry is greater than 80 percent of the size of the paged pool, the system sets the maximum size of the registry to 80 percent of the size of the paged pool. This prevents the registry from consuming space needed by processes. Note that setting this value does not allocate space in the paged pool, nor does it assure that the space will be available if needed. The paged pool size is determined by the PagedPoolSize value in the following registry key: HKEY_LOCAL_MACHINE For more information on RegistrySizeLimit and PagedPoolSize, refer to the registry help file, Regentry.chm, in the Windows Resource Kit. For an example of how to determine the current and maximum sizes of the registry, see Determining the Registry Size. Windows 2000: The maximum paged pool is approximately 300,470 MB so the registry size limit is 240-376 MB. However, if the /3GB switch is used, the maximum paged pool size is 192 MB, so the registry can be a maximum of 153.6 MB. Windows NT 4.0: The maximum paged pool size is 192 MB, so the registry size limit is 153.6 MB. Windows NT 3.51 and earlier: The maximum paged pool is 128 MB, so the registry size limit is 102 MB. Predefined Keys: An application must open a key before it can add data to the registry. To open a key, an application must supply a handle to another key in the registry that is already open. The system defines predefined keys that are always open. Predefined keys help an application navigate in the registry and make it possible to develop tools that allow a system administrator to manipulate categories of data. Applications that add data to the registry should always work within the framework of predefined keys, so administrative tools can find and use the new data. An application can use handles to these keys as entry points to the registry. These handles are valid for all implementations of the registry, although the use of the handles may vary from platform to platform. In addition, other predefined handles have been defined for specific platforms. The following are handles to the predefined keys.
The RegOverridePredefKey function enables you to map a predefined registry key to a specified key in the registry. For instance, a software installation program could remap a predefined key before installing a DLL component. This enables the installation program to easily examine the information that the DLL's installation procedure writes to the predefined key. The RegDisablePredefinedCache and RegDisablePredefinedCacheEx functions disable handle caching for predefined registry handles. Services that use impersonation should call RegDisablePredefinedCacheEx before using predefined registry handles. The predefined handles are not thread safe. Closing a predefined handle in one thread affects any other threads that are using the handle. Registry Files: Applications can save part of the registry in a file and then load the contents of the file back into the registry. A registry file is useful when a large amount of data is being manipulated, when many entries are being made in the registry, or when the data is transitory and must be loaded and then unloaded again. Applications that back up and restore parts of the registry are likely to use registry files. To save a key and its subkeys and values to a registry file, an application can call the RegSaveKey or RegSaveKeyEx function. RegSaveKey and RegSaveKeyEx create the file with the archive attribute. The file is created in the current directory of the process for a local key, and in the %systemroot%\system32 directory for a remote key. Windows Me/98/95: The file is created in the Windows directory with the archive, hidden, read-only, and system attributes. Registry files have the following two formats: standard and latest. The standard format is the only format supported by Windows 2000 and Windows NT. It is also supported by later versions of Windows for backward compatibility. RegSaveKey creates files in the standard format. The latest format is supported starting with Windows XP. Registry files that are created in this format cannot be loaded on Windows 2000 and Windows NT. RegSaveKeyEx can save registry files in either format by specifying either REG_STANDARD_FORMAT or REG_LATEST_FORMAT. Therefore, it can be used to convert registry files that use the standard format to the latest format. To write the registry file back to the registry, an application can use the RegLoadKey, RegReplaceKey, or RegRestoreKey functions as follows.
The RegConnectRegistry function establishes a connection to a predefined registry handle on another computer. An application uses this function primarily to access information from a remote registry on other machines in a network environment, which you can also do by using the Registry Editor. You might want to access a remote registry to back up a registry or regulate network access to it. Note that you must have appropriate permissions to access a remote registry using this function. Again, you can see how complicated the Windows Registry can be. With just one mistake you could hurt the performance and even the complete operations of your computer. The easiest way to fix registry issues is to set pride aside and forget the whole, "I can fix it" attitude when software programs are so inexpensive and can do the fixing for you in a safe way. Just make sure that the software you are using has a file backup option before downloading and paying for the full version. Visit the best registry cleaner section for the top registry optimizer and registry registry fix solutions. If you still want more information about Windows registry, visit the Microsoft links below: WARNING - You will be guided off this site by clicking on the following links. Windows registry information for advanced users (below) http://support.microsoft.com/kb/256986 How to back up and restore the registry in Windows XP and Windows Vista (below) http://support.microsoft.com/kb/322756 Windows 2000 Registry Repair Utility (below - download link) How to back up, edit, and restore the registry in Windows 2000 (below) http://support.microsoft.com/kb/322755 Return to Registry Articles Page
|
|
|
Copyright 2008 registry-repair-source.com. All Rights Reserved
|