This is a bit of a hack to be honest (although it does work) & until I sort out a cleaner method it will do :D
BTW this has been written & tested on Windows 7 only, I have none of the other Windows OS'es available at this time to test it.
TYPE Twin_drive
drive_letter$[]
label$[]
file_system$[]
drive_type$[]
FUNCTION Get_drives:
LOCAL script$="dscript"
LOCAL output$="drives.txt"
LOCAL temp_dir$=PLATFORMINFO$("TEMP")
LOCAL old_dir$
LOCAL command$="diskpart /s dscript > drives.txt"
LOCAL rv
old_dir$=GETCURRENTDIR$() // Store the current dir so we can go back when done
SETCURRENTDIR(temp_dir$)
IF DOESFILEEXIST(script$)=FALSE
OPENFILE(1,script$,0)
WRITELINE 1,"list volume"
CLOSEFILE 1
SHELLCMD("CMD /C diskpart /s dscript > drives.txt",TRUE,FALSE,rv)
ENDIF
IF DOESFILEEXIST(output$) THEN Process_output(output$)
Clean_up(old_dir$)
ENDFUNCTION
FUNCTION Process_output: file$
LOCAL line$
OPENFILE(1,file$,1)
WHILE NOT ENDOFFILE(1)
READLINE 1,line$
IF INSTR(line$,"----------")<>-1 THEN BREAK // Find the start of the drive info
WEND
REPEAT
READLINE 1,line$
DIMPUSH self.drive_letter$[], MID$(line$,15,1)
DIMPUSH self.label$[], MID$(line$,19,10)
DIMPUSH self.file_system$[], MID$(line$,32,5)
DIMPUSH self.drive_type$[], MID$(line$,39,10)
UNTIL ENDOFFILE(1)
CLOSEFILE 1
ENDFUNCTION
FUNCTION Clean_up: dir$
KILLFILE "dscript"
KILLFILE "drives.txt"
SETCURRENTDIR(dir$) // Go back to whence we came ;)
ENDFUNCTION
ENDTYPE
LOCAL disks AS Twin_drive
LOCAL d
disks.Get_drives()
FOR d=0 TO BOUNDS(disks.drive_letter$[],0)-1
PRINT disks.drive_letter$[d],0,d*8
PRINT disks.label$[d],10,d*8
PRINT disks.file_system$[d],100,d*8
PRINT disks.drive_type$[d],150,d*8
NEXT
SHOWSCREEN
KEYWAIT
Lee
EDIT:
Have found a way of accessing the drive letters from wrapping a function from the Windows kernel32.dll for those who have a full license . It only gives the drive letters at the moment (no types like disk/cd etc or filesystem) but it sure is cleaner =D
TYPE Kernel32
drive_letter$[]
INLINE
DECLARE_C_ALIAS(GetLogDrives, "kernel32.dll", "GetLogicalDrives",(void),int);
ENDINLINE
FUNCTION Get_Log_Drives:
INLINE
return GetLogDrives();
ENDINLINE
ENDFUNCTION
FUNCTION Available_Drives:
LOCAL bittest% = 1
LOCAL loop%,bitcompare%,result%
result = self.Get_Log_Drives()
FOR loop = 0 TO 25
bitcompare = bAND(result,bittest)
IF bitcompare <> 0
DIMPUSH self.drive_letter$[],CHR$(loop+65)
ENDIF
bittest = ASL(bittest,1)
NEXT
ENDFUNCTION
ENDTYPE
GLOBAL drives AS Kernel32
GLOBAL loop%,text$
drives.Available_Drives()
FOR loop = 0 TO BOUNDS(drives.drive_letter$[],0)-1
text$ = "Drive " + drives.drive_letter$[loop] + ": = Found"
PRINT text$,0,loop*8
NEXT
SHOWSCREEN
KEYWAIT