TWUGetPackageInstaller

The TWUGetPackageInstaller function downloads a package installer from the Internet server, using the package information supplied. Typically, this package information has been previously downloaded by TWUOpenUpdateURL or TWUGetPIF. After a successful download, you can run the package's installer by calling TWURunPackageInstaller.

#define TWU_DWNF_VERIFYTRUST    0x00000001  // Check digital signature
#define TWU_DWNF_USEROVERRIDE   0x00000002  // Allow user to override check
#define TWU_DWNF_NOCACHE        0x00000004  // Direct download; bypass cache

URESULT TWUGetPackageInstaller(
    TWUHANDLE hSession,
    const TCHAR *pszLocalPath,
    TWUPackageData *pPackage,
    DWORD dwDownloadFlags
);

Delphi version:

Const
    TWU_DWNF_VERIFYTRUST = $00000001;	{ Check digital signature }
    TWU_DWNF_USEROVERRIDE = $00000002;	{ Allow user to override check }

function TWUGetPackageInstaller(
    hSession: TWUHANDLE;
    pszLocalPath: PTCHAR;
    var pPackage: TWUPackageData;
    dwDownloadFlags: DWORD
): URESULT;

Parameters

hSession
[Input] Handle to an open TWU session.
pszLocalPath
[Input, optional] Pointer to the local path for the downloaded package installer, or NULL to download the package installer to the TEMP folder. If you specify this parameter, it must be a fully qualified file path.
pPackage
[Input, output] Pointer to the package data whose installer must be downloaded. The szDownloadPath data member is updated to reflect the local path of the downloaded package installer.
dwDownloadFlags
[Input] Combination of download flags, TWU_DWNF_xxx (see above)

Return value

If the function succeeds, it returns ERROR_SUCCESS (0). If it fails, it returns a nonzero Win32 API error code. You can use TWUGetErrorMessage to retrieve the error message that corresponds to the error code.