diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d3839952d7..8845512031 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,16 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-15 10:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/filesys.c + ! hb_fsIsDrv() changed on win platform to use GetLogicalDrives() API + instead of GetDriveTypeA(). This should fix existing TOFIX. + Thanks for Saulius Zrelskis for the suggestion. + I'd like to ask users to make side-by-side comparisons with + CA-Cl*pper to see if we're compatible. + ! Fixed hb_fsIsDrv() on non-win platforms to always set + internal error to zero. CA-Cl*pper does the same. + 2009-10-14 13:18 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/qth/QFileDialog.qth * contrib/hbqt/qth/QFontDatabase.qth diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index 4724c11669..574b912520 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -2899,10 +2899,6 @@ BYTE hb_fsCurDrv( void ) /* NOTE: 0=A:, 1=B:, 2=C:, 3=D:, ... */ -/* TOFIX: This isn't fully compliant because CA-Cl*pper doesn't access - the drive before checking. hb_fsIsDrv only returns TRUE - if there is a disk in the drive. */ - USHORT hb_fsIsDrv( BYTE nDrive ) { USHORT uiResult; @@ -2911,18 +2907,9 @@ USHORT hb_fsIsDrv( BYTE nDrive ) #if defined( HB_OS_WIN ) && !defined( HB_OS_WIN_CE ) { - char buffer[ 4 ]; - UINT type; - - buffer[ 0 ] = nDrive + 'A'; - buffer[ 1 ] = ':'; - buffer[ 2 ] = '\\'; - buffer[ 3 ] = '\0'; - hb_vmUnlock(); - type = GetDriveTypeA( buffer ); + uiResult = ( ( GetLogicalDrives() >> nDrive ) & 1 ) ? 0 : ( USHORT ) F_ERROR; hb_vmLock(); - uiResult = ( type == DRIVE_UNKNOWN || type == DRIVE_NO_ROOT_DIR ) ? F_ERROR : 0; hb_fsSetError( 0 ); } #elif defined( HB_OS_HAS_DRIVE_LETTER ) @@ -2936,17 +2923,9 @@ USHORT hb_fsIsDrv( BYTE nDrive ) HB_FS_GETDRIVE( uiSave ); HB_FS_SETDRIVE( nDrive ); HB_FS_GETDRIVE( uiNewDrive ); - if( ( UINT ) nDrive != uiNewDrive ) - { - uiResult = ( USHORT ) FS_ERROR; - hb_fsSetError( ( USHORT ) FS_ERROR ); - } - else - { - uiResult = 0; - hb_fsSetError( 0 ); - } + uiResult = ( ( UINT ) nDrive == uiNewDrive ) ? 0 : ( USHORT ) FS_ERROR; HB_FS_SETDRIVE( uiSave ); + hb_fsSetError( 0 ); hb_vmLock(); } @@ -2954,7 +2933,7 @@ USHORT hb_fsIsDrv( BYTE nDrive ) HB_SYMBOL_UNUSED( nDrive ); uiResult = ( USHORT ) FS_ERROR; - hb_fsSetError( ( USHORT ) FS_ERROR ); + hb_fsSetError( 0 ); #endif