Error handling is compatible

This commit is contained in:
Paul Tucker
2000-03-22 21:38:31 +00:00
parent e1103a85ab
commit 1c45ae7e98
2 changed files with 17 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
20000322-16:40 EST Paul Tucker <ptucker@sympatico.ca>
* source/rtl/diskspac.c
* no windows dialogs if disk not in drive.
* Compatible error box instead.
2000-03-22 16:35 GMT-5 David G. Holm <dholm@jsd-llc.com>
* config/os2/gcc.cf

View File

@@ -114,6 +114,7 @@ HB_FUNC( DISKSPACE )
char szPath[ 4 ];
P_GDFSE pGetDiskFreeSpaceEx;
UINT uiErrMode;
/* Get the default drive */
@@ -131,6 +132,10 @@ HB_FUNC( DISKSPACE )
szPath[ 2 ] = '\\';
szPath[ 3 ] = '\0';
uiErrMode = SetErrorMode( SEM_FAILCRITICALERRORS );
SetLastError(0);
pGetDiskFreeSpaceEx = ( P_GDFSE ) GetProcAddress( GetModuleHandle( "kernel32.dll" ),
"GetDiskFreeSpaceExA");
@@ -208,6 +213,8 @@ HB_FUNC( DISKSPACE )
DWORD dwNumberOfFreeClusters;
DWORD dwTotalNumberOfClusters;
SetLastError(0);
if( GetDiskFreeSpace( szPath,
&dwSectorsPerCluster,
&dwBytesPerSector,
@@ -238,6 +245,11 @@ HB_FUNC( DISKSPACE )
( double ) dwBytesPerSector;
}
}
SetErrorMode( uiErrMode );
if( GetLastError() != 0 )
hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT );
}
#else
@@ -249,4 +261,3 @@ HB_FUNC( DISKSPACE )
hb_retnlen( dSpace, -1, 0 );
}