[Bug 29667] New: Dragon Age: Origins DVD authenticity checks fail (DVD_LAYER_DESCRIPTOR big endian values need to be converted host endianness before being returned to caller)

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Jan 21 05:57:41 CST 2012


http://bugs.winehq.org/show_bug.cgi?id=29667

             Bug #: 29667
           Summary: Dragon Age: Origins DVD authenticity checks fail
                    (DVD_LAYER_DESCRIPTOR big endian values need to be
                    converted host endianness before being returned to
                    caller)
           Product: Wine
           Version: 1.3.37
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ntdll
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: focht at gmx.net
    Classification: Unclassified


Hello,

continuation of bug 26459
After all DVD structures are correctly byte-padded, the DVD authenticity checks
still fail.

The loader checks various fields in the DVD_LAYER_DESCRIPTOR returned from
IOCTL_DVD_READ_STRUCTURE.

DVD_LAYER_DESCRIPTOR description (there are several similar online resources):

http://www.osronline.com/ddkx/storage/k306_3mia.htm

--- snip ---
typedef struct _DVD_LAYER_DESCRIPTOR {
  UCHAR  BookVersion : 4;
  UCHAR  BookType : 4;
  UCHAR  MinimumRate : 4;
  UCHAR  DiskSize : 4;
  UCHAR  LayerType : 4;
  UCHAR  TrackPath : 1;
  UCHAR  NumberOfLayers : 2;
  UCHAR  Reserved1 : 1;
  UCHAR  TrackDensity : 4;
  UCHAR  LinearDensity : 4;
  ULONG  StartingDataSector;
  ULONG  EndDataSector;
  ULONG  EndLayerZeroSector;
  UCHAR  Reserved5 : 7;
  UCHAR  BCAFlag : 1;
  UCHAR  Reserved6;
} DVD_LAYER_DESCRIPTOR, *PDVD_LAYER_DESCRIPTOR;
--- snip ---

The problematic part are the following fields:

--- snip ---
StartingDataSector
    Specifies the first block that contains user data. This member can have one
of the following values:
    Value     Meaning
    0x30000     An initial block value of 0x30000 indicates that the media type
is DVD-ROM or DVD-R/-RW
    0x31000     An initial block value of 0x30000 indicates that the media type
is DVD-RAM or DVD+RW

EndDataSector
    Specifies the last sector of the user data in the last layer of the media. 
EndLayerZeroSector
    Specifies the last sector of the user data in layer zero. If this media
does not use the opposite track path method and contains multiple layers, this
value is set to zero.
--- snip ---

"Text" version of SCSI Multi-Media Commands - 6 (MMC-6) PDF:

http://hackipedia.org/Hardware/SCSI/Multimedia/SCSI%20Multimedia%20Commands%20-%206.pdf.raw-conversion.utf-8.txt

A bit hard to read due to formatting, I reformatted the relevant clause:

--- quote ---
3.8   Bit and byte ordering

This sub-clause describes the representation of fields in a table that defines
the format of a SCSI structure (e.g., the format of a CDB).

If a field consists of more than one bit and contains a single value (e.g., a
number), the least significant bit (LSB) is shown on the right and the most
significant bit (MSB) is shown on the left (e.g., in a byte, bit 7 is the MSB
and is shown on the left; and bit 0 is the LSB and is shown on the right).
The MSB and LSB are not labeled if the field consists of 8 or fewer bits.

If a field consists of more than one byte and contains a single value, the byte
containing the MSB is stored at the lowest address and the byte containing the
LSB is stored at the highest address (i.e., big-endian byte ordering).

...
--- quote ---

These ULONGs need to be byte-swapped (host endianness) before being returned to
caller.

The internal info string (containing formatted DVD_LAYER_DESCRIPTOR values):

"DVD-ROM, ReadOnly, OTP, 2, 0x30000, 0xfcffff, 0x22577f, silver media, ," 

The game loader code verifies the "StartingDataSector" value against 0x300 and
0x310 which fails because Wine doesn't do endianness conversion.

Code:
http://source.winehq.org/git/wine.git/blob/f082eac97c3ec71de58eea85bb4de5a12b19f13f:/dlls/ntdll/cdrom.c#l2551

Wine's "__APPLE__" code already does it right, using OSReadBigInt32() for big
endian to host endianness conversion.

Code:
http://source.winehq.org/git/wine.git/blob/f082eac97c3ec71de58eea85bb4de5a12b19f13f:/dlls/ntdll/cdrom.c#l2679

With that fix in place at least the DVD_LAYER_DESCRIPTOR data is now properly
verified.
The internal info string will now look like this:

"DVD-ROM, ReadOnly, OTP, 2, 0x300, 0xfffffc00, 0x7f572200, silver media, ,"

Though it still fails - another bug ;-)

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
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