ProcessFile: Difference between revisions

From TotalcmdWiki
Jump to navigation Jump to search
No edit summary
Line 11: Line 11:
* Unlike [[PackFiles]], [[ProcessFile]] is passed only one filename. Either ''DestName'' contains the full path and file name and ''DestPath'' is NULL, or ''DestName'' contains only the file name and ''DestPath'' the file path. This is done for compatibility with unrar.dll.
* Unlike [[PackFiles]], [[ProcessFile]] is passed only one filename. Either ''DestName'' contains the full path and file name and ''DestPath'' is NULL, or ''DestName'' contains only the file name and ''DestPath'' the file path. This is done for compatibility with unrar.dll.


* When Total Commander first opens an archive, it scans all file names with OpenMode==PK_OM_LIST, so [[ReadHeader]]() is called in a loop with calling ProcessFile(...,PK_SKIP,...). When the user has selected some files and started to decompress them, Total Commander again calls [[ReadHeader]]() in a loop. For each file which is to be extracted, Total Commander calls '''ProcessFile()''' with Operation==PK_EXTRACT immediately after the [[ReadHeader]]() call for this file. If the file needs to be skipped, it calls it with Operation==PK_SKIP.
* When Total Commander first opens an archive, it scans all file names with OpenMode==PK_OM_LIST, so [[ReadHeader]]() is called in a loop with calling '''ProcessFile'''(...,PK_SKIP,...). When the user has selected some files and started to decompress them, Total Commander again calls [[ReadHeader]]() in a loop. For each file which is to be extracted, Total Commander calls '''ProcessFile()''' with Operation==PK_EXTRACT immediately after the [[ReadHeader]]() call for this file. If the file needs to be skipped, it calls it with Operation==PK_SKIP.


* Each time ''DestName'' is set to contain the filename to be extracted, tested, or skipped. To find out what operation out of these last three you should apply to the current file within the archive, ''Operation'' is set to one of the following:
* Each time ''DestName'' is set to contain the filename to be extracted, tested, or skipped. To find out what operation out of these last three you should apply to the current file within the archive, ''Operation'' is set to one of the following:

Revision as of 14:58, 18 April 2006

ProcessFile should unpack the specified file or test the integrity of the archive.

 int __stdcall ProcessFile (HANDLE hArcData, int Operation, char *DestPath, char *DestName);

Description

ProcessFile should return zero on success, or one of the error values otherwise.

  • hArcData contains the handle previously returned by you in OpenArchive. Using this, you should be able to find out information (such as the archive filename) that you need for extracting files from the archive.
  • Unlike PackFiles, ProcessFile is passed only one filename. Either DestName contains the full path and file name and DestPath is NULL, or DestName contains only the file name and DestPath the file path. This is done for compatibility with unrar.dll.
  • When Total Commander first opens an archive, it scans all file names with OpenMode==PK_OM_LIST, so ReadHeader() is called in a loop with calling ProcessFile(...,PK_SKIP,...). When the user has selected some files and started to decompress them, Total Commander again calls ReadHeader() in a loop. For each file which is to be extracted, Total Commander calls ProcessFile() with Operation==PK_EXTRACT immediately after the ReadHeader() call for this file. If the file needs to be skipped, it calls it with Operation==PK_SKIP.
  • Each time DestName is set to contain the filename to be extracted, tested, or skipped. To find out what operation out of these last three you should apply to the current file within the archive, Operation is set to one of the following:
Constant Value Description
PK_SKIP 0 Skip this file
PK_TEST 1 Test file integrity
PK_EXTRACT 2 Extract to disk