Suggestions for bug in VOLUMENAME function
Posted: Fri Apr 24, 2020 3:16 pm
Hello,
If the function GetVolumeInformation fails (harddisk.c), a random buffer is returned
Regards
Massimo
If the function GetVolumeInformation fails (harddisk.c), a random buffer is returned
Code: Select all
HB_FUNC( VOLUMENAME )
{
DWORD dwVolumeSerialNumber;
BYTE VolumeNameBuffer[ 256 ];
BYTE FileSystemNameBuffer[ 256 ];
/*****
GetVolumeInformation( hb_pcount() ? hb_parc( 1 ): "C:\\",
( char * ) VolumeNameBuffer, sizeof( VolumeNameBuffer ),
&dwVolumeSerialNumber, 0, 0,
( char * ) FileSystemNameBuffer,
sizeof( FileSystemNameBuffer ) ); */
/*****/
if ( ! GetVolumeInformation( hb_pcount() ? hb_parc( 1 ): "C:\\",
( char * ) VolumeNameBuffer, sizeof( VolumeNameBuffer ),
&dwVolumeSerialNumber, 0, 0,
( char * ) FileSystemNameBuffer,
sizeof( FileSystemNameBuffer ) ) )
VolumeNameBuffer[0] = '\0' ;
/*****/
hb_retc( ( char * ) VolumeNameBuffer );
}
Massimo