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 ...@@ -115,6 +115,7 @@ D: Bug fixes
N: Jon Lech Johansen N: Jon Lech Johansen
E: jon-vl@nanocrew.net E: jon-vl@nanocrew.net
D: PS input fixes D: PS input fixes
D: Win32 port
N: Michel Kaempf N: Michel Kaempf
E: maxx@via.ecp.fr E: maxx@via.ecp.fr
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -140,7 +140,6 @@ struct es_descriptor_s; ...@@ -140,7 +140,6 @@ struct es_descriptor_s;
/***************************************************************************** /*****************************************************************************
* Macros and inline functions * Macros and inline functions
*****************************************************************************/ *****************************************************************************/
#ifdef NTOHL_IN_SYS_PARAM_H #ifdef NTOHL_IN_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
#elif defined(WIN32) #elif defined(WIN32)
...@@ -157,10 +156,10 @@ struct es_descriptor_s; ...@@ -157,10 +156,10 @@ struct es_descriptor_s;
/* MAX and MIN: self explanatory */ /* MAX and MIN: self explanatory */
#ifndef MAX #ifndef MAX
#define MAX(a, b) ( ((a) > (b)) ? (a) : (b) ) # define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#endif #endif
#ifndef MIN #ifndef MIN
#define MIN(a, b) ( ((a) < (b)) ? (a) : (b) ) # define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif #endif
/* MSB (big endian)/LSB (little endian) conversions - network order is always /* MSB (big endian)/LSB (little endian) conversions - network order is always
...@@ -171,19 +170,19 @@ struct es_descriptor_s; ...@@ -171,19 +170,19 @@ struct es_descriptor_s;
/* FIXME: hton64 should be declared as an extern inline function to avoid /* FIXME: hton64 should be declared as an extern inline function to avoid
* border effects (see byteorder.h) */ * border effects (see byteorder.h) */
#if WORDS_BIGENDIAN #if WORDS_BIGENDIAN
#define hton16 htons # define hton16 htons
#define hton32 htonl # define hton32 htonl
#define hton64(i) ( i ) # define hton64(i) ( i )
#define ntoh16 ntohs # define ntoh16 ntohs
#define ntoh32 ntohl # define ntoh32 ntohl
#define ntoh64(i) ( i ) # define ntoh64(i) ( i )
#else #else
#define hton16 htons # define hton16 htons
#define hton32 htonl # define hton32 htonl
#define hton64(i) ( ((u64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff ) ) # define hton64(i) ( ((u64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff ) )
#define ntoh16 ntohs # define ntoh16 ntohs
#define ntoh32 ntohl # define ntoh32 ntohl
#define ntoh64 hton64 # define ntoh64 hton64
#endif #endif
/* Macros with automatic casts */ /* Macros with automatic casts */
...@@ -194,15 +193,16 @@ struct es_descriptor_s; ...@@ -194,15 +193,16 @@ struct es_descriptor_s;
/* win32, cl and icl support */ /* win32, cl and icl support */
#if defined( _MSC_VER ) #if defined( _MSC_VER )
typedef long off_t; typedef long off_t;
#define __attribute__(x) # define __attribute__(x)
#define __inline__ __inline # define __inline__ __inline
#define strncasecmp strnicmp # define strncasecmp strnicmp
#define strcasecmp stricmp # define strcasecmp stricmp
#define S_ISBLK(m) (0) # define S_ISBLK(m) (0)
#define S_ISCHR(m) (0) # define S_ISCHR(m) (0)
#define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO) # define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
#define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG) # define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
#define I64C(x) x # define I64C(x) x
#else #else
#define I64C(x) x##LL # define I64C(x) x##LL
#endif #endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration. * interface, such as message output. See config.h for output configuration.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -49,11 +49,11 @@ void _intf_DbgMsgImm ( char *psz_file, char *psz_function, int i_line, ...@@ -49,11 +49,11 @@ void _intf_DbgMsgImm ( char *psz_file, char *psz_function, int i_line,
/* Non-TRACE mode */ /* Non-TRACE mode */
#if defined( _MSC_VER ) #if defined( _MSC_VER )
#define intf_DbgMsg # define intf_DbgMsg
#define intf_DbgMsgImm # define intf_DbgMsgImm
#else #else
#define intf_DbgMsg( format, args... ) # define intf_DbgMsg( format, args... )
#define intf_DbgMsgImm( format, args...) # define intf_DbgMsgImm( format, args...)
#endif #endif
#endif #endif
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling * dvd_css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 ) #elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h> # include <io.h>
#endif #endif
#include <string.h> #include <string.h>
...@@ -50,9 +50,11 @@ ...@@ -50,9 +50,11 @@
#include "intf_msg.h" #include "intf_msg.h"
#include "dvd_css.h" #include "dvd_css.h"
#ifdef HAVE_CSS #ifdef HAVE_CSS
#include "dvd_csstables.h" # include "dvd_csstables.h"
#endif /* HAVE_CSS */ #endif /* HAVE_CSS */
#include "dvd_ioctl.h" #include "dvd_ioctl.h"
#include "input_dvd.h" #include "input_dvd.h"
...@@ -333,8 +335,13 @@ int CSSGetKey( int i_fd, css_t * p_css ) ...@@ -333,8 +335,13 @@ int CSSGetKey( int i_fd, css_t * p_css )
i_pos = p_css->i_title_pos; i_pos = p_css->i_title_pos;
do { do {
#if !defined( WIN32 )
i_pos = lseek( i_fd, i_pos, SEEK_SET ); i_pos = lseek( i_fd, i_pos, SEEK_SET );
i_bytes_read = read( i_fd, pi_buf, 0x800 ); 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 */ /* PES_scrambling_control */
if( pi_buf[0x14] & 0x30 ) if( pi_buf[0x14] & 0x30 )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing * dvd_ifo.c: Functions for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 ) #elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h> # include <io.h>
#endif #endif
#include <string.h> #include <string.h>
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
#include "dvd_udf.h" #include "dvd_udf.h"
#include "input_dvd.h" #include "input_dvd.h"
/* /*****************************************************************************
* Local prototypes * Local prototypes
*/ *****************************************************************************/
void CommandRead ( command_desc_t ); void CommandRead ( command_desc_t );
static int ReadTitle ( ifo_t * , title_t *, off_t ); static int ReadTitle ( ifo_t * , title_t *, off_t );
static int FreeTitle ( title_t * ); static int FreeTitle ( title_t * );
...@@ -72,9 +72,18 @@ static int FreeTitleSet ( vts_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 ) 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 ); memset( pi_buffer, 0, DVD_LB_SIZE );
#if !defined( WIN32 )
p_ifo->i_pos = lseek( p_ifo->i_fd, i_pos, SEEK_SET ); p_ifo->i_pos = lseek( p_ifo->i_fd, i_pos, SEEK_SET );
read( p_ifo->i_fd, pi_buffer, DVD_LB_SIZE ); 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; return pi_buffer;
} }
...@@ -1095,9 +1104,15 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos ) ...@@ -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 */ /* parsing of chapter_map_t: it gives the entry cell for each chapter */
if( p_title->i_chapter_map_start_byte ) if( p_title->i_chapter_map_start_byte )
{ {
#if !defined( WIN32 )
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_pos = lseek( p_ifo->i_fd,
i_start + p_title->i_chapter_map_start_byte, i_start + p_title->i_chapter_map_start_byte,
SEEK_SET ); 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 = p_title->chapter_map.pi_start_cell =
malloc( p_title->i_chapter_nb *sizeof(chapter_map_t) ); malloc( p_title->i_chapter_nb *sizeof(chapter_map_t) );
......
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
* dvd_ioctl.c: DVD ioctl replacement function * dvd_ioctl.c: DVD ioctl replacement function
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -30,9 +31,12 @@ ...@@ -30,9 +31,12 @@
#include <string.h> /* memcpy(), memset() */ #include <string.h> /* memcpy(), memset() */
#include <sys/types.h> #include <sys/types.h>
#if !defined( WIN32 ) #if defined( WIN32 )
#include <netinet/in.h> # include <windows.h>
#include <sys/ioctl.h> # include <winioctl.h>
#else
# include <netinet/in.h>
# include <sys/ioctl.h>
#endif #endif
#ifdef DVD_STRUCT_IN_SYS_CDIO_H #ifdef DVD_STRUCT_IN_SYS_CDIO_H
...@@ -65,26 +69,6 @@ ...@@ -65,26 +69,6 @@
*****************************************************************************/ *****************************************************************************/
#if defined( SYS_BEOS ) #if defined( SYS_BEOS )
static void BeInitRDC ( raw_device_command *, int ); 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 #endif
/***************************************************************************** /*****************************************************************************
...@@ -132,6 +116,49 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright ) ...@@ -132,6 +116,49 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
i_ret = 0; 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 #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1; i_ret = -1;
...@@ -202,6 +229,35 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key ) ...@@ -202,6 +229,35 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memset( p_key, 0x00, 2048 ); 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 #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1; i_ret = -1;
...@@ -257,6 +313,22 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid ) ...@@ -257,6 +313,22 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = p_buffer[ 7 ] >> 6; *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 #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1; i_ret = -1;
...@@ -312,6 +384,35 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) ...@@ -312,6 +384,35 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
memcpy( p_challenge, p_buffer + 4, 12 ); 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 #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1; i_ret = -1;
...@@ -369,6 +470,37 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf ) ...@@ -369,6 +470,37 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
*pi_asf = p_buffer[ 7 ] & 1; *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 #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1; i_ret = -1;
...@@ -423,6 +555,30 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key ) ...@@ -423,6 +555,30 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 8 ); 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 #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1; i_ret = -1;
...@@ -473,6 +629,19 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid ) ...@@ -473,6 +629,19 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, IODVD_SEND_KEY, &dvdioctl ); 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 #else
/* DVD ioctls unavailable - do as if the ioctl failed */ /* DVD ioctls unavailable - do as if the ioctl failed */
i_ret = -1; i_ret = -1;
...@@ -527,6 +696,30 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) ...@@ -527,6 +696,30 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
return ioctl( i_fd, IODVD_SEND_KEY, &dvdioctl ); return ioctl( i_fd, IODVD_SEND_KEY, &dvdioctl );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */