* css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: css.c,v 1.20 2002/01/14 22:06:57 stef Exp $
+ * $Id: css.c,v 1.21 2002/01/21 07:00:21 gbazin Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
* Håkan Hjort <d95hjort@dtek.chalmers.se>
/* Since it's the first ioctl we try to issue, we add a notice */
_dvdcss_error( dvdcss, "css error: ioctl_ReadCopyright failed, "
"make sure there is a DVD in the drive, and that "
- "DVD ioctls were compiled in this libdvdcss version" );
+ "DVD ioctls were compiled in this libdvdcss version."
+#if defined( WIN32 )
+ "\nAlso note that if you are using Windows NT/2000/XP "
+ "you need to have administrator priviledges to be able "
+ "to use ioctls."
+#endif
+ );
return i_ret;
}
* libdvdcss.c: DVD reading library.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.c,v 1.28 2002/01/15 05:22:21 stef Exp $
+ * $Id: libdvdcss.c,v 1.29 2002/01/21 07:00:21 gbazin Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
return NULL;
}
+#if defined( WIN32 )
+ /* it's not possible to stat a drive letter. Fake a block device */
+ fileinfo.st_mode = S_IFBLK;
+#else
if( stat( psz_target, &fileinfo ) < 0 )
{
_dvdcss_error( dvdcss, "dvdcss: can't stat target" );
}
-
+#endif
+
if( S_ISBLK( fileinfo.st_mode ) ||
S_ISCHR( fileinfo.st_mode ) )
{
{
char psz_dvd[7];
_snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_target[0] );
+
+ /* To have access to ioctls, we need read and write access to the
+ * device. This is only allowed if you have administrator priviledges
+ * so we allow for a fallback method where ioctls are not available but
+ * we at least have read access to the device.
+ * (See Microsoft Q241374: Read and Write Access Required for SCSI
+ * Pass Through Requests) */
(HANDLE) dvdcss->i_fd =
CreateFile( psz_dvd, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, 0, NULL );
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_RANDOM_ACCESS, NULL );
+
+ if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
+ (HANDLE) dvdcss->i_fd =
+ CreateFile( psz_dvd, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_RANDOM_ACCESS, NULL );
+
if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
{
_dvdcss_error( dvdcss, "failed opening device" );
* vout_events.c: Windows DirectX video output events handler
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: vout_events.c,v 1.8 2002/01/17 23:02:45 gbazin Exp $
+ * $Id: vout_events.c,v 1.9 2002/01/21 07:00:21 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
{
case VK_ESCAPE:
case VK_F12:
- PostQuitMessage( 0 );
+ /* exit application */
+ p_main->p_intf->b_die = 1;
break;
}
TranslateMessage(&msg);
{
case 'q':
case 'Q':
- PostQuitMessage( 0 );
+ /* exit application */
+ p_main->p_intf->b_die = 1;
break;
case 'f': /* switch to fullscreen */
hInstance ); /* handle to application instance */
/* free window background brush */
- if( p_vout->p_sys->hwnd != NULL )
+ if( p_vout->p_sys->hbrush != NULL )
{
DeleteObject( p_vout->p_sys->hbrush );
p_vout->p_sys->hbrush = NULL;
/* the window has been closed so shut down everything now */
case WM_DESTROY:
intf_WarnMsg( 4, "vout: WinProc WM_DESTROY" );
+ /* exit application */
+ p_main->p_intf->b_die = 1;
PostQuitMessage( 0 );
+ return 0;
break;
case WM_SYSCOMMAND:
* vout_pictures.c : picture management functions
*****************************************************************************
* Copyright (C) 2000 VideoLAN
- * $Id: vout_pictures.c,v 1.11 2002/01/17 23:02:45 gbazin Exp $
+ * $Id: vout_pictures.c,v 1.12 2002/01/21 07:00:21 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
int *pi_x, int *pi_y, int *pi_width, int *pi_height )
{
if( (i_width <= 0) || (i_height <=0) )
+ {
+ *pi_width = *pi_height = *pi_x = *pi_y = 0;
+
return;
+ }
if( p_vout->b_scale )
{