Diego Biurrun
2013-02-01 12:05:43 UTC
Signed-off-by: Diego Biurrun <***@biurrun.de>
---
configure.ac | 1 -
src/ioctl.c | 41 +++++++++++++++++++----------------------
src/ioctl.h | 8 ++++++--
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/configure.ac b/configure.ac
index 44ff25c..ca2e708 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,6 @@ case x"${target_os}" in
yes
#endif],
AC_DEFINE(SYS_CYGWIN, 1, Have a Cygwin system.))
- AC_DEFINE(WIN32, 1, Using Win32.)
;;
xbeos*)
AC_DEFINE(SYS_BEOS, 1, Have a BeOS system.)
diff --git a/src/ioctl.c b/src/ioctl.c
index 5c7e615..3ebeb07 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -31,14 +31,15 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include "config.h"
-
#include <stdio.h>
-
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h>
-#if defined( WIN32 )
+#include "config.h"
+#include "common.h"
+#include "ioctl.h"
+
+#if defined( WIN32_DVD_API )
# include <windows.h>
# include <winioctl.h>
#elif defined ( SYS_OS2 )
@@ -90,10 +91,6 @@
# include <sys/dcmd_cam.h>
#endif
-#include "common.h"
-
-#include "ioctl.h"
-
/*****************************************************************************
* Local prototypes, BeOS specific
*****************************************************************************/
@@ -119,7 +116,7 @@ static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
/*****************************************************************************
* Local prototypes, win32 (aspi) specific
*****************************************************************************/
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
static void WinInitSSC ( struct SRB_ExecSCSICmd *, int );
static int WinSendSSC ( int, struct SRB_ExecSCSICmd * );
@@ -213,7 +210,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = dvdbs.copyrightProtectionSystemType;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );
@@ -373,7 +370,7 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.discKeyStructures, DVD_DISCKEY_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -541,7 +538,7 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
memcpy( p_key, dvdbs.titleKeyValue, DVD_KEY_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -687,7 +684,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = dvdbs.grantID;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
ULONG id;
@@ -808,7 +805,7 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
memcpy( p_challenge, dvdbs.challengeKeyValue, DVD_CHALLENGE_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -940,7 +937,7 @@ int ioctl_ReportASF( int i_fd, int *pi_remove_me, int *pi_asf )
*pi_asf = dvdbs.successFlag;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1075,7 +1072,7 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.key1Value, DVD_KEY_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1192,7 +1189,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1320,7 +1317,7 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1457,7 +1454,7 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1603,7 +1600,7 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_mask = dvdbs.driveRegion;
*p_scheme = dvdbs.rpcScheme;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1746,7 +1743,7 @@ int ioctl_SendRPC( int i_fd, int i_pdrc )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
INIT_SPTD( GPCMD_SEND_KEY, 8 );
@@ -1969,7 +1966,7 @@ static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc )
}
#endif
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
/*****************************************************************************
* WinInitSPTD: initialize a sptd structure
*****************************************************************************
diff --git a/src/ioctl.h b/src/ioctl.h
index c0bc7d5..bc423b8 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -24,6 +24,10 @@
#ifndef DVDCSS_IOCTL_H
#define DVDCSS_IOCTL_H
+#if defined( WIN32 ) || defined( SYS_CYGWIN )
+# define WIN32_DVD_API
+#endif
+
int ioctl_ReadCopyright ( int, int, int * );
int ioctl_ReadDiscKey ( int, int *, uint8_t * );
int ioctl_ReadTitleKey ( int, int *, int, uint8_t * );
@@ -101,7 +105,7 @@ int ioctl_SendRPC ( int, int );
/*****************************************************************************
* Common macro, win32 specific
*****************************************************************************/
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
#define INIT_SPTD( TYPE, SIZE ) \
DWORD tmp; \
SCSI_PASS_THROUGH_DIRECT sptd; \
@@ -194,7 +198,7 @@ typedef union dvd_authinfo dvd_authinfo;
/*****************************************************************************
* win32 ioctl specific
*****************************************************************************/
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
---
configure.ac | 1 -
src/ioctl.c | 41 +++++++++++++++++++----------------------
src/ioctl.h | 8 ++++++--
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/configure.ac b/configure.ac
index 44ff25c..ca2e708 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,6 @@ case x"${target_os}" in
yes
#endif],
AC_DEFINE(SYS_CYGWIN, 1, Have a Cygwin system.))
- AC_DEFINE(WIN32, 1, Using Win32.)
;;
xbeos*)
AC_DEFINE(SYS_BEOS, 1, Have a BeOS system.)
diff --git a/src/ioctl.c b/src/ioctl.c
index 5c7e615..3ebeb07 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -31,14 +31,15 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include "config.h"
-
#include <stdio.h>
-
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h>
-#if defined( WIN32 )
+#include "config.h"
+#include "common.h"
+#include "ioctl.h"
+
+#if defined( WIN32_DVD_API )
# include <windows.h>
# include <winioctl.h>
#elif defined ( SYS_OS2 )
@@ -90,10 +91,6 @@
# include <sys/dcmd_cam.h>
#endif
-#include "common.h"
-
-#include "ioctl.h"
-
/*****************************************************************************
* Local prototypes, BeOS specific
*****************************************************************************/
@@ -119,7 +116,7 @@ static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
/*****************************************************************************
* Local prototypes, win32 (aspi) specific
*****************************************************************************/
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
static void WinInitSSC ( struct SRB_ExecSCSICmd *, int );
static int WinSendSSC ( int, struct SRB_ExecSCSICmd * );
@@ -213,7 +210,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = dvdbs.copyrightProtectionSystemType;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );
@@ -373,7 +370,7 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.discKeyStructures, DVD_DISCKEY_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -541,7 +538,7 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
memcpy( p_key, dvdbs.titleKeyValue, DVD_KEY_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -687,7 +684,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = dvdbs.grantID;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
ULONG id;
@@ -808,7 +805,7 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
memcpy( p_challenge, dvdbs.challengeKeyValue, DVD_CHALLENGE_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -940,7 +937,7 @@ int ioctl_ReportASF( int i_fd, int *pi_remove_me, int *pi_asf )
*pi_asf = dvdbs.successFlag;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1075,7 +1072,7 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.key1Value, DVD_KEY_SIZE );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1192,7 +1189,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1320,7 +1317,7 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1457,7 +1454,7 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1603,7 +1600,7 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_mask = dvdbs.driveRegion;
*p_scheme = dvdbs.rpcScheme;
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
DWORD tmp;
@@ -1746,7 +1743,7 @@ int ioctl_SendRPC( int i_fd, int i_pdrc )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
-#elif defined( WIN32 )
+#elif defined( WIN32_DVD_API )
if( WIN2K ) /* NT/2k/XP */
{
INIT_SPTD( GPCMD_SEND_KEY, 8 );
@@ -1969,7 +1966,7 @@ static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc )
}
#endif
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
/*****************************************************************************
* WinInitSPTD: initialize a sptd structure
*****************************************************************************
diff --git a/src/ioctl.h b/src/ioctl.h
index c0bc7d5..bc423b8 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -24,6 +24,10 @@
#ifndef DVDCSS_IOCTL_H
#define DVDCSS_IOCTL_H
+#if defined( WIN32 ) || defined( SYS_CYGWIN )
+# define WIN32_DVD_API
+#endif
+
int ioctl_ReadCopyright ( int, int, int * );
int ioctl_ReadDiscKey ( int, int *, uint8_t * );
int ioctl_ReadTitleKey ( int, int *, int, uint8_t * );
@@ -101,7 +105,7 @@ int ioctl_SendRPC ( int, int );
/*****************************************************************************
* Common macro, win32 specific
*****************************************************************************/
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
#define INIT_SPTD( TYPE, SIZE ) \
DWORD tmp; \
SCSI_PASS_THROUGH_DIRECT sptd; \
@@ -194,7 +198,7 @@ typedef union dvd_authinfo dvd_authinfo;
/*****************************************************************************
* win32 ioctl specific
*****************************************************************************/
-#if defined( WIN32 )
+#if defined( WIN32_DVD_API )
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
--
1.7.9.5
1.7.9.5