ILockBytes - File-Based Implementation

Implemented on a byte array object underlying a COM compound file storage object, and designed to read and write directly to a disk file.

When to Use

Methods of ILockBytes are called from the compound file implementations of IStorage and IStream on the compound file storage object created through a call to StgCreateDocfile, so you do not need to call them directly.

Remarks

The following are the methods of the ILockBytes File-Based Implementation.

ILockBytes::ReadAt

Reads a block of bytes from a specified offset at the beginning of the byte-array.

ILockBytes::WriteAt

Writes a block of bytes from a specified offset at the beginning of the byte array.

ILockBytes::Flush

Ensures that any internal buffers maintained by the ILockBytes implementation are written out to the underlying physical storage.

ILockBytes::SetSize

Sets the size of the byte array.

ILockBytes::LockRegion

The dwLockTypes parameter is set to LOCK_ONLYONCE or LOCK_EXCLUSIVE, which will allow or restrict access to locked regions.

ILockBytes::UnlockRegion

This method unlocks the region locked by ILockBytes::LockRegion.

ILockBytes::Stat

The COM-provided IStorage::Stat implementation calls the ILockBytes::Stat method to retrieve information about the byte array object. If there is no reasonable name for the byte array, the COM-provided ILockBytes::Stat method returns NULL in the pwcsName member of the STATSTG structure.

ILockBytes

IStorage

IStream