Keep DOSbox window from automatically closing

Questions about Wine on Linux
Locked
uckjhfrv
Level 2
Level 2
Posts: 10
Joined: Mon Apr 13, 2015 2:24 pm

Keep DOSbox window from automatically closing

Post by uckjhfrv »

I'm trying to install a Windows application in Wine, but the installer quits without actually installing the program. Install Shield runs, then it apparently calls some console application because a DOSbox window pops up for just a second, then the installer quits. I can see that a lot of text is printed in the DOSbox window the split-second it is on the screen but then it closes before I can read it. I think I can determine from the DOSbox window why the program won't install, but I need to be able to read it. Is there a way to keep it from closing when it finishes or a way to capture its output or something?
User avatar
olivierfrdierick
Level 5
Level 5
Posts: 258
Joined: Thu Sep 13, 2012 12:09 pm

Re: Keep DOSbox window from automatically closing

Post by olivierfrdierick »

not "DOSbox" but "windows console" or "windows terminal". DOSbox is a specific DOS emulator program unrelated to Wine or Windows apps.

It's controlled by the installer. There's no way to prevent it from closing if it is not intended to be.
Furthermore it's common for console windows to popup and vanish when installing Windows software. They often have no content. They just show as a consequence of spawning a background process.
What you should do is check the terminal output of Wine for errors, and also check the AppDB entry of your Windows application for install guides or issues workarounds, or check within the application documentation itself where the installer puts its log files.
Which application is it?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: Keep DOSbox window from automatically closing

Post by dimesio »

olivierfrdierick wrote:DOSbox is a specific DOS emulator program unrelated to Wine or Windows apps.
Wine uses DOSBox to run DOS apps, so if this is a very old app, it may well be DOSBox opening. I don't know of a way to prevent the window from closing.
User avatar
olivierfrdierick
Level 5
Level 5
Posts: 258
Joined: Thu Sep 13, 2012 12:09 pm

Re: Keep DOSbox window from automatically closing

Post by olivierfrdierick »

dimesio wrote:Wine uses DOSBox to run DOS apps
My bad, I didn't know that. I wanted to clarify that all dos-like text consoles are not DOSBox ones, in case the orginal poster got confused and misnamed what he saw.

Also, with this information, I looked into the code.
DOSBox windows can be prevented from closing by re-compiling Wine with a single-line modification to the code.
In programs/winevdm/winevdm.c, function start_dosbox.
Find this line:

Code: Select all

p += sprintf( p, "exit\n" );
and add a line before it like this:

Code: Select all

p += sprintf( p, "pause\n" );
p += sprintf( p, "exit\n" );
This should make all DOSBox windows opened by Wine wait for a keypress before closing.

You may also comment the exit line, and then not only the DOSBox window will not close, but also allow you to type commands.

Note that none of the above is tested or garanteed to work by me. Try at your own risk. Make backups of your data, etc.
uckjhfrv
Level 2
Level 2
Posts: 10
Joined: Mon Apr 13, 2015 2:24 pm

Re: Keep DOSbox window from automatically closing

Post by uckjhfrv »

Thank you olivierfrdierick for your suggestion. What I utlimately did was to hijack the call to dosbox by temporarily replacing /usr/bin/dosbox with a script by the same name. I finally got the application to install successfully, but it does not yet work properly.
Locked