New uses: Vista, Telnet, per-protocol settings

Topics: Developer Forum, User Forum
Jun 15, 2007 at 2:02 AM
Edited Jun 15, 2007 at 2:11 AM
Hi All,
I was mucking around with this and came up with something nifty enough to share.

By putting my putty.exe in c:\program files\putty\ and using the built-in recipe, I got putty invoking properly under Vista. I had to set putty's default profile to use ssh and invoke UrlConf with the right-click "run as administrator" option to stop it from having registry access violations.

I then exported the HKEY_CLASSES_ROOT\ssh registry branch, intending to delete the existing telnet branch and replace it with a modified version of the ssh branch (using a find/replace on the .reg file).

So that putty would automatically use the correct connection method when invoked by the telnet or ssh protocol handler, I modified the command line to reference a preset name.

Finally, to allow IE7 to use the telnet protocol handler, I had to re-enable this disabled feature with a registry setting.

I'll still install RegConf on my workmates' PCs for the executable, but then I'll delete the HKEY_CLASSES_ROOT\telnet branch and install the following .reg file:

( Notice the modified "ssh\shell\open\command" key which causes the protocol handler to load a custom preset by name )

<< proto_telnet_ssh.reg >> WARNING: THIS FILE EXPECTS YOU TO HAVE DELETED THE [HKEY_CLASSES_ROOT\telnet] BRANCH

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_DISABLE_TELNET_PROTOCOL]
"iexplore.exe"=dword:00000000

[HKEY_CLASSES_ROOT\ssh]
"URL Protocol"=""
@="URL:SSH Protocol"

[HKEY_CLASSES_ROOT\ssh\shell]

[HKEY_CLASSES_ROOT\ssh\shell\open]

[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="\"C:\\Program Files\\UrlConf\\UrlConf.exe\" \"%1\" port=22 -- \"C:\\Program Files\\PuTTY\\PuTTY.exe\" -load proto_ssh $h"

[HKEY_CLASSES_ROOT\telnet]
"URL Protocol"=""
@="URL:telnet Protocol"

[HKEY_CLASSES_ROOT\telnet\shell]

[HKEY_CLASSES_ROOT\telnet\shell\open]

[HKEY_CLASSES_ROOT\telnet\shell\open\command]
@="\"C:\\Program Files\\UrlConf\\UrlConf.exe\" \"%1\" port=22 -- \"C:\\Program Files\\PuTTY\\PuTTY.exe\" -load proto_telnet $h"

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\proto_ssh]
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\proto_telnet]

!!! session settings are deleted due to posting space constraints. You will need to save your own preferred settings under these profile names rather than importing mine. Remember putty has both registry and file-based setting save modes, obviously I am using registry.
Coordinator
Jun 22, 2007 at 4:38 PM
Edited Jun 22, 2007 at 4:39 PM
Hi,

and thanks for sharing!

Good to know UrlConf is usable under Vista, too. I've not yet made the switch myself..

By the way, Putty can handle telnet URLs natively, so you don't need UrlConf.exe as a middle man. You could replace this:

@="\"C:\\Program Files\\UrlConf\\UrlConf.exe\" \"%1\" port=22 -- \"C:\\Program Files\\PuTTY\\PuTTY.exe\" -load proto_telnet $h"

with this:

@="\"C:\\Program Files\\PuTTY\\PuTTY.exe\" -load proto_telnet \"%1\""

Hrm, something like this should be available as a canned recipe in UrlConf. Time for me to dust off the compiler, I guess. :-)

If the only difference between the presets proto_ssh and proto_telnet is (as the name suggests) the protocol, then you could replace -load proto_telnet with -telnet and -load proto_ssh with -ssh and then get rid of the two presets. Well, in the telnet case you wouldn't need it at all, because Putty can derive it from the URL, i.e., this would be enough:

@="\"C:\\Program Files\\PuTTY\\PuTTY.exe\" \"%1\""

In any case, I should change UrlConf to explicitly request the SSH protocol (-ssh) in the canned recipe!

Why do you need to delete HKEY_CLASSES_ROOT\telnet first? As far as I can see your .reg file should overwrite all the essential parts, i.e. it should work without deleting. Maybe this is Vista protecting the Registry?