Writes a data set to the Target Service.
#include <smstsapi.h> CCODE NWSMTSWriteDataSet ( UINT32 connection, UINT32 dataSetHandle, UINT32 bytesToWrite, BUFFERPTR buffer);
(IN) Specifies the connection information returned by NWSMTSConnectToTargetService or NWSMTSConnectToTargetServicEx.
(IN) Specifies the handle returned by NWSMTSOpenDataSetForRestore.
(IN) Specifies the number of bytes to write.
(IN) Points to the caller allocated buffer containing the data to be written back through the TSA. The contents of the buffer should have been obtained previously from the NWSMTSReadDataSet call during backup.
See Section 9.3, Target Service Return Values for more information.
The following table lists the return values associated with the function.
NWSMTSWriteDataSet deformats the data set data and writes it out to the Target Service. The FID functions described in Storage Management Services Utilities Library can be used to deformat the data set data.
Before NWSMTSWriteDataSet is called, NWSMTSOpenDataSetForRestore must be called to open the data set.
NWSMTSWriteDataSet must be called repeatedly until all of the data is written to Target Services.
NWSMTSWriteDataSet writes the data set to the specified location. If the data spans many buffers, the engine will have to call NWSMTSWriteDataSet once for every buffer.
A special situation occurs when the restore mode is set to NWSM_DO_NOT_OVERWRITE_DATA_SET, and the data set spans multiple buffers. NWSMTSWriteDataSet must parse through the data to find the path information which may require sifting through multiple buffers. NWSMTSWriteDataSet can then determine if the data set exists on the Target Service.
NWSMTSWriteDataSet may not return NWSMTS_VALID_PARENT_HANDLE or NWSMTS_DATA_SET_ALREADY_EXISTS (indicating the data set exists) until it is called many times (see Invalid, Valid Handle).
NWSM_VALID_PARENT_HANDLE is returned when enough data has been received to create a valid parent handle and indicates that:
The parent already exists on the Target Service
The parent was not overwritten
A parent handle was created for the existing parent
The parent's children can be restored
If buffer contains fields that the TSA does not recognize, the fields are ignored.
NOTE:The bindery must be explicitly included in the restore session or it will not be restored.
See NWSMTSOpenDataSetForRestore for an example.