[Bug 38426] Return to Castle Wolfenstein - Platinum Edition installer reports an I/O error/crashes when inserting CD1 again after CD2 (file handles can't be used after media remount due to unix fd relation)

WineHQ Bugzilla wine-bugs at winehq.org
Sat Dec 28 11:03:26 CST 2019


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

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Summary|Installation of Return to   |Return to Castle
                   |Castle Wolfenstein -        |Wolfenstein - Platinum
                   |Platinum Edition crashes    |Edition installer reports
                   |                            |an I/O error/crashes when
                   |                            |inserting CD1 again after
                   |                            |CD2 (file handles can't be
                   |                            |used after media remount
                   |                            |due to unix fd relation)
                 CC|                            |focht at gmx.net

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

confirming. I've found a distributed "backup" with two CD images to play with.
There is no DRM/disk protection a la SafeDisc/SecuROM so one can use 'cdemu' on
the original .bin images for investigation.

NOTE: I've used original Wine 1.6.2 this bug was reported against for testing
but the same underlying design problem/issue is still present years later with
recent Wine 5.0.

Mount image for CD1:

--- snip ---
$ cdemu load 0 Return\ to\ Castle\ Wolfenstein\ \(USA\)\ \(Disc\ 1\)\ \(The\
Platinum\ Edition\).cue

$ udisksctl mount -b /dev/sr1
Mounted /dev/sr1 at /run/media/focht/wolfplat_1.
--- snip ---

Run the launcher/bootstrapper (outside of mount point):

--- snip ---
$ WINEDEBUG=+seh,+relay,+server wine "g:\\Launch.exe" >>log.txt 2>&1
...
--- snip ---

When installer asks for CD2:

--- snip ---
$ wine eject

$ cdemu load 0 Return\ to\ Castle\ Wolfenstein\ \(USA\)\ \(Disc\ 2\)\ \(The\
Platinum\ Edition\).cue

$ udisksctl mount -b /dev/sr1
Mounted /dev/sr1 at /run/media/focht/wolfplat_2.
--- snip ---

Click 'OK'. Installation continues.

When installer asks for CD1:

--- snip ---
$ wine eject

$ cdemu load 0 Return\ to\ Castle\ Wolfenstein\ \(USA\)\ \(Disc\ 1\)\ \(The\
Platinum\ Edition\).cue

$ udisksctl mount -b /dev/sr1
Mounted /dev/sr1 at /run/media/focht/wolfplat_1.
--- snip ---

Click 'OK'. A dialog about "performance settings" is displayed.
After dismissing the dialog, the error message "An I/O error occurred while
installing a file..." is displayed.

Relevant part of trace:

--- snip ---
0025:Call KERNEL32.CreateProcessA(00000000,0033f618
"G:\\Setup\\rsrc\\..\\..\\setupcw.exe
",00000000,00000000,00000000,00000000,00000000,00000000,0033f170,0033f1d0)
ret=00434bc1 
...
0028: init_process_done( gui=1, module=00400000, ldt_copy=f7ee35e0,
entry=004021af )
0025: *wakeup* signaled=0
0028: init_process_done() = 0
...
0025:Ret  KERNEL32.CreateProcessA() retval=00000001 ret=00434bc1 
...
0028:Ret  PE DLL (proc=0x7e661f40,module=0x7e5d0000
L"user32.dll",reason=PROCESS_ATTACH,res=0x1) retval=1
0028:Starting process L"G:\\setupcw.exe" (entryproc=0x4021af)
0028:Call KERNEL32.SetErrorMode(00000004) ret=004021c9
0028:Ret  KERNEL32.SetErrorMode() retval=00000000 ret=004021c9
0028:Call KERNEL32.GetCommandLineA() ret=004021cf
0028:Ret  KERNEL32.GetCommandLineA() retval=001427f0 ret=004021cf
0028:Call KERNEL32.GetModuleHandleA(00000000) ret=00402216
0028:Ret  KERNEL32.GetModuleHandleA() retval=00400000 ret=00402216
0028:Call KERNEL32.GetModuleFileNameA(00400000,0033fab4,00000100) ret=00402297
0028:Ret  KERNEL32.GetModuleFileNameA() retval=0000000e ret=00402297
0028:Call KERNEL32._lopen(0033fab4 "G:\\setupcw.exe",00000000) ret=00402309
0028: create_file( access=80000000, attributes=00000040, sharing=00000003,
create=1, options=00000060, attrs=00000080,
objattr={rootdir=0000,sd={},name=L""},
filename="/home/focht/.wine/dosdevices/g:/setupcw.exe" )
0028: create_file() = 0 { handle=0034 }
0028:Ret  KERNEL32._lopen() retval=00000034 ret=00402309
...
0028:Call KERNEL32._llseek(00000034,00003a00,00000000) ret=00402353
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._llseek() retval=00003a00 ret=00402353
0028:Call KERNEL32._lread(00000034,0033fe5f,00000001) ret=00402366
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._lread() retval=00000001 ret=00402366
0028:Call KERNEL32._lread(00000034,00405360,00000004) ret=004023d3
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._lread() retval=00000004 ret=004023d3
0028:Call KERNEL32._lread(00000034,00405410,0000000c) ret=004023e2
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._lread() retval=0000000c ret=004023e2
0028:Call KERNEL32._lread(00000034,004053b4,00000008) ret=004023f1
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._lread() retval=00000008 ret=004023f1
0028:Call KERNEL32._lread(00000034,00405374,00000040) ret=00402400
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._lread() retval=00000040 ret=00402400
0028:Call KERNEL32._lread(00000034,004053fc,00000003) ret=0040240f
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._lread() retval=00000003 ret=0040240f
0028:Call KERNEL32._lread(00000034,0033f934,00000074) ret=00402444
0028: get_handle_fd( handle=0034 )
0028: *fd* 0034 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=0, access=00120089,
options=00000060 }
0028:Ret  KERNEL32._lread() retval=00000074 ret=00402444
...
0028:Call user32.SetWindowTextA(000500de,0033f0e0 "Please insert the Return to
Castle Wolfenstein - Platinum Edition CD 2 into the CD-ROM drive and press the
OK button.\r\n") ret=10014896 
...
0028:Call user32.DialogBoxParamA(10000000,00000072,00020026,100146e5,00000000)
ret=1001463d 
...
0028:Call user32.DrawTextA(0004002b,0033f0e0 "Please insert the Return to
Castle Wolfenstein - Platinum Edition CD 1 into the CD-ROM drive and press the
OK button.\r\n",ffffffff,0033dc74,00000c50) ret=1001498d 
...
0028:Call KERNEL32.GetVolumeInformationA(0033e264
"G:\\",0033e390,00000020,00000000,00000000,00000000,00000000,00000000)
ret=10013fa1
0028: create_file( access=80000000, attributes=00000040, sharing=00000003,
create=1, options=00000060, attrs=00000000,
objattr={rootdir=0000,sd={},name=L""},
filename="/home/focht/.wine/dosdevices/g::" )
0028: create_file() = 0 { handle=00d4 }
0028: get_handle_fd( handle=00d4 )
0028: *fd* 00d4 -> 19
0028: get_handle_fd() = 0 { type=1, cacheable=1, access=00120089,
options=00000060 }
0028: close_handle( handle=00d4 )
0028: close_handle() = 0
0028:Ret  KERNEL32.GetVolumeInformationA() retval=00000001 ret=10013fa1 
0028:Call KERNEL32.lstrlenA(0033e390 "wolfplat_1") ret=10013fae
0028:Ret  KERNEL32.lstrlenA() retval=0000000a ret=10013fae 
...
0028:Call KERNEL32.lstrcmpiA(0052a1f8 "wolfplat_1",00539200 "wolfplat_1")
ret=1000b0e2
0028:Ret  KERNEL32.lstrcmpiA() retval=00000000 ret=1000b0e2
...
0028:Call user32.SetWindowTextA(000700de,0033f0e0 "For optimum performance,
your game graphics will be set to RECOMMENDED settings. To customize these
settings go to the System menu inside the Main menu of the game. \r\n\r\nPlease
refer to the README file for more details.") ret=10014896 
...
0028:Ret  user32.DialogBoxParamA() retval=00000001 ret=1001463d 
...
0028:Call KERNEL32._llseek(00000034,00000000,00000002) ret=1000d164
0028: get_handle_fd( handle=0034 )
0028: get_handle_fd() = VOLUME_DISMOUNTED { type=0, cacheable=0,
access=00000000, options=00000000 }
0028:Ret  KERNEL32._llseek() retval=ffffffff ret=1000d164
0028:Call KERNEL32.SetErrorMode(00000000) ret=100150b2
0028:Ret  KERNEL32.SetErrorMode() retval=00008000 ret=100150b2
...
0028:Call KERNEL32._lread(00000034,001552f8,00000cb5) ret=00401e5d
0028: get_handle_fd( handle=0034 )
0028: get_handle_fd() = VOLUME_DISMOUNTED { type=0, cacheable=0,
access=00000000, options=00000000 }
0028:Ret  KERNEL32._lread() retval=ffffffff ret=00401e5d
0028:Call KERNEL32.SetErrorMode(00008000) ret=100150d0
0028:Ret  KERNEL32.SetErrorMode() retval=00000000 ret=100150d0
0028:Call user32.DialogBoxParamA(10000000,00000072,000100b6,100146e5,00000000)
ret=1001463d 
...
0028:Call user32.SetWindowTextA(000a0074,005947a8 "An I/O error occurred while
installing a file. This is normally caused by bad installation media or a
corrupt installation file.") ret=10014896 
...
--- snip ---

The main installer keeps an extra file handle to its main executable open
during the whole installation process. It reads resources for displaying
text/icons from the executable using _llseek/_lread. The problem is that Wine
has the underlying unix fd associated with the file handle which became invalid
at the point of unmounting CD1 and mounting CD2 (STATUS_VOLUME_DISMOUNTED).

On Windows, when a file handle is opened, the filename internally includes the
name of the device object on which the physical file resides. In this case,
'G:\\setupcw.exe' would translate to '\Device\CdRom0\Setupcw.exe'.
'\Device\CdRom0' is the name of the device object representing the volume. The
device object is associated with the file object. The device was never removed
(device vs. media removal), hence the association is still valid. Subsequent
I/O requests to the device should not fail, regardless if the underlying
physical media changed in between.

Unfortunately a design problem in Wine which is not easy to fix.

ProtectionID scan for documentation:

--- snip ---
-=[ ProtectionID v0.6.9.0 DECEMBER]=-
(c) 2003-2017 CDKiLLER & TippeX
Build 24/12/17-21:05:42

Scanning -> G:\KeyCheckDLL.dll
File Type : 32-Bit Dll (Subsystem : Win GUI / 2), Size : 135168 (021000h)
Byte(s) | Machine: 0x14C (I386)
Compilation TimeStamp : 0x3BCDEACD -> Wed 17th Oct 2001 20:32:13 (GMT)
[TimeStamp] 0x3BCDEACD -> Wed 17th Oct 2001 20:32:13 (GMT) | PE Header | - |
Offset: 0x00000118 | VA: 0x10000118 | -
[TimeStamp] 0x3BCDEACD -> Wed 17th Oct 2001 20:32:13 (GMT) | Export | - |
Offset: 0x00016384 | VA: 0x10016384 | -
[File Heuristics] -> Flag #1 : 00000000000000000000000100000000 (0x00000100)
[Entrypoint Section Entropy] : 6.58 (section #0) ".text   " | Size : 0x10E6E
(69230) byte(s)
[DllCharacteristics] -> Flag : (0x0000) -> NONE
[SectionCount] 5 (0x5) | ImageSize 0x24000 (147456) byte(s)
[Export] 100% of function(s) (1 of 1) are in file | 0 are forwarded | 1 code |
0 data | 0 uninit data | 0 unknown | 
[VersionInfo] Product Name : KeyCheckDLL Dynamic Link Library
[VersionInfo] Product Version : 01.002
[VersionInfo] File Description : KeyCheckDLL DLL
[VersionInfo] File Version : 01.002
[VersionInfo] Original FileName : KeyCheckDLL.DLL
[VersionInfo] Internal Name : CWS KeyCheckDLL
[VersionInfo] Legal Copyrights : Copyright (C) 2000
[ModuleReport] [IAT] Modules -> KERNEL32.dll | USER32.dll | GDI32.dll |
WINSPOOL.DRV | ADVAPI32.dll | COMCTL32.dll
[CdKeySerial] found "CDKey" @ VA: 0x000163C5 / Offset: 0x000163C5
[CompilerDetect] -> Visual C++ 6.0
[!] File appears to have no protection or is using an unknown protection
- Scan Took : 0.231 Second(s) [0000000E7h (231) tick(s)] [246 of 580 scan(s)
done]

Scanning -> G:\Launch.exe
File Type : 32-Bit Exe (Subsystem : Win GUI / 2), Size : 77824 (013000h)
Byte(s) | Machine: 0x14C (I386)
Compilation TimeStamp : 0x39A5A543 -> Thu 24th Aug 2000 22:44:19 (GMT)
[TimeStamp] 0x39A5A543 -> Thu 24th Aug 2000 22:44:19 (GMT) | PE Header | - |
Offset: 0x000000E0 | VA: 0x004000E0 | -
[File Heuristics] -> Flag #1 : 00000000000000000000000000000000 (0x00000000)
[Entrypoint Section Entropy] : 6.64 (section #0) ".text   " | Size : 0x63E0
(25568) byte(s)
[DllCharacteristics] -> Flag : (0x0000) -> NONE
[SectionCount] 4 (0x4) | ImageSize 0x15000 (86016) byte(s)
[VersionInfo] Company Name : InstallShield Software Corporation
[VersionInfo] Product Name : DemoShield Multi-CD Launcher
[VersionInfo] Product Version : 6.70
[VersionInfo] File Description : Multi-CD Launch
[VersionInfo] File Version : 6. 70. 006
[VersionInfo] Internal Name : Multi-CD Launch
[VersionInfo] Legal Copyrights : ©1999-2000 InstallShield Software Corp.
[ModuleReport] [IAT] Modules -> KERNEL32.dll | USER32.dll | GDI32.dll
[CompilerDetect] -> Visual C++ 6.0
[!] File appears to have no protection or is using an unknown protection
- Scan Took : 0.209 Second(s) [0000000D1h (209) tick(s)] [506 of 580 scan(s)
done]

Scanning -> G:\Setupcw.exe
File Type : 32-Bit Exe (Subsystem : Win GUI / 2), Size : 1563029 (017D995h)
Byte(s) | Machine: 0x14C (I386)
Compilation TimeStamp : 0x3BD86C3F -> Thu 25th Oct 2001 19:47:11 (GMT)
[TimeStamp] 0x3BD86C3F -> Thu 25th Oct 2001 19:47:11 (GMT) | PE Header | - |
Offset: 0x000000D8 | VA: 0x004000D8 | -
[TimeStamp] 0x3BD86C3F -> Thu 25th Oct 2001 19:47:11 (GMT) | Export | - |
Offset: 0x00002D14 | VA: 0x00404714 | -
-> File has 1548181 (0179F95h) bytes of appended data starting at offset 03A00h
[File Heuristics] -> Flag #1 : 00000000000001001100000100000100 (0x0004C104)
[Entrypoint Section Entropy] : 6.28 (section #0) ".text   " | Size : 0x2126
(8486) byte(s)
[DllCharacteristics] -> Flag : (0x0000) -> NONE
[SectionCount] 4 (0x4) | ImageSize 0x7000 (28672) byte(s)
[Export] 100% of function(s) (2 of 2) are in file | 0 are forwarded | 2 code |
0 data | 0 uninit data | 0 unknown | 
[VersionInfo] Company Name : Activision Publishing. Inc.
[VersionInfo] File Description : Return to Castle Wolfenstein - GOTY
[VersionInfo] File Version : 1.0
[VersionInfo] Legal Copyrights : ®2002 Activision Publishing. Inc.
[ModuleReport] [IAT] Modules -> KERNEL32.dll | USER32.dll | GDI32.dll |
ADVAPI32.dll
[-= Installer =-] Wise Installation Wizard Module !
- Scan Took : 0.189 Second(s) [0000000BDh (189) tick(s)] [566 of 580 scan(s)
done]

Scanning -> G:\Setupet.exe
File Type : 32-Bit Exe (Subsystem : Win GUI / 2), Size : 1715160 (01A2BD8h)
Byte(s) | Machine: 0x14C (I386)
Compilation TimeStamp : 0x3BD86C3F -> Thu 25th Oct 2001 19:47:11 (GMT)
[TimeStamp] 0x3BD86C3F -> Thu 25th Oct 2001 19:47:11 (GMT) | PE Header | - |
Offset: 0x000000D8 | VA: 0x004000D8 | -
[TimeStamp] 0x3BD86C3F -> Thu 25th Oct 2001 19:47:11 (GMT) | Export | - |
Offset: 0x00002D14 | VA: 0x00404714 | -
-> File has 1700312 (019F1D8h) bytes of appended data starting at offset 03A00h
[File Heuristics] -> Flag #1 : 00000000000001001100000100000100 (0x0004C104)
[Entrypoint Section Entropy] : 6.28 (section #0) ".text   " | Size : 0x2126
(8486) byte(s)
[DllCharacteristics] -> Flag : (0x0000) -> NONE
[SectionCount] 4 (0x4) | ImageSize 0x7000 (28672) byte(s)
[Export] 100% of function(s) (2 of 2) are in file | 0 are forwarded | 2 code |
0 data | 0 uninit data | 0 unknown | 
[VersionInfo] Company Name : Activision Publishing. Inc.
[VersionInfo] File Description : Wolfenstein - Enemy Territory
[VersionInfo] File Version : 9.02.204.0
[VersionInfo] Legal Copyrights : ®2003 Activision Publishing. Inc.
[ModuleReport] [IAT] Modules -> KERNEL32.dll | USER32.dll | GDI32.dll |
ADVAPI32.dll
[-= Installer =-] Wise Installation Wizard Module !
- Scan Took : 0.194 Second(s) [0000000C2h (194) tick(s)] [566 of 580 scan(s)
done]
--- snip ---

$ sha1sum Return\ to\ Castle\ Wolfenstein\ \(USA\)\ \(Disc\ *
428aacbf5f5f82510498d69a0993dd5c045ae689  Return to Castle Wolfenstein (USA)
(Disc 1) (The Platinum Edition).bin
b99842feaa4f348b2cb39710f3ad15c56fab366a  Return to Castle Wolfenstein (USA)
(Disc 1) (The Platinum Edition).cue
2307c46ac91d115d7a40fb48f3896bd783629500  Return to Castle Wolfenstein (USA)
(Disc 2) (The Platinum Edition).bin
317c6d6d522e4d5b9ec7e620d2d8103c0ef40fb3  Return to Castle Wolfenstein (USA)
(Disc 2) (The Platinum Edition).cue

$ du -sh Return\ to\ Castle\ Wolfenstein\ \(USA\)\ \(Disc\ *
758M    Return to Castle Wolfenstein (USA) (Disc 1) (The Platinum Edition).bin
4.0K    Return to Castle Wolfenstein (USA) (Disc 1) (The Platinum Edition).cue
532M    Return to Castle Wolfenstein (USA) (Disc 2) (The Platinum Edition).bin
4.0K    Return to Castle Wolfenstein (USA) (Disc 2) (The Platinum Edition).cue

$ wine --version
wine-5.0-rc3

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