Commit 41dc1176 authored by Diego Biurrun's avatar Diego Biurrun

ioctl: Drop single-use INIT_SPTD/SEND_SPTD macros

parent 00abe6bb
......@@ -169,7 +169,13 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = dvdbs.copyrightProtectionSystemType;
#elif defined( WIN32 )
INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );
DWORD tmp;
SCSI_PASS_THROUGH_DIRECT sptd = { 0 };
uint8_t p_buffer[8];
sptd.Length = sizeof( SCSI_PASS_THROUGH_DIRECT );
sptd.DataBuffer = p_buffer;
sptd.DataTransferLength = sizeof( p_buffer );
WinInitSPTD( &sptd, GPCMD_READ_DVD_STRUCTURE );
/* When using IOCTL_DVD_READ_STRUCTURE and
DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
......@@ -180,7 +186,10 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
sptd.Cdb[ 6 ] = i_layer;
sptd.Cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
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;
if( i_ret == 0 )
{
......
......@@ -65,20 +65,6 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
dvd.format = FORMAT; \
dvd.buffer = &dvdbs; \
dvd.bufferLength = sizeof(dvdbs);
#elif defined( WIN32 )
#define INIT_SPTD( TYPE, SIZE ) \
DWORD tmp; \
SCSI_PASS_THROUGH_DIRECT sptd = { 0 }; \
uint8_t p_buffer[ (SIZE) ]; \
sptd.Length = sizeof( SCSI_PASS_THROUGH_DIRECT ); \
sptd.DataBuffer = p_buffer; \
sptd.DataTransferLength = (SIZE); \
WinInitSPTD( &sptd, (TYPE) );
#define SEND_SPTD( DEV, SPTD, TMP ) \
(DeviceIoControl( (HANDLE)(DEV), IOCTL_SCSI_PASS_THROUGH_DIRECT, \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(TMP), NULL ) ? 0 : -1)
#elif defined( __QNXNTO__ )
#define INIT_CPT( TYPE, SIZE ) \
CAM_PASS_THRU * p_cpt = { 0 }; \
......
......@@ -93,14 +93,23 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
#elif defined( WIN32 )
INIT_SPTD( GPCMD_SEND_KEY, 8 );
DWORD tmp;
SCSI_PASS_THROUGH_DIRECT sptd = { 0 };
uint8_t p_buffer[8];
sptd.Length = sizeof( SCSI_PASS_THROUGH_DIRECT );
sptd.DataBuffer = p_buffer;
sptd.DataTransferLength = sizeof( p_buffer );
WinInitSPTD( &sptd, GPCMD_SEND_KEY );
sptd.Cdb[ 10 ] = DVD_SEND_RPC;
p_buffer[ 1 ] = 6;
p_buffer[ 4 ] = i_pdrc;
i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
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;
#elif defined( __QNXNTO__ )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment