Share via


HrESERestoreAddDatabase Function

HrESERestoreAddDatabase Function

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The HrESERestoreAddDatabase function informs the Exchange Storage Engine (ESE) that the specified database is to be restored. This function, or HrESERestoreAddDatabaseNS, must be called for each database in the storage group that is being restored.

Applies To

ESEbcli2 DLL Functions Interface

Syntax

[C++]HRESULT HrESERestoreAddDatabase (     HCCX phccxRestoreContext,     wcharwszDatabaseDisplayName,     GUID guidDatabase,     wcharwszDatabaseStreamsS,     wchar** wszDatabaseStreamsD );

Parameters

  • phccxRestoreContext
    Input parameter. A handle to a restore context. The handle is passed to the various restore functions, and contains information about the current restore operations.
  • wszDatabaseDisplayName
    Input parameter. The display name of the database to be restored.
  • guidDatabase
    The globally unique identifier (GUID) of the database. This value is obtained from the ESE when the database was backed up, with the HrESEBackupPrepare Function. The GUID is returned in the DATABASE_BACKUP_INFO Structure.
  • wszDatabaseStreamsS
    Input parameter. A buffer containing NULL-separated strings specifying the source stream files. The last stream file name must be followed by two NULL characters.
  • wszDatabaseStreamsD
    Output parameter. A buffer containing NULL-separated strings specifying the destination stream files for the database. The last stream file name is followed by two NULL characters.

Return Value

The following return codes can be returned. To retrieve the error string for an ESE error, use the standard FormatMessage function. For the general errors hrErrorFromESECall and hrErrorFromCallbackCall, more information about the error is available using the standard GetLastError function.

S_OK Success.
ESE-specific error codes ESE-specific error codes, as defined in esebkmsg.h.
Other Other Microsoft Win32 or remote procedure call (RPC) errors.

Remarks

This function requests that the ESE provide the destination file names in the wszDatabaseStreamsD parameter. The HrESERestoreAddDatabaseNS function provides the destination path array to the server. Use the function most appropriate to the operation. If the application is restoring the database to the original location, use this function. If the application is restoring the database to a different location, use HrESERestoreAddDatabaseNS.

The buffers pointed to by wszDatabaseStreamsS, and referenced by the pointer passed in wszDatabaseStreamsD, contain individual file names separated by a single NULL character. The last file name in the buffer is followed by two consecutive NULL characters.

Important  The wszDatabaseStreamS and wszDatabaseStreamsD buffers passed to this function are not standard C-style NULL-terminated strings. Do not attempt to use standard string-manipulation functions that rely on having a single NULL character that terminates the string, because those functions cannot copy these buffers. This can potentially result in failed restores and corrupted databases.

Applications that use this function must be run under a user account that has Microsoft Windows server operating systems Backup and Restore privileges.

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.