This function opens an existing storage object that does not reside in a disk file, but instead has an underlying byte array provided by the caller.
WINOLEAPI StgOpenStorageOnILockBytes( ILockBytes *plkbyt, IStorage *pStgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen );
[in] ILockBytes pointer to the underlying byte array object that contains the storage object to be opened.
[in] Most often NULL. If not NULL, this parameter is used instead of the plkbyt parameter to specify the storage object to open. In this case, it points to the IStorage interface on a previously opened 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.
[in] Specifies the access mode to use to open the storage object.
[in] Can 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.
[in] Reserved for future use; set to zero.
[out] Pointer to the location of an IStorage pointer to the opened storage on successful return.
One of the values described in the following table is returned.
|S_OK||Indicates that the storage object was successfully opened.|
|STG_E_FILENOTFOUND||Indicates that the specified byte array does not exist.|
|STG_E_ACCESSDENIED||Indicates that access was denied because the caller has insufficient permission, or another caller has the file open and locked.|
|STG_E_LOCKVIOLATION||Indicates that access was denied because another caller has the file open and locked.|
|STG_E_SHAREVIOLATION||Indicates that access was denied because another caller has the file open and locked.|
|STG_E_FILEALREADYEXISTS||Indicates that the byte array exists but is not a storage object.|
|STG_E_TOOMANYOPENFILES||Indicates that the storage object was not opened because there are too many open files.|
|STG_E_INSUFFICIENTMEMORY||Indicates that the storage object was not opened due to a lack of memory.|
|STG_E_INVALIDNAME||Indicates that either pwcsName or snbExclude contains an invalid name.|
|STG_E_INVALIDPOINTER||Indicates that snbExclude, pwcsName, pstgPriority, or ppStgOpen contains an invalid pointer.|
|STG_E_INVALIDFLAG||Indicates that the grfMode parameter contains a bad flag combination.|
|STG_E_INVALIDFUNCTION||Indicates that the access mode STGM_DELETEONRELEASE was specified in the grfMode parameter.|
|STG_E_OLDDLL||Indicates that the DLL being used to open this storage object is a version prior to the one used to create it.|
|STG_E_OLDFORMAT||Indicates that the storage object being opened was created by the Beta 1 storage provider. This format is no longer supported.|
This function can also return any file system errors, or Win32 errors wrapped in an HRESULT, or ILockBytes interface error return values.
The StgCreateDocfileOnILockBytes and StgOpenStorageOnILockBytes functions are not available for the non-desktop compatible implementation by means of CESYSGEN.
StgOpenStorageOnILockBytes opens the specified root storage object. The storage object is opened according to the access mode in the grfMode parameter; a pointer to the IStorage interface on the opened storage object is supplied through the ppstgOpen parameter.
The storage object must have been previously created by the StgCreateDocfileOnILockBytes function.
Except for specifying a programmer-provided byte-array object, StgOpenStorageOnILockBytes is similar to the StgOpenStorage function. For more information, refer to StgOpenStorage.
Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application.
|Runs on||Versions||Defined in||Include||Link to|
|Windows CE OS||2.0 and later||Objbase.h||Ole232.lib|
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
Last updated on Tuesday, July 13, 2004
© 1992-2000 Microsoft Corporation. All rights reserved.