CPackage::Open

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

BOOL Open(
LPCTSTR lpszPackageFile, // name of package file
LPCTSTR lpszPassword, // password
DWORD dwOpenFlags, // package open flags
);

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 CPackage::Create 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.

Return Values

If the function succeeds, the return value is TRUE.

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

Remarks

Use the CPackage::Close 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

CPackage::Close