[WCX Devel] Question

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

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Mahoney
Junior Member
Junior Member
Posts: 2
Joined: 2005-01-04, 16:33 UTC

[WCX Devel] Question

Post by *Mahoney »

Want to write my own packer plugin for Total Commander. Downloaded WCX Writer's Reference and decided to create a "dummy" plugin first, which will only tell via message box that certain function has been called (still providing TC with neccessary "dummy" information).

A question: When I open any archive of my type, TC calls OpenArchive function, then ReadHeader+ProcessFile for each file. All's fine. If then I select some files and press F5 to unpack, than all's fine again. But when after opening the archive, I CLOSE it without unpacking anything, nothing happens (I expected that CloseArchive should be called). But it's not all! When I open different archive (of the same type) TC doesn't call OpenArchive, it calls ReadHeader+ProcessFile referring to the old archive, which already has been closed!

What I'm doin' wrong???
gigaman
Member
Member
Posts: 134
Joined: 2003-02-14, 11:28 UTC

Post by *gigaman »

Strange... did you export the CloseArchive function correctly? (with the right name and calling convention)
Also, do you return the correct results from ReadHeader and ProcessFile calls?
Mahoney
Junior Member
Junior Member
Posts: 2
Joined: 2005-01-04, 16:33 UTC

I did all correct

Post by *Mahoney »

If any mandatory function was exported incorrectly, then TC would not accept my plugin. CloseArchive calls normally after unpacking. ReadHeader returns 0 after every success and E_END_ARCHIVE in the end. ProcessFile returns 0 on success.

Even don't know what to think! I downloaded a sample of plugin, everything seems the same!

Will try to put my code in this downloaded sceletron. Maybe will find out the reason...
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

If I understand the question correctly, it is similar to the one that I have.

How can my packer plugin detect, whether or not an archive that is handled by it, is currently open in one (or more) of Total Commander's panels?
As far as I understand "WCX Writer's Reference", TC calls the CloseArchive() function not when the user "leaves" the archive, but when the plugin has finished listing or extracting its contents.

Background of my question is, that I want my plugin to act different according to the situation (like TC's built-in ZIP packer does):
  • When the target file already exists, and is currently *closed*, and the user has selected files in the other panel and chooses "Files" > "Pack...", then (s)he should be asked something like "Archive <target> already exists. Overwrite? [Yes] [No]".
  • When the target file already exists, and is currently *open*, and the user has selected files in the other panel and chooses "Copy" then (s)he should be asked something like "<Source> already exists in archive <target>. Overwrite <source>? [Yes] [No]".
TIA, Juergen
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50834
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2Juergen
I'm sorry but you can't find out - and you shouldn't do this either! It's better to ask about the overwritten files.
Author of Total Commander
https://www.ghisler.com
Juergen
Power Member
Power Member
Posts: 517
Joined: 2003-05-02, 18:19 UTC
Location: Berlin (Germany)
Contact:

Post by *Juergen »

I see, thanks for the reply. There is still something unclear, I probably have expressesd myself ambiguously.

When the user wants to create a new archive, and that archive already exists, then I want the plugin to ask whether (s)he actiually wants to overwrite it. But when the user wants to add files to an existing archive, then the plugin should not ask whether the archive shall be overwritten, because the files will be added to it, and will not overwrite it.
So how can the plugin react adequately, when it doesn't know the situation?

Regards, Juergen
Post Reply