WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Registry
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Save and Reload Hive Files in Windows 95

Keywords:    RegLoadHive

Question:

I'm not sure how create a hive file to disk with the Windows 95 registry. Do you have any suggestions?

Answer:

There's an option in NT's Registry Editor to save a hive to a file, but not in Windows 95 Regedit.exe, so to save a hive to a file in Win95 using Winbatch, it involves a DllCall.

Here is how to unload registry information to a hive, and then reloading it with the RegLoadHive. Hives are different from exported *.REG branches of the registry in that they are not permanently written to the Registry when loaded. They are sort of virtual in that way (somewhat like mapped drives)---they go away when you reboot your machine or unloaded them.

This is different than doing an export of a branch to a *.REG text file. A hive file is a binary file, that when loaded, does not get permanently written to the Registry.

A lot of people have problems implementing a "hive-save" in Windows 95. Here's how to do it with a DllCall from WinBatch. The Hive-files can be loaded with RegLoadHive.

The most simple way to perform this task is this one:

   hkey=RegOpenKey(@regcurrent, "Software\Netscape")
   ret = DllCall ("C:\WINDOWS\SYSTEM\ADVAPI32.DLL",long:"RegSaveKeyA",long:hkey,lpstr:"C:\TEMP\HIVEFILE.BIN", lpnull)
   RegCloseKey(hkey)

   Message("DllCall returns:", ret)
where: This works. You can import the hive file with RegLoadHive.

It is not the easiest way, nor the most transparent or safe.


Article ID:   W13720
Filename:   How to Save Hive Files in Windows 95.txt
File Created: 1999:04:15:16:55:56
Last Updated: 1999:04:15:16:55:56