otya128 / winevdm

16-bit Windows (Windows 1.x, 2.x, 3.0, 3.1, etc.) on 64-bit Windows
GNU General Public License v2.0
2.69k stars 154 forks source link

INT21H function AH=3Dh (Open File) call problem with relative path specification. #1451

Closed nanitaro closed 1 month ago

nanitaro commented 1 month ago

Describe the bug This is a problem I found in a game supplement to a Japanese adult game magazine named TECH GIAN. When I proceed with the game, it hangs with a message box that says “The file data\B2\B01.bmp cannot be opened.” This message does not appear in the real environment of Windows 98SE.

The directory structure of this game is as follows dir.txt

This game is started by executing Prin.exe. When the game mode is switched during the game, SLG1.exe or SLG2.exe under WORK is executed from Prin.exe. When SLG1.exe or SLG2.exe is executed, the message box in question appears. The trace log shows that it is trying to open the data\B2\B01.bmp by specifying a relative path, but it is failing. Line 88362 of the trace log.

40b4:0738:trace:int21:INT21_CreateFile CreateFile called: function=3d, action=01, access/share=0000, create flags=0000, file=data\B2\B01. bmp.

Copy the DATA directory to \DEAR_P\STORY2, where the DATA directory is in the same hierarchy as the WORK directory. When Prin.exe is executed in this state, the error message box does not appear, and I confirmed that it works correctly. This is probably because the current directory remains \DEAR_P\STORY2 even after SLG1.EXE is executed, and is not changed to \DEAR_P\STORY2\WORK.

Expected behavior The game proceeds without error messages.

Screenshots msgbox

Environment (please complete the following information):

Additional context As you can see from the trace log, other files are opened with absolute paths. Since this is the only file with a relative path, I think it may be a bug in the game. However, the file opens correctly in the actual Windows 98SE environment, so is it possible to interpret the relative path in the same way as in real Windows?

It is very helpful to provide a trace file if possible. Please note that this file contains detailed information about the program. Procedure

  1. Run the command prompt.
  2. Set the environment variable:
    set WINEDEBUG=+all,-snoop,-ldt,-fixup,-module,-global,-local,-disasm,-syslevel,-thunk
  3. *old-executable-file* 2> trace.txt
  4. Upload trace.txt here. trace.txt
cracyc commented 1 month ago

Try https://github.com/otya128/winevdm/pull/1452

nanitaro commented 1 month ago

Thank you. It now works the same as actual Windows 98SE. I will close the issue.