My WFX plugin can't be loaded properly

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

Moderators: white, Hacker, petermad, Stefan2

Post Reply
speller2
Junior Member
Junior Member
Posts: 91
Joined: 2009-01-26, 13:49 UTC
Location: Russia

My WFX plugin can't be loaded properly

Post by *speller2 »

Hi, I've lost all my plugging skills since last time I did that about 10 yrs ago.

I'm trying to create a new plugin in FPC. It's a 64-bit/Unicode plugin only. I created a dll with the wfx64 extension, it's loaded by the TC process, its entrypoint is executed, but then TC shows the following error box:

Code: Select all

---------------------------
Total Commander
---------------------------
Error, could not load plugin!
---------------------------
ОК   
---------------------------
And doesn't call any of the functions in the dll. I'm exporting FsInitW, FsFindFirstW, FsFindNextW functions. But never have a breakpoint stopped inside them (but it's stopped in the entrypoint). The dll exports the mentioned functions 100%.

What I'm doing wrong?
speller2
Junior Member
Junior Member
Posts: 91
Joined: 2009-01-26, 13:49 UTC
Location: Russia

Re: My WFX plugin can't be loaded properly

Post by *speller2 »

Ah, forgot the TcFindClose function, it's not mentioned as obligatory in the help file toc...
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: My WFX plugin can't be loaded properly

Post by *Dalai »

Uh, FsFindClose function is in the Mandatory section of the Filesystem plugin guide...

Nonetheless it would be nice if TC would tell more details about what's wrong/missing.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
speller2
Junior Member
Junior Member
Posts: 91
Joined: 2009-01-26, 13:49 UTC
Location: Russia

Re: My WFX plugin can't be loaded properly

Post by *speller2 »

I was looking at the TOC section of the HLP file. There's no TcFindClose function there. That's my fault I had read the guide text after posting this thread. This thread can be deleted.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: My WFX plugin can't be loaded properly

Post by *ghisler(Author) »

No need to delete it, it may help other plugin writers too.
Author of Total Commander
https://www.ghisler.com
speller2
Junior Member
Junior Member
Posts: 91
Joined: 2009-01-26, 13:49 UTC
Location: Russia

Re: My WFX plugin can't be loaded properly

Post by *speller2 »

Hm, now I have the same error with the 32-bit version. The entrypoint section of the plugin dll is executed but then the same error and nothing more is called. TC 9.51 32 bit. All mandatory functions exported: FsInitW, FsFindFirstW, FsFindNextW, FsFindClose.
speller2
Junior Member
Junior Member
Posts: 91
Joined: 2009-01-26, 13:49 UTC
Location: Russia

Re: My WFX plugin can't be loaded properly

Post by *speller2 »

The 32-bit version doesn't support Unicode functions??? When I switched from FsInitW, FsFindFirstW, FsFindNextW to FsInit, FsFindFirst, FsFindNext it started working. Why no unicode in 32-bit?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: My WFX plugin can't be loaded properly

Post by *Dalai »

The 32-bit version supports Unicode of course:
TC WFX guide, Unicode section wrote:Total Commander will call the Unicode functions on all NT-based systems (Windows NT, 2000, XP, Vista, 7) if they are present.
But as is stated in the plugin guide, the ANSI functions are still mandatory. They can just do nothing and return an error but they need to be available to TC. Not sure if Unicode only function export would work if the plugin file is named .uwfx (letter u before the rest of the extension).

Summary: Simple ANSI plugins work when exporting FsInit, FsFindFirst, FsFindNext and FsFindClose. Unicode plugins need to export the ANSI functions and their Unicode counterparts, i.e. FsInitW, FsFindFirstW and FsFindNextW.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: My WFX plugin can't be loaded properly

Post by *ghisler(Author) »

The 32-bit plugin requires the ANSI functions because people may install it on older Windows versions which do not support Unicode. It's OK to just return an error, or show an error message in FsFindFirst and only implement the W functions.

There is no such requirement in the 64-bit version because all 64-bit versions of Windows support Unicode.

Please do not call your plugin <name>.uwfx. The uwfx extension should only be used when there are separate ANSI and Unicode versions of the plugin. Then both files need to be present.
Author of Total Commander
https://www.ghisler.com
speller2
Junior Member
Junior Member
Posts: 91
Joined: 2009-01-26, 13:49 UTC
Location: Russia

Re: My WFX plugin can't be loaded properly

Post by *speller2 »

Thanks for the explanation! Could you also add this info to the guide on GitHub?
Post Reply