TC ignores HKCR\* key

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
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

TC ignores HKCR\* key

Post by *icfu »

When executing (by doubleclick or Enter) a file with an unknown extension .ext, i.e. which has no assignment under HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ext and HKCR\.ext, the expected behaviour is to execute the default action under HKCR\* when existing. TC ignores that one and opens the "Open With" dialog instead, despite the rightclick menu shows Notepad painted in bold.

Code: Select all

[HKEY_CLASSES_ROOT\*\shell]
@="Notepad"

[HKEY_CLASSES_ROOT\*\shell\Notepad]
@="Notepad"

[HKEY_CLASSES_ROOT\*\shell\Notepad\command]
@="notepad %1"
works correctly in Explorer and other related file managers.

Icfu
This account is for sale
User avatar
roentgen
Power Member
Power Member
Posts: 757
Joined: 2005-12-03, 19:58 UTC

Post by *roentgen »

2icfu
I just tested with the following:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]
@="TCMD"

[HKEY_CLASSES_ROOT\*\shell\TCMD]
@="TCMD"

[HKEY_CLASSES_ROOT\*\shell\TCMD\command]
@="\"C:\\TotalCMD\\TOTALCMD.EXE\" /o /t \"%1\""
and I get the "Open With" in both TC and explorer. More of it, all un-associated exts get a nasty TC icon :P. Crappy M$ implementation if I may say or there's something else needed to make it work.
TC for Linux please!
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

If TC now really uses ShellExecuteEx with SHELLEXECUTEINFO.lpVerb set to NULL as stated in the history there should be no difference between Explorer and TC.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

You have to rename the HKCR\Unknown key as well – or render it useless by disabling the default action, etc... – this key is executed even before HKCR\*!

Sorry, I forgot to mention this change, it's one of the standard annoyances I remove when installing.... ;)

After this you will see that Explorer will work as I have reported.

Icfu
This account is for sale
User avatar
roentgen
Power Member
Power Member
Posts: 757
Joined: 2005-12-03, 19:58 UTC

Post by *roentgen »

HKCR\Unknown
Quite a nice key :D. I didn't know about it...

However, if we resume ourselves to the standard reg keys (i.e without deleting HKCR\Unknown) I see a clear separation:

- HKCR\* is reserved for assigned/known extentions,
- HKCR\Unknown is designed for... uhm... unknown :D extensions.

Deleting HKCR\Unknown we have the difference between the 2 programs:
- explorer executes the commands under HKCR\* as if there is a known extension, while
- TC is hardcoded with the HKCR\Unknown part in it.

Which is the right behaviour? I don't like explorer's behaviour but I sure don't like TC hardcoded way either.

If I change

Code: Select all

[HKEY_CLASSES_ROOT\Unknown\shell\openas\command]
to have notepad as default action, I see explorer executing notepad and we have TC still showing the "Open with" dialog.



Besides that, depending on your needs, wouldn't HKCR\Unknown be a beter place to place your custom command?
TC for Linux please!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed HKEY_CLASSES_ROOT\* is currently not supported by TC, sorry. The same is true for HKEY_CLASSES_ROOT\Unknown. I could not find any documentation for these keys at Microsoft.

Currently when there is no association, TC calls ShellExecuteEx with verb "openwith". This was recommended somehwere in the docs (sorry, don't remember where).
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2ghisler(Author)
Currently when there is no association, TC calls ShellExecuteEx with verb "openwith". This was recommended somehwere in the docs (sorry, don't remember where).
14.02.07 Fixed: When pressing ENTER on a file on Windows 2000, XP and Vista, do not search for the default verb, but pass a NULL pointer to ShellExecuteEx
Is this history entry is obsolote?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC still verifies that an association exists, and if there is one, it passes NULL to ShellExecuteEx. If these is no association, TC calls ShellExecuteEx with verb 'openas' on Windows 9x. On Windows 2000/XP/Vista, TC calls ShellExecuteEx with verb 'open' for the command
shell32.dll,OpenAs_RunDLL name_of_doubleclicked_file
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

I think on Windows NT based systems you should call ShellExecuteEx with verb set to NULL even no association exists. This will have the same effect if there is really no association but also consider the currently not detected associations.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

@roentgen:
HKCR\* is reserved for assigned/known extentions
Nope, this key is for all files, no matter if they have a known, unknown or no extension at all.
Besides that, depending on your needs, wouldn't HKCR\Unknown be a beter place to place your custom command?
It would in theory (if TC would support it), but that key is difficult to handle from the user's point of view. For example if you add a default open action in there, the context menu entry "Open With" will be renamed to "Open" while functionality is still intact, but you aren't able to differentiate anymore. From my own experiences it's better to either leave that key as is or nuke it, which is what I prefer for several reasons.

As you can see here, I also kill the standard "Open With" functionality and replace it with a static "Open With" entry which works for all files, because the default Windows way has a severe limitation: several extensions are blocked, you cannot add alternative applications (to Exe files, for example).

Code: Select all

[HKEY_CLASSES_ROOT\*\shell\OpenAs]
@="Open with..."
[HKEY_CLASSES_ROOT\*\shell\OpenAs\command]
@="rundll32.exe shell32.dll,OpenAs_RunDLL %1"
[-HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Open With]
[-HKEY_CLASSES_ROOT\Unknown\shell]
Which is the right behaviour? I don't like explorer's behaviour but I sure don't like TC hardcoded way either.
Explorer's behaviour can at least be corrected if you don't like Open With functionality by manipulating the registry.

@Lefteous and ghisler:
I think on Windows NT based systems you should call ShellExecuteEx with verb set to NULL even no association exists. This will have the same effect if there is really no association but also consider the currently not detected associations.
Indeed, this would solve another problem as well:
TC would also execute files without any extension, without the need to create an HKCR\. (dot) or HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\. (dot) key.

Icfu
This account is for sale
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

I can't beleave that this won't be changed. It's clearly a bug. :evil:
Post Reply