VidCoder & Floppy drive

Mar 13, 2011 at 3:24 PM

Why VidCoder keeps trying to read my floppy disc?

Coordinator
Mar 27, 2011 at 1:04 AM

I don't know. I don't have a floppy drive but I'm not sure what would set it off. This is the code I use to check drives for DVDs and Blu-Rays:

DriveInfo[] driveCollection = DriveInfo.GetDrives();
var driveList = new List<DriveInformation>();

foreach (DriveInfo driveInfo in driveCollection)
{
	if (driveInfo.DriveType == DriveType.CDRom && driveInfo.IsReady)
	{
		if (File.Exists(driveInfo.RootDirectory + @"VIDEO_TS\VIDEO_TS.IFO"))
		{
			driveList.Add(new DriveInformation
			{
				RootDirectory = driveInfo.RootDirectory.FullName,
				VolumeLabel = driveInfo.VolumeLabel,
				DiscType = DiscType.Dvd
			});
		}
		else if (Directory.Exists(driveInfo.RootDirectory + "BDMV"))
		{
			driveList.Add(new DriveInformation
			{
				RootDirectory = driveInfo.RootDirectory.FullName,
				VolumeLabel = driveInfo.VolumeLabel,
				DiscType = DiscType.BluRay
			});
		}
	}
}

As far as I know floppies' DriveType should be Removable, so VidCoder shouldn't be checking for directories on them. What are you doing when you see floppy disk activity?

Mar 27, 2011 at 7:39 PM

While the program is running, drive's LED illuminates. I just insert a diskette to stop this annoying sound...

Coordinator
Mar 27, 2011 at 9:40 PM

Okay then it must be this part then:

var options = new ConnectionOptions { EnablePrivileges = true };
var scope = new ManagementScope(@"root\CIMV2", options);

try
{
	var query = new WqlEventQuery
	{
	    EventClassName = "__InstanceModificationEvent",
	    WithinInterval = TimeSpan.FromSeconds(1),
		Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5" // DriveType - 5: CDROM
	};
	
	this.watcher = new ManagementEventWatcher(scope, query);

	// register async. event handler
	this.watcher.EventArrived += this.HandleDiscEvent;
	this.watcher.Start();
}
catch (Exception e)
{
	System.Diagnostics.Debug.WriteLine(e.Message);
}

But I double checked the DriveType and 5 is CD/DVD/Blu-ray optical media only: http://msdn.microsoft.com/en-us/library/aa394173.aspx . I can't find anything about Floppy drives reporting with a DriveType of 5. I have a few ideas but I don't have a floppy drive to test on. If you want to help out a bit, you could try compiling VidCoder yourself and fiddling with the Condition property in Services/DriveService.cs. I was thinking maybe

@"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5 and TargetInstance.MediaType = 11"

or

@"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DeviceId = 'E:'"

(Where E: is the CD drive)