What is Windows Registry??


What is Registry?

Ans.) First we will know that what is registry,and how is the registry important. Registry is an important in a computer. It depends up on the operating system that we are using.In windows, the default settings are stored in the registry. Also third party softwares store their setting in the registry. Softwares store their settings like window width,last used file in software etc.


The type of the registry values available are :

1. string value
2. binary value
3. DWORD value
4. multi-string value
5. expandable string value



Windows Registry is an enormous batch of files containing information about almost everything that occurs on the computer, from a visit to a Web site to a program installation. The registry also contains information about drivers and other essential programs, like DLLs -- small helper programs that often work with more than one application. This information is stored in the form of "keys" that help programs run. It's like a big blueprint for where everything goes on your computer and how it all fits together. Only computers running Windows operating systems have registries, and despite rumors to the contrary, Windows 7 will have a registry.

A registry may have hundreds of thousands of entries, and new entries are created all the time. As it fills with information, the registry may cause a computer's performance to suffer. One problem is that Windows almost never removes registry entries, even if a program is uninstalled, as most uninstallers aren't able to effectively remove their own registry keys. And as files are moved around and programs are uninstalled, some registry keys point to programs or files that no longer exist or are located elsewhere.

Fortunately, these errors don't have to be tolerated. The registry can be cleaned up, though not completely. And for your troubles, you may get better performance and decreased boot time. Some satisfied users report fewer instances of lag or Windows hanging (when the computer isn't responding). The exact performance boost varies depending on the state of the registry and the effectiveness of the cleaner program employed. You may also free up disk space, although most registry entries are very small.

Default Registry looks like this:



Where are the Windows Registry files?

If you have Windows 9x or ME, known as the 9x Platform, the Registry files are stored in the Windows folder. They are named System.dat and User.dat. However, Windows ME also has Classes.dat. These files all have Hidden attributes so unless you are view hidden files you will not find them.

If you have Windows NT, 2000, 2003, Xp or Vista, known as the NT Platform, the Registry files are stored in their own folder; Windows\System32\Config. You will not be able to copy these files to make backups, as the operating system is protecting them for security reasons.
Lets start with an explanation of the Registry Keys.

Open RegEdit, you'll see the six Hives on the Windows 9x Platform and five on the NT Platform under the "My Computer" header:

HKEY_CLASSES_ROOT: Contains software settings about the file system, it contains shortcut information, and other user interface information. There will be a SubKey for every file association. And each Key here points to another key. The entire Hive is part of HKEY_LOCAL_MACHINE and can be found at HKEY_LOCAL_MACHINE\Software\Classes. If you change a setting in either of these two locations it is also changed in the other.

HKEY_CURRENT_USER: Contains the information for the currently logged-on user, such as settings and software information. Setting changed in this Hive will only affect the current user. This Hive is part of the HKEY_USERS hive.
1) AppEvents Key: contains the settings for which sounds to play for system sound events
2) Control Panel Key: Control Panel settings are stored here, similar to system.ini and win.ini in Win 3.x.
3) InstallLocationsMRU: contains folder paths and drives
4) Keyboard layout: specifies current keyboard layout
5) Network: Network connection information
6) RemoteAccess: Contains information about the current log-on location using Dial-Up Networking
7) Software: Software configuration settings for the currently logged-on user.
You may find other Keys here placed by other software, that is probably should have been placed in one of the above Sub-Keys. The entire Hive is also found at the HKEY_USERS\.Default or if more then one profile HKEY_USERS\(Profile name). If you change and setting in either of these two locations it is also changed in the other.
HKEY_LOCAL_MACHINE: Contains information about the hardware and software settings that are used for all users of this computer.
1) Config: Configuration information . Same as the Hive HKEY_CURRENT_CONFIG on Windows 9x
2) Enum: Hardware information (found under System in NT)
3) Hardware: Information passed to Windows from the BIOS (found under System in NT)
4) Network: information about networks installed to the machine.
5) Security: network security settings.
6) Software: Software-specific information and settings
7) System: System startup and device driver information, and operating system settings.

HKEY_USERS:
Information about for each user that logs onto this computer is stored here. Each user will have a Sub-Key under this heading. On Windows 9x, if there is only one user, the SubKey will be ".default". When a user logs on, one of the Sub-Keys will be loaded to the HKEY_CURRENT_USER key.
HKEY_CURRENT_CONFIG : Contains info about the current hardware configuration, pointing to HKEY_LOCAL_MACHINE\Config. This hive is dynamic, meaning it is built on the fly.
HKEY_DYN_DATA: This key contains dynamic information about plug-n-play devices. The data here changes constantly. This key is rewritten every time you boot up, it is a virtual Hive. This Hive is dynamic, meaning it is built on the fly and is not used on the NT Platform.
How Windows uses the Registry

For reference:

HKCU=HKEY_CURRENT_USER
HKLM=HKEY_LOCAL_MACHINE

First you need to understand that the Shell of Windows is the Windows Explorer. Without the Explorer there is no Windows, No desktop and so on.

With Windows loaded and you are logged on, Windows now can use the information in the Registry that each Hive contains. Here is a sample of how the Registry is used.

