Home COM GDI+ WebBrowser Data Access

IStorage Interface

 

IID_IStorage

{0000000B-0000-0000-C000-000000000046}

 

 

The IStorage interface supports the creation and management of structured storage objects. Structured storage allows hierarchical storage of information within a single file, and is often referred to as "a file system within a file". Elements of a structured storage object are storages and streams. Storages are analogous to directories, and streams are analogous to files. Within a structured storage there will be a primary storage object that may contain substorages, possibly nested, and streams. Storages provide the structure of the object, and streams contain the data, which is manipulated through the IStream interface.

 

The IStorage interface provides methods for creating and managing the root storage object, child storage objects, and stream objects. These methods can create, open, enumerate, move, copy, rename, or delete the elements in the storage object.

 

An application must release its IStorage pointers when it is done with the storage object to deallocate memory used. There are also methods for changing the date and time of an element.

 

There are a number of different modes in which a storage object and its elements can be opened, determined by setting values from STGM Constants. One aspect of this is how changes are committed. You can set direct mode, in which changes to an object are immediately written to it, or transacted mode, in which changes are written to a buffer until explicitly committed. The IStorage interface provides methods for committing changes and reverting to the last-committed version. For example, a stream can be opened in read-only mode or read/write mode. For more information, see STGM Constants.

 

Other methods provide access to information about a storage object and its elements through the STATSTG structure.

 

Call the methods of IStorage to manage substorages or streams within the current storage. This management includes creating, opening, or destroying substorages or streams, as well as managing aspects such as time stamps, names, and so forth. You also can commit changes or revert to previous version for storages opened in transacted mode. The methods of IStorage do not include means to read and write data—this is reserved for IStream, which manages the actual data. While the IStorage and IStream interfaces are used to manipulate the storage object and its elements, the IPersistStorage interface contains methods that are called to serialize the storage object and its elements to a disk file.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IStorage Methods

Description

CreateStream

Creates and opens a stream object with the specified name contained in this storage object. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction.

OpenStream

Opens an existing stream object within this storage object using the specified access permissions in grfMode. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction.

CreateStorage

Creates and opens a new storage object within this storage object. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction.

OpenStorage

Opens an existing storage object with the specified name according to the specified access mode. The name must not exceed 31 characters in length (not including the string terminator). The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction.

CopyTo

Copies the entire contents of this open storage object into another storage object. The layout of the destination storage object may differ.

MoveElementTo

Copies or moves a substorage or stream from this storage object to another storage object.

Commit

Reflects changes for a transacted storage object to the parent level.

Revert

Discards all changes that have been made to the storage object since the last commit operation.

EnumElements

Returns an enumerator object that can be used to enumerate the storage and stream objects contained within this storage object.

DestroyElement

Removes the specified storage or stream from this storage object.

RenameElement

Renames the specified storage or stream in this storage object.

SetElementTimes

Sets the modification, access, and creation times of the indicated storage element, if supported by the underlying file system.

SetClass

Assigns the specified CLSID to this storage object.

SetStateBits

Stores up to 32 bits of state information in this storage object.

Stat

Returns the STATSTG structure for this open storage object.

 

QueryInterface

 

FUNCTION IStorage_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 IStorage_QueryInterface (pthis, riid, ppvObj) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

AddRef

 

FUNCTION IStorage_AddRef ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

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

END FUNCTION

 

 

Release

 

FUNCTION IStorage_Release ( _

  BYVAL pthis AS DWORD PTR _

  ) AS DWORD
 

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

END FUNCTION

 

 

CreateStream

 

FUNCTION IStorage_CreateStream ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsName AS STRING _

, BYVAL grfMode AS DWORD _

, BYVAL reserved1 AS DWORD _

, BYVAL reserved2 AS DWORD _

, BYREF ppstm AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  pwcsName = UCODE$(pwcsName & $NUL)
  CALL DWORD @@pthis[3] USING IStorage_CreateStream (pthis, pwcsName, grfMode, reserved1, reserved2, ppstm) TO HRESULT
  FUNCTION = HRESULT

 

END FUNCTION

 

 

OpenStream

 

FUNCTION IStorage_OpenStream ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsName AS STRING _

, BYVAL reserved1 AS LONG _

, BYVAL grfMode AS DWORD _

, BYVAL reserved2 AS DWORD _

, BYREF ppstm AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  pwcsName = UCODE$(pwcsName & $NUL)
  CALL DWORD @@pthis[4] USING IStorage_OpenStream (pthis, pwcsName, reserved1, grfMode, reserved2, ppstm) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

CreateStorage

 

FUNCTION IStorage_CreateStorage ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsName AS STRING _

, BYVAL grfMode AS DWORD _

, BYVAL reserved1 AS DWORD _

, BYVAL reserved2 AS DWORD _

, BYREF ppstg AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  pwcsName = UCODE$(pwcsName & $NUL)
  CALL DWORD @@pthis[5] USING IStorage_CreateStorage (pthis, pwcsName, grfMode, reserved1, reserved2, ppstg) TO HRESULT
  FUNCTION = HRESULT

 

END FUNCTION

 

 

OpenStorage

 

FUNCTION IStorage_OpenStorage ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsName AS STRING _

, BYVAL pstgPriority AS DWORD _

, BYVAL grfMode AS DWORD _

, BYVAL snbExclude AS DWORD _

, BYVAL reserved AS DWORD _

, BYREF ppstg AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  pwcsName = UCODE$(pwcsName & $NUL)
  CALL DWORD @@pthis[6] USING IStorage_OpenStorage (pthis, pwcsName, pstgPriority, grfMode, snbExclude, reserved, ppstg) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

CopyTo

 

FUNCTION IStorage_CopyTo ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL ciidExclude AS DWORD _

, BYVAL rgiidExclude AS DWORD _

, BYVAL snbExclude AS DWORD _

, BYVAL pstgDest AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING IStorage_CopyTo (pthis, ciidExclude, rgiidExclude, snbExclude, pstgDest) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

MoveElementTo

 

FUNCTION IStorage_MoveElementTo ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsName AS STRING _

, BYVAL pstgDest AS DWORD _

, BYVAL pwcsNewName AS STRING _

, BYVAL grfFlags AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  pwcsName = UCODE$(pwcsName & $NUL)
  pwcsNewName = UCODE$(pwcsNewName & $NUL)
  CALL DWORD @@pthis[8] USING IStorage_MoveElementTo (pthis, pwcsName, pstgDest, pwcsNewName, grfFlags) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Commit

 

FUNCTION IStorage_Commit ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL grfCommitFlags AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[9] USING IStorage_Commit (pthis, grfCommitFlags) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Revert

 

FUNCTION IStorage_Revert ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG
 

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


END FUNCTION

 

 

EnumElements

 

FUNCTION IStorage_EnumElements ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL reserved1 AS DWORD _

, BYVAL reserved2 AS DWORD _

, BYVAL reserved3 AS DWORD _

, BYREF ppenum AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[11] USING IStorage_EnumElements (pthis, reserved1, reserved2, reserved3, ppenum) TO HRESULT
  FUNCTION = HRESUL
T


END FUNCTION

 

 

DestroyElement

 

FUNCTION IStorage_DestroyElement ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsName AS STRING _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  pwcsName = UCODE$(pwcsName & $NUL)
  CALL DWORD @@pthis[12] USING IStorage_DestroyElement (pthis, pwcsName) TO HRESULT
  FUNCTION = HRESULT

 

END FUNCTION

 

 

RenameElement

 

FUNCTION IStorage_RenameElement ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsOldName AS STRING _

, BYVAL pwcsNewName AS STRING _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  pwcsOldName = UCODE$(pwcsOldName & $NUL)
  pwcsNewName = UCODE$(pwcsNewName & $NUL)
  CALL DWORD @@pthis[13] USING IStorage_RenameElement (pthis, pwcsOldName, pwcsNewName) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SetElementTimes

 

FUNCTION IStorage_SetElementTimes ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwcsName AS STRING _

, BYREF pctime AS FILETIME _

, BYREF patime AS FILETIME _

, BYREF pmtime AS FILETIME _

  ) AS LONG
 

   LOCAL HRESULT AS LONG
   pwcsName = UCODE$(pwcsName & $NUL)
   CALL DWORD @@pthis[14] USING IStorage_SetElementTimes (pthis, pwcsName, pctime, patime, pmtime) TO HRESULT
   FUNCTION = HRESULT

 

END FUNCTION

 

 

SetClass

 

FUNCTION IStorage_SetClass ( _

  BYVAL pthis AS DWORD PTR _

, BYREF prmclsid AS GUID _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[15] USING IStorage_SetClass(pthis, prmclsid) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SetStateBites

 

FUNCTION IStorage_SetStateBits ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL grfStateBits AS DWORD _

, BYVAL grfMask AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[16] USING IStorage_SetStateBits (pthis, grfStateBits, grfMask) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Stat

 

FUNCTION IStorage_Stat ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pstatstg AS STATSTG _

, BYVAL grfStatFlag AS DWORD _

  ) AS LONG
 

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


END FUNCTION

 

 

Page last updated on Friday, 17 March 2006 23:27:50 +0100