Export (0) Print
Expand All

ORSaveHive function

Writes the specified offline registry hive to a file.

Syntax


DWORD ORSaveHive(
  _In_ ORHKEY Handle,
  _In_ PCWSTR lpHivePath,
  _In_ DWORD  dwOsMajorVersion,
  _In_ DWORD  dwOsMinorVersion
);

Parameters

Handle [in]

A handle to the offline registry hive to save.

lpHivePath [in]

A pointer to a Unicode string that specifies the name of the registry hive file. This cannot be the name of an existing file.

dwOsMajorVersion [in]

The major version number of the operating system. This member can be one of the following values.

ValueMeaning
5

If dwOsMinorVersion is 1, the operating system is Windows XP.

If dwOsMinorVersion is 2, the operating system is Windows Server 2003 R2, Windows Server 2003, or Windows XP Professional x64 Edition.

6

If dwOsMinorVersion is 0, the operating system is Windows Server 2008 or Windows Vista.

If dwOsMinorVersion is 1, the operating system is Windows Server 2008 R2 or Windows 7.

 

dwOsMinorVersion [in]

The minor version number of the operating system. This member can be one of the following values.

ValueMeaning
0

If dwOsMajorVersion is 6, the operating system is Windows Server 2008 or Windows Vista.

1

If dwOsMajorVersion is 5, the operating system is Windows XP.

If dwOsMajorVersion is 6, the operating system is Windows Server 2008 R2 or Windows 7.

2

If dwOsMajorVersion is 5, the operating system is Windows Server 2003 R2, Windows Server 2003, or Windows XP Professional x64 Edition.

If dwOsMajorVersion is 6, the dwOsMinorVersion parameter must be 0 or 1.

 

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error. Possible error codes include the following:

  • If the caller does not have the necessary access rights to write the file, the function returns ERROR_ACCESS_DENIED.
  • If the specified file already exists, the function returns ERROR_ALREADY_EXISTS.

Remarks

The ORSaveHive function must be used to save changes made to an offline registry hive. Changes are not preserved until ORSaveHive is called to save the hive to a file.

The dwOsMajorVersion and dwOsMinorVersion parameters together specify the target format of the registry hive file. The following table summarizes the most recent operating system version numbers.

Operating systemVersion number
Windows Server 2008 R26.1
Windows 76.1
Windows Server 20086.0
Windows Vista6.0
Windows Server 2003 R25.2
Windows Server 20035.2
Windows XP Professional x64 Edition5.2
Windows XP5.1

 

Use the GetVersionEx function to retrieve information about the current operating system.

The ORSaveHive function locks the registry hive while it is writing the hive to the file, then closes the file and releases the lock. The registry hive remains in memory until it is closed by calling the ORCloseHive function. It is possible to make further changes to the registry hive while it is open; however, to preserve these changes the hive must be saved to a new file, because the ORSaveHive function will not overwrite an existing file.

The ORSaveHive function can be used to save part of the offline registry hive. The key specified in the Handle parameter becomes the root key of a hive that consists of the specified key and all of its subkeys.

Requirements

Redistributable

Windows Offline Registry library version 1.0 or later

Header

Offreg.h

DLL

Offreg.dll

See also

GetVersionEx
ORCloseHive
OROpenHive

 

 

Community Additions

ADD
Show:
© 2015 Microsoft