Suggestions for bug in VOLUMENAME function

Post Reply
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Suggestions for bug in VOLUMENAME function

Post by MaxP »

Hello,

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 );
}
Regards
Massimo
Post Reply