[Bug 40322] Alone in the dark 4 crashes using builtin 'explorer' when started with executable name only (game command line parser expects full executable path)

WineHQ Bugzilla wine-bugs at winehq.org
Wed Dec 9 05:28:39 CST 2020


https://bugs.winehq.org/show_bug.cgi?id=40322

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://web.archive.org/web
                   |                            |/20201209091858/http://down
                   |                            |load.fileplanet.com/ftp1/fp
                   |                            |new/gamedemos/action/alone4
                   |                            |cd1.zip?st=j6psbsMPjmHZan7f
                   |                            |Brxd6w&e=1607516308
           Keywords|                            |download
             Status|UNCONFIRMED                 |NEW
                 CC|                            |focht at gmx.net
            Summary|Alone in the dark 4 crashes |Alone in the dark 4 crashes
                   |in virtual desktop          |using builtin 'explorer'
                   |                            |when started with
                   |                            |executable name only (game
                   |                            |command line parser expects
                   |                            |full executable path)
     Ever confirmed|0                           |1
          Component|-unknown                    |programs

--- Comment #17 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming. Correcting summary as it has nothing to do with virtual desktop.
You can also run the game in windowed mode by passing 'window' to the command
line.

Created snapshot via Internet Archive:

https://web.archive.org/web/20201209091858/http://download.fileplanet.com/ftp1/fpnew/gamedemos/action/alone4cd1.zip?st=j6psbsMPjmHZan7fBrxd6w&e=1607516308

---

The app has a broken command line parser. It always expects quoted full
executable path. Long paths with spaces require quotation marks (default game
install path).

