Determine the type of drive
- RichAlgeni
- Addict

- Posts: 935
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Determine the type of drive
Is there a way to determine the type of a disk drive on a system? Specifically, I'd like to know if a drive is removable, and a DVD or Blu-ray drive. I am writing a process to convert DVD files to mp4's.
Re: Determine the type of drive
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
- RichAlgeni
- Addict

- Posts: 935
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Re: Determine the type of drive
Thank you!!!
Re: Determine the type of drive
Code: Select all
Procedure.i SL_IsLocalDrive(Drive$)
Drive$ = UCase(Left(Drive$, 1))
Protected.i nDrive = RealDriveType_(Asc(Drive$) - 65, 0)
Select nDrive
Case #DRIVE_NO_ROOT_DIR
nDrive = 0
Case #DRIVE_UNKNOWN
ndrive = 0
Case #DRIVE_REMOVABLE
nDrive = 1
Case #DRIVE_FIXED
nDrive = 1
Case #DRIVE_REMOTE
nDrive = 0
Case #DRIVE_CDROM
nDrive = 0
Case #DRIVE_RAMDISK
nDrive = 0 ; Could be -1, if allowing RAM Drives
EndSelect
ProcedureReturn nDrive
EndProcedure
Debug SL_IsLocalDrive("P")
Procedure.s SL_GetLocalDrives()
Protected.i i, ri
Protected.i mask = GetLogicalDrives_()
Protected.s d$, r$
For i = 0 To 31
If mask & (1 << i)
d$ = Chr('A' + i) + ":\"
ri = GetDriveType_(d$)
If ri <> #DRIVE_CDROM And (ri = #DRIVE_FIXED Or ri = #DRIVE_REMOVABLE)
r$ + d$ + #CMA$
EndIf
EndIf
Next i
ProcedureReturn RTrim(r$, #CMA$)
EndProcedure
Debug SL_GetLocalDrives()The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
- RichAlgeni
- Addict

- Posts: 935
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Re: Determine the type of drive
So, I really didn't use the code for the disk type, as it really didn't make a difference to what I was trying to accomplish.
This is what I wrote, a process to convert and combine DVD video files, and make one mp4 file.
https://www.purebasic.fr/english/viewtopic.php?t=83429
This is what I wrote, a process to convert and combine DVD video files, and make one mp4 file.
https://www.purebasic.fr/english/viewtopic.php?t=83429