The ILockBytes interface of the com.ms.com package is implemented on a byte array object that is backed by some physical storage, such as a disk file, global memory, or a database. It is used by a COM compound file storage object to give its root storage access to the physical device, while isolating the root storage from the details of accessing the physical storage.
Most applications will not implement the ILockBytes interface because COM provides file-based and memory-based implementations of ILockBytes. If you choose to implement your own ILockBytes interface, you should consider providing custom marshaling by implementing the IMarshal interface as part of your byte array object. The reason for this is that when the COM-provided implementations of IStorage and IStream are marshaled to another process, their ILockBytes interface pointers are also marshaled to the other process. The default marshaling mechanism creates a proxy byte array object (which includes the ILockBytes interface) that transmits method calls back to the original byte array object. Custom marshaling can improve efficiency by creating a remote byte array object that can directly access the byte array.
Note The ILockBytes interface was added as of versions 2925 through 3167 of the Microsoft virtual machine.
public interface ILockBytes extends IUnknown { // Methods public int ReadAt(long ulOffset, byte buf[], int off, int len); public int WriteAt(long ulOffset, byte buf[], int off, int len); public void Flush(); public void SetSize(long cb); public void LockRegion(long libOffset, long cb, int dwLockType); public void UnlockRegion(long libOffset, long cb, int dwLockType); public void Stat(com.ms.com.STATSTG pstatstg, int grfStatFlag); } IUnknown | +--ILockBytes