3.3.4.6 RestoreWithPasswd (Opnum 35)

The RestoreWithPasswd method restores the metabase from a backup, using a supplied password to decrypt the secure data.

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

pszMDBackupName: A pointer to a Unicode string containing the name of the backup to be restored.

dwMDVersion: An integer value specifying the version number of the backup to be restored, which MUST be less than or equal to MD_BACKUP_MAX_VERSION (9999) or the following constant.

Value

Meaning

MD_BACKUP_HIGHEST_VERSION

0xFFFFFFFE

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

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

pszPasswd: A password string used to decrypt the secure properties in the metabase backup. If the password is not correct, an error is returned. If a password is not supplied, this method functions exactly the same as the Restore method.

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.

0x8007052B

ERROR_WRONG_PASSWORD

Unable to update the password. The value provided as the current password is incorrect.

Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].

The opnum field value for this method is 35.

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 does not exist, the server MUST return the E_INVALIDARG error code.

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

  • Any encrypted data MUST be decrypted with the password the client has provided. If no password is provided, the function behaves exactly as the Restore method.

  • If the backup cannot be decrypted with the supplied password, the server MUST return the error code ERROR_WRONG_PASSWORD.