VirtFsEnum

Top  Previous  Next

int _stdcall

VirtFsEnum(

   IN  PACKAGE_HANDLE               hPkg,

   IN  VIRTFS_ENUM_CALLBACK         Callback,

   IN  LPVOID                       Data )

Enumerates files in the virtual application package.

Parameters

hPkg [in]

Virtual application package handle, returned by PackageOpen.

Callback [in]

Callback function that will be called for each file in the package. The callback function must return 1 to continue enumeration, or 0 to stop recursion on files (winding up directories progressively).

Data [in]

Arbitrary data passed to the callback function.

Return value

Returns APIRET_SUCCESS if successful.

Code sample

// Callback function

BOOL _stdcall

VirtFsEnumCallback(

   LPVOID                           Data,

   IN  WCHAR*                       FileName,

   IN  ULONG                        FileFlags,

   LARGE_INTEGER                    CreationTime,

   LARGE_INTEGER                    LastAccessTime,

   LARGE_INTEGER                    LastWriteTime,

   LARGE_INTEGER                    ChangeTime,

   LARGE_INTEGER                    EndOfFile,

   ULONG                            FileAttributes )

{

   printf("%x: %ws\n", Data, FileName);

   return (TRUE);

}

 

// Enumeration sample function

void EnumSample ()

{

   PACKAGE_HANDLE   hPkg;

   if (PackageOpen(L"C:\\MyPackage.exe", 0, &hPkg) == APIRET_SUCCESS)

   {

      // Modify package property "AutoLaunch"

      VirtFsEnum(hPkg, VirtFsEnumCallback, (LPVOID)0x12345678);

 

      // Save and close package

      PackageSave(hPkg, L"c:\\now\\output.exe");

      PackageClose(hPkg);

   }

}