When connecting through SSH tunnel, look for plink.exe on PATH

bazzilic posted 2 years ago in Creating a connection

As far as I understood, right now HeidiSQL would not detect plink.exe on PATH. However, if you install PuTTY through Chocolatey, it puts plink on PATH. I would also assume, that many people put putty executables on PATH manually. So, probably, it makes sense for HeidiSQL to check if it's available there.

ansgar posted 2 years ago

I am using CreateProcess() to fire the configured path to plink.exe, with the current directory as lpCurrentDirectory parameter. That does not mean that plink.exe has to exist there - you can always point the path to some other directory. However, I don't know if that also finds a plink.exe somewhere in your path environment without having a folder in the HeidiSQL plink.exe setting. Try it out?

bazzilic posted 2 years ago

Do you pass the path to plink as lpApplicationName or as lpCommandLine? As I understood from MSDN, the first one would not search PATH, and the second one would.

However, it is not entirely clear in the documentation.

bazzilic posted 2 years ago

Also, yeah, I tried before posting, it doesn't see plink on the PATH (I tried putting plink and plink.exe and neither worked).

ansgar posted 2 years ago

Currently, HeidiSQL passes the whole string from the plink.exe setting as lpApplicationName parameter, e.g. c:\some\where\plink.exe.

lpCommandLine is then populated with parameters which plink expects, such as -N -L....

If I read the docs correctly, then I could make use of case 2:

On the other hand, if the CommandLine parameter is non-NULL and the ApplicationName parameter is NULL, then the API attempts to extract the application name from the CommandLine parameter.

With some luck, that case will work with an executable on the path variable:

CreateProcess(nil, 'plink.exe -N -L[more parameters]', ...)
bazzilic posted 2 years ago

From what I got from the docs, it should do the trick.

ansgar posted 2 years ago

r5110 does exactly that. In my tests, I could use a folderless "plink.exe" which then was taken from a folder from my path environment variable. Also, having a folder in that setting does not seem to harm here. Also, having spaces in the path to plink.exe still works here.

Please test yourself after updating heidisql.exe.

bazzilic posted 2 years ago


Please login to leave a reply, or register at first.