https://bugs.winehq.org/show_bug.cgi?id=46962
Bug ID: 46962 Summary: Macromedia Director Player 4.x based games (16-bit NE) fail to run: "This program requires at least 4MB free memory to run." (The Rock) Product: Wine Version: 4.5 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: focht@gmx.net Distribution: ---
Hello folks,
I found a game written with Macromedia Director 4.0.4 using Internet Archive:
https://archive.org/search.php?query=macromedia%20director%205&and%5B%5D...
https://archive.org/details/THEROCK_201807
-> https://archive.org/download/THEROCK_201807/THE_ROCK.zip
It's a 16-bit NE Windows binary.
--- snip --- $ WINEDEBUG=+seh,+relay,+globalmem wine ./THE_ROCK.EXE >>log.txt 2>&1 ... 005c:Call KERNEL.169: GETFREESPACE(0000) ret=1247:0b09 ds=1577 005c:Call KERNEL32.GlobalMemoryStatus(0087f810) ret=7e57ee80 005c:trace:globalmem:GlobalMemoryStatusEx <-- LPMEMORYSTATUSEX: dwLength 64, dwMemoryLoad 16, ullTotalPhys 3e30a3000, ullAvailPhys 3407f6000, ullTotalPageFile 5d90a2000, ullAvailPageFile 5367f5000, ullTotalVirtual fffdffff, ullAvailVirtual fffcffff 005c:trace:globalmem:GlobalMemoryStatus Length 32, MemoryLoad 16, TotalPhys ffffffff, AvailPhys ffffffff, TotalPageFile 7fffffff, AvailPageFile 7fffffff, TotalVirtual fffdffff, AvailVirtual fffcffff 005c:Ret KERNEL32.GlobalMemoryStatus() retval=000000c7 ret=7e57ee80 005c:Ret KERNEL.169: GETFREESPACE() retval=fffcffff ret=1247:0b09 ds=1577 ... 005c:Call user32.MessageBoxA(00000000,003b504e "This program requires at least 4MB free memory to run.",003b514e "Director Player 4.0",00000000) ret=f7b4a765 --- snip ---
Wine source:
--- snip --- 1365 /*********************************************************************** 1366 * GlobalMemoryStatus (KERNEL32.@) 1367 * Provides information about the status of the memory, so apps can tell 1368 * roughly how much they are able to allocate 1369 * 1370 * RETURNS 1371 * None 1372 */ 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; ... 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 } 1437 1438 TRACE_(globalmem)("Length %u, MemoryLoad %u, TotalPhys %lx, AvailPhys %lx," 1439 " TotalPageFile %lx, AvailPageFile %lx, TotalVirtual %lx, AvailVirtual %lx\n", 1440 lpBuffer->dwLength, lpBuffer->dwMemoryLoad, lpBuffer->dwTotalPhys, 1441 lpBuffer->dwAvailPhys, lpBuffer->dwTotalPageFile, lpBuffer->dwAvailPageFile, 1442 lpBuffer->dwTotalVirtual, lpBuffer->dwAvailVirtual ); 1443 } --- snip ---
"limit page file size for really old binaries" -> apparently the same has to be done for reported virtual memory size (cap at 2GB).
Capping allows the game to start and show intro/gameplay sequence (until it runs out of local heap which is a different issue).
NOTE: This is not the same as bug 44931 ("Macromedia Director Player 5.0/6.0 based games fail to run: "This program requires at least 3MB of free virtual memory to run" (Nine: The last Resort)") which is about capping dwAvailPageFile+dwAvailPhys <= 0x7FFFFFFF (2GB).
$ sha1sum THE_ROCK.* efe3caca127562528d9496a434b1649a7c6ff46d THE_ROCK.EXE 6dc54219cf8b64d98a8a24f1bd2ebd32cefee8e8 THE_ROCK.zip
$ du -sh THE_ROCK.* 2.1M THE_ROCK.EXE 984K THE_ROCK.zip
$ wine --version wine-4.5-185-g17056908ac
Regards