shithub: libdvdcss

Download patch

ref: cf2eb147875db33b8aa06245b47ccea49b621d58
parent: 04675299a604238ec1d03cbfdb7e1067f2416c5d
author: Sam Hocevar <sam@videolan.org>
date: Sat Aug 10 13:42:09 EDT 2002

* ./src/ioctl.c: fixed ReportRPC for Win32.
  * ./src/device.h: removed unneeded exported symbols.


--- a/src/device.c
+++ b/src/device.c
@@ -2,7 +2,7 @@
  * device.h: DVD device access
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: device.c,v 1.2 2002/08/10 14:27:26 sam Exp $
+ * $Id: device.c,v 1.3 2002/08/10 17:42:09 sam Exp $
  *
  * Authors: St�phane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -52,6 +52,17 @@
 #include "libdvdcss.h"
 #include "ioctl.h"
 #include "device.h"
+
+/*****************************************************************************
+ * Device reading prototypes, win32 specific
+ *****************************************************************************/
+#ifdef WIN32
+int _win32_dvdcss_readv  ( int, struct iovec *, int, char * );
+int _win32_dvdcss_aopen  ( dvdcss_t, char );
+int _win32_dvdcss_aclose ( int );
+int _win32_dvdcss_aseek  ( int, int, int );
+int _win32_dvdcss_aread  ( int, void *, int );
+#endif
 
 /*****************************************************************************
  * readv_*: readv() replacements for iovec-impaired C libraries
--- a/src/device.h
+++ b/src/device.h
@@ -2,7 +2,7 @@
  * device.h: DVD device access
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: device.h,v 1.2 2002/08/10 14:27:26 sam Exp $
+ * $Id: device.h,v 1.3 2002/08/10 17:42:09 sam Exp $
  *
  * Authors: St�phane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -47,17 +47,6 @@
 int _dvdcss_open       ( dvdcss_t );
 int _dvdcss_close      ( dvdcss_t );
 int _dvdcss_readv      ( dvdcss_t, struct iovec *, int );
-
-/*****************************************************************************
- * Device reading prototypes, win32 specific
- *****************************************************************************/
-#ifdef WIN32
-int _win32_dvdcss_readv  ( int, struct iovec *, int, char * );
-int _win32_dvdcss_aopen  ( char, dvdcss_t );
-int _win32_dvdcss_aclose ( int );
-int _win32_dvdcss_aseek  ( int, int, int );
-int _win32_dvdcss_aread  ( int, void *, int );
-#endif
 
 /*****************************************************************************
  * Device reading prototypes, raw-device specific
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -2,7 +2,7 @@
  * ioctl.c: DVD ioctl replacement function
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ioctl.c,v 1.12 2002/07/01 10:36:37 hjort Exp $
+ * $Id: ioctl.c,v 1.13 2002/08/10 17:42:09 sam Exp $
  *
  * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
  *          Samuel Hocevar <sam@zoy.org>
@@ -1620,18 +1620,15 @@
 
         memset( &buffer, 0, sizeof( buffer ) );
 
-#if !defined(_MSC_VER)
-#   warning "Fix ReportRPC for WIN32!"
-#endif
         i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_GET_REGION, NULL, 0,
                 region, DVD_REGION_LENGTH, &tmp, NULL ) ? 0 : -1;
 
         /* Someone who has the headers should correct all this. */
-	/* Use the IOCTL_SCSI_PASS_THROUGH_DIRECT so we get the reall
+	/* Use the IOCTL_SCSI_PASS_THROUGH_DIRECT so we get the real
 	 * values of theses entities?  */
-        if(key->SystemRegion != 0) {
-	    *p_type = key->ResetCount > 1 ? 1 : 3 - key->ResetCount;
-	    *p_mask =  0xff ^ (1 << (key->SystemRegion - 1));
+        if(region->SystemRegion != 0) {
+	    *p_type = region->ResetCount > 1 ? 1 : 3 - region->ResetCount;
+	    *p_mask =  0xff ^ (1 << (region->SystemRegion - 1));
 	    *p_scheme = 1;
 	}
 	else
@@ -1705,11 +1702,8 @@
             /* leave the flags to 0 */
             break;
 
-        case GPCMD_READ_DVD_STRUCTURE:
-        case GPCMD_REPORT_KEY:
-            p_rdc->flags = B_RAW_DEVICE_DATA_IN;
-            break;
-    }
+        case GPCMD_READ_DVD_STRUCTURE: case GPCMD_REPORT_KEY:
+    p_rdc->flags = B_RAW_DEVICE_DATA_IN; break; }
 
     p_rdc->command[ 0 ]      = i_type;
 
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -2,7 +2,7 @@
  * ioctl.h: DVD ioctl replacement function
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ioctl.h,v 1.6 2002/07/01 10:36:37 hjort Exp $
+ * $Id: ioctl.h,v 1.7 2002/08/10 17:42:09 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -186,6 +186,8 @@
 #define IOCTL_DVD_READ_KEY              CTL_CODE(FILE_DEVICE_DVD, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
 #define IOCTL_DVD_SEND_KEY              CTL_CODE(FILE_DEVICE_DVD, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
 #define IOCTL_DVD_END_SESSION           CTL_CODE(FILE_DEVICE_DVD, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_DVD_GET_REGION            CTL_CODE(FILE_DEVICE_DVD, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_DVD_SEND_KEY2             CTL_CODE(FILE_DEVICE_DVD, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
 
 #define IOCTL_SCSI_PASS_THROUGH_DIRECT  CTL_CODE(FILE_DEVICE_CONTROLLER, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)