Nasty Pathing bug - Programs launched from Button Bar

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Nasty Pathing bug - Programs launched from Button Bar

Post by *Balderstrom »

I noticed some odd behaviour when I had DiskMon running the other day. I just tested in both 7.55a and 7.56a

With the following button:

Code: Select all

TOTALCMD#BAR#DATA
"%ProgramFiles%\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe"
%P%S
%ProgramFiles%\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe
Media Player Classic
%ProgramFiles%\K-Lite Codec Pack\Media Player Classic\

-1
Notice there are quotes around the Command/Program to be launched.

Yet Total Commander looks for the file "Program.exe" in my system drive, before parsing "Program Files" and with an app placed there (I renamed one of the SysInternal tools to Program.exe, and placed it in my system drive). TC launches that program and not Media Player Classic. TC never finishes parsing the path to launch what should of been the command.

It does not affect TC's command prompt, nor the DirectoryMenu.
It occurs on the Button, whether or not quotes are used.
And even if you replace %ProgramFiles% with the appropriate folder/path, and use quotes or don't, still occurs.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Strange, TC passes the full path to Windows ShellExecuteEx. Are you sure that you have double quotes around the program name? If you put it like that in the ini, the double quotes will be lost when loading them.
Author of Total Commander
https://www.ghisler.com
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, Christian.

I am afraid I can confirm Balderstrom's report.

In order to reproduce it you have to
  • have an executable file named C:\program.exe
    (I used a copy of Notepad2.exe, the editor. But it does not really matter. The name is what matters.)
  • create a button.
    Commandline e.g. "C:\Program Files\Java\Jre6\Bin\javacpl.exe" or "%ProgramFiles%\Java\Jre6\Bin\javacpl.exe" or use Balderstrom's example provided the program exists on your machine. (The double quotes do exist and should exist.)
  • Click the button. The executable file which will be launched will be C:\program.exe. And it will complain that it cannot open the file "C:\Program Files\Java\Jre6\Bin\javacpl.exe".
  • Renaming C:\program.exe to C:\program_.exe is sufficient to make the problem disappear.
Total Commander 7.56a
Windows 7 Enterprise, 32-bit / Windows 2003 Std Sp2 32-bit

Kind regards,
Karl
--
P.S.:
The problem is meaner than initially reported:
As long as the executable file C:\program.exe exists, it is not possible to launch a command line "C:\Program Files\Java\Jre6\Bin\javacpl.exe" from the T.C. commandline, either. Same result as by clicking the button.
--
P.S. 2:
Hm, the source of the reported problem must be related to the executable file itself which you assigned to the button as well:
Launching this command, "%programfiles%\7-zip\7zFM.exe" on the same machine, having C:\program.exe still in place, works without any problem. C:\program.exe does not get launched.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

FileMon output (meant FileMon not DirMon in OP) after reparsing of path (Editted real paths to protect the innocent ;)

Code: Select all

9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\Users\Foobar\Application Data\TotalCMD\GUI\ToolBars\†\Programs.Bar	REPARSE	Options: Open  Access: Read	
9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KU\C\Foobar\Application Data\TotalCMD\GUI\ToolBars\†\Programs.Bar	REPARSE	Options: Open  Access: Read	
9:22:29 AM	TotalCMD.exe:1784	QUERY INFORMATION	C:\Program Files\	SUCCESS	Attributes: DRA
9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\	SUCCESS	Options: Open Directory  Access: 00100001	
9:22:29 AM	TotalCMD.exe:1784	DIRECTORY	C:\	SUCCESS	FileBothDirectoryInformation: Program Files	
9:22:29 AM	TotalCMD.exe:1784	CLOSE	C:\	SUCCESS		
9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic	REPARSE	Options: Open Directory  Access: 00100020	
9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic	REPARSE	Options: Open Directory  Access: 00100020	
9:22:29 AM	TotalCMD.exe:1784	QUERY INFORMATION	C:\Program	NOT FOUND	Attributes: Error	
9:22:29 AM	TotalCMD.exe:1784	QUERY INFORMATION	C:\Program.exe	SUCCESS	Attributes: A	
9:22:29 AM	TotalCMD.exe:1784	QUERY INFORMATION	C:\Program.exe	SUCCESS	Attributes: A	
9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\Program.exe	SUCCESS	Options: Open  Access: 00100020	
9:22:29 AM	TotalCMD.exe:1784	CLOSE	C:\Program.exe	SUCCESS		
9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic	REPARSE	Options: Open  Access: Read-Attributes	
9:22:29 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic	REPARSE	Options: Open  Access: Read-Attributes	
9:22:29 AM	Program.exe:1080	QUERY INFORMATION	C:\Program.exe	SUCCESS	FileNameInformation	
These lines, should not be occuring:
9:22:29 AM TotalCMD.exe:1784 QUERY INFORMATION C:\Program NOT FOUND Attributes: Error
9:22:29 AM TotalCMD.exe:1784 QUERY INFORMATION C:\Program.exe SUCCESS Attributes: A
9:22:29 AM TotalCMD.exe:1784 QUERY INFORMATION C:\Program.exe SUCCESS Attributes: A
9:22:29 AM TotalCMD.exe:1784 OPEN C:\Program.exe SUCCESS Options: Open Access: 00100020
9:22:29 AM TotalCMD.exe:1784 CLOSE C:\Program.exe SUCCESS
And when launched from TC's Command-Prompt, paste the quoted path directly there. They do not occur at all.

