Plugin interface descriptions for TC 7.5 (beta)

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

Moderators: Hacker, petermad, Stefan2, white

Summr
Junior Member
Junior Member
Posts: 19
Joined: 2009-07-19, 15:23 UTC
Location: Hungary

Post by *Summr »

As I know there isn't a compiler switch for that and it's a big flaw I think. But even if there was, when somebody wants to code a unicode plugin and provide the Ansi interface too for the older TC then PChar as general type would be
incorrect. It's like if you use TCHAR* for Ansi functions in C, but you compile it as unicode.
Plugins: RamCopy, Transformer Framework
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You mean that Delphi 2009 is Unicode-only now, and cannot create any programs for Win9x/ME any more?
Author of Total Commander
https://www.ghisler.com
Summr
Junior Member
Junior Member
Posts: 19
Joined: 2009-07-19, 15:23 UTC
Location: Hungary

Post by *Summr »

Basically delphi 2009 is unicode (unlike the previous versions) but it also knows ansi.
To make it easier for you to understand what i was talking about i show you an example:

1. The following 2 TC api functions in earlier versions than Delphi 2009 work like: (here pchar = pansichar by default)

function FsMkDir (RemoteDir: pchar): bool; stdcall; // Ansi declaration in fsplugin.pas
function FsMkDirW (RemoteDir: pwidechar): bool; stdcall; // Wide declaration in fsplugin.pas-ban

function FsMkDir (RemoteDir: pansichar): bool; stdcall; // This is how delphi handles the Ansi declaration
function FsMkDirW (RemoteDir: pwidechar): bool; stdcall; // This is how delphi handles the Wide declaration

2. The situation is the following starting from Delphi 2009: (here pchar = pwidechar by default)

function FsMkDir (RemoteDir: pchar): bool; stdcall; // Ansi declaration in fsplugin.pas
function FsMkDirW (RemoteDir: pwidechar): bool; stdcall; // Wide declaration in fsplugin.pas-ban

function FsMkDir (RemoteDir: pwidechar): bool; stdcall; // This is how delphi 2009 handles the Ansi declaration
function FsMkDirW (RemoteDir: pwidechar): bool; stdcall; // This is how delphi 2009 handles the Wide declaration

So as you see there isn't any problem with the types before delphi 2009, because pchar is pansichar and it works as it's expected.
But from delphi 2009 FSMkDir receives pwidechar in fact (since pchar is pwidechar) so it causes type incompatibility. TC sends pansichar, but receives pwidechar in the RemoteDir parameter
Plugins: RamCopy, Transformer Framework
Giovanni
Member
Member
Posts: 154
Joined: 2005-03-23, 18:28 UTC

Post by *Giovanni »

ghisler(Author) wrote:You mean that Delphi 2009 is Unicode-only now, and cannot create any programs for Win9x/ME any more?
Correct - the Embarcadero website states that Delphi 2009 has dropped support for Windows 9x, ME, NT4 - "applications compiled with Delphi 2009 will not work on those versions of Windows".
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for the clarifications!
Author of Total Commander
https://www.ghisler.com
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

Is it still beta?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The official plugin descriptions for TC 7.50 have been available on our plugins page on www.ghisler.com for a while now. Please download them from there:
http://www.ghisler.com/plugins.htm
Author of Total Commander
https://www.ghisler.com
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

I have questions:
-The wcx documentation doesn't state anything about file extensions. Should we use wcx or uwcx?

ReadHeader is still listed as required, but the Unicode page states "use ReadHeaderEx". Could you clarify?

My plugin exports Unicode versions of all required functions, but I get "this is not a valid plugin". :?
Do I have to support legacy TC versions?

ADDED:
I found a mistake:
ReadHeaderEx is listed as ANSI-only.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

- uwcx should be used only when there are two separate plugins for ANSI and Unicode. If there is only one plugin, use just WCX.

- You MUST implement the basic ANSI functions which are listed as required. You can return just "no more files" or other error if you are sure that no one with TC 7 or older will want to use the plugin, but the functions must be there.

- Support not, but export them (see reply to your second question). Why? This should prevent crashes of older TC versions installed on the same computer when they load your plugin.
Author of Total Commander
https://www.ghisler.com
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

Thanks for the reply.
I'll export these functions, however I think that you're overcautious. Older TC versions won't crash because they refuse to load a plugin w/out exports that they understand. ;)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Well, but they could show errors all the time about missing functions, which would be very annoying...
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

In FSPLUGIN.HLP it is said for the CryptProc() function
See the WebDAV plugin sources for an example on how to use these functions.
However if I check the source of webdav_src.zip there are no functions CrpytProc()/FsSetCryptCallback().
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, it seems that I added it only to my SFTP plugin, but not yet to the webDAV plugin. Therefore please check the code of the SFTP plugin instead:
http://ghisler.ch/board/viewtopic.php?t=19994
Author of Total Commander
https://www.ghisler.com
Lufti
Junior Member
Junior Member
Posts: 3
Joined: 2006-02-13, 13:09 UTC
Contact:

Post by *Lufti »

Hello,

there is a mistake in the [face=courier]RequestProcT[/face] implementation (in [face=courier]cunicode.cpp[/face]) leading to a wrong ansi callback function being called; here is an excerpt:

Code: Select all

BOOL RequestProcT(...)
{
    if (RequestProcW) {
        ...
    } else if (LogProc) { // wrong callback
        ...
}
Must be changed to the following in order to have the correct callback function called:

Code: Select all

BOOL RequestProcT(...)
{
    if (RequestProcW) {
        ...
    } else if (RequestProc) { // ok
        ...
}
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks, I will fix it!
Author of Total Commander
https://www.ghisler.com
Post Reply