OpenPackage

The OpenPackage function opens the specified package file and returns a handle that can be used to access the package.

HPACKAGE OpenPackage(
LPCTSTR lpszPackageFile, // name of package file
LPCTSTR lpszPassword, // password
DWORD dwOpenFlags, // package open flags
LPPATCHSTATUSPROC lpfnCallback, // pointer to callback function
LPARAM lParam // callback function parameter
);

Parameters

lpszPackageFile
[in] A pointer to a null-terminated string which specifies the package file that is to be opened.
 
lpszPassword
[in] A pointer to a null-terminated string which specifies the password that was used to secure the package. A package created with a password cannot be applied unless it matches the password that was provided to the CreatePackage function. Note that the password is case sensitive. If no password was specified, this parameter may be NULL or point to an empty string.
 
dwOpenFlags
[in] Specifies a set of options which are used when opening the patch package.
 
The following values are defined:
Value Description
PACKAGE_OPEN_UPDATE Open an existing package file for updating. This permits both read and write access to the package.
PACKAGE_OPEN_CREATE Create a new package file. If the specified file name already exists, the file is overwritten with an empty package.
PACKAGE_OPEN_READONLY Open an existing package file for reading. The package can be read but cannot be modified.
lpfnCallback
[in] Specifies the address of a callback function of type LPPATCHSTATUSPROC that is called each time another portion of the patch file has been applied. This parameter can be NULL.
 
For more information on the progress callback function, see PatchStatusProc.
 
lParam
[in] A 32-bit user-defined parameter that is passed through the callback function. If no callback function has been specified, this parameter should be zero.

Return Values

If the function succeeds, the return value is an open handle to the specified package file.

If the function fails, the return value is INVALID_PACKAGE_HANDLE. To get extended error information, call GetLastError.

Remarks

Use the ClosePackage function to close the package file and release the memory allocated for the package.

The handle returned by this function is not a handle to a Windows object and cannot be used with functions such as ReadFile and WriteFile.

Requirements

Windows NT/2000/XP: Requires Windows NT 4.0 SP3 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Include apatch.h.
Library: Use apatch32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

ClosePackage