[WCX] Couple questions about the packer plugin interface

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

[WCX] Couple questions about the packer plugin interface

Post by *Dalai »

Hi there,

I have a couple of simple questions regarding the packer plugin interface:
  • In ReadHeader/ReadHeaderEx a plugin can (and is supposed to) return a FileTime. This timestamp seems to be wrong unless I convert it to local time before returning it to TC. Is it supposed to be this way? The WDX and WFX content plugin interfaces expect the date and time in UTC.
  • If OpenArchive fails, e.g. because the plugin returns an error, TC doesn't seem to call CloseArchive. Correct?
  • When unpacking a file TC doesn't seem to set the date and time of the unpacked file to what was listed in the archive. Correct?
    Asked a different way: If I want the unpacked file to have the timestamp from the archive, I need to set it myself. Correct?
  • What do the members UnpVer and Method of THeaderData(Ex) structures represent? They're not described in the WCX plugin guide.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Re: [WCX] Couple questions about the packer plugin interface

Post by *milo1012 »

Dalai wrote: 2022-07-28, 18:09 UTCIn ReadHeader/ReadHeaderEx a plugin can (and is supposed to) return a FileTime. This timestamp seems to be wrong unless I convert it to local time before returning it to TC. Is it supposed to be this way? The WDX and WFX content plugin interfaces expect the date and time in UTC.
Yes, I think it's supposed to be like this.
I think the reason is simple: the whole wcx interface was constructed around the DOS/FAT timestamp structure for files and basically the zip archive, which can handle only local time zone timestamps. AFAIK wdx and ft_datetime expects a raw FILETIME structure, but the wcx interface expects a "DOStime", as it's basically dealing with a "virtual" filesystem. What I do to convert my UTC times to wcx local time (including DST!) is basically this order of converter functions: That algorithm documented in TC's wcx guide
( (year - 1980) << 25 | month << 21 | day << 16 | hour << 11 | minute << 5 | second/2 )
is exactly what a DosDateTime does.
Dalai wrote: 2022-07-28, 18:09 UTCWhen unpacking a file TC doesn't seem to set the date and time of the unpacked file to what was listed in the archive. Correct?
Asked a different way: If I want the unpacked file to have the timestamp from the archive, I need to set it myself. Correct?
Yes, from what I see, TC doesn't touch any files itself, it just creates the folder structure for you when trying to unpack dirs. But that's basically it. You have to set all file "metadata" (attributes) by yourself.
Dalai wrote: 2022-07-28, 18:09 UTCWhat do the members UnpVer and Method of THeaderData(Ex) structures represent? They're not described in the WCX plugin guide.
Just a guess: UnpVer was intended for things like rar: you can only unpack rar files created with 5.0 archive format with program/DLL intended for 5.0 and higher (same for 2.0 and 2.9 format)
Method: probably for zip: deflate and deflate64 and so on. You can actually see this in a zip archive with TC's internal unpacker: it shows the method in the file properties page. But I don't think this was ever fully implemented for wcx. But of course only Christian can fully confirm/answer this.
TC plugins: PCREsearch and RegXtract
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: [WCX] Couple questions about the packer plugin interface

Post by *Dalai »

Thanks for the quick response.
milo1012 wrote: 2022-07-28, 21:27 UTCWhat I do to convert my UTC times to wcx local time (including DST!) is basically this order of converter functions:
My approach is a little bit different:

Code: Select all

FileTimeToLocalFileTime
FileTimeToSystemTime
and to get something TC expects I use the Delphi functions SystemTimeToDateTime and DateTimeToFileDate. Just wanted to find out if I need to convert it at all.
You have to set all file "metadata" (attributes) by yourself.
Mmh, the upside is that it gives programmers more freedom, but it has the downside that it needs to be implemented ;). But not a big deal in this case.
Just a guess: UnpVer was intended for things like rar: you can only unpack rar files created with 5.0 archive format with program/DLL intended for 5.0 and higher (same for 2.0 and 2.9 format)
Method: probably for zip: deflate and deflate64 and so on. You can actually see this in a zip archive with TC's internal unpacker: it shows the method in the file properties page. But I don't think this was ever fully implemented for wcx. But of course only Christian can fully confirm/answer this.
Sounds plausible. Let's see what Ghisler has to say about it.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply