Share this page 

Get the CDROM drive letterTag(s): WinAPI/Registry


[Function declarations]
FUNCTION ulong GetLogicalDrives() LIBRARY "Kernel32.dll"
FUNCTION uint GetDriveType( Ref String as_root_path ) 
   LIBRARY "kernel32.dll" ALIAS FOR "GetDriveTypeA"

[PB function String of_GetCDRootPath()]

integer   li_ctr
string    ls_root
ulong     lul_drives, lul_rem

lul_drives = GetLogicalDrives()

DO
  lul_rem = MOD(lul_drives, 2)
  IF lul_rem = 1 THEN
     ls_root = Char(li_ctr + 64) + ":\"
     IF GetDriveType(ls_root_path) = 5 THEN
        Return ls_root_path
     END IF
     li_ctr ++
  END IF
  lul_drives /= 2
LOOP UNTIL lul_drives = 0

RETURN ""