file copying - C# Disc eject randomly fails saying the session has to close (not even burning a disc) -
my users have been having annoying issue lately.
i've got app takes images cd, dvd, or usb drive , copies them network.
when it's done copying should automatically eject disc.
the problem is, when disc done being copied , goes eject, takes long time. 1 of users said waited hour finish closing , eject.
on other discs has happened, user try hit physical eject button , bubble on windows 7 pops , says please wait until session closed before ejecting.
nothing being burned disc , disc not cd-rw or dvd-rw don't understand why needs close session on disc.
is possible person burned cd messed somehow?
out of 250+ discs have gone through far today, happened on 2 of them leads me believe wrong these discs.
here's method ejects drive:
private void eject() { try { volumedeviceclass volumedeviceclass = new volumedeviceclass(); foreach (volume device in volumedeviceclass.devices) { if (!device.isusb) continue; if (device.logicaldrive == null || (device.logicaldrive.length == 0)) continue; /* should down here if our device usb drive */ device.eject(true); } var sb = new stringbuilder(); mcisendstring("open " + _drivename.substring(0, 2) + " type cdaudio alias cddrive", sb, 127, intptr.zero); mcisendstring("set cddrive door open", sb, 127, intptr.zero); } catch (exception ex) { ex.log(ex.message, logger.severity.error, "error ejecting cd drive: " + environment.machinename); } }
Comments
Post a Comment