PackFiles NOT called???

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

Moderators: white, Hacker, petermad, Stefan2

VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

PackFiles NOT called???

Post by *VSB »

When I try to pack files i get "Error during packing" (seems function just NOT called
some code:
Fuction called only from PluginManager (http://wincmd.ru/plugring/pluginmanager.html) not from Option button in Pack dialog

Code: Select all

void __stdcall ConfigurePacker (HWND Parent, HINSTANCE DllInstance)
{
	MessageBox(NULL,_T("WCX_Linker"),_T("Options"),MB_OK);
}
Not Called?

Code: Select all

int __stdcall PackFiles (char *PackedFile, char *SubPath, char *SrcPath, char *AddList, int Flags)
{
	
	MessageBox(NULL,_T("already exists"),_T("gg"),MB_OK|MB_ICONERROR);
	return E_NOT_SUPPORTED;
}
Where is problem??

P.S.
Compiled in MS VS2008 as Debug Build


Full code: http://pastebin.org/388753
VS Solution http://ifolder.ru/18493443
Last edited by VSB on 2010-07-10, 22:20 UTC, edited 1 time in total.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48028
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Does GetPackerCaps return the right flags? For the options dialog, make sure to add PK_CAPS_OPTIONS (16) to the return value. To ensure that PackFiles is called, you need to set one or more of these:

PK_CAPS_NEW=1
Can create new archives
PK_CAPS_MODIFY=2
Can modify existing archives
PK_CAPS_MULTIPLE=4
Archive can contain multiple files

Please note that TC caches these flags in the wincmd.ini, so you may need to remove and re-add your plugin.
Author of Total Commander
https://www.ghisler.com
VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

Post by *VSB »

Here is GetPackerCaps()

Code: Select all

int __stdcall  GetPackerCaps()   //TODO:add OPTIONS
{
	MessageBox(NULL,_T("already exists"),_T("gg"),MB_OK|MB_ICONERROR);
	return PK_CAPS_NEW|PK_CAPS_OPTIONS       ;
}
Messagebox is for debug.
Seems that function NOT called
constant defined in wcxhead.h:

Code: Select all

/* Returned by GetPackCaps */
#define PK_CAPS_NEW         1    /* Can create new archives              */
#define PK_CAPS_MODIFY      2    /* Can modify exisiting archives        */
#define PK_CAPS_MULTIPLE    4    /* Archive can contain multiple files   */
#define PK_CAPS_DELETE      8    /* Can delete files                     */
#define PK_CAPS_OPTIONS    16    /* Has options dialog                   */
#define PK_CAPS_MEMPACK    32    /* Supports packing in memory           */

#define PK_CAPS_BY_CONTENT 64    /* Detect archive type by content       */
#define PK_CAPS_SEARCHTEXT 128   /* Allow searching for text in archives */
                                 /* created with this plugin}            */
#define PK_CAPS_HIDE       256   /* Show as normal files (hide packer    */
                                 /* icon), open with Ctrl+PgDn, not Enter*/
#define PK_CAPS_ENCRYPT    512   /* Plugin supports PK_PACK_ENCRYPT option*/
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48028
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Hmm, it should be called in this case - can you check the line in wincmd.ini for your plugin? It should read
pluginext=17,c:\path\pluginname.wcx
Author of Total Commander
https://www.ghisler.com
VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

Post by *VSB »

No, there isn't "pluginext=17,c:\path\pluginname.wcx" in ini
Seems TC just doesn't call any function from plugin (if it call GetPackerCaps() I will see messagebox, but i doesn't see it)

At first i thought about spaces in path to plugin and place it directly in c:\ but I get the same behavior - nothing happened
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

What line in [PackerPlugins] section of wincmd.ini do you have for your plugin?
VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

Post by *VSB »

2MVV
I have problem even before line in wincmd ini: GetPackerCaps() is not called (it must be called when I add plugin to TC)
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

As I see, Total Commander calls GetPackerCaps for plugins not during installing but when you're opening pack dialog. :!:


Anyway, it seems that some error appears when TC tries to call GetPackerCaps from your plugin, so TC unloads plugin and writes 0 as packer caps (I added messageboxes for GetPackerCaps and for attaching and detaching in DllMain and I see only attach and detach messages).

BTW, all seems to work fine when I'm executing rundll32 wcx_linker.dll,,GetPackerCaps (I see attach, GetPackerCaps and detach messages).
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

OK I found problem. Your .def file had no CloseArchive function. I've just added it - and TC called PackSetDefaultParams and GetPackerCaps between attach and detach on first opening pack dialog.


To Mr. Ghisler: If some required functions in plugin are missing TC shows error message saying that module is not a WCX plugin. But this message is not displayed when CloseArchive is missing - maybe you should correct it? Does TC check for all mandatory functions while installing plugin or just for some of them?

Also I think that TC may display some message to user if some mandatory function is absent in plugin (or just single message with list of mandatory functions that must be added to plugin). Maybe one function that will get functions from plugin for both install and load? So, function calls GetProcAddress for all functions and then checks if all mandatory functions are loaded and shows error message if some of them are missing (you will need to check functions presence in both cases anyway).
VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

Post by *VSB »

2MVV

Thank you!


2ghisler(Author)

Hmm, may bee there is some reason add ability of making pack-only plugins without dummy mandatory functions? (if plugin do some actions with files and folders, that actually aren't packing and so, there can't be an archive to unpack)
VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

Post by *VSB »

May bee my hands are too curved, but still no working

Code: Select all

LIBRARY "WCX_Linker.wcx"
EXPORTS
	OpenArchive
	OpenArchiveW
	ReadHeaderEx
	ReadHeaderExW
	ProcessFile
	ProcessFileW
	CloseArchive
	SetChangeVolProc
	SetChangeVolProcW
	SetProcessDataProc
	SetProcessDataProcW
	PackFiles
	GetPackerCaps
	ConfigurePacker
	PackSetDefaultParams
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Well, you forgot ReadHeader function. Here my working .def:

Code: Select all

EXPORTS
	OpenArchive
	OpenArchiveW
	ReadHeader
	ReadHeaderEx
	ReadHeaderExW
	ProcessFile
	ProcessFileW
	CloseArchive
	SetChangeVolProc
	SetChangeVolProcW
	SetProcessDataProc
	SetProcessDataProcW

	PackFiles
	GetPackerCaps
	ConfigurePacker
	PackSetDefaultParams
(yes, LIBRARY line is not necessary)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48028
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I agree that TC should complain about missing exports.
Author of Total Commander
https://www.ghisler.com
VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

Post by *VSB »

Last edited by VSB on 2010-07-12, 22:18 UTC, edited 2 times in total.
VSB
Member
Member
Posts: 136
Joined: 2006-12-12, 12:02 UTC
Location: Russia

Post by *VSB »

And how to compile without dependency to MSVCRT90.DLL
When I use Multi-threaded Debug (/MTd)
I get error:
Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup LIBCMTD.lib WCX_Linker
Post Reply