ref: e24d72f5d84d7e1384544048f9befc987e68dc53
parent: 00e3bb6ea62a6a5dace32cc43856ccd7a790a3c6
author: Jon Lech Johansen <jlj@videolan.org>
date: Fri Nov 15 13:39:08 EST 2002
* ./src/ioctl.[ch]: ReportRPC win32 changes. Needs testing.
--- 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.19 2002/11/14 12:38:57 gbazin Exp $
+ * $Id: ioctl.c,v 1.20 2002/11/15 18:39:08 jlj Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
@@ -1622,28 +1622,26 @@
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
- u8 buffer[ DVD_REGION_LENGTH ];
- PDVD_REGION region = (PDVD_REGION) &buffer;
+ u8 buffer[DVD_RPC_KEY_LENGTH];
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
memset( &buffer, 0, sizeof( buffer ) );
- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_GET_REGION, NULL, 0,
- region, DVD_REGION_LENGTH, &tmp, NULL ) ? 0 : -1;
+ key->KeyLength = DVD_RPC_KEY_LENGTH;
+ key->KeyType = DvdGetRpcKey;
+ key->KeyFlags = 0;
- /* Someone who has the headers should correct all this. */
- /* Use the IOCTL_SCSI_PASS_THROUGH_DIRECT so we get the real
- * values of theses entities? */
- if(region->SystemRegion != 0) {
- *p_type = region->ResetCount > 1 ? 1 : 3 - region->ResetCount;
- *p_mask = 0xff ^ (1 << (region->SystemRegion - 1));
- *p_scheme = 1;
- }
- else
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+
+ if( i_ret < 0 )
{
- *p_type = 0; /* ?? */
- *p_mask = 0xff;
- *p_scheme = 1; /* ?? */
+ return i_ret;
}
+
+ *p_type = ((PDVD_RPC_KEY)key->KeyData)->TypeCode;
+ *p_mask = ((PDVD_RPC_KEY)key->KeyData)->RegionMask;
+ *p_scheme = ((PDVD_RPC_KEY)key->KeyData)->RpcScheme;
}
else
{
--- 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.10 2002/10/19 09:53:33 gbazin Exp $
+ * $Id: ioctl.h,v 1.11 2002/11/15 18:39:08 jlj Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
@@ -195,8 +195,8 @@
#define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
+#define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
-#define DVD_REGION_LENGTH (sizeof(DVD_REGION))
#define DVD_COPYRIGHT_MASK 0x00000040
#define DVD_NOT_COPYRIGHTED 0x00000000
@@ -271,12 +271,15 @@
UCHAR Reserved1:7;
} DVD_ASF, * PDVD_ASF;
-typedef struct _DVD_REGION {
- UCHAR CopySystem;
- UCHAR RegionData;
- UCHAR SystemRegion;
- UCHAR ResetCount;
-} DVD_REGION, *PDVD_REGION;
+typedef struct _DVD_RPC_KEY
+{
+ UCHAR UserResetsAvailable:3;
+ UCHAR ManufacturerResetsAvailable:3;
+ UCHAR TypeCode:2;
+ UCHAR RegionMask;
+ UCHAR RpcScheme;
+ UCHAR Reserved2[1];
+} DVD_RPC_KEY, * PDVD_RPC_KEY;
typedef struct _SCSI_PASS_THROUGH_DIRECT
{