Opens an existing storage object that does not reside in a disk file, but instead has an underlying byte array provided by the caller.

HRESULT StgOpenStorageOnILockBytes(

ILockBytes * plkbyt,
//Specifies the underlying byte array
IStorage * pStgPriority,
//Points to a previous opening of a root storage object
DWORD grfMode,
//Specifies the access mode for the object
SNB snbExclude,
//Points to an SNB structure specifying elements to be excluded
DWORD reserved,
//Reserved, must be zero
IStorage ** ppstgOpen
//Points to location for returning the storage object



Points to the underlying byte array that contains the storage object to be opened.


Most often NULL. If not NULL, this parameter is used instead of the plkbyt parameter to specify the storage object to open. It points to a previous opening of a root storage object, most often one that was opened in priority mode.

After the StgOpenStorageOnILockBytes function returns, the storage object specified in the pStgPriority parameter on function entry is invalid, and can no longer be used; use the one specified in the ppStgOpen parameter instead.


Specifies the access mode to use to open the storage object.


May be NULL. If not NULL, this parameter points to a block of elements in this storage that are to be excluded as the storage object is opened. This exclusion occurs independent of whether a snapshot copy happens on the open. .


Indicates reserved for future use; must be zero.


Points to the location where the opened storage is placed.

Return Values


Indicates the storage object was successfully opened.


Indicates the specified byte array does not exist.


Indicates insufficient access to open the byte array. Exclusions specified without read-write permissions or attempt to open the byte array with conflicting permissions to a simultaneous open.


Indicates the byte array exists but is not a storage object.


Indicates the storage object was not opened because there are too many open files.


Indicates the storage object was not opened due to a lack of memory.


Indicates bad name in the pwcsName parameter or the snbExclude parameter.


Indicates bad pointer in one of the parameters: snbExclude, pwcsName, pstgPriority, or ppStgOpen.


Indicates bad flag combination in the grfMode parameter.


Indicates STGM_DELETEONRELEASE specified in the grfMode parameter.


Indicates the DLL being used to open this storage object is a version prior to the one used to create it.


Indicates the storage object being opened was created by the Beta 1 storage provider. This format is no longer supported.

File system error return values.

ILockBytes interface error return values.


This function opens the specified root storage object. The storage object is opened according to the access mode in the grfMode parameter; a pointer to the opened storage object is returned through the ppstgOpen parameter.

The storage object must have been previously created by the StgCreateDocfileOnILockBytes function.

The semantics of the StgOpenStorageOnILockBytes function are almost exactly the same as those of the StgOpenStorage function. For more information, see the discussion of the StgOpenStorage function.

See Also


Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database