Buttonbar icon with %P%S does not always work on search result

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

tm8544
Junior Member
Junior Member
Posts: 30
Joined: 2008-11-29, 08:11 UTC
Location: Finland

Buttonbar icon with %P%S does not always work on search result

Post by *tm8544 »

1. Serch files from Server, e.g. *.txt
2. Feed the searchresult to listbox
3. Try to open a resultfile for viewing/editing using buttonbar with %P%S in parameters
4. File can not be opened. Instead on UNC-filename \\192.168..... editor gets filename C:\192.168......

If edited by pressing F4, there is no problem

If search is done on the computers own drives, everything works ok. Searchlist problem exists only when search is done to a server.

When buttonbaricon is used to view/edit a server file directly from source or target directory, everything works fine.

See attached image when there was a file named \\192.168.0.90\Varasto\Adsl\IP-kamera\kamera.txt in searchlist
Image: https://ht23.dy.fi/julkinen/2024-12-27-210501.png
tm8544
Junior Member
Junior Member
Posts: 30
Joined: 2008-11-29, 08:11 UTC
Location: Finland

Re: Buttonbar icon with %P%S does not always work on search result

Post by *tm8544 »

forgot to mention TC version: TC 11.50 RC4 (x64)
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Buttonbar icon with %P%S does not always work on search result

Post by *petermad »

I can confirm that when using %P%S (or %S or %R) in Search results on remote Server, then the first \ in the path is removed - so instead of passing \\Server\path\file TC passes: \Server\path\file

It Works OK when using %P%N (or %N)

This bug appears the first time in TC 11.50b3.

Probably due to this change:
historty.txt wrote:20.10.24 Fixed: Button bar, start menu: Remove any leading backslashes from names in fields %O, %R, %S, e.g. from file system plugin names (32/64)
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Buttonbar icon with %P%S does not always work on search result

Post by *ghisler(Author) »

Confirmed.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Buttonbar icon with %P%S does not always work on search result

Post by *petermad »

history.txt wrote:29.12.24 Fixed: Button bar, start menu: Do not remove any leading duplicate backslashes from names in fields %S, %P%O, %P%S etc., e.g. after searching in UNC path (32/64)
Confirmed fixed in TC 11.50 final :-)
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
AntonyD
Power Member
Power Member
Posts: 1554
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Buttonbar icon with %P%S does not always work on search result

Post by *AntonyD »

It's time to kill the SPAM post)))
Last edited by AntonyD on 2025-01-05, 13:34 UTC, edited 1 time in total.
#146217 personal license
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Buttonbar icon with %P%S does not always work on search result

Post by *white »

Moderator message from: white » 2025-01-04, 10:49 UTC

Spam post removed.
mikeyww
Junior Member
Junior Member
Posts: 42
Joined: 2005-07-02, 02:58 UTC

Re: Buttonbar icon with %P%S does not always work on search result

Post by *mikeyww »

I am experiencing a similar issue with v11.50 x64. I have a Start Menu entry that runs an AutoHotkey script. It has worked for months or years. With 11.50, I get an access error with %P%S but not with %P or %P%N.

For some reason, %P%S does not work when running a program that has its file properties set to run the program as administrator.
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Buttonbar icon with %P%S does not always work on search result

Post by *petermad »

For some reason, %P%S does not work when running a program that has its file properties set to run the program as administrator.
Confirmed.

I tetsted with Notepad++.exe and %P%S - and if I set the properties for Notepad++.exe (Compatibility tab) to run as administrator, then I get a mixed language error message (I am running TC with English language):
---------------------------
Total Commander
---------------------------
File not found!

C:\Program Files\Notepad++\notepad++.exe



"Den handling, der blev anmodet om, kræver administratorrettigheder."
---------------------------
OK
---------------------------
The translation of the Danish part is: "The requested action requires administrator rights".

If I prepend the command in the button with and asterisk - it works. The same if I run TC as administrator.

It also works (without the asterisk) if I use %P%N

But, I see the same behavior in TC 11.03 - so it is not a new thing
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Buttonbar icon with %P%S does not always work on search result

Post by *white »

petermad wrote: 2025-01-04, 22:54 UTC But, I see the same behavior in TC 11.03 - so it is not a new thing
And when using TC 7.0 (in which %S was introduced).
And when configuring TC to use Notepad++.exe as the editor and clicking the F4 Edit button when a file is selected.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Buttonbar icon with %P%S does not always work on search result

Post by *ghisler(Author) »

2mikeyww
Please provide the exact command and exact parameters you used which worked with 11.03 but not with 11.50.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Buttonbar icon with %P%S does not always work on search result

Post by *white »

2ghisler(Author)
Do you confirm the issues (like petermad and me) when running a program that has its file properties set to run the program as administrator?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Buttonbar icon with %P%S does not always work on search result

Post by *ghisler(Author) »

2white
That's a different problem - mikeyww writes that it worked with older versions but not with 11.50.

The problem you describe happens because when using %S or any other multi-file command, TC switches from launching with ShellExecuteEx to launching with CreateProcess. The reason us that ShellExecuteEx only supports a very limited maximum command line length (8191 for current windows versions), while CreateProcess supports up to 32767 characters.

Unfortunately CreateProcess does not support launching with higher user rights. Put an asterisk * at the start of the command to force launching as administrator with ShellExecuteEx.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Buttonbar icon with %P%S does not always work on search result

Post by *white »

ghisler(Author) wrote: 2025-01-05, 10:55 UTC 2white
That's a different problem - mikeyww writes that it worked with older versions but not with 11.50.
Perhaps, we'll see when he responds.
ghisler(Author) wrote: 2025-01-05, 10:55 UTC Unfortunately CreateProcess does not support launching with higher user rights. Put an asterisk * at the start of the command to force launching as administrator with ShellExecuteEx.
The asterisk doesn't work when configuring the editor in TC.
Would it be possible, or a good idea, to try ShellExecuteEx when CreateProcess fails in this case?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Buttonbar icon with %P%S does not always work on search result

Post by *ghisler(Author) »

The asterisk doesn't work when configuring the editor in TC.
What does this have to do with parameter %S in this thread?
Anyway, I could switch to ShellExecuteEx for the editor, but I fear that it would break a LOT of configurations because programs and parameters are passed to it in a different way than with CreateProcess.
Author of Total Commander
https://www.ghisler.com
Post Reply