DriveSpace Programming Interface

Microsoft MS-DOS version 6.x introduced the DriveSpace file system, which increases the storage capacity of disk drives by compressing data written to the drive. DriveSpace includes a programming interface that lets disk utility programs examine and manage disk drives containing compressed data. The DriveSpace programming interface is described in the MS-DOS Programmer's Reference for version 6.x. This section describes addional IOCTL functions that have been added to the DriveSpace programming interface for Windows 95.

Raw I/O IOCTL Functions

A client application can use the DriveSpace IOCTL functions (Interrupt 21h Function 4404h) to read and write raw data to a compressed volume. The following new IOCTL functions are provided:

Function letter

Action

r

DSRawRead

w

DSRawWrite


See also DSRawRead, DSRawWrite

Raw I/O IOCTL Data Packet

To perform a raw I/O operation, a client application passes a data packet consisting of a header defined by the DSHDR and DSRAWIO structures, followed by an array of RawClusterInfo structures that describe a set of clusters on which to operate. The IOCTL function returns a failure status in the dspResult field of the DSHDR structure if a normal write (that is, any write other than a raw write IOCTL) to the drive has occurred since the most recent previous raw I/O IOCTL. The failure status tells DEFRAG.EXE that its knowledge of the state of the drive may no longer be valid.

See also DSHDR, DSRAWIO, RawClusterInfo

Reading Fragmented Clusters

To read a fragmented cluster, the client must know how many sectors, including the fragment header, that the cluster consumes. Because the MDFAT entry gives only the size of the first fragment, the client must either read the fragment header and compute the total sector count, or issue a raw read IOCTL in which the rci_data field of the RawClusterInfo structure is NULL. Raw reads where the rci_pdata field is NULL return no raw data, but they do fill in the other fields in the RawClusterInfo structure. When a fragmented cluster is actually read, the fragmented header is stripped from the data that is returned; that is, the first byte in the data buffer contains the first byte of the cluster's raw data.

See also RawClusterInfo

Writing Fragmented Clusters

On version 3.0 CVFs, a client application can use the raw write IOCTL to write a fragmented cluster. To accomplish this, RCFFRAG must be set in the rci_flags field of the RawClusterInfo structure. In addition, the first sector of the data to be written must contain the fragment header exactly as it should appear on this disk. This means that a compressed cluster's data begins immediately following the fragment header in the first sector. An uncompressed cluster's data begins in the second sector of the data. The remainder of the first sector after the fragment header is usually padded with the DWORD value 45544550h. The FRAGHDR structure defines the format of the fragment header:

See also FRAGHDR, RawClusterInfo