Home COM GDI+ WebBrowser Data Access

ILockBytes Interface

 

IID_ILockBytes

{0000000A-0000-0000-C000-000000000046}

 

 

The ILockBytes interface 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.

 

The ILockBytes methods are called by the COM implementations of IStorage and IStream on the compound file object. Unless you are implementing IStorage and IStream, you would not need to call ILockBytes methods directly. If you write your own ILockBytes implementation, you can use the StgCreateDocfileOnILockBytes function to create a compound file storage object backed by your implementation of ILockBytes.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

ILockBytes Methods

Description

ReadAt

Reads a specified number of bytes starting at a specified offset from the beginning of the byte array.

WriteAt

Writes a specified number of bytes to a specified location in the byte array.

Flush

Ensures that any internal buffers maintained by the byte array object are written out to the backing storage.

SetSize

Changes the size of the byte array.

LockRegion

Restricts access to a specified range of bytes in the byte array.

UnlockRegion

Removes the access restriction on a range of bytes previously restricted with ILockBytes::LockRegion.

Stat

Retrieves a STATSTG structure for this byte array object.

 

QueryInterface

 

FUNCTION ILockBytes_QueryInterface ( _

  BYVAL pthis AS DWORD PTR _

, BYREF riid AS GUID _

, BYREF ppvObj AS DWORD _

  ) AS LONG


  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[0] USING ILockBytes_QueryInterface (pthis, riid, ppvObj) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

AddRef

 

FUNCTION ILockBytes_AddRef ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

  LOCAL DWRESULT AS LONG
  CALL DWORD @@pthis[1] USING ILockBytes_AddRef (pthis) TO DWRESULT
  FUNCTION = DWRESULT
 

END FUNCTION

 

 

Release

 

FUNCTION ILockBytes_Release ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

  LOCAL DWRESULT AS DWORD
  CALL DWORD @@pthis[2] USING ILockBytes_Release (pthis) TO DWRESULT
  FUNCTION = DWRESULT
 

END FUNCTION

 

 

ReadAt

 

FUNCTION ILockBytes_ReadAt ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL ulOffset AS QUAD _

, BYVAL pv AS DWORD _

, BYVAL cb AS DWORD _

, BYREF pcbRead AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING ILockBytes_ReadAt (pthis, ulOffset, pv, cb, pcbRead) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

WriteAt

 

FUNCTION ILockBytes_WriteAt ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL ulOffset AS QUAD _

, BYVAL pv AS DWORD _

, BYVAL cb AS DWORD _

, BYREF pcbWritten AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING ILockBytes_WriteAt (pthis, ulOffset, pv, cb, pcbWritten) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Flush

 

FUNCTION ILockBytes_Flush ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[5] USING ILockBytes_Flush (pthis) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SetSize

 

FUNCTION ILockBytes_SetSize ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL cb AS QUAD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[6] USING ILockBytes_SetSize (pthis, cb) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

LockRegion

 

FUNCTION ILockBytes_LockRegion ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL libOffset AS QUAD _

, BYVAL cb AS QUAD _

, BYVAL dwLockType AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING ILockBytes_LockRegion (pthis, libOffset, cb, dwLockType) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

UnlockRegion

 

FUNCTION ILockBytes_UnlockRegion ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL libOffset AS QUAD _

, BYVAL cb AS QUAD _

, BYVAL dwLockType AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[8] USING ILockBytes_UnlockRegion (pthis, libOffset, cb, dwLockType) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Stat

 

FUNCTION ILockBytes_Stat ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pstatstg AS STATSTG _

, BYVAL grfStatFlag AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[9] USING ILockBytes_Stat (pthis, pstatstg, grfStatFlag) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Page last updated on Friday, 17 March 2006 23:54:52 +0100