StgOpenStorageOnILockBytes

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
);

Parameters

plkbyt

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

pStgPriority

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.

grfMode

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

snbExclude

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. .

reserved

Indicates reserved for future use; must be zero.

ppstgOpen

Points to the location where the opened storage is placed.

Return Values

S_OK

Indicates the storage object was successfully opened.

STG_E_FILENOTFOUND

Indicates the specified byte array does not exist.

STG_E_ACCESSDENIED

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.

STG_E_FILEALREADYEXISTS

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

STG_E_TOOMANYOPENFILES

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

STG_E_INSUFFICIENTMEMORY

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

STG_E_INVALIDNAME

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

STG_E_INVALIDPOINTER

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

STG_E_INVALIDFLAG

Indicates bad flag combination in the grfMode parameter.

STG_E_INVALIDFUNCTION

Indicates STGM_DELETEONRELEASE specified in the grfMode parameter.

STG_E_OLDDLL

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

STG_E_OLDFORMAT

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.

Comments

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

StgOpenStorage

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