PuTTY with Windows 7 jumplist support

Geplaatst door Daniel B. Roy op 29 januari 2010

Tag(s): Hobbyprojecten, Open Source

[UPDATE 2011-07-14: With the release of PuTTY 0.61, jumplist support is now natively included in PuTTY, rendering this patch unnecessary. I've removed the download links from this article, please go to the PuTTY site to download the latest version of PuTTY.]

One of Windows 7's neater additions is the jumplist (my Mac Fanboy co-workers would actually call this a 'stolen UI idea'). This is a really handy thing for PuTTY, because it would allow you to start a saved session directly, without having to start PuTTY first and then double-clicking the session. You would then have a type of shortcut to saved sessions and as an added bonus save one valuable mouse-click in the process. Also, by pinning items in the jumplist, this offers a recent and favorite sessions functionality. Since PuTTY is open source, I decided to download the code and add this functionality myself. The resultant new version of PuTTY is downloadable below.

The jumplist is an application specific list, that can contain items defined by the application, for instance a list of recently opened documents or a list of favorites defined in the application. The list is persistent across application restarts and is accessed by right clicking the taskbar button of a running application or the icon of a pinned non-running application. For MS Word the jumplist looks like this:

With my changes added in, a saved session is added to the PuTTY jumplist when it is started by doubleclicking it in the config screen, or started from the command line with the "-load" parameter. Clicking a saved session in the jumplist will start it in PuTTY. The result can be seen below. As you can see, it is also possible to pin frequently used saved sessions in the jumplist as a kind of favorites.

I sent the changes to the PuTTY team and they have added them to the wishlist on their site. If you like them, please don't hesitate to petition the PuTTY maintainers to add this code to the actual program.


For those that are interested, I'll give some more details about the code. I used this excellent set of posts on the Microsoft site as a guide to the implementation, combined with the online MSDN library.

One thing to be aware of as a programmer is that the jumplist is write-only. You can't read what your jumplist currently looks like. Every time you want to change or update the jumplist, you have to rebuild it from scratch, not being able to access the old list. So, even if you're just adding one item to the top of the list you have to already know what all the other items that are staying in the list were, because from code you can't find out.

Obviously, this means that as a program you need to store the contents of your jumplist in your own persistent storage, so you know what your list looked like the last time you created it. I used the registry for this, adding an extra key to PuTTY's existing storage location.

Also, not being used to C programming, I spent quite some time mucking about with lowlevel string processing and calling COM functions from C code. COM being a technology that is built around OOP, quite some plumbing is required to connect the classless language C to the COM subsystem. The Windows 7 SDK header files do take a lot of that pain away though.

My general approach was as follows:

  1. Download the putty bleeding-edge source files from their SVN repository.
  2. Add Windows 7 header files to the project, using the Windows 7 SDK. Required for using the COM subsystem from C.
  3. Create functions to manipulate the internal registry list of jumplist entries. These functions add and remove items from the registry list.
  4. Create functions for manipulation of the jumplist. For instance: the function add_session_to_jumplist() first uses a function from 3 to update the registry list and then recreates the jumplist.
  5. Insert calls to functions from 4 in several places in the code. Specifically I had a session added to the jumplist when it is double clicked or opened with the commandline '-load' parameter.

The resultant sourcecode patch can be downloaded from the PuTTY site or below and contains extensive comments. I hope anyone else creating this type of thing finds them helpful.

Please beware that by downloading and using this adapted version of putty, you are implicitly saying that you trust me. If I am evil than I could have modified the file below to send your sensitive SSL keys and information directly to my mailbox. I didn't, of course, but you need to be aware of the possibility.

I hope this addition to one of my favorite programs is useful to you.


Geplaatst door Max op 7 april 2010 uur:
Thank you!
Geplaatst door Richard Leahy op 28 april 2010 uur:

I can't get this to compile when replacing the source files with those attached. I am using Visual Studio C++ 2008 Express and have installed the Windows 7 SDK.

Can anyone help? Anyone had the same problem?

Geplaatst door Pěna op 1 mei 2010 uur:
Thank you very much especially for the compiled binaries. That's exactly what I was looking for ;-)
Actually there is one little thing... it seems like it has some kind of archaic interface in comparsion to official releases on http://www.chiark.greenend.org.uk/~sgtatham/putty/
Geplaatst door Mike op 13 mei 2010 uur:
Very cool.
Just what I have been looking for.
Geplaatst door Sascha Fuhrmann op 14 mei 2010 uur:
Pinning don't work for me. I can pin a session, but when i close the session the icon don't stay in taskbar :-(
Geplaatst door Daniel op 16 mei 2010 uur:
@Sascha Fuhrmann: remember that you must pin the PuTTY program to the taskbar, so that the icon will remain in the taskbar when PuTTY closes.

To do this, while PuTTY is running rightclick the taskbar button and choose the option 'Pin this program to taskbar' (near the bottom of the list)
Geplaatst door Magnus Österlind op 26 mei 2010 uur:
Very nice!
I've been adding jumplist support in my application, and I've noticed that you have the same problem as I do. If you remove all but 1 item from the list, and pin this item, the item doesn't move to the "pinned" folder directly, but you have to open/close the taskbar for it to be refreshed.
Any idea on what could be causing this weird behavior?
Geplaatst door PhazeonPhoenix op 13 februari 2011 uur:
Have you ever thought of further modifying this patch to be able to read from configuration files? That's the one feature this modification needs.
Geplaatst door James op 1 maart 2011 uur:
Thanks so much it works for me
Geplaatst door Ryan op 17 maart 2011 uur:
Is there a way to force the session you are opening to be maximized?
Geplaatst door Michał Pasternak op 22 april 2011 uur:
Thank you, this is a great idea and it's a shame, that Putty developers didn't add it to the official sources.
Geplaatst door Valeriy op 9 juni 2011 uur:
Thank you! Great Work!
Geplaatst door Curtis Gibby op 29 juni 2011 uur:
Thank you for adding this feature to PuTTY -- it's something that will help my day-to-day SSH connections go much more quickly!
Geplaatst door John Jemmett op 21 juli 2011 uur:
This feature is said to be in version 0.61. Thanks for the help in making it possible.
Geplaatst door Mathias Begert op 26 maart 2012 uur:
Thank you for this, very useful!

Schrijf een reactie:

*optioneel, wordt niet getoond.