IAppxFactory::CreatePackageWriter method (appxpackaging.h)

Creates a write-only package object to which files can be added.

Syntax

HRESULT CreatePackageWriter(
  [in]          IStream               *outputStream,
  [in]          APPX_PACKAGE_SETTINGS *settings,
  [out, retval] IAppxPackageWriter    **packageWriter
);

Parameters

[in] outputStream

Type: IStream*

The output stream that receives the serialized package data. The stream must support at least the Write method.

[in] settings

Type: APPX_PACKAGE_SETTINGS*

The settings for the production of this package.

[out, retval] packageWriter

Type: IAppxPackageWriter**

The package writer created by this method.

Return value

Type: HRESULT

If the method succeeds, it returns S_OK. Otherwise, it returns an error code that includes, but is not limited to, those in the following table.

Return code Description
E_INVALIDARG
The specified hashMethod member of the APPX_PACKAGE_SETTINGS structure is not a valid hash algorithm URI.
ERROR_INVALID_PARAMETER
The specified hashMethod member of the APPX_PACKAGE_SETTINGS structure is not a valid hash algorithm URI.
NTE_BAD_ALGID
The hash value is SHA1.

Remarks

The implementation of an IAppxPackageWriter is not guaranteed to write data to the output stream before the Close method is called on the writer object. No other thread should access outputStream until the writer returns from its Close method.

Examples

For an example, see How to create an app package.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header appxpackaging.h

See also

IAppxFactory