TC can't use my plugin

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
User avatar
Dinosaur
Junior Member
Junior Member
Posts: 12
Joined: 2005-09-14, 06:01 UTC
Location: Moscow

TC can't use my plugin

Post by *Dinosaur »

I have one problem with my plugin made in MSVS .NET 2003.

This is packer plugin, but TC can't use it. I checked exported functions (with fileinfo.wlx plugin), functions (names, calling convention, etc.) and everything is correct, but I can't use it. It doesn't appear in 3rd party packers list in Pack dialog and TC displays "Copy ..." instead of "Pack ..." in that dialog. But even if I press "OK" button, an error message appears.

I recompiled some plugins that were made in MSVS 6.0 and they worked correctly, so it's nothing wrong with compiler/linker.

I tried different compiler/linker settings, but it didn't help. What's wrong?
Sorry for my English. Sometimes it may be very confused. :)
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2Dinosaur
Hi,

I would really like to help you but you need to provide some more information.

These steps could help:
1) Tell us the content of the displayed error message (In english).
2) Tell us the line which has been added in the [PackerPlugin] section of your Wincmd.ini (if any).
3) Provide a link where to download the current version of your plugin.
User avatar
Dinosaur
Junior Member
Junior Member
Posts: 12
Joined: 2005-09-14, 06:01 UTC
Location: Moscow

Post by *Dinosaur »

1. If I try to pack files with my plugin, TC displays "Error packing files!" message.
2. Line in wincmd.ini is "dpf=0,F:\TotalCommander\plugins\wcx\dpf\dpf.wcx". Plugin can create and modify archives.
3. Sorry, but I can't provide my plugin for downloading because I don't have my web site and it (plugin) is intended for my own use only (at least, in its current state). I could attach it to this post, but this forum doesn't support attachments. :(

In fact, some research discovered that plugin is loaded successfully (LoadLibrary() doesn't fail), all existing functions are detected by TC, but TC just doesn't call them. :?
Sorry for my English. Sometimes it may be very confused. :)
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

Line in wincmd.ini is "dpf=0,F:\TotalCommander\plugins\wcx\dpf\dpf.wcx"
this could be the problem. 0 means the plugin cannot pack files! Could you post your code for GetPackerCaps here?
Make sure you have exported this function.

here is an example

Code: Select all

int __stdcall GetPackerCaps()
{
	return PK_CAPS_NEW | PK_CAPS_MODIFY;
}
User avatar
Dinosaur
Junior Member
Junior Member
Posts: 12
Joined: 2005-09-14, 06:01 UTC
Location: Moscow

Post by *Dinosaur »

Here is code of all functions (redundant parts were removed):

Code: Select all

#define	WIN32_LEAN_AND_MEAN
#define	STRICT

#include	<windows.h>
#include	<crtdbg.h>
#include	<wcxhead.h>
#include	"DPF.h"

// Data processing progress callback function
tProcessDataProc	processData;

BOOL WINAPI DllMain (HINSTANCE, DWORD, void*)
{
	_RPT0(_CRT_WARN, "DllMain()\n");
	_CrtDumpMemoryLeaks();
	return TRUE;
}

HANDLE __stdcall OpenArchive (tOpenArchiveData* archiveData)
{
	_RPT1(_CRT_WARN, "OpenArchive(\"%s\")\n", archiveData->ArcName);
	return NULL;
}

int __stdcall ReadHeader (HANDLE arcData, tHeaderData* headerData)
{
	_RPT0(_CRT_WARN, "ReadHeader()\n");
	return E_END_ARCHIVE;
}

int __stdcall ProcessFile (HANDLE arcData, int operation, char* destPath, char* destName)
{
	_RPT0(_CRT_WARN, "ProcessFile()\n");
	return 0;
}

int __stdcall CloseArchive (HANDLE arcData)
{
	_RPT0(_CRT_WARN, "CloseArchive()\n");
	return 0;
}

int __stdcall PackFiles (char* packedFile, char* subPath, char* srcPath, char* addList, int flags)
{
	_RPT1(_CRT_WARN, "PackFiles(\"%s\", ...)\n", packedFile);
	return 0;
}

