Deserializes package data from a stream and creates a package object to represent the package being read. While a Packaging API object obtained from the package object, or the package object itself, is still in use, the stream may be used to access package data.
HRESULT ReadPackageFromStream( IStream *stream, OPC_READ_FLAGS flags, IOpcPackage **package );
A pointer to the IStream interface of the stream.
The stream must be readable, seekable, have size, and must contain package data. Additionally, if the stream is not clonable, it will be buffered and read sequentially, incurring overhead.
The value that specifies the read settings for caching package components and validating them against OPC conformance requirements.
A pointer to the IOpcPackage interface of the package object that represents the package being read through the stream.
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
||The method succeeded.|
||The value passed in the flags parameter is not a valid OPC_READ_FLAGS enumeration value.|
||This method is not implemented for this version of Windows.|
||At least one of the stream and package parameters is NULL.|
||An HRESULT error code from the IStream interface.|
||An HRESULT error code from the Package Consumption Error Group.|
||An HRESULT error code from the Part URI Error Group.|
Do not use a stream to serialize package data when the same stream is being used to deserialize a package, because the attempt may result in undefined behavior.
The Packaging APIs can interact with packages that map a ZIP archive as specified in the OPC, and that are based on either Zip32 (ZIP 2.0) or Zip64 (ZIP 4.5) encoding.
For information about how to use this method to load a package, see the Loading a Package programming task.Getting Started with the Packaging API, and Platform Update for Windows Vista.
Packaging objects are not thread-safe.
For more information, see the Getting Started with the Packaging API.
|Windows version||Windows 7 [desktop apps only] Windows Server 2008 R2 [desktop apps only]|