FsGetFile: WFX can cause exception or degraded functionality

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
mvf
Junior Member
Junior Member
Posts: 2
Joined: 2010-07-03, 20:29 UTC

FsGetFile: WFX can cause exception or degraded functionality

Post by *mvf »

Hi there,

I wanted to report a minor bug with TC 7.55a:

WFX plugins can provide file download functionality by implementing

[face=courier]int __stdcall FsGetFile(char* RemoteName, char* LocalName, int CopyFlags, RemoteInfoStruct* ri);[/face]

If [face=courier]FsGetFile[/face] returns [face=courier]FS_FILE_OK[/face] after modifying the contents of its [face=courier]RemoteName[/face] parameter, TC may misbehave or encounter an exception.

Steps to reproduce:

- In your [face=courier]FsGetFile[/face] implementation, change [face=courier]RemoteName[/face]'s contents (in the scenarios below I replaced all backslashes with slashes).
- Return [face=courier]FS_FILE_OK[/face].
- In TC, enter a directory provided by the plugin.


Manifestation #1: Edit

- Open the editor (F4) on a file provided by the plugin

Observed:

Code: Select all

---------------------------
Total Commander 7.55a
---------------------------
Access violation at address 00528AC4. Write of address 00000000.
Access violation at address 00528AC4. Write of address 00000000
Windows XP SP3 5.1 (Build 2600)

Please report this error to the Author, with a description
of what you were doing when this error occurred!

Windows exception: C0000005
Stack trace:
00528AC4
6BD90B  673F5F  67457B  5F761C  67DF26  544F3F
419294  414560  4431E1  4465CF  4447B5  445C6F
4431E1  4447B5  445132  >414560  4446F3  414560
419C2C  419CC4  6C0F31  
Raw:
76005A  6BD90B  6BDCBD  6BDDB7  673F5F  6BD90B
6BDCBD  6BDDB7  673F5F  6B61CF  40208E  402212
402235  6731B3  67396C  4446F3  414560  40208E
4023B3  4023DB  4026A4  4036AD  403796  432390
6BD90B  646E2B  646E5B  40208E  402212  402235
6BDC75  6BDAD0  6BD861  6BD861  67A54B  6BDCBD
63DA96  445401  4330EF  6BD861  6BA127  6BD861
6BA127  6BA127  6BDCBD  6BDDB7  6BA393  6BDCBD
6BDDB7  6BA393  6BA205  6BA393  6BA205  6BA198
6BA835  6BA844  6BA835  6BA835  6BA835  68A396
Manifestation #2: Quick View

- Open quick view (Ctrl+Q) on a file provided by the plugin

Observed: Instead of the file contents, only a question mark ("?") is displayed in the quick view panel.

Manifestation #3: Browsing Search Results

- On a path provided by the plugin, run a file search that finds at least one file.
- Within the search dialog, in the bottom pane listing the found files, invoke Lister (F3 or "View" button).

Observed: Instead of showing Lister, TC displays an empty message box with a warning icon and the caption "File not found!".

The following instances of [face=courier]FsGetFile[/face] seem to work even when the plugin clobbers [face=courier]RemoteName[/face]:

- Text-enabled searches, when FsGetFile is invoked for each file (although the results can't be viewed in Lister due to #3)
- Opening Lister outside of the search dialog
- Copying files

EDIT: Updated for 7.55a

Kind regards,
--
Matthias
User avatar
MVV
Power Member
Power Member
Posts: 8704
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

One question - why do you modify RemoteName parameter that TC doesn't expect to be modified? :?:
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48231
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed you shouldn't modify the RemoteName parameter.
Author of Total Commander
https://www.ghisler.com
mvf
Junior Member
Junior Member
Posts: 2
Joined: 2010-07-03, 20:29 UTC

Post by *mvf »

Well, this is embarassing. I was in fact changing the LocalName parameter because I have to access the local file using a library that expects slashes where normal Windows paths have backslashes. I just re-read the docs and they state that the path may not be changed. I now just restore LocalName to its previous contents before returning from FsGetFile.

Sorry for wasting your time. Must be the heat. :oops:
User avatar
MVV
Power Member
Power Member
Posts: 8704
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Maybe it would be easier to make string copy and modify it as you need instead of double-modification that can cause bugs? It is much more correct programming style.
Post Reply