I've written a packer plug-in for an archive file format we're using internally. Listing the files works, but extracting a file always fails with a file not found error.
I can follow along in the debugger how ReadHeaderExW and ProcessFileW are called in a loop to list the files, and then again to unpack the file. However the unpack loop doesn't stop at the desired file, instead it runs through the entire archive and then reports failure.
I debugged another packer plug-in, and the unpack loop extracted the file and stopped as soon as the desired file is returned from ReadHeaderExW. I looked closely at the data returned by ProcessFileW but didn't find anything set up differently than our plug-in.
Does Beyond Compare rely on some other behaviour to unpack a file? Is there any other way I can debug this problem?
--
PS Here's what the reference from Total Commander says about these operations. BCompare appears to do the same.
I can follow along in the debugger how ReadHeaderExW and ProcessFileW are called in a loop to list the files, and then again to unpack the file. However the unpack loop doesn't stop at the desired file, instead it runs through the entire archive and then reports failure.
I debugged another packer plug-in, and the unpack loop extracted the file and stopped as soon as the desired file is returned from ReadHeaderExW. I looked closely at the data returned by ProcessFileW but didn't find anything set up differently than our plug-in.
Does Beyond Compare rely on some other behaviour to unpack a file? Is there any other way I can debug this problem?
--
PS Here's what the reference from Total Commander says about these operations. BCompare appears to do the same.
Here is a simple pseudocode declaration how Total Commander calls the extraction functions:
1. Loop to scan for files in the archive:
2. Loop to extract files from the archive:
1. Loop to scan for files in the archive:
Code:
OpenArchive() with OpenMode==PK_OM_LIST repeat ReadHeader() ProcessFile(...,PK_SKIP,...) until error returned CloseArchive()
Code:
OpenArchive() with OpenMode==PK_OM_EXTRACT repeat ReadHeader() if WantToExtractThisFile() ProcessFile(...,PK_EXTRACT,...) else ProcessFile(...,PK_SKIP,...) until error returned CloseArchive()
Comment