Commit b8ce47bb authored by Sam Hocevar's avatar Sam Hocevar

  * Win2000 DVD input by Jon Lech Johansen <jon-vl@nanocrew.net>.
parent 94d3d4d8
......@@ -115,6 +115,7 @@ D: Bug fixes
N: Jon Lech Johansen
E: jon-vl@nanocrew.net
D: PS input fixes
D: Win32 port
N: Michel Kaempf
E: maxx@via.ecp.fr
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.33 2001/05/31 01:37:08 sam Exp $
* $Id: common.h,v 1.34 2001/05/31 03:12:49 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -140,7 +140,6 @@ struct es_descriptor_s;
/*****************************************************************************
* Macros and inline functions
*****************************************************************************/
#ifdef NTOHL_IN_SYS_PARAM_H
# include <sys/param.h>
#elif defined(WIN32)
......@@ -157,10 +156,10 @@ struct es_descriptor_s;
/* MAX and MIN: self explanatory */
#ifndef MAX
#define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
# define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef MIN
#define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
# define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
/* MSB (big endian)/LSB (little endian) conversions - network order is always
......@@ -171,19 +170,19 @@ struct es_descriptor_s;
/* FIXME: hton64 should be declared as an extern inline function to avoid
* border effects (see byteorder.h) */
#if WORDS_BIGENDIAN
#define hton16 htons
#define hton32 htonl
#define hton64(i) ( i )
#define ntoh16 ntohs
#define ntoh32 ntohl
#define ntoh64(i) ( i )
# define hton16 htons
# define hton32 htonl
# define hton64(i) ( i )
# define ntoh16 ntohs
# define ntoh32 ntohl
# define ntoh64(i) ( i )
#else
#define hton16 htons
#define hton32 htonl
#define hton64(i) ( ((u64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff ) )
#define ntoh16 ntohs
#define ntoh32 ntohl
#define ntoh64 hton64
# define hton16 htons
# define hton32 htonl
# define hton64(i) ( ((u64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff ) )
# define ntoh16 ntohs
# define ntoh32 ntohl
# define ntoh64 hton64
#endif
/* Macros with automatic casts */
......@@ -194,15 +193,16 @@ struct es_descriptor_s;
/* win32, cl and icl support */
#if defined( _MSC_VER )
typedef long off_t;
#define __attribute__(x)
#define __inline__ __inline
#define strncasecmp strnicmp
#define strcasecmp stricmp
#define S_ISBLK(m) (0)
#define S_ISCHR(m) (0)
#define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
#define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
#define I64C(x) x
# define __attribute__(x)
# define __inline__ __inline
# define strncasecmp strnicmp
# define strcasecmp stricmp
# define S_ISBLK(m) (0)
# define S_ISCHR(m) (0)
# define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
# define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
# define I64C(x) x
#else
#define I64C(x) x##LL
# define I64C(x) x##LL
#endif
......@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_msg.h,v 1.14 2001/05/31 01:37:08 sam Exp $
* $Id: intf_msg.h,v 1.15 2001/05/31 03:12:49 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -49,11 +49,11 @@ void _intf_DbgMsgImm ( char *psz_file, char *psz_function, int i_line,
/* Non-TRACE mode */
#if defined( _MSC_VER )
#define intf_DbgMsg
#define intf_DbgMsgImm
# define intf_DbgMsg
# define intf_DbgMsgImm
#else
#define intf_DbgMsg( format, args... )
#define intf_DbgMsgImm( format, args...)
# define intf_DbgMsg( format, args... )
# define intf_DbgMsgImm( format, args...)
#endif
#endif
......
......@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.30 2001/05/31 01:37:08 sam Exp $
* $Id: dvd_css.c,v 1.31 2001/05/31 03:12:49 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -38,9 +38,9 @@
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
# include <io.h>
#endif
#include <string.h>
......@@ -50,9 +50,11 @@
#include "intf_msg.h"
#include "dvd_css.h"
#ifdef HAVE_CSS
#include "dvd_csstables.h"
# include "dvd_csstables.h"
#endif /* HAVE_CSS */
#include "dvd_ioctl.h"
#include "input_dvd.h"
......@@ -333,8 +335,13 @@ int CSSGetKey( int i_fd, css_t * p_css )
i_pos = p_css->i_title_pos;
do {
#if !defined( WIN32 )
i_pos = lseek( i_fd, i_pos, SEEK_SET );
i_bytes_read = read( i_fd, pi_buf, 0x800 );
#else
i_pos = SetFilePointer( (HANDLE) i_fd, i_pos, 0, FILE_BEGIN );
ReadFile( (HANDLE) i_fd, pi_buf, 0x800, &i_bytes_read, NULL );
#endif
/* PES_scrambling_control */
if( pi_buf[0x14] & 0x30 )
......
......@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.28 2001/05/31 01:37:08 sam Exp $
* $Id: dvd_ifo.c,v 1.29 2001/05/31 03:12:49 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -36,9 +36,9 @@
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
# include <io.h>
#endif
#include <string.h>
......@@ -51,9 +51,9 @@
#include "dvd_udf.h"
#include "input_dvd.h"
/*
/*****************************************************************************
* Local prototypes
*/
*****************************************************************************/
void CommandRead ( command_desc_t );
static int ReadTitle ( ifo_t * , title_t *, off_t );
static int FreeTitle ( title_t * );
......@@ -72,9 +72,18 @@ static int FreeTitleSet ( vts_t * );
*****************************************************************************/
static __inline__ u8* FillBuffer( ifo_t* p_ifo, u8* pi_buffer, off_t i_pos )
{
#if defined( WIN32 )
DWORD tmp;
#endif
memset( pi_buffer, 0, DVD_LB_SIZE );
#if !defined( WIN32 )
p_ifo->i_pos = lseek( p_ifo->i_fd, i_pos, SEEK_SET );
read( p_ifo->i_fd, pi_buffer, DVD_LB_SIZE );
#else
p_ifo->i_pos = SetFilePointer( (HANDLE) p_ifo->i_fd, i_pos, NULL, FILE_BEGIN );
ReadFile( (HANDLE) p_ifo->i_fd, pi_buffer, DVD_LB_SIZE, &tmp, NULL );
#endif
return pi_buffer;
}
......@@ -1095,9 +1104,15 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
/* parsing of chapter_map_t: it gives the entry cell for each chapter */
if( p_title->i_chapter_map_start_byte )
{
#if !defined( WIN32 )
p_ifo->i_pos = lseek( p_ifo->i_fd,
i_start + p_title->i_chapter_map_start_byte,
SEEK_SET );
#else
p_ifo->i_pos = SetFilePointer( (HANDLE) p_ifo->i_fd,
i_start + p_title->i_chapter_map_start_byte,
NULL, FILE_BEGIN );
#endif
p_title->chapter_map.pi_start_cell =
malloc( p_title->i_chapter_nb *sizeof(chapter_map_t) );
......
......@@ -2,10 +2,11 @@
* dvd_ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.c,v 1.15 2001/05/31 01:37:08 sam Exp $
* $Id: dvd_ioctl.c,v 1.16 2001/05/31 03:12:49 sam Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -30,9 +31,12 @@
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h>
#if !defined( WIN32 )
#include <netinet/in.h>
#include <sys/ioctl.h>
#if defined( WIN32 )
# include <windows.h>
# include <winioctl.h>
#else
# include <netinet/in.h>
# include <sys/ioctl.h>
#endif
#ifdef DVD_STRUCT_IN_SYS_CDIO_H
......@@ -65,26 +69,6 @@
*****************************************************************************/
#if defined( SYS_BEOS )
static void BeInitRDC ( raw_device_command *, int );
#define INIT_RDC( TYPE, SIZE ) \
raw_device_command rdc; \
u8 p_buffer[ (SIZE) ]; \
memset( &rdc, 0, sizeof( raw_device_command ) ); \
rdc.data = (char *)p_buffer; \
rdc.data_length = (SIZE); \
BeInitRDC( &rdc, (TYPE) );
#endif
/*****************************************************************************
* Local prototypes, Darwin specific
*****************************************************************************/
#if defined( SYS_DARWIN1_3 )
#define INIT_DVDIOCTL( SIZE ) \
dvdioctl_data_t dvdioctl; \
u8 p_buffer[ (SIZE) ]; \
dvdioctl.p_buffer = p_buffer; \
dvdioctl.i_size = (SIZE); \
dvdioctl.i_keyclass = kCSS_CSS2_CPRM; \
memset( p_buffer, 0, (SIZE) );
#endif
/*****************************************************************************
......@@ -132,6 +116,49 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
i_ret = 0;
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 p_buffer[ 8 ];
SCSI_PASS_THROUGH_DIRECT sptd;
memset( &sptd, 0, sizeof( sptd ) );
memset( &p_buffer, 0, sizeof( p_buffer ) );
/* When using IOCTL_DVD_READ_STRUCTURE and
DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
is always 6. So we send a raw scsi command instead. */
sptd.Length = sizeof( SCSI_PASS_THROUGH_DIRECT );
sptd.CdbLength = 12;
sptd.DataIn = SCSI_IOCTL_DATA_IN;
sptd.DataTransferLength = 8;
sptd.TimeOutValue = 2;
sptd.DataBuffer = p_buffer;
sptd.Cdb[ 0 ] = GPCMD_READ_DVD_STRUCTURE;
sptd.Cdb[ 6 ] = i_layer;
sptd.Cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
sptd.Cdb[ 8 ] = (8 >> 8) & 0xff;
sptd.Cdb[ 9 ] = 8 & 0xff;
i_ret = DeviceIoControl( (HANDLE) i_fd,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&sptd, sizeof( SCSI_PASS_THROUGH_DIRECT ),
&sptd, sizeof( SCSI_PASS_THROUGH_DIRECT ),
&tmp, NULL ) ? 0 : -1;
*pi_copyright = p_buffer[4];
}
else
{
/* TODO: add WNASPI support for Win9x */
intf_ErrMsg( "css error: DVD ioctls not functional yet" );
intf_ErrMsg( "css error: assuming disc is unencrypted" );
*pi_copyright = 0;
i_ret = 0;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1;
......@@ -202,6 +229,35 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memset( p_key, 0x00, 2048 );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_DISK_KEY_LENGTH];
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
memset( &buffer, 0, sizeof( buffer ) );
key->KeyLength = DVD_DISK_KEY_LENGTH;
key->SessionId = *pi_agid;
key->KeyType = DvdDiskKey;
key->KeyFlags = 0;
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
if( i_ret < 0 )
{
return i_ret;
}
memcpy( p_key, key->KeyData, 2048 );
}
else
{
i_ret = -1;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1;
......@@ -257,6 +313,22 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = p_buffer[ 7 ] >> 6;
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
ULONG id;
DWORD tmp;
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_START_SESSION,
&tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;
*pi_agid = id;
}
else
{
i_ret = -1;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1;
......@@ -312,6 +384,35 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
memcpy( p_challenge, p_buffer + 4, 12 );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_CHALLENGE_KEY_LENGTH];
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
memset( &buffer, 0, sizeof( buffer ) );
key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
key->SessionId = *pi_agid;
key->KeyType = DvdChallengeKey;
key->KeyFlags = 0;
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
if( i_ret < 0 )
{
return i_ret;
}
memcpy( p_challenge, key->KeyData, 10 );
}
else
{
i_ret = -1;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1;
......@@ -369,6 +470,37 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
*pi_asf = p_buffer[ 7 ] & 1;
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_ASF_LENGTH];
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
memset( &buffer, 0, sizeof( buffer ) );
key->KeyLength = DVD_ASF_LENGTH;
key->SessionId = *pi_agid;
key->KeyType = DvdAsf;
key->KeyFlags = 0;
((PDVD_ASF)key->KeyData)->SuccessFlag = *pi_asf;
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
if( i_ret < 0 )
{
return i_ret;
}
*pi_asf = ((PDVD_ASF)key->KeyData)->SuccessFlag;
}
else
{
i_ret = -1;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1;
......@@ -423,6 +555,30 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 8 );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_BUS_KEY_LENGTH];
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
memset( &buffer, 0, sizeof( buffer ) );
key->KeyLength = DVD_BUS_KEY_LENGTH;
key->SessionId = *pi_agid;
key->KeyType = DvdBusKey1;
key->KeyFlags = 0;
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
memcpy( p_key, key->KeyData, 8 );
}
else
{
i_ret = -1;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1;
......@@ -473,6 +629,19 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, IODVD_SEND_KEY, &dvdioctl );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;
}
else
{
i_ret = -1;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1;
......@@ -527,6 +696,30 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
return ioctl( i_fd, IODVD_SEND_KEY, &dvdioctl );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_CHALLENGE_KEY_LENGTH];
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
memset( &buffer, 0, sizeof( buffer ) );
key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
key->SessionId = *pi_agid;
key->KeyType = DvdChallengeKey;
key->KeyFlags = 0;
memcpy( key->KeyData, p_challenge, 10 );
return DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
}
else
{
return -1;
}
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
return -1;
......@@ -569,6 +762,30 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_BUS_KEY_LENGTH];
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
memset( &buffer, 0, sizeof( buffer ) );
key->KeyLength = DVD_BUS_KEY_LENGTH;
key->SessionId = *pi_agid;
key->KeyType = DvdBusKey2;
key->KeyFlags = 0;
memcpy( key->KeyData, p_key, 8 );
return DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
}
else
{
return -1;
}
#elif defined( SYS_DARWIN1_3 )
INIT_DVDIOCTL( 12 );
......
......@@ -2,7 +2,7 @@
* dvd_ioctl.h: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.h,v 1.8 2001/05/25 04:44:49 sam Exp $
* $Id: dvd_ioctl.h,v 1.9 2001/05/31 03:12:49 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -32,7 +32,37 @@ int ioctl_InvalidateAgid ( int, int * );
int ioctl_SendChallenge ( int, int *, u8 * );
int ioctl_SendKey2 ( int, int *, u8 * );
#ifdef SYS_BEOS
/*****************************************************************************
* Common macro, BeOS specific
*****************************************************************************/
#if defined( SYS_BEOS )
#define INIT_RDC( TYPE, SIZE ) \
raw_device_command rdc; \
u8 p_buffer[ (SIZE) ]; \
memset( &rdc, 0, sizeof( raw_device_command ) ); \
rdc.data = (char *)p_buffer; \
rdc.data_length = (SIZE); \
BeInitRDC( &rdc, (TYPE) );
#endif
/*****************************************************************************
* Common macro, Darwin specific
*****************************************************************************/
#if defined( SYS_DARWIN1_3 )
#define INIT_DVDIOCTL( SIZE ) \
dvdioctl_data_t dvdioctl; \
u8 p_buffer[ (SIZE) ]; \
dvdioctl.p_buffer = p_buffer; \
dvdioctl.i_size = (SIZE); \
dvdioctl.i_keyclass = kCSS_CSS2_CPRM; \
memset( p_buffer, 0, (SIZE) );
#endif
/*****************************************************************************
* Various DVD I/O tables
*****************************************************************************/
#if defined( SYS_BEOS ) || defined( WIN32 )
/* The generic packet command opcodes for CD/DVD Logical Units,
* From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
......@@ -43,6 +73,81 @@ int ioctl_SendKey2 ( int, int *, u8 * );
/* DVD struct types */
#define DVD_STRUCT_COPYRIGHT 0x01
#define DVD_STRUCT_DISCKEY 0x02
#endif
#if defined( WIN32 )
#define IOCTL_DVD_START_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
#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_SCSI_PASS_THROUGH_DIRECT CTL_CODE(FILE_DEVICE_CONTROLLER, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
typedef enum
{
DvdChallengeKey = 0x01,
DvdBusKey1,
DvdBusKey2,
DvdTitleKey,
DvdAsf,
DvdSetRpcKey = 0x6,
DvdGetRpcKey = 0x8,
DvdDiskKey = 0x80,
DvdInvalidateAGID = 0x3f
} DVD_KEY_TYPE;
typedef struct _DVD_COPY_PROTECT_KEY
{
ULONG KeyLength;
DVD_SESSION_ID SessionId;
DVD_KEY_TYPE KeyType;
ULONG KeyFlags;
union
{
struct
{
ULONG FileHandle;
ULONG Reserved; // used for NT alignment
};
LARGE_INTEGER TitleOffset;
} Parameters;
UCHAR KeyData[0];
} DVD_COPY_PROTECT_KEY, *PDVD_COPY_PROTECT_KEY;
typedef struct _DVD_ASF
{
UCHAR Reserved0[3];
UCHAR SuccessFlag:1;
UCHAR Reserved1:7;
} DVD_ASF, * PDVD_ASF;
typedef struct _SCSI_PASS_THROUGH_DIRECT
{
USHORT Length;
UCHAR ScsiStatus;
UCHAR PathId;
UCHAR TargetId;
UCHAR Lun;
UCHAR CdbLength;
UCHAR SenseInfoLength;
UCHAR DataIn;
ULONG DataTransferLength;
ULONG TimeOutValue;
PVOID DataBuffer;
ULONG SenseInfoOffset;
UCHAR Cdb[16];
} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
#define SCSI_IOCTL_DATA_OUT 0
#define SCSI_IOCTL_DATA_IN 1
/* Key formats */
#define DVD_REPORT_AGID 0x00
......
......@@ -7,7 +7,7 @@
* will only be given back to netlist when refcount is zero.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: dvd_netlist.c,v 1.6 2001/05/31 01:37:08 sam Exp $
* $Id: dvd_netlist.c,v 1.7 2001/05/31 03:12:49 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
* Stphane Borel <stef@videolan.org>
......@@ -37,14 +37,14 @@
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#if !defined( WIN32 )
#include <sys/uio.h> /* struct iovec */
#if defined( WIN32 )
# include <io.h>
# include "iovec.h"
#else
#include <io.h>
#include "iovec.h"
# include <sys/uio.h> /* struct iovec */
#endif
#include "config.h"
......
......@@ -5,7 +5,7 @@
* contains the basic udf handling functions
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_udf.c,v 1.7 2001/05/31 01:37:08 sam Exp $
* $Id: dvd_udf.c,v 1.8 2001/05/31 03:12:49 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -34,25 +34,26 @@
#include "defs.h"
#ifdef HAVE_CSS
#define MODULE_NAME dvd
# define MODULE_NAME dvd
#else /* HAVE_CSS */
#define MODULE_NAME dvdnocss
# define MODULE_NAME dvdnocss
#endif /* HAVE_CSS */
#include "modules_inner.h"