HrESERestoreAddDatabase Function

Topic Last Modified: 2006-06-12

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

HRESULT HrESERestoreAddDatabase
(
        HCCX phccxRestoreContext,
        wchar* wszDatabaseDisplayName,
        GUID guidDatabase,
        wchar* wszDatabaseStreamsS,
        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.
  • 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.