> >*-- >* Store Volume information in the passed array. >* >* 1- Volume Name >* 2- Volume Serial (numeric) >* 3- Volume Serial (hexadecimal string) >* >* Parameters >* >* pcDrive - Drive Letter of the drive to get information. >* paDriveinfo - Variable passed by reference. >* It is dimensioned as an 3 element array. >* Example : >* >* Local aVolinfo >* GetVolInfo("C", @aVolinfo) >* ? aVolInfo(3) && serial number in hex. format. >*-- > >PROCEDURE GetVolInfo > LParam pcDrive, paDriveInfo > > Declare Integer GetVolumeInformation In Win32API ; > String @, String @, Integer, Integer ; > @, Integer @, Integer @, String @, Integer > > Local LcDrive, LcHex > Local Lcroot, Lcvolbuffer, Lnvolsize, Lnvolsernum > Local Lnmaxlen, Lnfsflags, Lcfsnmbuff, Lnfsnmsz > > Lcdrive = Upper(Left(Ltrim(pcDrive), 1)) > Lcroot = Lcdrive+":\" > > Lnvolsize = 260 > Lnfsnmsz = 260 > Lcvolbuffer = Replicate(chr(0),260) > Lcfsnmbuff = Replicate(chr(0),260) > > Lnmaxlen = 0 > Lnvolsernum = 0 > Lnfsflags = 0 > > Lnerror = GetVolumeInformation(@Lcroot,@Lcvolbuffer, Lnvolsize, ; > @Lnvolsernum, @Lnmaxlen,@Lnfsflags, @Lcfsnmbuff, Lnfsnmsz) > > IF Lnvolsernum < 0 > Lnvolsernum = 0xFFFFFFFF + Lnvolsernum + 1 > Endif > LcHex = Right(Transform(Lnvolsernum, '@0'),8) > > If type('paDriveinfo(1)')='U' .or. ALen(paDriveInfo,1)<3 > Dimension paDriveinfo(3) > Endif > > paDriveInfo(1) = Left(Lcvolbuffer, At(Chr(0), Lcvolbuffer) -1) > paDriveInfo(2) = Lnvolsernum > paDriveInfo(3) = Left(lcHex,4)+'-'+Right(lcHex, 4) > >Endproc > >>