Sine the bug is pretty old, the quotation part was already fixed with bug 47790
("putty.exe displays an error at startup when placed in a path with accented
characters.")

https://source.winehq.org/git/wine.git/commitdiff/ceb32f668360ef51b932fa6350858a6b8d2d26ec
("kernel32: Quote first command line arg in process paramenters.")

It tries to parse out the path before the executable name.

--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files (x86)/Infogrames/Alone in the Dark -
Demo

$ WINEDEBUG=+seh,+relay,+process wine explorer /desktop=Alone,800x600
Alone4.exe >>log.txt 2>&1

0194:Call KERNEL32.GetCommandLineA() ret=004a16bc
0194:Ret  KERNEL32.GetCommandLineA() retval=0012bc10 ret=004a16bc
0194:trace:seh:dispatch_exception code=c0000005 flags=0 addr=004A1987
ip=004a1987 tid=0194
0194:trace:seh:dispatch_exception  info[0]=00000001
0194:trace:seh:dispatch_exception  info[1]=00000000
0194:trace:seh:dispatch_exception  eax=00000000 ebx=7ffde000 ecx=00000000
edx=00006578 esi=00000000 edi=0031ff3c
0194:trace:seh:dispatch_exception  ebp=0031fe8c esp=0031fe50 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00010216
0194:trace:seh:call_vectored_handlers calling handler at 7B00F270 code=c0000005
flags=0
0194:trace:seh:call_vectored_handlers handler at 7B00F270 returned 0
...
wine: Unhandled page fault on write access to 00000000 at address 004A1987
(thread 0194), starting debugger...
--- snip ---

Works:

--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files (x86)/Infogrames/Alone in the Dark -
Demo

$ WINEDEBUG=+process wine alone4.exe window
--- snip ---

Works: 'start' method creates full quoted executable path

--- snip ---
$ WINEDEBUG=+process wine start alone4.exe window

0024:trace:process:CreateProcessInternalW app L"C:\\Program Files
(x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" cmdline
L"\"C:\\Program Files (x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe\"
window"

0024:trace:process:NtCreateUserProcess L"\\??\\C:\\Program Files
(x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" image L"C:\\Program
Files (x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" cmdline
L"\"C:\\Program Files (x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe\"
window" parent (nil)
--- snip ---

Works: Running 'explorer' but with quoted long path:

--- snip ---
$ WINEDEBUG=+process,+explorer wine explorer "C:\\Program Files
(x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe"
--- snip ---

Crashes:

--- snip ---
$ WINEDEBUG=+process wine explorer ./alone4.exe
0024:trace:process:CreateProcessInternalW app (null) cmdline
L"\"./alone4.exe\""
0024:trace:process:NtCreateUserProcess L"\\??\\C:\\Program Files
(x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" image L"C:\\Program
Files (x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" cmdline
L"\"./alone4.exe\"" parent (nil)
--- snip ---

--- snip ---
$ WINEDEBUG=+process wine cmd /c alone4.exe
...
01f8:trace:process:CreateProcessInternalW app L"C:\\Program Files
(x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" cmdline L"alone4.exe
window"
01f8:trace:process:NtCreateUserProcess L"\\??\\C:\\Program Files
(x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" image L"C:\\Program
Files (x86)\\Infogrames\\Alone in the Dark - Demo\\alone4.exe" cmdline
L"alone4.exe window" parent (nil)
--- snip ---

Relevant disassembly:

--- snip ---
...
004A16B6 | call dword ptr ds:[<&GetCommandLineA>]           |
004A16BC | mov dword ptr ss:[ebp-20],eax                    | "Alone4.exe"
004A16BF | push 4F4648                                      | "stencil"
004A16C4 | mov edx,dword ptr ss:[ebp-20]                    | "Alone4.exe"
004A16C7 | push edx                                         |
004A16C8 | call 4ACBA0                                      |
004A16CD | add esp,8                                        |
004A16D0 | test eax,eax                                     |
004A16D2 | jne 4A16E9                                       |
004A16D4 | push 4F4650                                      | "STENCIL"
004A16D9 | mov eax,dword ptr ss:[ebp-20]                    | "Alone4.exe"
004A16DC | push eax                                         |
004A16DD | call 4ACBA0                                      |
004A16E2 | add esp,8                                        |
004A16E5 | test eax,eax                                     |
004A16E7 | je 4A16F0                                        |
004A16E9 | mov byte ptr ds:[5BDB9E],1                       |
004A16F0 | push 4F4658                                      | "window"
004A16F5 | mov ecx,dword ptr ss:[ebp-20]                    | "Alone4.exe"
004A16F8 | push ecx                                         |
004A16F9 | call 4ACBA0                                      |
...
004A18C3 | mov byte ptr ds:[520DDC],1                       |
004A18CA | mov ecx,dword ptr ss:[ebp-20]                    |
004A18CD | mov dword ptr ss:[ebp-24],ecx                    |
004A18D0 | mov edx,dword ptr ss:[ebp-24]                    |
004A18D3 | movsx eax,byte ptr ds:[edx]                      |
004A18D6 | cmp eax,22                                       |
004A18D9 | jne alone4.4A18E4                                | start quote?
004A18DB | mov ecx,dword ptr ss:[ebp-24]                    |
004A18DE | add ecx,1                                        | yes, next char
004A18E1 | mov dword ptr ss:[ebp-24],ecx                    |
004A18E4 | push 22                                          |
004A18E6 | mov edx,dword ptr ss:[ebp-24]                    |
004A18E9 | push edx                                         |
004A18EA | call alone4.4AB2B0                               | find end quote
004A18EF | add esp,8                                        |
004A18F2 | mov dword ptr ss:[ebp-28],eax                    |
004A18F5 | cmp dword ptr ss:[ebp-28],0                      |
004A18F9 | je alone4.4A1930                                 |
...
004A1972 | push 5C                                          | backslash
004A1974 | push 5BDA98                                      | "Alone4.exe"
004A1979 | call 4AB2B0                                      |
004A197E | add esp,8                                        |
004A1981 | mov dword ptr ss:[ebp-30],eax                    |
004A1984 | mov ecx,dword ptr ss:[ebp-30]                    |
004A1987 | mov byte ptr ds:[ecx],0                          | *boom*
--- snip ---

--- snip ---
004AB2B0 | push ebp                                         |
004AB2B1 | mov ebp,esp                                      |
004AB2B3 | push edi                                         |
004AB2B4 | mov edi,dword ptr ss:[ebp+8]                     |
004AB2B7 | xor eax,eax                                      |
004AB2B9 | or ecx,FFFFFFFF                                  |
004AB2BC | repne scasb                                      |
004AB2BE | inc ecx                                          |
004AB2BF | neg ecx                                          |
004AB2C1 | dec edi                                          |
004AB2C2 | mov al,byte ptr ss:[ebp+C]                       |
004AB2C5 | std                                              |
004AB2C6 | repne scasb                                      |
004AB2C8 | inc edi                                          |
004AB2C9 | cmp byte ptr ds:[edi],al                         |
004AB2CB | je 4AB2D1                                        |
004AB2CD | xor eax,eax                                      |
004AB2CF | jmp 4AB2D3                                       |
004AB2D1 | mov eax,edi                                      |
004AB2D3 | cld                                              |
004AB2D4 | pop edi                                          |
004AB2D5 | leave                                            |
004AB2D6 | ret                                              |
--- snip ---

Since there are multiple methods leading to a crash, only the explorer part
should be fixed.

Wine source:

https://source.winehq.org/git/wine.git/blob/310019789f7bde12ae3f25f723957c975fb2f804:/programs/explorer/desktop.c#l1052

--- snip ---
...
1052     /* if we have a command line, execute it */
1053     if (cmdline)
1054     {
1055         STARTUPINFOW si;
1056         PROCESS_INFORMATION pi;
1057 
1058         memset( &si, 0, sizeof(si) );
1059         si.cb = sizeof(si);
1060         WINE_TRACE( "starting %s\n", wine_dbgstr_w(cmdline) );
1061         if (CreateProcessW( NULL, cmdline, NULL, NULL, FALSE, 0, NULL,
NULL, &si, &pi ))
1062         {
1063             CloseHandle( pi.hThread );
1064             CloseHandle( pi.hProcess );
1065         }
1066     }
--- snip ---

The 'cmd' way is IMHO a WONTFIX. The game should crash on Windows as well if
you open a command prompt in the game install directory and just type
'alone4.exe' or run 'cmd /c alone4.exe'.

$ wine --version
wine-6.0-rc1-29-g310019789f7

$ sha1sum alone4cd1.zip 
b52e8c03a2597cffa68580f7c7a30ad079c3a202  alone4cd1.zip

$ du -sh alone4cd1.zip 
83M    alone4cd1.zip

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list