leecher1337 / ntvdmx64

Run Microsoft Windows NTVDM (DOS) on 64bit Editions
784 stars 81 forks source link

WOW32/Win16: Applications not having enough memory #107

Closed isaacmakessoftware closed 2 years ago

isaacmakessoftware commented 3 years ago

I am looking for a way to increase the allocated memory for the win16 applications. They perform slow and often ask for more extended memory or changing my system config with more ram. This is not an issue and on 32 bit windows does not happen. Is there a way to increase the ram allocated for win16 applications? DOS apps work fine, even faster than DOSBOX, but win16 needs more ram.

leecher1337 commented 3 years ago

Thanks for testing WOW16 support. Hm, normally, NTVDM takes memory settings from an accompanied .pif file. But this mainly applies to DOS applications, I think. Do you have a sample for a publically available Win16 application that asks for more RAM, so that I have a test case to check?

Performance- and compatibilitywise, you may be better off with winevdm yet (you can use it additionally to NTVDMx64, they don't interfere with each other). Maybe I get HAXM build to also work with WOW16 some day for better hardware-accellerated performance, currently NTVDMx64 HAXM build only works for DOS applications.

isaacmakessoftware commented 3 years ago

Hey leecher1337 thanks for the info. I am using a copy of lotus smartsuite 4 from winworld https://winworldpc.com/product/lotus-smartsuite/40 It is very slow and says "not enough RAM available to continue". The WINEVDM is ...................... well wine and does not work as well as your solution. Hope that helps, maybe there is a config file I can edit to increase the ram.

isaacmakessoftware commented 3 years ago

It's a very slow install process, it took me 2 hours. It keeps giving memory errors and not opening applications, and the file copy is slow probably cause of the ram.

isaacmakessoftware commented 3 years ago

Ok I'll test updated version of the application Thanks for the effort, it must not be easy I am also sorry I didn't reply earlier, I got a bit busy

leecher1337 commented 3 years ago

Short update on the meory issue that seems to be plaguing Lotus Smartsuite: It doesn't seem that the VM doesn't have enough mem. It seems that the TOOLHELP.DLL library, which is used to call SYSTEMHEAPINFO function just thinks that it's not initialized and therefore fails the call:

*** Trace point *** : Instruction Trace
AX:de40 BX:2c60 CX:0000 DX:0000 SP:ddc4 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:168f IP:1498
168f:1498 9aca151f1e       CALLF       1e1f:15ca    ; SYSTEMHEAPINFO
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:de40 BX:2c60 CX:0000 DX:0000 SP:ddc0 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15ca
1e1f:15ca c8140100         ENTER       0114,00
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:de40 BX:2c60 CX:0000 DX:0000 SP:dcaa BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15ce
1e1f:15ce 57               PUSH        DI
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:de40 BX:2c60 CX:0000 DX:0000 SP:dca8 BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15cf
1e1f:15cf 56               PUSH        SI
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:de40 BX:2c60 CX:0000 DX:0000 SP:dca6 BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15d0
1e1f:15d0 1e               PUSH        DS
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:de40 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15d1
1e1f:15d1 b8171e           MOV         AX,1e17
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:1e17 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15d4
1e1f:15d4 8ed8             MOV         DS,AX
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:1e17 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e17 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15d6
1e1f:15d6 833e800100       CMP         Word Ptr [0180],+00
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:1e17 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e17 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15db
1e1f:15db 7503e92100       JZ          1601
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:1e17 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e17 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:15dd
1e1f:15dd e92100           JMP         1601
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:1e17 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e17 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:1601
1e1f:1601 b80000           MOV         AX,0000
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e17 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:1604
1e1f:1604 e96200           JMP         1669
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:dca4 BP:ddbe SI:2d6e DI:ee16
DS:1e17 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:1669
1e1f:1669 1f               POP         DS
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:dca6 BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:166a
1e1f:166a 5e               POP         SI
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:dca8 BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:166b
1e1f:166b 5f               POP         DI
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:dcaa BP:ddbe SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:166c
1e1f:166c c9               LEAVE      
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:ddc0 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:1e1f IP:166d
1e1f:166d ca0400           RETF        0004
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:ddc8 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:168f IP:149d
168f:149d 837eec0f         CMP         Word Ptr [BP-14],+0f ; wUserFreePercent
C:0 P:1 A:0 Z:1 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:ddc8 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:168f IP:14a1
168f:14a1 7303e9af02       JB          1755
C:0 P:1 A:1 Z:0 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:ddc8 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:168f IP:14a6
168f:14a6 837eee0f         CMP         Word Ptr [BP-12],+0f ; wGDIFreePercent
C:0 P:1 A:1 Z:0 S:0 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:ddc8 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:168f IP:14aa
168f:14aa 7303e9a602       JB          1755
C:1 P:0 A:1 Z:0 S:1 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:ddc8 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:168f IP:14ac
168f:14ac e9a602           JMP         1755
C:1 P:0 A:1 Z:0 S:1 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0
*** Trace point *** : Instruction Trace
AX:0000 BX:2c60 CX:0000 DX:0000 SP:ddc8 BP:de58 SI:2d6e DI:ee16
DS:1e87 ES:0000 FS:0000 GS:0000 SS:1e87 CS:168f IP:1755
168f:1755 6a00             PUSH        +00
C:1 P:0 A:1 Z:0 S:1 T:0 I:1 D:0 O:0
NT:0 IOPL:3 WP:0 NE:0 ET:1 TS:0 EM:0 MP:0 PE:1 CPL:3 PG:0 VM:0

If you look at the code of SystemHeapInfo in WOW16, you see:

    if (!wLibInstalled || !lpSysHeap ||
        lpSysHeap->dwSize != sizeof (SYSHEAPINFO))
        return FALSE;

wLibInstalled is a global that gets initialized on TOOLHELP init:

    /* Unless we say otherwise, the library is installed OK */
    wLibInstalled = TRUE;

    /* Do the KERNEL type-checking.  Puts the results in global variables */
    KernelType();

    /* If the KERNEL check failed (not in PMODE) return that the library did
     *  not correctly install but allow the load anyway.
     */
    if (!wTHFlags)
    {
        wLibInstalled = FALSE;

        /* Return success anyway, just fails all API calls */
        return 1;
    }

So I somehow have to find the code path where toolhelp loads and check why it fails. Unfortunately, it's a PITA to debug Win16 apps. I can do instruction tracing with Yoda, but it doesn't resolve any symbols, thus I have to match it with disassembled Win16 binary in order to find the execution flow.

leecher1337 commented 3 years ago

Seems to be a problem with the columbia.edu build, if you build it yourself, you get a slightly smaller toolhelp.dll which doesn't exhibit the problem. As you said you are trying to build the latest release yourself anyway, can you verify that the memory error is gone with it too?

isaacmakessoftware commented 3 years ago

Hmmmm.......I am still trying to figure out how to build it but when I do I will update you

leecher1337 commented 3 years ago

Just use minnt build instructions. But I found out that I locally built toolhelp from newer source than NT4 source (whereas build process uses classic NT4 source), that explains the difference. I need to issue a patch then, but at least I found the reason and know how to fix it, will issue a commit soon.

isaacmakessoftware commented 3 years ago

I don't know if you still remember me but I finally managed to build it with the needed requisities (your youtube video was helpful). However, I am getting file errors when it asks if I want to install the WOW32 support. It can't find miscellaneous files, and when checking, they indeed were not there. The columbia.edu build contained those files, so what is the problem?

leecher1337 commented 3 years ago

Hi, which files are missing? If you had an error with building them, you should see errors in buildchk.err file.

isaacmakessoftware commented 3 years ago

I'll check and update you.

isaacmakessoftware commented 3 years ago

Quite a couple files are missing, see the screenshots uploaded. The one with the fewer files is the build I did, the one with more is the columbia.edu build. Buildchk.err contains two awkwardly placed text lines that go as follows: 1>NMAKE : fatal error U1077: 'exe2bin' : return code '0x1'

1>NMAKE : fatal error U1077: 'exe2bin' : return code '0x1' What could that mean? 2020-12-19_15h05_09 2020-12-19_15h05_47

leecher1337 commented 3 years ago

exe2bin error could be due to https://github.com/leecher1337/ntvdmx64/issues/82#issuecomment-607463113

leecher1337 commented 2 years ago

No further information given on exe2bin issue, assuming solved by deletion of exe2bin.exe in System32 directory