https://bugs.winehq.org/show_bug.cgi?id=44931
Bug ID: 44931 Summary: This program requires at least 3MB of free virtual memory to run in "Nine: The last Resort" game Product: Wine Version: 3.5 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: register001@free.fr Distribution: ---
Created attachment 61032 --> https://bugs.winehq.org/attachment.cgi?id=61032 WINEDEBUG=+relay,+seh,+tid wine your_program.exe >> /tmp/output.txt 2>&1
I get this error dialog box when running the game Nine The last Resort after installation.
Dialog Title: "Director Player 5.0" Message: "This program requires at least 3MB of free virtual memory to run"
Config: Ubuntu 16.04 wine-3.5
https://bugs.winehq.org/show_bug.cgi?id=44931
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Summary|This program requires at |Macromedia Director Player |least 3MB of free virtual |5.0/6.0 based games fail to |memory to run in "Nine: The |run: "This program requires |last Resort" game |at least 3MB of free | |virtual memory to run" | |(Nine: The last Resort) CC| |focht@gmx.net
--- Comment #1 from Anastasius Focht focht@gmx.net --- Hello folks,
that's because Macromedia Director 5.0/6.0 created games are incompatible with modern Windows versions. It's a known issue and you would get the same error with MS Windows.
http://www.tacktech.com/display.cfm?ttid=303
From your log file:
--- snip --- ... 0009:Call KERNEL32.GlobalMemoryStatus(0033f82c) ret=0046a04b 0009:Ret KERNEL32.GlobalMemoryStatus() retval=00000000 ret=0046a04b 0009:Call user32.LoadStringA(00400000,00000880,0033f89c,00000080) ret=0046a07b 0009:Ret user32.LoadStringA() retval=00000013 ret=0046a07b 0009:Call user32.LoadStringA(00400000,0000000f,0033f91c,00000080) ret=0046a092 0009:Ret user32.LoadStringA() retval=00000042 ret=0046a092 0009:Call user32.MessageBoxA(00000000,0033f99c "This program requires at least 3MB of free virtual memory to run.",0033f89c "Director Player 5.0",00000000) ret=0046a0cb ... --- snip ---
You could run the app as follows to show the reported values for your system.
--- snip --- $ WINEDEBUG=+globalmem wine ./foobar ... --- snip ---
The app probably wants something well below 2GB.
You could try to patch your app as described on this website:
https://www.sacah.net/2008/01/how-to-edit-director-player-60-to-stop.html ("Fix '*mb of free virtual memory' on 'Director Player 6.0' and 'Director Player 5.0' programs on XP/Vista")
Regards
https://bugs.winehq.org/show_bug.cgi?id=44931
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |kernel32
--- Comment #2 from Anastasius Focht focht@gmx.net --- Hello again,
I found a "backup" of 'Macromedia Director 5' on Internet to play with. Even the installer has the same problem.
--- quote --- Macromedia Director 5 Released in 1996 by Macromedia For Windows 3.1 with Win32s and Windows 95
Director is a multimedia authoring tool, and is used to create Macromedia Shockwave content.
This archive contains an ISO image with both a 16-bit Windows 3.1 version and a 32-bit Windows 95 version. --- quote ---
On my system:
--- snip --- $ WINEDEBUG=+seh,+relay,+globalmem wine ./d5acce32.exe >>log.txt 2>&1 ... 0009:Call KERNEL32.GlobalMemoryStatus(0032f81c) ret=00469cfb 0009:trace:globalmem:GlobalMemoryStatusEx <-- LPMEMORYSTATUSEX: dwLength 64, dwMemoryLoad 13, ullTotalPhys 3e32a9000, ullAvailPhys 35c7a0000, ullTotalPageFile 5d92a8000, ullAvailPageFile 55279f000, ullTotalVirtual 7ffdffff, ullAvailVirtual 7ffcffff 0009:trace:globalmem:GlobalMemoryStatus Length 32, MemoryLoad 13, TotalPhys 7fffffff, AvailPhys 7fffffff, TotalPageFile 7fffffff, AvailPageFile 7fffffff, TotalVirtual 7ffdffff, AvailVirtual 7ffcffff 0009:Ret KERNEL32.GlobalMemoryStatus() retval=000000c7 ret=00469cfb 0009:Call user32.LoadStringA(00400000,00000880,0032f88c,00000080) ret=00469d2b 0009:Ret user32.LoadStringA() retval=00000013 ret=00469d2b 0009:Call user32.LoadStringA(00400000,0000000f,0032f90c,00000080) ret=00469d42 0009:Ret user32.LoadStringA() retval=00000042 ret=00469d42 0009:Call user32.MessageBoxA(00000000,0032f98c "This program requires at least 3MB of free virtual memory to run.",0032f88c "Director Player 5.0",00000000) ret=00469d7b ... --- snip ---
Disassembly of installer show the same brain damaged sequence as from the link I posted earlier:
--- snip --- 00469CE0 SUB ESP,29C 00469CE6 LEA EAX,[LOCAL.156] 00469CEA PUSH ESI 00469CEB MOV DWORD PTR SS:[LOCAL.156],20 00469CF3 PUSH EDI 00469CF4 PUSH EAX ; pMemorystatus => OFFSET LOCAL.156 00469CF5 CALL DWORD PTR DS:[<&KERNEL32.GlobalMemoryStatus>] 00469CFB MOV EAX,DWORD PTR SS:[LOCAL.151] ; AvailPageFile = 0x7FFFFFFF 00469CFF ADD EAX,DWORD PTR SS:[LOCAL.153] ; AvailPhys = 0x7FFFFFFF ; 2GB AvailPageFile + 2GB AvailPhys = overflow 00469D03 CMP EAX,387520 ; >= 3700000 Bytes? 00469D08 JGE SHORT 00469D88 00469D0A LEA EAX,[LOCAL.128] 00469D11 PUSH 80 00469D16 PUSH EAX 00469D17 MOV ECX,DWORD PTR DS:[514350] 00469D1D PUSH 880 ; StringID = 2176. => 'Director Player 5.01' 00469D22 MOV ESI,DWORD PTR DS:[<&USER32.LoadStringA>] 00469D28 PUSH ECX 00469D29 CALL ESI ; USER32.LoadStringA 00469D2B LEA ECX,[LOCAL.96] 00469D32 PUSH 80 00469D37 PUSH ECX 00469D38 MOV EAX,DWORD PTR DS:[514350] 00469D3D PUSH 0F ; StringID = 15. => 'This program requires at least %dMB of free virtual memory to run.' 00469D3F PUSH EAX 00469D40 CALL ESI ; USER32.LoadStringA 00469D42 LEA ECX,[LOCAL.96] 00469D49 PUSH 3 00469D4B LEA EDX,[LOCAL.64] 00469D52 PUSH ECX 00469D53 PUSH 100 00469D58 PUSH EDX 00469D59 CALL 004FFA7F 00469D5E LEA ECX,[LOCAL.128] 00469D65 LEA EDX,[LOCAL.64] 00469D6C ADD ESP,10 00469D6F PUSH 0 ; Type = MB_OK|MB_DEFBUTTON1|MB_APPLMODAL 00469D71 PUSH ECX ; Caption => OFFSET LOCAL.128 00469D72 PUSH EDX ; Text => OFFSET LOCAL.64 00469D73 PUSH 0 ; hOwner = NULL 00469D75 CALL DWORD PTR DS:[<&USER32.MessageBoxA>] 00469D7B XOR EAX,EAX 00469D7D POP EDI 00469D7E POP ESI 00469D7F ADD ESP,29C 00469D85 RETN 8 00469D88 CALL 004676C0 00469D8D TEST EAX,EAX 00469D8F JZ SHORT 00469D9E 00469D91 XOR EAX,EAX 00469D93 POP EDI 00469D94 POP ESI 00469D95 ADD ESP,29C 00469D9B RETN 8 --- snip ---
You basically need to ensure dwAvailPageFile+dwAvailPhys <= 0x7FFFFFFF (2GB)
Wine source:
https://source.winehq.org/git/wine.git/blob/fe09e2dba66095f1494946226c911a2a...
--- snip --- 1373 VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) 1374 { 1375 MEMORYSTATUSEX memstatus; 1376 OSVERSIONINFOW osver; 1377 IMAGE_NT_HEADERS *nt = RtlImageNtHeader( GetModuleHandleW(0) ); 1378 1379 /* Because GlobalMemoryStatus is identical to GlobalMemoryStatusEX save 1380 for one extra field in the struct, and the lack of a bug, we simply 1381 call GlobalMemoryStatusEx and copy the values across. */ 1382 memstatus.dwLength = sizeof(memstatus); 1383 GlobalMemoryStatusEx(&memstatus); 1384 1385 lpBuffer->dwLength = sizeof(*lpBuffer); 1386 lpBuffer->dwMemoryLoad = memstatus.dwMemoryLoad; ... 1416 /* values are limited to 2Gb unless the app has the IMAGE_FILE_LARGE_ADDRESS_AWARE flag */ 1417 /* page file sizes are not limited (Adobe Illustrator 8 depends on this) */ 1418 if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)) 1419 { 1420 if (lpBuffer->dwTotalPhys > MAXLONG) lpBuffer->dwTotalPhys = MAXLONG; 1421 if (lpBuffer->dwAvailPhys > MAXLONG) lpBuffer->dwAvailPhys = MAXLONG; 1422 if (lpBuffer->dwTotalVirtual > MAXLONG) lpBuffer->dwTotalVirtual = MAXLONG; 1423 if (lpBuffer->dwAvailVirtual > MAXLONG) lpBuffer->dwAvailVirtual = MAXLONG; 1424 } 1425 1426 /* work around for broken photoshop 4 installer */ 1427 if ( lpBuffer->dwAvailPhys + lpBuffer->dwAvailPageFile >= 2U*1024*1024*1024) 1428 lpBuffer->dwAvailPageFile = 2U*1024*1024*1024 - lpBuffer->dwAvailPhys - 1; 1429 1430 /* limit page file size for really old binaries */ 1431 if (nt->OptionalHeader.MajorSubsystemVersion < 4 || 1432 nt->OptionalHeader.MajorOperatingSystemVersion < 4) 1433 { 1434 if (lpBuffer->dwTotalPageFile > MAXLONG) lpBuffer->dwTotalPageFile = MAXLONG; 1435 if (lpBuffer->dwAvailPageFile > MAXLONG) lpBuffer->dwAvailPageFile = MAXLONG; 1436 } ... 1443 } --- snip ---
"work around for broken photoshop 4 installer" -> Line 1427 looks pretty much what we want. The change was introduced by Alexandre himself in year 2004:
https://source.winehq.org/git/wine.git/commitdiff/2130f613102c46aaa643336ff4... ("In GlobalMemoryStatus, also cap the sum of dwAvailPhys and")
The problem with that code is the test for < 2 GB range (MAXLONG). GCC emits this code:
--- snip --- ... addl %edx,%eax testl %eax,%eax jns no_need_to_cap_2gb ... --- snip ---
'test' will set the sign flag based on the most significant bit of %eax.
Consider two cases:
dwAvailPageFile(0x7fffffff) + dwAvailPhys(0x7fffffff) = 0xfffffffe, causes a signed overflow, but not an unsigned overflow (or carry) -> 'S' flag set, 'C' flag not set.
dwAvailPageFile(0xffffffff) + dwAvailPhys(0x7fffffff) = 0x7ffffffe, causes an unsigned overflow (with carry) -> 'C' flag set, 'S' flag not set.
The latter case is actually the default for non-IMAGE_FILE_LARGE_ADDRESS_AWARE apps. The unsigned overflow is not detected hence no 2GB cap handling. I've modified the expression to take potential unsigned integer overflow into account and the app works correctly. This will likely fix a lot of old Adobe installers/apps from Win9X era.
Regards
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #3 from matt87075 register001@free.fr --- for the record
hippo@hippo-camp:~/.wine32clean/drive_c/Nine$ WINEDEBUG=+globalmem WINEPREFIX=~/.wine32clean wine Nine_95.exe 0009:trace:globalmem:GlobalMemoryStatusEx <-- LPMEMORYSTATUSEX: dwLength 64, dwMemoryLoad 38, ullTotalPhys 1ebdb5000, ullAvailPhys 12d47e000, ullTotalPageFile 3e72b4000, ullAvailPageFile 30ab08000, ullTotalVirtual 7ffdffff, ullAvailVirtual 7ffcffff 0009:trace:globalmem:GlobalMemoryStatus Length 32, MemoryLoad 38, TotalPhys 7fffffff, AvailPhys 7fffffff, TotalPageFile 7fffffff, AvailPageFile 7fffffff, TotalVirtual 7ffdffff, AvailVirtual 7ffcffff
---
Is there a patch i can test?
(I think a lot of old win95 apps suffered from this bug, do you win a prize for the quickest solving of so many old bugs??? :))
https://bugs.winehq.org/show_bug.cgi?id=44931
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #4 from Zebediah Figura z.figura12@gmail.com --- I would try `ulimit -v`.
(For the record, this sort of problem is known. I think the oldest bug tracking something like it is 19494.)
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #5 from Anastasius Focht focht@gmx.net --- *** Bug 43455 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #6 from Anastasius Focht focht@gmx.net --- Hello Zebediah,
--- quote --- (For the record, this sort of problem is known. I think the oldest bug tracking something like it is 19494.) --- quote ---
well, the original reason bug 19494 was created for is invalid. The conclusion drawn from the error message has nothing to do with virtual memory/pagefile etc. I've put an update in that ticket and resolved it.
But yes, an improvement could be to allow tweaking certain pagefile/physmem values via registry settings to get rid of some hacks in 'GlobalMemoryStatus()' It doesn't necessarily need to be accessible via user interface though (as shown in http://www.tacktech.com/display.cfm?ttid=303) .. that would be luxury.
Regards
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #7 from matt87075 register001@free.fr --- "I've modified the expression to take potential unsigned integer overflow into account and the app works correctly."
Anastasius, do you have a binary of your fix i can test?
thanks
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #8 from matt87075 register001@free.fr --- My wine was updated to 3.6. Same problem.
https://bugs.winehq.org/show_bug.cgi?id=44931
matt87075 register001@free.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|3.5 |3.6
https://bugs.winehq.org/show_bug.cgi?id=44931
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://winworldpc.com/down | |load/695dc399-680b-c3b8-11c | |3-a5e280ba08ef Keywords| |download
--- Comment #9 from Anastasius Focht focht@gmx.net --- Hello folks,
revisiting, still present.
Another archived copy of Macromedia Director 5 for testing located here:
https://winworldpc.com/product/director/50
https://winworldpc.com/download/695dc399-680b-c3b8-11c3-a5e280ba08ef
$ wine --version wine-4.5-185-g17056908ac
Regards
https://bugs.winehq.org/show_bug.cgi?id=44931
Sagawa sagawa.aki+winebugs@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sagawa.aki+winebugs@gmail.c | |om
--- Comment #10 from Sagawa sagawa.aki+winebugs@gmail.com --- Created attachment 64454 --> https://bugs.winehq.org/attachment.cgi?id=64454 proposed patch
Here is a proposed patch which makes Director Player 5.0 happy. I think 1GB is enough for Win9x era programs.
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #11 from Sagawa sagawa.aki+winebugs@gmail.com --- For the record, I have another copy of Director Player 5.0.
It has following Optional Header: Optional Header (32bit) Magic 0x10B 267 linker version 2.55 size of code 0x10ce00 1101312 size of initialized data 0x1cc00 117760 size of uninitialized data 0x7800 30720 entrypoint RVA 0x1010c7 1052871 base of code 0x1000 4096 base of data 0x10f000 1110016 image base 0x400000 4194304 section align 0x1000 4096 file align 0x200 512 required OS version 1.00 image version 0.00 subsystem version 4.00 Win32 Version 0x0 0 size of image 0x136000 1269760 size of headers 0x400 1024 checksum 0x0 0 Subsystem 0x2 (Windows GUI) DLL characteristics: 0x0 stack reserve size 0x100000 1048576 stack commit size 0x1000 4096 heap reserve size 0x100000 1048576 heap commit size 0x1000 4096 loader flags 0x0 0 RVAs & sizes 0x10 16
Yes, it's "really old binaries" in the condition.
https://bugs.winehq.org/show_bug.cgi?id=44931
alex.jacobs1977@mail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alex.jacobs1977@mail.com
--- Comment #12 from alex.jacobs1977@mail.com --- Problem is still present in plain vanilla wine-5.0.
https://bugs.winehq.org/show_bug.cgi?id=44931
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #13 from joaopa jeremielapuree@yahoo.fr --- Bug occurs with wine-5.13 too.
https://bugs.winehq.org/show_bug.cgi?id=44931
Robert Schultz robert@cosmicrealms.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |robert@cosmicrealms.com
--- Comment #14 from Robert Schultz robert@cosmicrealms.com --- I can CONFIRM that the proposed patch from Sagawa FIXES the issue for Director 5.
Before the patch it gave a warning that at least 10MB was required for running. After that patch it launched perfectly fine and worked great.
This should probably be merged into wine.
https://bugs.winehq.org/show_bug.cgi?id=44931
Le Gluon du Net legluondunet@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |legluondunet@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #15 from Le Gluon du Net legluondunet@gmail.com --- Unfortunately patch from Sagawa does not work with Macromedia 4 game (tested with "Jewels of the Oracle"). But it is out the scope of this bug report? Just for your information, without any patch, when you launch a Macromedia 4 game, game fail to run with this error message:: "This program requires at least 4MB of free virtual memory to run".
https://bugs.winehq.org/show_bug.cgi?id=44931
Mhowser mhowser265@outlook.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mhowser265@outlook.com
--- Comment #16 from Mhowser mhowser265@outlook.com --- Noob here, This bug still occurs in wine 6.0, so how do I apply Sagawa's patch? https://bugs.winehq.org/attachment.cgi?id=64454&action=edit
https://bugs.winehq.org/show_bug.cgi?id=44931
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL|https://winworldpc.com/down |https://archive.org/downloa |load/695dc399-680b-c3b8-11c |d/macromedia-director-5/DIR |3-a5e280ba08ef |ECTOR_5.ISO
--- Comment #17 from Anastasius Focht focht@gmx.net --- Hello folks,
adding stable download links via Internet Archive:
Macromedia Director 5:
https://archive.org/details/macromedia-director-5
Macromedia Director 6:
https://archive.org/details/macromedia-director-6
Regards
https://bugs.winehq.org/show_bug.cgi?id=44931
Alex Bradbury asb@asbradbury.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |asb@asbradbury.org
https://bugs.winehq.org/show_bug.cgi?id=44931
odecif@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |odecif@gmail.com
--- Comment #18 from odecif@gmail.com --- Still an issue with wine-7.1 and the game Safecracker. The patch at www.sacah.net still works though as a walkaround.
https://bugs.winehq.org/show_bug.cgi?id=44931
kolAflash kolAflash@kolahilft.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kolAflash@kolahilft.de
--- Comment #19 from kolAflash kolAflash@kolahilft.de --- Same for the "TKKG" game series by Tivola. (games for children after a audio play and book series) At least TKKG 1 up to 4 are affected by this. https://www.tkkg-site.de/de/spielen/computerspiele/tivola/serie.html You can get most games of this series at archive.org https://archive.org/details/tkkg-1-jennifer-is-missing
The patch by Sagawa works like charm! https://bugs.winehq.org/show_bug.cgi?id=44931#c10 Tested with Wine-6.0.4 on Debian-12. For Wine-6.0.4 compilation see also: https://forum.winehq.org/viewtopic.php?t=37982 (topic waiting for moderation)
Related: https://forum.winehq.org/viewtopic.php?t=30440 https://bugs.winehq.org/show_bug.cgi?id=55494
https://bugs.winehq.org/show_bug.cgi?id=44931
--- Comment #20 from kolAflash kolAflash@kolahilft.de --- P.S. Looks like ScummVM has support for Macromedia Director games :-) So for at least some games this might be an alternative. Maybe it's even more comfortable, because of ScummVM features like picture zooming. https://wiki.scummvm.org/index.php/Director (I didn't test TKKG 1 with ScummVM yet)