When you install any version of the Windows operating system, a part of the installation procedure prompts you to enter the user’s name and the name of the user’s company. This registration information is stored in the registry and can be changed by carefully editing the data with the Registry Editor. However, not everyone is comfortable with firing up the Registry Editor and delving into its data. Even if you’re familiar with editing the registry, it’s a time-consuming job. Wouldn’t it be nice if you could just pop open a dialog box and enter the new registration information? Well, now you can.

I’ve developed the Registration Changer, a tool that makes quick work of this tedious task. To create the inner workings of the Registration Changer, I combined features made available by Windows Script Host and VBScript to create a script. Then, to give the utility a neat user interface, I packaged the script in an HTML Application (HTA). In this Daily Drill Down, I’ll introduce you to my Registration Changer utility, which is available as a free download, and explain how it works.

A closer look at the registration information
Registration information, which consists of the owner’s name and a company name (if specified), is stored in the registry as simple text strings. The owner’s name is stored in the RegisteredOwner key, while the company name is stored in the RegisteredOrganization key. Registration information is displayed on the General tab of the System Properties dialog box under the Registered To heading, as shown in Figure A.

Figure A
The user’s name and the name of the user’s company appear on the General tab of the System Properties dialog box under the Registered To heading.

This is fine as long as the user sticks with that system, but you’ll want to change the entries when they pass along the system to someone else in the company.

Back up!

Always use caution when working with the registry. Unintentional changes made to the registry can cause the system to crash. Always back up your system before opening the registry.

As you may know, the underlying structure of the registry in each of the Microsoft operating systems is very similar. However, there are slight differences. In the Windows 95, Windows 98, and Windows Me operating systems, the RegisteredOwner and RegisteredOrganization keys are stored in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion key. In Windows NT, Windows 2000, and Windows XP, the keys are stored in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion key.

Blank keys

Keep in mind that either or both of the RegisteredOwner and RegisteredOrganization keys can be blank. In other words, the keys exist in the registry, but they contain an empty string.

Automating registry changes
As I mentioned, manually editing the registration information stored in the registry via the Registry Editor can be a tricky and time-consuming operation. Fortunately, the Windows Script Host provides programming methods that allow you to quickly and easily automate the process of editing the registry. The two methods that I use in this script are the RegRead and RegWrite methods.

As its name implies, the RegRead method allows you to access a key in the registry and read the value stored in that particular key. Likewise, the RegWrite method allows you to change the value of any particular key in the registry.

What about RegDelete?

The Windows Script Host actually provides you with one more method for making modifications to the registry, the RegDelete method. However, since the Registration Changer utility doesn’t really need to explicitly delete anything from the registry, and because the RegWrite method can actually overwrite an existing value, I didn’t need to use the RegDelete method in the script. Nevertheless, it’s good to know that RegDelete is available.

In order to use the RegRead and RegWrite methods, you need to know the exact name of the key in the registry that you want to edit, as well as its exact path. You also need to know what type of data the key holds. Without getting into too much detail on this last point, there are actually four different data types that the registry contains: strings, 32-bit unsigned values, binary data, and expandable macro strings.

Installing the Registration Changer utility
Once you’ve downloaded the Registration Changer utility installation package, simply double-click the RegChange Installation.exe file. When you do, the installation program will prompt you to choose a folder in which to install the application. If the folder doesn’t exist, the installation program will create it for you.

After you install the Registration Changer utility, you’ll see the following two files in your folder:

  • RegChange.hta
  • RegChange.ico

Of course, the RegChange.hta file is the HTA file that you’ll use to launch the application. The RegChange.ico file contains the icon that the HTA uses for the control menu and the taskbar.

Using the Registration Changer utility
Using the Registration Changer utility is easy. After you install the utility, just double-click the HTA file to launch it. If you prefer, you can create a shortcut to the HTA file and place it on your Start menu. Once you launch the Registration Changer utility, you’ll see the main screen, as shown in Figure B.

Figure B
The Registration Changer utility makes it easy to change registration information.

To begin, you need to select the operating system you’re using. As you can see, the operating systems are grouped according to the location in the registry in which the RegisteredOwner and RegisteredOrganization keys are stored. If you fail to select an operating system and then click either the Display or OK buttons, you’ll see the error message shown in Figure C. When you click OK, you’ll be returned to the main screen and can start again.

Figure C
If you fail to select an operating system before you proceed, you’ll see an error message.

Be sure to select the right operating system

It’s imperative that you select the correct operating system for this operation to be successful. If the operating system is incorrect, the Registration Changer will apply the changes to the wrong location in the registry. When that happens, the registration information you wanted to change will remain unchanged, and unnecessary garbage will be added to the registry. If you happen to apply the changes to the wrong operating system, you can easily remove the unnecessary garbage by running the utility again and leaving the text boxes blank.

After you select an operating system, you may want to see the current registration information for the system. Just click the Display button. When you do, you’ll see the current registration information displayed in the dialog box shown in Figure D.

Figure D
The Registration Changer utility can display the current registration information before you make any changes.

If you want to change the registration information, just enter the text in the appropriate dialog boxes and click OK. When you do, you’ll be prompted to confirm the operation before you proceed, as shown in Figure E.

Figure E
Before the Registration Changer makes any changes to the registry, it gives you a chance to abort the operation.

If you select No, you’ll be returned to the main screen and can start over. If you click Yes, the Registration Changer will apply the changes to the registry. You can then instantly check the results by clicking the Display button. When you’re done, just click Cancel, or click Close and the main Registration window will close.

Blanking out registration information

If you prefer to simply blank out the registration information rather than enter new names, just leave the text boxes blank and click OK.

That’s all there is to it. The Registration Changer makes it easy to edit the registry without fear. As I stated earlier, be sure to back your system up before you go poking around in the registry. It’s not something you should do lightly.

More help with HTAs

If you’d like to know more about HTML Applications, here are some more articles that examine this powerful technology. Each one describes a utility that is enhanced by HTA and includes a download you can use as source code for developing your own applications: