Windows 3.1 executable crashes at startup

Questions about Wine on Linux
Locked
jmgallag
Newbie
Newbie
Posts: 2
Joined: Tue Jul 05, 2016 1:29 am

Windows 3.1 executable crashes at startup

Post by jmgallag »

Hi,

I am trying to get a couple of Win 3.1 era executables working under Wine. These support a Tektronix digitizer (TWD 120) that connects to the host PC via SCSI. The first exe (twd120.exe) allows the PC/digitizer to function as a digital storage oscilloscope. The second (twd120v.exe) is for viewing samples captured with the first.

I previously had this digitizer working with a very old Toshiba laptop running Win95. That PC died, and I would like to get this running under a more modern OS. The laptop I am using now is a Dell C400 (Pentium 3), loaded with Lubuntu 16.04 and Wine 1.8.

I am first trying to get the viewing exe to start, under the theory that SCSI is not an issue for the viewer and the non-SCSI issues will be the same for both executables.

The viewer is at ~/.wine/drive_c/tek, and is configured as Windows 3.1 via winecfg. I am starting the viewer like so: wine c:\\tek\\twd120v.exe. I see the outline for the first window, but the crash occurs before the contents are painted, and the Wine "Program Error" dialog appears. The contents from "Show Details" are below.

Any help appreciated. Thanks!


Unhandled exception: denormal float operand in 16-bit code (12af:0a0f).
In 16 bit mode.
Register dump:
CS:12af SS:138f DS:138f ES:138f FS:0033 GS:003b
IP:0a0f SP:a33e BP:a35a FLAGS:0292( R- -- I S -A- - )
AX:138f BX:a350 CX:1427 DX:1427 SI:0000 DI:0005
Stack dump:
0x138f:0xa33e: a350 138f a350 138f 0000 0000 0000 bff0
0x138f:0xa34e: 0000 0000 0000 0000 3fe0 138f a371 0938
0x138f:0xa35e: 12af 05fe 1427 a3aa 138f 010f 0036 0036
0271: sel=138f base=003db9f8 limit=0000cf9f 16-bit rw-
Backtrace:
=>0 0x12af:0x0a0f (0x138f:0xa35a)
1 0x12af:0x0938 (0x138f:0xa370)
2 0xfe12:0xaf07 (0x138f:0xa614)
3 0xfe12:0xd700 (0x138f:0xa624)
4 0x3a13:0x3f13 (0x138f:0xa63a)
5 0x9a13:0x3f15 (0x138f:0xa648)
6 0x9a12:0xbf16 (0x138f:0xa654)
7 0x9a12:0x5f11 (0x138f:0xaf1c)
8 0x6211:0xe702 (0x138f:0xaf28)
9 0x6211:0xef29 (0x138f:0xaf3c)
10 0x0111:0xdf00 (0x138f:0x0000)
0x12af:0x0a0f: wait
Modules:
Module Address Debug info Name (123 modules)
ELF 7b800000-7ba63000 Deferred kernel32<elf>
\-PE 7b810000-7ba63000 \ kernel32
ELF 7bc00000-7bcf2000 Deferred ntdll<elf>
\-PE 7bc10000-7bcf2000 \ ntdll
ELF 7bf00000-7bf04000 Deferred <wine-loader>
ELF 7d2e9000-7d2ff000 Deferred libgpg-error.so.0
ELF 7d2ff000-7d374000 Deferred libpcre.so.3
ELF 7d374000-7d391000 Deferred libgcc_s.so.1
ELF 7d391000-7d440000 Deferred libgcrypt.so.20
ELF 7d440000-7d466000 Deferred liblzma.so.5
ELF 7d466000-7d46f000 Deferred librt.so.1
ELF 7d46f000-7d495000 Deferred libselinux.so.1
ELF 7d495000-7d523000 Deferred libsystemd.so.0
ELF 7d523000-7d52c000 Deferred libffi.so.6
ELF 7d52c000-7d545000 Deferred libresolv.so.2
ELF 7d545000-7d54a000 Deferred libkeyutils.so.1
ELF 7d54a000-7d5a4000 Deferred libdbus-1.so.3
ELF 7d5a4000-7d630000 Deferred libgmp.so.10
ELF 7d630000-7d665000 Deferred libhogweed.so.4
ELF 7d665000-7d6a1000 Deferred libnettle.so.6
ELF 7d6a1000-7d6b6000 Deferred libtasn1.so.6
ELF 7d6b6000-7d6ea000 Deferred libidn.so.11
ELF 7d6ea000-7d74c000 Deferred libp11-kit.so.0
ELF 7d74c000-7d759000 Deferred libkrb5support.so.0
ELF 7d759000-7d75e000 Deferred libcom_err.so.2
ELF 7d75e000-7d78f000 Deferred libk5crypto.so.3
ELF 7d78f000-7d866000 Deferred libkrb5.so.3
ELF 7d866000-7d87a000 Deferred libavahi-client.so.3
ELF 7d87a000-7d888000 Deferred libavahi-common.so.3
ELF 7d888000-7d9e0000 Deferred libgnutls.so.30
ELF 7d9e0000-7da32000 Deferred libgssapi_krb5.so.2
ELF 7da32000-7dab9000 Deferred libcups.so.2
ELF 7dab9000-7daf1000 Deferred uxtheme<elf>
\-PE 7dac0000-7daf1000 \ uxtheme
ELF 7daf1000-7daf8000 Deferred libxfixes.so.3
ELF 7daf8000-7db03000 Deferred libxcursor.so.1
ELF 7db03000-7db16000 Deferred libxi.so.6
ELF 7db16000-7db1a000 Deferred libxcomposite.so.1
ELF 7db1a000-7db27000 Deferred libxrandr.so.2
ELF 7db27000-7db33000 Deferred libxrender.so.1
ELF 7db33000-7db3a000 Deferred libxxf86vm.so.1
ELF 7db3a000-7db3e000 Deferred libxinerama.so.1
ELF 7db3e000-7db64000 Deferred libxcb.so.1
ELF 7db64000-7dcaf000 Deferred libx11.so.6
ELF 7dcaf000-7dcc4000 Deferred libxext.so.6
ELF 7dcda000-7dd69000 Deferred winex11<elf>
\-PE 7dce0000-7dd69000 \ winex11
ELF 7dd69000-7de64000 Deferred comctl32<elf>
\-PE 7dd70000-7de64000 \ comctl32
ELF 7de64000-7dedb000 Deferred shlwapi<elf>
\-PE 7de70000-7dedb000 \ shlwapi
ELF 7dedb000-7e117000 Deferred shell32<elf>
\-PE 7def0000-7e117000 \ shell32
ELF 7e117000-7e200000 Deferred comdlg32<elf>
\-PE 7e120000-7e200000 \ comdlg32
ELF 7e302000-7e309000 Deferred libxdmcp.so.6
ELF 7e309000-7e30d000 Deferred libxau.so.6
ELF 7e30d000-7e34c000 Deferred winspool<elf>
\-PE 7e310000-7e34c000 \ winspool
ELF 7e34c000-7e363000 Deferred commdlg.dll16.so
PE 7e350000-7e363000 Deferred commdlg.dll16
ELF 7e363000-7e378000 Deferred win87em.dll16.so
PE 7e370000-7e378000 Deferred win87em.dll16
ELF 7e378000-7e38d000 Deferred sound.drv16.so
PE 7e380000-7e38d000 Deferred sound.drv16
ELF 7e38d000-7e3b7000 Deferred msacm32<elf>
\-PE 7e390000-7e3b7000 \ msacm32
ELF 7e3b7000-7e436000 Deferred rpcrt4<elf>
\-PE 7e3c0000-7e436000 \ rpcrt4
ELF 7e436000-7e56d000 Deferred ole32<elf>
\-PE 7e450000-7e56d000 \ ole32
ELF 7e56d000-7e625000 Deferred winmm<elf>
\-PE 7e570000-7e625000 \ winmm
ELF 7e625000-7e650000 Deferred mmsystem.dll16.so
PE 7e630000-7e650000 Deferred mmsystem.dll16
ELF 7e650000-7e664000 Deferred mouse.drv16.so
PE 7e660000-7e664000 Deferred mouse.drv16
ELF 7e664000-7e679000 Deferred keyboard.drv16.so
PE 7e670000-7e679000 Deferred keyboard.drv16
ELF 7e679000-7e68f000 Deferred display.drv16.so
PE 7e680000-7e68f000 Deferred display.drv16
ELF 7e68f000-7e6b6000 Deferred mpr<elf>
\-PE 7e6a0000-7e6b6000 \ mpr
ELF 7e6b6000-7e705000 Deferred user.exe16.so
PE 7e6c0000-7e705000 Deferred user.exe16
ELF 7e705000-7e737000 Deferred gdi.exe16.so
PE 7e710000-7e737000 Deferred gdi.exe16
ELF 7e737000-7e74c000 Deferred comm.drv16.so
PE 7e740000-7e74c000 Deferred comm.drv16
ELF 7e74c000-7e761000 Deferred system.drv16.so
PE 7e750000-7e761000 Deferred system.drv16
ELF 7e761000-7e785000 Deferred imm32<elf>
\-PE 7e770000-7e785000 \ imm32
ELF 7e807000-7e831000 Deferred libexpat.so.1
ELF 7e831000-7e87a000 Deferred libfontconfig.so.1
ELF 7e87a000-7e8a5000 Deferred libpng12.so.0
ELF 7e8a5000-7e8c0000 Deferred libz.so.1
ELF 7e8c0000-7e970000 Deferred libfreetype.so.6
ELF 7e970000-7e993000 Deferred libtinfo.so.5
ELF 7e993000-7e9b9000 Deferred libncurses.so.5
ELF 7e9b9000-7ea5f000 Deferred krnl386.exe16.so
PE 7e9d0000-7ea5f000 Deferred krnl386.exe16
ELF 7ea5f000-7ea79000 Deferred version<elf>
\-PE 7ea60000-7ea79000 \ version
ELF 7ea79000-7eaee000 Deferred advapi32<elf>
\-PE 7ea90000-7eaee000 \ advapi32
ELF 7eaee000-7ec09000 Deferred gdi32<elf>
\-PE 7eb00000-7ec09000 \ gdi32
ELF 7ec09000-7ed59000 Deferred user32<elf>
\-PE 7ec20000-7ed59000 \ user32
ELF 7ed59000-7ed70000 Deferred winevdm<elf>
\-PE 7ed60000-7ed70000 \ winevdm
ELF 7ed70000-7ed83000 Deferred libnss_files.so.2
ELF 7ed83000-7ed90000 Deferred libnss_nis.so.2
ELF 7ed90000-7edab000 Deferred libnsl.so.1
ELF 7efab000-7f000000 Deferred libm.so.6
ELF b7341000-b734b000 Deferred libnss_compat.so.2
ELF b734d000-b7503000 Deferred libc.so.6
ELF b7503000-b7508000 Deferred libdl.so.2
ELF b7508000-b7525000 Deferred libpthread.so.0
ELF b753b000-b76f2000 Dwarf libwine.so.1
ELF b76f4000-b7719000 Deferred ld-linux.so.2
ELF b771b000-b771c000 Deferred [vdso].so
Threads:
process tid prio (all id:s are in hex)
0000000e services.exe
0000001e 0
0000001d 0
00000014 0
00000010 0
0000000f 0
00000012 winedevice.exe
0000001c 0
00000019 0
00000018 0
00000013 0
0000001a plugplay.exe
00000020 0
0000001f 0
0000001b 0
00000021 explorer.exe
00000027 0
00000026 0
00000025 0
00000022 0
00000023 (D) C:\windows\system32\winevdm.exe
00000028 0 <==
00000024 0
System information:
Wine build: wine-1.8
Platform: i386
Version: Windows 5.1 (0)
Host system: Linux
Host version: 4.4.0-24-generic
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Windows 3.1 executable crashes at startup