So let's click on the Start button, which is controlled be the Explorer.exe. Now Windows reads the Key HKCU\ Microsoft\ Windows\ CurrentVersion\ Policies Keys to determine what the current user is allowed to do. What the user is allowed to access. Now scroll up to the Programs label and the Key HKCU\ Microsoft\ Windows\ CurrentVersion\ Explorer is read to determine how Windows will react. Now you open the Start menu and it opens, then you click on a program you wish to open. This is a shortcut that you are clicking on. A shortcut is a file with the extension ".lnk" so Windows now looks at the HKLM\Software\Classes Key for the extension ".lnk" which reads "lnkfile". So Windows now looks for HKLM\Software\Classes\lnkfile which read "ShortCut" and it sees "NeverShowEx" = "" which means do not display file extension for this type of file extension. Windows then looks to see what SubKeys are there and it finds a CLSID SubKey which points to "{00021401- 0000- 0000- C000- 000000000046}". Since the SubKey was "CLSID" Windows knows to look at HKLM\Software\Classes\CLSID Key and finds the matching SubKey. This Key also read "ShortCut" and Windows now looks for what SubKeys are available. It find the "ProgID" Key which points back to the "lnkfile" Key. and it find the server file at the "InProcServer32" file. So Windows now knows to serve this file to Shell32.dll.

If the Explorer did not find the CLSID key listed it would have to search the CLSID Keys for a matching ProgID Key that pointed to the "lnkfile" Key.

Shell32.dll now takes over, the Explorer makes an API call to the Shell32.dll and tells it to Shell (run, start) the file that the that you clicked on. Now the Shell32 knows that this is a ShortCut so it reads the file and determines that you wish to activate the program QikFix. So it starts QikFix now needs an starts loading the other DLLs it needs to run. QikFix searches its' own directory and if not found there looks to the Windows Folder then the System folder. It finds the DLLs it knows it need to run, and then now sees that it needs an interface. So as with all Visual Basic programs it need the Msvbvm50.Dll or Msvbvm60.Dll to do the work for it. So then Msvbvm50.dll draws the plain window and then starts adding the text boxes and the tabs. To do this is may need help form another dll as with the case of the tabs. It knows it needs tabclt32.ocx because when I selected to use the tabs I need to include the DLL name in my source code, which in this case is an Active X control (ocx). Now it needs to draw Tabs but the Msvbvm50.dll has no idea what a tab is.

If there where TypeLib Keys under the CLSID Key then the Explorer would also got read the matching HKLM\Software\Classes\TypeLib Key. The TypeLib Key may point to an Interface Key (HKLM\Software\Classes\Interface) and this Key will tell the Explorer what version is available and so on. To understand more you need to read the next section about SubKeys.
Explanation of SubKeys

You will find a vast amount of different SubKeys, some are user (read) only by the software program, while most of the SubKeys are read by Windows.

The Heart of Windows

The Registry works the same on both the Windows 9x platform, and the NT Platform. However it is laid out a little differently, especially when it comes to the hardware.

The real heart of the Windows Registry is found at the Key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows, controlling the software. The System Drivers are controlled at HKEY_LOCAL_MACHINE\System. The hardware is controlled at HKEY_LOCAL_MACHINE\Enum in Windows 9x and ME And HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum in the NT Platform.

How to clean Computer Registry :


Cleaning Registry:

Registry cleaning is not without risks. This is a very sensitive area of your computer, and if you're happy with how your computer is running, don't go digging around. Trying to manually edit your registry can create errors in the registry that make it impossible to load Windows. Some registry-cleaning programs have been known to delete important registry keys or essential DLL files. And the performance improvements may be negligible, while running the program and approving each recommended deletion could take hours. In addition, reliable data on how registry cleaners affect performance are almost impossible to find. Most "performance tests" are actually produced by the developers of registry-cleaning tools.

Despite these concerns, it is­ possible to clean out some of the registry's gunk, and your computer may be better off for it. On the next page, we'll take a look at how to go about this delicate job.


Before you mess around with the registry, it's best to to create a backup copy of the registry and to also save any important data to an external hard drive or disk. Some registry-cleaning programs have a feature to back up a copy of your system's registry. If not, a simple Internet search should lead you to a free backup program.

Windows has a built-in program for editing the registry. It's creatively titled regedit.exe and can be accessed by going to the Start menu, clicking Run and typing in the program name. While this program is easy to access, it's difficult to use. Registry entries have long, oblique names that don't say much about what they represent. Even savvy computer users may have no idea what a particular entry points to. So unless you have specific instructions for how to alter or delete a clearly defined entry, it's best not to experiment with regedit.exe.

Third-party registry-cleaner programs are plentiful and remove a lot of the confusing grunt work of parsing and deleting registry entries. To find a program that suits you, check reviews on sites like ZDNet, CNET, PC World or PC Magazine. Some of these programs are free or only fix a few entries at a time, which can be quite laborious when a registry may have 2,000 broken entries. Others may cost $20 or more and may come as part of a package of system utilities.

It's not necessary to clean a registry more than once a month. Using a disk defrag program may provide additional performance boosts.

Before you run the program you've chosen, make sure you close all other open programs, as well as those running in the system tray, next to the clock in the bottom right corner of your screen. Follow directions closely: Most of these cleaner programs are intuitive, first scanning the registry for errors and then offering choices to fix broken entries, but you may miss an important step or warning if you click madly and try to speed through the process.

Some experts recommend against using programs that automatically delete registry errors . Instead, it's better to approve deletions manually. The cleaner will likely offer a list of registry entries that it's safe to delete because they are certainly obsolete. It may also provide an option to "repair" an entry. Going deeper and deleting borderline entries could affect a program's ability to function, such as by deleting a DLL that the cleaner doesn't realize is shared by more than one program -- or you may irreparably damage your installation of Windows. When in doubt, let the entry stay.

And that's about it. Hopefully you managed to clean up a few hundred entries without bricking your computer. If not, well, then you probably can't read this anymore and won't be interested in the links on the next page about registry cleaners and other related topics.