[libdvdcss-devel] win32: Use proper handle instead of file descriptor to access devices
Alexander Strasser
eclipse7 at gmx.net
Fri Nov 21 21:16:57 CET 2014
On 2014-11-19 23:41 +0100, Alexander Strasser wrote:
> On 2014-11-19 23:13 +0100, Jean-Baptiste Kempf wrote:
> > On 19 Nov, Alexander Strasser wrote :
> > > It broke:
> > > - device.c:dvdcss_use_ioctls
> > > - integrity of the code base because it's incompatible with ioctl.c design
> > > - test/dvd_region.c (it uses internals and thus is not the same as below)
> > > - test/csstest and probably all other downstream clients
> >
> > Can you detail the breakage?
>
> I could not test with a player yet. (Maybe tomorrow or at weekend.)
Finally I came around to test it with a player. Tested 3 of my DVDs
with MPlayer and the good news is playback still worked! Personally
I will continue to use the version with 1b4e3f9 reverted because of
below...
Some remarks to my findings; basically we got lucky because of the
bug in dvdcss_use_ioctls that was introduced in that same commit:
@@ -92,7 +92,7 @@ static int os2_open ( dvdcss_t, const char * );
int dvdcss_use_ioctls( dvdcss_t dvdcss )
{
#if defined( WIN32 )
- if( dvdcss->b_file )
+ if( dvdcss->p_handle )
{
return 0;
}
@@ -344,38 +344,32 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
print_debug( dvdcss, "opening target `%s'", psz_device );
#if defined( WIN32 )
- dvdcss->b_file = 1;
- /* If device is "X:" or "X:\", we are not actually opening a file. */
- if (psz_device[0] && psz_device[1] == ':' &&
- (!psz_device[2] || (psz_device[2] == '\\' && !psz_device[3])))
- dvdcss->b_file = 0;
-
- /* Initialize readv temporary buffer */
+ dvdcss->p_handle = NULL;
dvdcss->p_readv_buffer = NULL;
dvdcss->i_readv_buf_size = 0;
+#endif /* defined( WIN32 ) */
- if( !dvdcss->b_file )
+#if defined( WIN32 ) || defined( __OS2__ )
+ /* If device is "X:" or "X:\", we are not actually opening a file. */
+ if( psz_device[0] && psz_device[1] == ':' &&
+ ( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
{
+#if defined( WIN32 )
print_debug( dvdcss, "using Win2K API for access" );
dvdcss->pf_seek = win2k_seek;
dvdcss->pf_read = win2k_read;
dvdcss->pf_readv = win2k_readv;
return win2k_open( dvdcss, psz_device );
The condition in dvdcss_use_ioctls was reversed from what it was
before. This lead to the code not using ioctls, which I explained
in my previous mail cannot work anymore. So AFAIK this in turn leads
to the pessimistic assumption that discs are always scrambled. So with
current libdvdcss git version scrambled DVDs still play and unscrambled
ones too. It will waste some time and CPU trying to crack the keys for
unscrambled DVDs but things will play after that. RPC stuff, in general,
and test/dvd_region.exe don't work anymore.
If I *fix* the dvdcss_use_ioctls bug, playback of scrambled DVDs
*fails* for me here. It assumes the disc is unscrambled and reading
the DVD objects fails. For unscrambled ones it continues to work.
Alexander
> Here are some outputs I get when running the programs under test:
>
> csstest without 1b4e3f9
> $ DVDCSS_VERBOSE=2 test/csstest D: 1024
> libdvdcss debug: opening target `D:'
> libdvdcss debug: using Win2K API for access
> libdvdcss debug: disc reports copyright information 0x0
> libdvdcss debug: drive region(s) 2, region mask 0xfd, RPC-II, region
> code set
> libdvdcss debug: disc is unscrambled
> [...]
> requested sector:
> 000001ba...0d4e514811313801030202200100000000000d4e4149...
> sector is not scrambled
>
> csstest with 1b4e3f9::
> $ DVDCSS_VERBOSE=2 test/csstest D: 1024
> libdvdcss debug: opening target `D:'
> libdvdcss debug: using Win2K API for access
> [...]
> requested sector:
> 000001ba...0d4e514811313801030202200100000000000d4e4149...
> sector is not scrambled
>
>
> For dvd_region:
> $ DVDCSS_VERBOSE=2 test/dvd_region -d D:
> libdvdcss debug: opening target `D:'
> libdvdcss debug: using Win2K API for access
> libdvdcss debug: disc reports copyright information 0x0
> libdvdcss debug: drive region(s) 2, region mask 0xfd, RPC-II, region
> code set
> libdvdcss debug: disc is unscrambled
> [...]
> ret 0, copyright 0
> Drive region info:
> Type: Drive region is set
> Region: 2 playable
> RPC Scheme: The Logical Unit _shall_ adhere to the specification and all
> requirements of the Content Scrambling System (CSS) license agreement
> concerning RPC.
>
> vs:
> $ DVDCSS_VERBOSE=2 test/dvd_region -d D:
> libdvdcss debug: opening target `D:'
> libdvdcss debug: using Win2K API for access
> [...]
> ret -1, copyright 0
> Drive region info:
> dvd_region: File exists
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/libdvdcss-devel/attachments/20141121/9a184847/attachment.sig>
More information about the libdvdcss-devel
mailing list