Help with MFC-based plug-in

  • We have an internally-developed archive format that I would like to write a PowerArchiver plug-in for (which would also be for internal use only). The class that handles the archive file is MFC-based, and so I have started with an MFC DLL project. Using example source from Total Commander’s site, I believe I have the basics in place for an “operational” plug-in (OpenArchive, ReadHeader, ProcessFile, CloseArchive). But, when I add the plug-in to PA and then attempt to open a file with the plug-in’s associated extension, PA returns with the error dialog “PowerArchiver cannot open this file. It does not appear to be a valid archive.” I’m not well-versed as to the best way to attempt to debug the plug-in and see what might be going wrong. Can anyone share some skeleton source for a working MFC-based plug-in that I could use as reference? Thanks.

  • conexware

    Did you try looking at current TC plugins, most of them come with source:

    that should help you. Also, make sure plugin is entered properly in PA.


  • I did manage to get a plug-in up and working by using some of the shared source you pointed me to as a starting point. I do have a couple more questions, though:

    1. GetPackerCaps never seems to be called. Does PA make use of this function? Reason being, I implemented DeleteFiles and added PK_CAPS_DELETE to the return value of GetPackerCaps, but PA still does not let me delete a file from my archive. I even tried removing and re-adding the plug-in from within PA first, but no luck. Does PA allow for plug-in formats to be modified (delete, freshen, add, etc.)?

    2. I have need, under certain circumstances, to prompt the user for input during file extration. Currently, using AfxMessageBox, the message dialog is displayed and responds to keyboard input, but not mouse input (busy cursor is shown and no clicks are allowed). Is there a better way to handle this? Or is this somthing that I should not be doing altogether? (EDIT: This appears to only occur when dragging the file from PA and dropping it into the desktop or other Explorer window. Extract by double-click, or the Extract dialog works fine.)

    Thanks for your help. PA’s plug-in architecture has saved me from having to write a GUI front-end myself.

  • conexware

    1. PA currently does not support everything. I will check with our dev team if that particular function is used. We planned to implement more for next major release, but our plate is sooooo full right now :-).

    2. Will check as well.

    I am glad someone is making use of it :P.

  • One more (at the moment): I managed to determine that I needed to put my plug-in and settings.ini into a BH archive, then rename it as a .ppf in order to get PA to auto-install it. Using the settings.ini from the existing plug-ins as a guide, I was able to get the plug-in set up for a single extension. Is there a way to do multiple extensions from one settings.ini? I’ve tried:


    But only the first extion is assigned to the plug-in. Any way to pull this off currently? Thanks again.

Log in to reply