3.2.4.9 CprepDiskWriteFileData (Opnum 17)

The CprepDiskWriteFileData method writes information to a file on a given partition on a given disk.

 HRESULT CprepDiskWriteFileData(
   [in] CPREP_DISKID DiskId,
   [in] unsigned long ulPartition,
   [in, string] wchar_t* FileName,
   [in] unsigned long cbDataIn,
   [in, size_is(cbDataIn)] byte* DataIn
 );

DiskId: The identifier of the ClusPrepDisk representing the disk that holds the file to write to.

ulPartition: The partition number of the partition associated with the volume on the disk that holds the file to write to.

FileName: The path and name of the file to write to.

cbDataIn: The size, in bytes, of the buffer DataIn.

DataIn: The data to write to the file.

Return Values: A signed 32-bit value that indicates return status. If the method returns a negative value, it has failed. 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] sections 2.2 and 2.1.

Return value/code

Description

0x00000000

S_OK

The call was successful.

0x8007139F

ERROR_INVALID_STATE

The ClusPrepDisk.OnlineState is not equal to Online.

0x80070002

ERROR_FILE_NOT_FOUND

The disk was not found or ulPartition cannot be mapped to a volume.

0x800703ED

ERROR_UNRECOGNIZED_VOLUME

The volume does not contain a file system.

0x80070548

ERROR_INVALID_SERVER_STATE

The server's Prepare State is not Online.

For any other condition, this method MUST return a value that is not one of the values listed in the preceding table. The client MUST behave in one consistent, identical manner for all values that are not listed in the preceding table.

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

The opnum field value for this method is 17.

When processing this call, the server MUST do the following as specified in section 3.2.4:

  • Obtain the ClusPrepDisk identified by the DiskId parameter.

  • Verify that the ClusPrepDisk.OnlineState is Online.

  • Map ulPartition to the corresponding volume.

  • Verify that the volume contains a file system.

  • Create the file if it does not exist.

  • Write the contents of buffer DataIn to the file, starting at offset 0.

  • Truncate the file length to cbDataIn bytes if its current length is greater than cbDataIn bytes.