Troy Rollo : ntdll: Fix DVD_ReadStructure's layout of layer information.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Apr 8 13:12:24 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 90df5a967f5057336781d3edb7416227fc82cd73
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=90df5a967f5057336781d3edb7416227fc82cd73

Author: Troy Rollo <wine at troy.rollo.name>
Date:   Sat Apr  8 10:05:01 2006 +1000

ntdll: Fix DVD_ReadStructure's layout of layer information.

Fix DVD_ReadStructure to reflect what Windows actually does, not what
Microsoft (incorrectly) documents it to do and not what the DDK
headers (incorrectly) suggest it does.

---

 dlls/ntdll/cdrom.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c
index 8838949..a94613a 100644
--- a/dlls/ntdll/cdrom.c
+++ b/dlls/ntdll/cdrom.c
@@ -176,6 +176,32 @@ static const char *iocodex(DWORD code)
 #define FRAME_OF_TOC(toc, idx)  FRAME_OF_ADDR((toc).TrackData[idx - (toc).FirstTrack].Address)
 #define MSF_OF_FRAME(m,fr) {int f=(fr); ((UCHAR *)&(m))[2]=f%CD_FRAMES;f/=CD_FRAMES;((UCHAR *)&(m))[1]=f%CD_SECS;((UCHAR *)&(m))[0]=f/CD_SECS;}
 
+/* The documented format of DVD_LAYER_DESCRIPTOR is wrong. Even the format in the
+ * DDK's header is wrong. There are four bytes at the start which always seem to
+ * follow the sequence "02 08 00 00".
+ */
+typedef struct
+{
+    UCHAR MagicHeader[4];
+    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;
+} internal_dvd_layer_descriptor;
+
+
 static NTSTATUS CDROM_ReadTOC(int, int, CDROM_TOC*);
 static NTSTATUS CDROM_GetStatusCode(int);
 
@@ -1844,9 +1870,13 @@ static NTSTATUS DVD_ReadStructure(int de
     {
     case DvdPhysicalDescriptor:
         {
-            DVD_LAYER_DESCRIPTOR *p = layer;
+            internal_dvd_layer_descriptor *p = (internal_dvd_layer_descriptor *) layer;
             struct dvd_layer *l = &s.physical.layer[s.physical.layer_num];
 
+            p->MagicHeader[0] = 2;
+            p->MagicHeader[1] = 8;
+            p->MagicHeader[2] = 0;
+            p->MagicHeader[3] = 0;
             p->BookVersion = l->book_version;
             p->BookType = l->book_type;
             p->MinimumRate = l->min_rate;




More information about the wine-cvs mailing list