Post by Bob Wya »

That's such a mad project - I've gotta help. I love the "upgrade" to a PIII!! 8)

I've not tried to run any 16-bit code under Wine... But a quick look at the source indicates that winevdm.exe contains some so called thunks to transfer from a 32-bit execution to "virtual/fake" 16-bit environment, and back again. I think a relevant Wiki page is: Chapter 8. Kernel modules in the Wine Developers Guide...

It would be helpful to see a bit more detail on what your application is trying to do, so perhaps try:

Code: Select all

cd ~/.wine/drive_c/tek
export WINEDEBUG=+relay,+winevdm,+timestamp
wine twd120v.exe
That could be a "biggie" - depending on how far your application gets... If so a pastebin site like bpaste would be most appropriate...

Thanks
Bob
jmgallag
Newbie
Newbie
Posts: 2
Joined: Tue Jul 05, 2016 1:29 am

Re: Windows 3.1 executable crashes at startup

Post by jmgallag »

Thanks! I did as you suggested and captured the output... all 11MB worth. I compressed it and uploaded to google drive: https://drive.google.com/file/d/0B4110i ... sp=sharing

I am an experienced C developer, but very little experience with low level Windows stuff. What should I be looking for in the output?
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Windows 3.1 executable crashes at startup

Post by Bob Wya »

jmgallag wrote:Thanks! I did as you suggested and captured the output... all 11MB worth. I compressed it and uploaded to google drive: https://drive.google.com/file/d/0B4110i ... sp=sharing

I am an experienced C developer, but very little experience with low level Windows stuff. What should I be looking for in the output?
Hi,

Then you've already got all the tools you need then to dive in and start hacking!! Wine is written mostly in pure C - with minimal blobs of assembler. So it's pretty similar to the Linux kernel in many ways - but with less assembler... :lol:

Just clone the >>> Wine Git code <<< .

The Wine Debug channels are documented here (WINETRACE, et al., is standardised API - just think of this as a fancy printf - mainly defined in include/wine/debug.h)

Anyway, I'd suggest the next step is to bump up the level of detail - to see what Wine is complaining about (if anything):

Code: Select all

export WINEDEBUG=+relay,+winevdm,+rundll,+gdi,+user,warn+all,err+all
So all the warnings and errors... Plus everything from all the 16-bit API calls that Wine virtualises (via the Virtual DOS Machine).

The dump is going to be even bigger this time (real big in fact)... Sorry!! :lol:

I've written some preliminary notes - see below... Bear in mind that I've just finished a 24-hour work shift - so they may not be too accurate or useful yet!

Bob

The winevdm.exe (VDM = Virtual DOS Machine) main() function is simply:

Code: Select all

/***********************************************************************
 *           main
 */
int main( int argc, char *argv[] )
{
    DWORD count;
    HINSTANCE16 instance;
    LOADPARAMS16 params;
    WORD showCmd[2];
    char buffer[MAX_PATH];
    STARTUPINFOA info;
    char *cmdline, *appname, **first_arg;
    char *p;

    if (!argv[1]) usage();

    if (!strcmp( argv[1], "--app-name" ))
    {
        if (!(appname = argv[2])) usage();
        first_arg = argv + 3;
    }
    else
    {
        if (!SearchPathA( NULL, argv[1], ".exe", sizeof(buffer), buffer, NULL ))
        {
            WINE_MESSAGE( "winevdm: unable to exec '%s': file not found\n", argv[1] );
            ExitProcess(1);
        }
        appname = buffer;
        first_arg = argv + 1;
    }

    if (*first_arg) first_arg++;  /* skip program name */
    cmdline = build_command_line( first_arg );

    if (WINE_TRACE_ON(winevdm))
    {
        int i;
        WINE_TRACE( "GetCommandLine = '%s'\n", GetCommandLineA() );
        WINE_TRACE( "appname = '%s'\n", appname );
        WINE_TRACE( "cmdline = '%.*s'\n", cmdline[0], cmdline+1 );
        for (i = 0; argv[i]; i++) WINE_TRACE( "argv[%d]: '%s'\n", i, argv[i] );
    }

    GetStartupInfoA( &info );
    showCmd[0] = 2;
    showCmd[1] = (info.dwFlags & STARTF_USESHOWWINDOW) ? info.wShowWindow : SW_SHOWNORMAL;

    params.hEnvironment = 0;
    params.cmdLine = MapLS( cmdline );
    params.showCmd = MapLS( showCmd );
    params.reserved = 0;

    RestoreThunkLock(1);  /* grab the Win16 lock */

    /* some programs assume mmsystem is always present */
    LoadLibrary16( "gdi.exe" );
    LoadLibrary16( "user.exe" );
    LoadLibrary16( "mmsystem.dll" );

    if ((instance = LoadModule16( appname, &params )) < 32)
    {
        if (instance == 11)
        {
            /* first see if it is a .pif file */
            if( ( p = strrchr( appname, '.' )) && !strcasecmp( p, ".pif"))
                pif_cmd( appname, cmdline + 1);
            else
            {
                /* try DOS format */
                /* loader expects arguments to be regular C strings */
                start_dos_exe( appname, cmdline + 1 );
            }
            /* if we get back here it failed */
            instance = GetLastError();
        }

        WINE_MESSAGE( "winevdm: can't exec '%s': ", appname );
        switch (instance)
        {
        case  2: WINE_MESSAGE("file not found\n" ); break;
        case 11: WINE_MESSAGE("invalid program file\n" ); break;
        default: WINE_MESSAGE("error=%d\n", instance ); break;
        }
        ExitProcess(instance);
    }

    /* wait forever; the process will be killed when the last task exits */
    ReleaseThunkLock( &count );
    Sleep( INFINITE );
    return 0;
}
Corresponding to the following TRACE outputs in your debug output...

Code: Select all

1282893.277:trace:winevdm:main GetCommandLine = 'C:\windows\system32\winevdm.exe --app-name C:\tek\twd120v.exe C:\tek\twd120v.exe'
1282893.277:trace:winevdm:main appname = 'C:\tek\twd120v.exe'
1282893.277:trace:winevdm:main cmdline = ''
1282893.277:trace:winevdm:main argv[0]: 'C:\windows\system32\winevdm.exe'
1282893.277:trace:winevdm:main argv[1]: '--app-name'
1282893.277:trace:winevdm:main argv[2]: 'C:\tek\twd120v.exe'
1282893.277:trace:winevdm:main argv[3]: 'C:\tek\twd120v.exe'
After that I'm seeing corresponding 16-bit entry and exit points:

Code: Select all

grep "exe16" wine-debug-20160705-1630.txt
winevdm.exe has thunk wrappers (written in assembly) that enter and exit from the virtualised 16-bit DOS environment.

To check function return values we'd need to find a suitable reference manual (since MSDN doesn't really do much DOS /16-bit support these days). Hmmm... Hopefully a more detailed log will help us pin down the area where Wine is blowing up at!!
Locked