- Different results from different software
There are probably a lot of different registry optimizers out there in the market. However, each of them gives different results when the author uses them to scan his pc or laptop. The simplest answer is that each program determines differently what errors are and also, some of the free scans that machines use can identify errors that are "less than dangerous" to the author’s PC. So the fact that certain programs identify errors one way and others do it another way does not mean that the program is not effective.
- No sufficient tweaking functions to the registry
It is important for the registry optimizer software’s to include tweaking options for the users to utilize. For newbie’s who want to edit and do changes to the registry without actually learning the registry structure will find these functions very exciting and useful for them. In the registry, users can actually do a lot of things if the registry is to be tweaked for example, disabling the shut down command in Windows XP just in case if the user is running a kiosk or just simply does not want to shut down the computer.
- Reviews on current registry optimizers
1.3 The concept of Windows registry
The registry concept works within the operating system is, for example, an .INI file is stored for each program or even computer games for it to store as an address in the operating system. The concept is that, would it work better if all the .INI files are stored under one centralized registry. The advantages to having all the files stored under one centralised registry:-
- Because the registry is accessed through a special API, it is available to scripts and remote management using WMI. Each script does not have to be customised for every applications unique configuration file layouts and restrictions.
- The registry can be accessed as one item over a network connection for remote management/support, including from scripts, using the standard API.
- It can be backed up more easily, in that it is just a small number of files in specific locations.
(Concept of Windows Registry,
Courtesy of Wikipedia & Answers.com, 2006)
- Benefits of Registry Optimizers
The reason the author decided to choose this title and do a Registry Optimizer is because he thinks that the registry is the roots of all things. Having a good and healthy registry is the key to a face and smooth-operated computer. In order to have a computer in good condition, a program or software that is use to maintain it is important for example, The Windows Registry Optimizer. There are a few obvious benefits to using registry optimizer:-
- Increases performance significantly
After the user have executed the utilities that is available in the program, the performance change will obviously not be visible, but it does clear up the registry and the user will notice the fast loading of programs and even during windows startup.
1.5 Conclusion
The current Windows Registry Optimizers that is available in the market is not entirely reliable because of their weaknesses. The author however, will try to avoid the mistakes that have been done by other software developers and will try to develop software that is free from those flaws. In designing successful software, a proper literature review analysis is needed to identify the problems.
Chapter 2: Study on Windows Registry
2.0 Windows Registry Overview
In this chapter, we will discuss the windows registry concept and how it works. The chapter embraced the literature review results from various sources, the underlying theory of the Windows Registry.
2.1 Windows Registry Definition
The registry has a subtle but an important role in Windows XP. It consists of a big collection of settings that is accessed every time software is executed or an action is taken in Windows operating system. The settings in the registry determine how Windows XP appears and how it behaves. It even controls applications running on the computer. This gives the registry great potential as a tool where enabling them to customize settings that aren’t available in the user interface.
Windows stores configuration data in the registry. The registry is a hierarchical database, which can be described as a central repository for configuration data (Microsoft’s terminology) or a configuration database (author’s terminology). A hierarchical database has characteristics that make it ideally suited to storing configuration data. Lay out the database in a diagram, like the one shown in Figure 1-1, and it looks like an outline or organization chart. This allows settings to be referenced using paths, similar to file paths in Windows operating system. For example, in Figure 1-1, the path A\G\M references the shaded box. Also, each setting is an ordered pair that associated a value’s name with its data, similar to the way the government associates social security numbers with tax records. The registry’s hierarchical organization makes all settings easy to reference.
Figure 2.1: The registry is a hierarchical database that contains most of Windows settings
The registry is a kind of database. Every database has physical files stored on its disk that hold the data that is to be viewed. The registry is no exception. The Registry comprises a set of files which is known as hives, are stored on the hard drive of your Windows XP operating system. The hives that are stored, on the hard drive of Windows XP system, correspond to actual keys within the Registry subtrees. (How the Registry is Architected, http://www.windowsitlibrary.com).
In Windows, every action accesses the registry. With every click, Windows consults the registry. Every time a program is launched, the operating system consults the registry. Every application the author uses looks for its settings in the registry. The registry is certainly the center of attention.
2.2 Structure of the registry
The registry is always regarded as a very complex structure, when it is not. It is in fact, an inverse hierarchical tree-like structure, more like a file system. As from what the author look at, a file system consists of a single root per drive while the registry has either five or six roots, depending on the windows version. These are:
TABLE 2-1: Root directory of the registry (courtesy of http://www.windowsdevcenter.com)
The registry works with a file system consisting of a root folder or root directory. A root directory has one or more subfolders or subdirectories. The subfolders in turn or subdirectory can have one or more subfolders or subdirectories and etc. The registry also consists of root keys where each of the root keys has multiple sub keys. Each sub key can have more sub keys, which is how it works. In the registry, a key can have one or more values.
2.2.1 Keys
Keys are similar to folders concept in Windows operating system. Keys can be inside another key as long as the names are unique and different within each key. A key, similar to folders, are limited in the naming section where it is allowed only 512 ANSI or 256 Unicode characters. What differentiates folders with registry keys is that the registry key can use ASCII characters which is (\) backslash, asterisk (*) and etc.
Figure 2.2 When one key is linked to another, as in this example, the same subkeys and values appear in both places.(courtesy of The Anatomy of Windows, by Greg Shultz from TechRepublic, 2005 )
2.2.2 Values
From the authors understanding, Values is comparable to files in a folder in Windows operating system. A value’s name is similar to a file’s name. A value’s type is similar to a file’s extension for example .exe or .doc and etc. A value’s data is like the content of a file for example a .doc file contains a document and etc. As the author can see, he clicks the value in the registry pane, and on the right hand side, it shows three columns which shows the attributes:-
-
Name: All values need a name. The naming rule applies which is up to 512 or 256 Unicode characters except for the ASCII characters.
-
Type: Each value has different type of data which determines their type. For example, REG_DWORD value has a double-word number, and a REG_SZ value contain a string.
-
Data: Each value can be empty, or null, or can contain data. A value’s data can be of a maximum of 32,767 bytes, but the practical limit is 2 KB. The data is usually linked to the type, except that binary values can contain almost strings, double-words or anything else for that matter.
All the keys in the registry must at least contain one value, usually is the default value. However, some error-causing programs tend to sometimes change the value to cause unwanted problems. In most cases, the default value is null, and Registry Editor (regedit) shows the data as value not set.
2.2.3 Types
TABLE 2-2: Types of values in the registry (Courtesy of the Windows Registry Guide Book, by Jerry Honeycutt, 2005)
2.3 Key Relationships
Now that the author has learned about the six top-level keys, and what can be contained in each entry, the relationship of the keys has to be noted. There are actually only two keys. They are HKEY_LOCAL_MACHINE and HKEY_USERS. The other keys are either for subsections of these two keys or dynamically created keys that are built when the system is restarted.
2.3.1 HKEY_LOCAL_MACHINE
This key contains the global information about the system that pertains to system hardware and application software settings. The information contained therein applies to all users who log into the system in the operating system. This key has three aliases at the top level:
-
HKEY_CLASSES_ROOT – This is the alias for HKEY_LOCAL_MACHINE\Software\Classes, and contains information that deals with file associations, drag-and-drop, shortcuts, and OLE/COM.
-
HKEY_CURRENT_CONFIG- This is different depending on the operating system. In Windows 95 and 98, this key is the alias for HKEY_LOCAL_MACHINE\Config\000n, where n is the specific configuration that is currently loaded. In Windows XP, two subkeys are directly below the root; \Software (an alias for HKEY_LOCAL_MACHINE\SYSTEM\ControlSet00n\Hardware Profiles\000n\Software), and \System(an alias for part of HKEY_LOCAL_MACHINE\System\CurrentControlSet).
-
HKEY_DYN_DATA – This also depends on the operating system. In Windows 95 and 98, this key derives its data from a number of different locations in the HKEY_LOCAL_MACHINE tree for the subkey \Config Manager. Its PerfStats subkey is derived from performance information reported by the local system. Both are dynamically created at boot time. While this key exists on Windows XP systems, it’s related to the minimal Plug and Play support offered by XP’s capability to support multiple hardware configurations.
2.3.1 HKEY_USERS
This key contains information specific to each user configured on the system. Windows XP requires user accounts, and will have a \.Default subkey along with a subkey identified by a Security ID code (SID) for each user. Windows 95 and 98 can contain only a \.Default subkey or specific user keys, which are not encrypted like the Security ID keys in Windows XP.
2.4 Registry Editor (regedit.exe)
Regedit, also known as Windows Registry Editor, is often used to view and edit values and keys in the registry. However, the registry editor is not viewable directly in the Start > Programs directory. For users to view the registry, the regedit command is needed to execute the regedit to open. Under command prompt, users will have to go to C:/Windows/regedit or an easier method is to open the ‘Run’ in Start button, then simply type ‘regedit’ to execute the regedit.
Figure 2-3: The Windows Registry Editor (Courtesy of Windows Registry Guide, by Jerry Honeycutt,2006)
From the understanding of the author, users change the registry every time they log on to the computer. With Registry Editor, it affects the settings without the help of a user interface. That makes the Registry Editor one of the operating systems most powerful and dangerous tools. On one side, the Windows XP operating system can be customized in ways that are not possible in the user interface form. Every version of Windows since windows 3.1 always had a Registry Editor. During the days of Windows 95, and Windows 2000, there are limitations to what the registry editor can do. But now, with Windows XP, the author hopes to get the best of the Registry Editor. Regedit is in %SYSTEMROOT%, C:\Windows on most computers.
2.5 Conclusion
Understanding the structure of the Windows Registry is essential in the author’s success in this project. The author understands the importance of having the knowledge of the Windows Registry. The author assumes that he has to be an expert in the Windows Registry structure and how it works once he starts developing the software. The registry is not an easy structure to modify as it is dangerous and lethal if wrongly modified. For all of its benefits, the registry is a great tool. On the one hand, it is the central place for all of Windows’s configuration data. On the other hand, the fact that the registry is so critical also makes it one of the operating system’s weaknesses. If the registry fails, Windows will also fail at the same time.
Chapter 3: Study on Windows API
3.0 Windows API Overview
In this chapter, the author would like to introduce the basics and definitions of Win32 API. The author will also discuss on the necessity of Win32 API on this project.
3.1 Windows API definition
Win32 API is basically a production of Microsoft. It is a core set of application programming interfaces that is developed by Microsoft and implemented in their operating systems. The language that uses Win32 API’s are C or C++ languages as the Win32 API’s is designed to be used by it. The languages are the most direct way to interact with a Windows system for software applications. The Win32 API consists of a function that is embedded in it to simplify the job for software developers to create software using the Windows API and associated Windows technologies.
3.1.1 Windows API Components
Windows API has functions that are grouped in six categories:
- Base Services
Obviously, users and including the author himself have heard about the existence of ‘kernel’ in Windows operating system. It is one of the resources that are resided in Windows API. This function provides access to the main resources available to Windows system. Resources such as file systems, devices, processes and threads, access to the Windows registry and error handling all resides in kernel.exe, kernel32.dll, or advapi.dll files.
- Graphics Device Interface
Resides in gdi32.dll file in Windows operating system. It function is to output or display graphical content to output devices. For example, monitors, printers, speakers and etc.
- User Interface
This function, in the opinion of the author, is the most used function by software developers who uses .NET framework to develop software. It provides functions to manage windows and basic functions such as buttons and scroll bars. It can also accept inputs from keyboards and mouse clicks, and any other functionality associated with the GUI part of Windows. This functions is embedded in user32.dll on earlier versions of Windows operating system but for Windows XP and later, it resides in comctl32.dll.
- Common Dialog Box Library
This function controls dialog boxes and also for saving files, choosing color and fonts and etc. The library is embedded in comdlg32.dll on Windows system.
- Common Control Library
Authorizes applications to some advanced controls in the operating system. Things like status bars, progress bars, toolbars and tabs are included in this library. The library is embedded in comctl32.dll on Windows operating system.
- Windows Shell
Shell in Windows operating system allows applications to access the functionality provided by the operating system shell, including changing and enhancing. It is embedded in shell32.dll and shlwapi.dll in Windows system.
- Network Services
Allows the usage of networking capabilities in Windows operating system. For example NetBIOS, Winsock and etc.
3.2 Windows API Visual Basic functions
There are 15 different Visual Basic functions that is available in Windows API;-
-
API Name : SHSetValue
SHSetValue sets the value of a registry key.
-
API Name : RegSaveKey
RegSaveKey function saves the specified key and all of its subkeys and values to a new file.
-
API Name : RegRestoreKey
The RegRestoreKey function reads the registry information in a specified file and copies it over the specified key. This registry information may be in the form of a key and multiple levels of subkeys.
-
API Name : RegOpenKeyEx
The RegOpenKey function opens the specified key.
-
API Name: RegNotifyChangeKeyValue
The RegNotifyChangeKeyValue function notifies the caller about changes to the attributes or contents of a specified registry key. The function does not notify the caller if the specified key is deleted.
-
API Name: RegEnumValue
The RegEnumValue function enumerates the values for the specified open registry key. The function copies one indexed value name and data block for the key each time it is called.
-
API Name: RegEnumKeyEx
The RegEnumKeyEx function enumerates subkeys of the specified open registry key. The function retrieves information about one subkey each time it is called.
-
API Name: RegDeleteValue
The RegDeleteValue function removes a named value from the specified registry key.
-
API Name: RegDeleteKey
The RegDeleteKey function deletes the specified key. This function cannot delete a key that has subkeys.
-
API Name: RegCreateKeyEx
The RegCreateKeyEx function creates the specified key. If the key already exists in the registry, the function opens it.
-
API Name: RegSetValueEx
RegSetValueEx writes a value to a registry key. If the value does not already exist, it will be created. The value can be of a number of different data types. In Visual Basic. If some sort of string value is written to the registry, the string must be explicitly be passed ByVal. The function returns zero if successful, or a non-zero value error code if an error occurred.
-
API Name: RegQueryValueEx
RegQueryValueEx reads a value from a registry key. It can read many different types of data, including integer types and strings. In Visual Basic, when reading a type of string from the registry, you must pass the string variable explicitly ByVal. The function returns 0 if successful, or a non-zero value error code if an error occurred.
-
API Name: RegOpenKeyEx
RegOpenKeyEx opens a key in the Windows Registry. The handle it gives must be used when the author read to or write from any values under that key. Unlike RegCreateKeyEx, this function will not create the key if it does not exist. The function puts a handle to the opened key into the variable passed as phkResult. The function returns 0 if successful or a non-zero value error code if an error occurred.
-
API Name : RegCreateKeyEx
RegCreateKeyEx creates a new registry key. If the key is to be created already exists, the existing key will be opened. The handle to the reated/opened key is put into the variable passed as phkResult. The function returns 0 if successful, or a non-zero error code if an error occurs.
-
API Name : RegCloseKey
RegCloseKey closes a registry key. This should be done after reading to or writing to the registry. Closing the registry key frees up some resources. Obviously, it can no longer be used the key after closing it. The function returns 0 if successful or a non-zero error code if an error occurs.
3.3 Conclusion
The role Windows API is playing in the development of the Windows Registry Optimizer is important as most of the functions in editing the registry using Visual Basic is in Windows API. The author must master these functions in order to develop the Windows Register Optimizer.