Code: Select all

9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\TotalCMD\Data\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\TotalCMD\Data\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Users\FooBar\Application Data\TotalCMD\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KU\C\FooBar\Application Data\TotalCMD\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\TotalCMD\Data\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\TotalCMD\Data\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Users\FooBar\Application Data\TotalCMD\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KU\C\FooBar\Application Data\TotalCMD\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\TotalCMD\Data\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\TotalCMD\Data\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Users\FooBar\Application Data\TotalCMD\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KU\C\FooBar\Application Data\TotalCMD\wincmd\wincmd_Shortcuts.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	QUERY INFORMATION	C:\Program Files	SUCCESS	Attributes: DRA	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\	SUCCESS	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	DIRECTORY	C:\	SUCCESS	FileBothDirectoryInformation: Program Files	
9:47:36 AM	TotalCMD.exe:1784	CLOSE	C:\	SUCCESS		
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic\	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\	SUCCESS	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	DIRECTORY	C:\	SUCCESS	FileBothDirectoryInformation: Program Files	
9:47:36 AM	TotalCMD.exe:1784	CLOSE	C:\	SUCCESS		
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\desktop.ini	REPARSE	Options: Open  Access: Read	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic\	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic	REPARSE	Options: Open Directory  Access: 00100001	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: 00120189	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: 00120189	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: Read-Attributes	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\Program Files\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: 00100020	
9:47:36 AM	TotalCMD.exe:1784	OPEN	C:\mnt\HD3\W2KB\C\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe	REPARSE	Options: Open  Access: 00100020
9:47:36 AM	TotalCMD.exe:1784	QUERY INFORMATION	C:\Program Files	SUCCESS	Attributes: DRA	
9:47:36 AM	mpc-hc.exe:1408	OPEN	C:\Program Files	REPARSE	Options: Open Directory  Access: 00100020	
Notice, there are no "NOT FOUND" lines, nor "Program.exe" lines in the output from launching directly from TC's command-prompt.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Deleted.
Last edited by Balderstrom on 2010-12-21, 02:32 UTC, edited 1 time in total.
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, Balderstrom.

I have got no doubt that some kind of bug exists, in particular as I can reproduce it. I am not sure whether it is Total Commander alone that is to be blamed.

Reason:

As explained before, whether C:\program.exe will be launched or not also depends on which executable file I launch from the buttonbar in Total Commander.

Example (C:\program.exe still exists, it is still Notepad2.exe by the way).
If I click on a button which starts
"C:\Program Files\Adobe\ReaderX\Reader\AcroRd32.exe"
C:\program.exe will not be started. AcroRd32.exe comes up as expected.
So there is no hint that T.C. might commit a mistake or Windows itself.

If I click on a button, however, which starts
"C:\Program Files\Java\jre6\bin\javacpl.exe"
C:\program.exe will be launched and there will be an error message stating:
Notepad2: "C:\Program Files\Java\jre6\bin\Files\Java\jre6\bin\javaw.exe -Xbootclasspath/a:"C:\Program Files\Java\jre6\lib\deploy.jar" -Duser.home="C:\Users\Karlchen" com.sun.deploy.panel.ControlPanel" not found.
Would you like to create this file?
If C:\Program.exe does not exist, the same commandline ("C:\Program Files\Java\jre6\bin\javacpl.exe") works fine.
So in this case some component, (T.C., the Windows API, what else?) must commit a mistake.

One unanswered question is what the difference may be between an executable file called by a T.C. button that triggers the error and an executable file called by a T.C. button that does not trigger the error.

The executable file which is launched by the T.C. button seems to have an impact as well, not just Total Commander.

Kind regards,
Karl
--
P.S.:
The error can occur on
+ Windows 7, 32-bit
+ Windows Vista, 32-bit
+ (maybe other Windows versions?)
using
+ Total Commander 7.56a, 7.55a, 7.50a
+ (maybe other Total Commander versions?)
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I imagine your install of Acrobat has something like this:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Applications\WinRAR.exe]