int __stdcall DeleteFiles (char* packedFile, char* deleteList)
{
	_RPT1(_CRT_WARN, "DeleteFiles(\"%s\", ...)\n", packedFile);
	return E_NOT_SUPPORTED;
}

int __stdcall GetPackerCaps ()
{
	_RPT0(_CRT_WARN, "GetPackerCaps()\n");
	return (PK_CAPS_NEW | PK_CAPS_MULTIPLE);
}

void __stdcall ConfigurePacker (HWND parentWnd, HINSTANCE instance)
{
	_RPT0(_CRT_WARN, "ConfigurePacker()\n");
}

void __stdcall SetProcessDataProc (HANDLE arcData, tProcessDataProc processDataProc)
{
	_RPT0(_CRT_WARN, "SetProcessDataProc()\n");
	processData = processDataProc;
}

BOOL __stdcall CanYouHandleThisFile (char* fileName)
{
	_RPT1(_CRT_WARN, "CanYouHandleThisFile(\"%s\")\n", fileName);
	return TRUE;
}

void __stdcall PackSetDefaultParams (PackDefaultParamStruct*)
{
	_RPT0(_CRT_WARN, "PackSetDefaultParams()\n");
}
After running TC under debugger and some work debug output window contains only:
...
DllMain()
DllMain()
...
Sorry for my English. Sometimes it may be very confused. :)
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2Dinosaur
try to reinstall (uninstall and install) the plugin and observe if the wincmd entry has changed. If not you are defintely not exporting GetPackerCaps.
GetPackerCaps is only called on plugin installation to set the value in the settings file entry!
User avatar
Dinosaur
Junior Member
Junior Member
Posts: 12
Joined: 2005-09-14, 06:01 UTC
Location: Moscow

Post by *Dinosaur »

I did it several times. No effect. :(
Sorry for my English. Sometimes it may be very confused. :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2Dinosaur
Try changing the line in wincmd.ini manually to

dpf=3,F:\TotalCommander\plugins\wcx\dpf\dpf.wcx

and restart TC.

To make GetPackerCaps work, make sure that it is listed in the .def file, otherwise it will be exported with name mangling.
Author of Total Commander
https://www.ghisler.com
User avatar
Dinosaur
Junior Member
Junior Member
Posts: 12
Joined: 2005-09-14, 06:01 UTC
Location: Moscow

Post by *Dinosaur »

ghisler(Author) wrote:Try changing the line in wincmd.ini manually to
dpf=3,F:\TotalCommander\plugins\wcx\dpf\dpf.wcx
and restart TC.
Yes, TC added my plugin to list of packers, but message "Error packing files!" still appears.
ghisler(Author) wrote:To make GetPackerCaps work, make sure that it is listed in the .def file, otherwise it will be exported with name mangling.
Yes, it's listed. I told that I ran TC under APISpy and monitored all API calls related to DLLs. TC loads and gets all functions addresses successfully, but can't use it. It just doesn't call my functions!
Sorry for my English. Sometimes it may be very confused. :)
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2Dinosaur
Hi,

you may send me the complete project to total_commander at lefteous dot de if you want.
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2Dinosaur
I received your plugin, thanks.

---------------------------
PackSetDefaultParams()
---------------------------
If you see this message, then something happened and plugin became useable.
Please let me know about this.
Thank you.
---------------------------
OK
---------------------------

As you see I could solve your problem. Add SetChangeVolProc and it will work. I have tested it.

2ghisler (author)
Maybe the packer plugin sdk should be updated to inform all authors that all callbacks must be exported.
User avatar
Dinosaur
Junior Member
Junior Member
Posts: 12
Joined: 2005-09-14, 06:01 UTC
Location: Moscow

Post by *Dinosaur »

2Lefteous
Oh, thank you very very much!
I spent so much time and nerves on searching source of problem and this source was to trivial... :roll:

2ghisler(Author)
You may do as Lefteous said, but my suggestion is just to ignore callbacks that aren't exported.
Sorry for my English. Sometimes it may be very confused. :)
Post Reply