TWUEnumPackageDependencies
The TWUEnumPackageDependencies function enumerates the dependencies of a given package, including the package itself. This is recursive: dependencies of dependencies are enumerated in a depth-first manner. The enumeration returns dependencies before the dependents, so it can be used to install packages from the bottom up. The original package is enumerated last.
- If a package is used by more than one other package, it is only enumerated the first time it is encountered.
- If the dependency graph contains circular dependencies (which we do not recommend), then the circular reference is broken arbitrarily.
Package dependencies are defined by the DependsOn key in the package sections of the package information file.
TWUPackageData * TWUEnumPackageDependencies( TWUHANDLE hSession, TWUPackageData *pPackage, fTWUPackageCB pCallback, LPARAM lCookie, URESULT *puResult );
Delphi version:
function TWUEnumPackageDependencies( hSession: TWUHANDLE; pPackage: PTWUPackageData; pCallback: fTWUPackageCB; lCookie: LPARAM; var puResult: URESULT ): PTWUPackageData;
Parameters
- hSession
- [Input] Handle to an open TWU session.
- pPackage
- [Input] Pointer to the starting package for the enumeration. This package will be enumerated last, after all its dependencies have been enumerated.
- pCallback
- [Input] Pointer to the callback function that will be called once for each enumerated package.
- lCookie
- [Input] User-defined value that will be passed unchanged to the callback function. You can use this cookie to pass additional information to the callback function.
- puResult
- [Output, optional] Pointer to a variable that receives the nonzero error code if the enumeration was terminated prematurely, or ERROR_SUCCESS (0) if all package dependencies were enumerated. If this parameter is NULL, no result code is returned.
Return value
The function returns a pointer to the package that caused the enumeration to fail (by returning a nonzero result from the callback function), or NULL if all or no packages were enumerated. If all packages were enumerated, *puResult will contain ERROR_SUCCESS; if no packages were enumerated, *puResult will contain a nonzero error code.