[HKEY_CLASSES_ROOT\Applications\WinRAR.exe\shell]
"FriendlyCache"="WinRAR archiver"
"FriendlyCacheCTime"=hex:e9,fe,78,85,4b,c4,ca,01

[HKEY_CLASSES_ROOT\Applications\WinRAR.exe\shell\open]

[HKEY_CLASSES_ROOT\Applications\WinRAR.exe\shell\open\command]
@="\"F:\\Program Files\\WinRAR\\WinRAR.exe\" \"%1\""
But that registry info should be irrelevant to the ButtonBar, no?
Note: Issue does NOT occur with WinRAR on a Button.

mpc-hc.exe is launched normally/expectedly:
  • TC: A quoted path placed in TC's Command-line.
  • TC: A quoted (or unquoted) path placed in TC's StartMenu.
  • TC: A quoted (or unquoted) path placed in TC's DirMenu.
  • A quoted (or unquoted) path Pasted directly into an Explorer "address bar"
  • A quoted (or unquoted) path placed in the Windows RunBox. (Win+R)
  • A quoted (or unquoted) path launched via AHK.
    eg: Run, F:\Program Files\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe
  • A quoted path, directly launched from a real command prompt.
  • A quoted path, launched with "START" from a command prompt.
  • A normal windows shortcut.
  • Quoted path, launched from Nyacus shell.
  • Quoted path, launched from nScript shell.
I don't have any other Launcher type programs around any longer. Nor do I know of any other ways to launch programs in windows, aside from perhaps Jscript or wscript - and I don't use those.

So I'd say the issue is with the way TC is parsing paths from the Button Bar, since it doesn't occur with it's own command prompt or DirMenu items.

Though it appears to be solely an issue with Program Files.
I've been unable to reproduce it with other directories.

And if I create a folder C:\Program
TC tests that it is a directory, then continues to parse the path and then launches MPC-HC.exe as I would of expected.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Strangely the error does not occur here on Windows 7 x64. I will try to check it in a debugger, but I fear that I cannot do much about it.

Btw, c:\ is write-protected for files on Windows Vista/7, so there is no big risk anyway.
Author of Total Commander
https://www.ghisler.com
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hm, strange enough, but I have not been able to reproduce the problem on a Server2008 R2 (64-bit i.e.), either.

Will crosscheck on my private Win7 64-bit as soon as possible.

Karl
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have checked it in the debugger now: The problem seems to be the %S parameter. For some strange reason, TC then uses CreateProcess instead of ShellExecuteEx. I don't remember why this is done, but I will try to change it to ShellExecuteEx in the next beta test.
Author of Total Commander
https://www.ghisler.com
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Uhm ...

Balderstrom uses %S, true.
As a matter of fact, I have not done so when reproducing the problem.

:? Karl :?
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Merry Christmas, Christian.

Now it was possible to reproduce the behaviour reported by Balderstrom on Windows 7 Home Premium 64-bit, but without using the button parameter %N%S or %S.

How to reproduce:
  • In elevated mode copy C:\utils\Notepad2\Notepad2.exe as C:\Program.exe (Notepad2: The improved Notepad editor)
  • Drag and drop "C:\Program Files (x86)\Java\jre6\bin\javacpl.exe" to the T.C. buttonbar to create a new button.
  • Button properties:
    TOTALCMD#BAR#DATA
    "C:\Program Files (x86)\Java\jre6\bin\javacpl.exe"

    C:\Program Files (x86)\Java\jre6\bin\javacpl.exe
    javacpl
    C:\Program Files (x86)\Java\jre6\bin\

    -1
  • Click on this button to launch javacpl.exe
  • Result:
    C:\Program.exe is launched and displays this error message:
    "C:\Program Files (x86)\Java\jre6\bin\Files (x86)\Java\jre6\bin\javaw.exe -Xbootclasspath/a:"C:\Program Files (x86)\Java\jre6\lib\deploy.jar" -Duser.home="C:\Users\karlchen" com.sun.deploy.panel.ControlPanel" not found.
    Would you like to create this file?
  • As Process Hacker reveals the commandline which T.C. spawned does not look correct:
    C:\Program Files (x86)\Java\jre6\bin\javaw.exe -Xbootclasspath/a:"C:\Program Files (x86)\Java\jre6\bin\..\lib\deploy.jar" -Duser.home="C:\Users\karlchen" com.sun.deploy.panel.ControlPanel
    Although the button command field does hold the required double quotes they seem to absent from the commandline that T.C. launched. Who else might have stripped them?
  • Note:
    The file C:\Program.exe does not have to be Notepad2. I tried using ExamDiff.exe as C:\Program.exe. The effect will be the same, only the exact wording of the error message will be different.
  • Note 2:
    The problem cannot be reproduced if you use a different command in the buttonbar e.g. "C:\Program Files (x86)\IrfanView\i_view32.exe". This seems to support my hypothesis posted before that the executable file itself plays an important role as well.
