3.1.4.29 Restore (Opnum 29)

The Restore method restores the metabase from a backup.

 HRESULT Restore(
   [unique, in, string] LPCWSTR pszMDBackupName,
   [in] DWORD dwMDVersion,
   [in] DWORD dwMDFlags
 );

pszMDBackupName: A string of up to 100 Unicode characters that identifies the backup to be restored.

dwMDVersion: An integer value specifying either the version number of the backup to be restored or the following constant.

Value

Meaning

 MD_BACKUP_HIGHEST_VERSION

0xFFFFFFFE

Restore from the highest existing backup version in the specified backup location.

dwMDFlags: This parameter is reserved and SHOULD always be set to zero.

Return Values: A signed 32-bit value that indicates return status. If the method returns a negative value, it failed. If the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a Win32 error code in the lower 16 bits. Zero or positive values indicate success, with the lower 16 bits in positive nonzero values containing warnings or flags defined in the method implementation. For more information about Win32 error codes and HRESULT values, see [MS-ERREF].

Return value/code

Description

0x00000000

S_OK

The call was successful.

0x80070057

E_INVALIDARG

One or more arguments are invalid.

0x80070013

ERROR_INVALID_DATA

The data is invalid.

0x800CC802

MD_ERROR_INVALID_VERSION

The version specified by dwMDVersion is invalid.

0x000CC805L

MD_WARNING_INVALID_DATA

Invalid metabase data.

0x80070008

ERROR_NOT_ENOUGH_MEMORY

There is not enough memory to complete the operation.

The opnum field value for this method is 29.

When processing this call, the server MUST do the following:

  • The server restores from a backup that is identified by the pszMDBackupName parameter and the version number.

  • If the pszMDBackupName parameter is an empty string, the server MUST use a default backup name as defined by the server implementation.

  • If the backup named by pszMDBackupName and dwMDVersion does not exist, the server MUST return an error.

  • If the value of the dwMDVersion parameter is greater than MD_BACKUP_MAX_VERSION (9999) and not equal to MD_BACKUP_HIGHEST_VERSION, the server MUST return the E_INVALIDARG error code.