Run linux command from wine (fake exe)

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
phaemon
Newbie
Newbie
Posts: 2
Joined: Wed Apr 25, 2012 11:48 am

Run linux command from wine (fake exe)

Post by phaemon »

Hi all,

I'm running HeidiSQL in wine, and it can do ssh tunnels, but only using plink.exe. So can I create a fake plink, that is actually a linux program, that will grab the command line arguments Heidi sends and do my own ssh -L with it?

I tried just calling a bash script plink.exe but wine didn't like that. Any ideas?

Thanks!
qparis
Level 2
Level 2
Posts: 44
Joined: Fri Dec 03, 2010 6:55 am

Post by qparis »

wine cmd /c /bin/ps aux should work (For exemple)

If you really need a .exe file,

test.c

Code: Select all

#include <stdio.h>

int main()
{
	system("cmd /c /bin/ps aux");
}
Then, build it like this: i586-mingw32msvc-gcc test.c [/code]
phaemon
Newbie
Newbie
Posts: 2
Joined: Wed Apr 25, 2012 11:48 am

Post by phaemon »

Sorry, no that doesn't work. It still gives a bad exe error.

Still, I now pretty much have the C program I need to execute whatever I need to execute! I can print out my SSH line at least from a .exe that runs in Wine, so thanks for the details on that.

Now, I just need to know how to get my local ssh to run from wine...Anyone?
ischou
Level 4
Level 4
Posts: 109
Joined: Sun Nov 28, 2010 7:22 pm

Re: Run linux command from wine (fake exe)

Post by ischou »

phaemon wrote:Hi all,

I'm running HeidiSQL in wine, and it can do ssh tunnels, but only using plink.exe. So can I create a fake plink, that is actually a linux program, that will grab the command line arguments Heidi sends and do my own ssh -L with it?

I tried just calling a bash script plink.exe but wine didn't like that. Any ideas?

Thanks!
I think the problem you are having with "bad exe" might be that you're compiling the program as a Linux executable and renaming it plink.exe.

You will also get a bad exe if plink.exe is a renamed shell script.

The example given by qparis uses a cross-compiler to build a windows executable from the C source.

You need either a cross-compiler or build the code on a windows machine.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

qparis wrote:int main()
{
system("cmd /c /bin/ps aux");
}
Too complicated. See this: http://wiki.winehq.org/FAQ#head-a2e0e85 ... ebfefa7ce4
Locked