Countercheck:
  • In elevated mode rename C:\Program.exe to C:\Program_.exe
  • Click the javacpl button in T.C.
  • Result: the Java control panel is launched as to be expected
  • Process Hacker displays the commandline like this:
    "C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -Xbootclasspath/a:"C:\Program Files (x86)\Java\jre6\bin\..\lib\deploy.jar" -Duser.home="C:\Users\karlchen" com.sun.deploy.panel.ControlPanel
    Note:
    The required double quotes are present.
Environment:

Windows 7 Home Premium 64-bit
Total Commander 7.56a


Conclusion:

As has been shown in the course of this thread so far:
  • Balderstrom's problem can be reproduced.
  • It is not limited to either 32-bit or 64-bit Windows versions
  • It is not limited to the current T.C. version 7.56a
  • The buttonbar parameter %S may trigger the problem
  • The parameter %S cannot be the only factor triggering the problem as it has been reproduced without using %S
  • The executable file itself which is launched from the buttonbar seems to be a relevant factor as well, because executable files like IrfanView and 7Zip can be launched successfully even though C:\Program.exe is present.
  • Very likely the source of the problem is more complex than initially assumend.
Kind regards,
Karl
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately I can only reproduce it with %S parameter. In this case, TC uses CreateProcess, because only CreateProcess supports command lines up to 64k characters long. ShellExecureEx only supports up to 8k length. I'm not sure why I don't use double quotes in CreateProcess, maybe it didn't work with them - I will have to test that.
Author of Total Commander
https://www.ghisler.com
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, Christian.

I am not quite sure whether you used the right executable file in your buttonbar. :wink:

The problem cannot be reproduced using any executable file. It can be reproduced launching e.g. javacpl.exe.

I assume that one pre-requisite for reproducing is that the executable file which is launched by the button spawns a child process and then exits itself.
(javacpl.exe does exactly this. If this behaviour is a pre-requisite, then it should be feasible finding more such cases, e.g. a number of my much beloved portable apps use "launchers" that set the appropriate environment, launch the actual app and exit.)

Another point is that the required double quotes around the fully qualified executable name have been present inside the button definition all the time.

In case C:\program.exe does not exist, Process Hacker or Process Explorer both display those double quotes in the javacpl commandline. - This suggests that T.C. does not remove the double quotes.

In case C:\program.exe exist, however, both task managers agree that in the commandline there are no double quotes around C:\program files\java\jre\bin\javaw.exe. - This suggests that the double quotes have been removed, but by whom? As javaw.exe must be spawned by javacpl.exe it is not too unlikely the culprit really is javacpl.exe.

The point really may be that Balderstrom reported problem #1 caused by parameter %S and that what was meant as a confirmation of Balderstrom's report actually turns out to be a report about the same symptom but caused by quite a different more tricky mechanism.

Kind regards,
Karl
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, Christian. Hi, Balderstrom.

Why the heck did this idea not occur to me any sooner?

Balderstrom, you reported a problem which is related to the buttonbar parameter %S, as you, Christian, confirmed.

In none of my attempts to reproduce the problem, the parameter %S was present. But I could reproduce the symptom. But only using a few of the executables which ship with Sun/Oracle Java for Windows.

As a matter of fact it is the java executable javacpl.exe which causes the same symptom that you, Balderstrom, reported. javacpl.exe fails to spawn javaw.exe provided C:\program.exe exists.

Portable Pidgin e.g. uses a launcher. This launcher spawns the pidgin.exe and then terminates. Portable Pidgin does not exhibit the same problem as javacpl. It can be launched successfully from the T.C. buttonbar, no matter whether C:\program.exe exists or not.

Conclusion:

The problem reproduced and reported by me is unrelated to Balderstrom's report. (%S parameter)
In my case javacpl.exe itself causes the failure, not Total Commander.
There may be more executable files acting like javacpl.exe and failing in the same situation. So hopefully my report did not only confuse everybody, including myself, but maybe it will also help clear up in similar cases that Total Commander is not the culprit.
Consider my "javacpl.exe" problem accounted for, unsolved, but closed with respect to Total Commander. :)

And sorry, Balderstrom, for unwillingly hijacking your thread. :oops:

Kind regards,
Karl
Post Reply