FindNextPackageFile

The FindNextPackageFile function returns the first file in the package that matches the specified search criteria.

BOOL FindNextPackageFile(
HPACKAGE hPackage, // handle to package file
LPPACKAGE_FILE_INFORMATION lpFileInfo // file information
);

Parameters

hPackage
[in] Handle to an open package file.
 
lpFileInfo
[in/out] A pointer to a PACKAGE_FILE_INFORMATION structure that will contain information about the file. Note that the cbStructure member must be initialized to the size of the structure that is being passed to the function.

Return Values

If the FindNextPackageFile function succeeds, it will return a non-zero value.

If the function fails, it will return a value of zero. To get extended error information, call GetLastError.

Remarks

The FindNextPackageFile function will return FALSE after the last file has been returned.

Files that have been deleted from the package will not be returned by this function.

Example

// Delete all executable files from the package
PACKAGE_FILE_INFORMATION pfInfo;
DWORD dwError = ERROR_SUCCESS;
BOOL bResult;

pfInfo.cbStructure = sizeof(PACKAGE_FILE_INFORMATION);
bResult = FindFirstPackageFile(hPackage, _T("*.exe"),
                               PACKAGE_FILE_PLATFORM_DEFAULT,
                               PACKAGE_FIND_RECURSIVE, &pfInfo);

while (bResult)
{
       bResult = DeletePackageFile(hPackage,
                                   PACKAGE_FILE_PLATFORM_DEFAULT,
                                   pfInfo.dwChecksum,
                                   pfInfo.szFileName);

       if (bResult == FALSE)
       {
           dwError = GetLastError();
           break;
       }

       bResult = FindNextPackageFile(hPackage, &pfInfo);
}

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

FindFirstPackageFile, GetNextPackageFile