I have tested this against a floppy with read/write and read only access set and it works correctly, however since I don't have a RW CDRom I can't test it further.use strict; use warnings; use Win32API::File 0.08 qw( :ALL ); my $sRootPath = "d:/"; if(GetDriveType( $sRootPath ) == 5){ # then this is a CD-ROM my $sPath = "//./D:"; my $uAccess = 0; my $uShare = FILE_SHARE_READ(); my $pSecAttr = []; my $uCreate = OPEN_ALWAYS(); my $uFlags = 0; my $hModel = 0; my $hDisk= CreateFile( $sPath, $uAccess, $uShare, $pSecAttr, $uCre +ate, $uFlags, $hModel) or die "Can't read attributes of $sPath: $^E\ +n"; my $controlcode = IOCTL_DISK_IS_WRITABLE; my $inbuff = []; my $inbuffsz = 0 ; my $outbuff = []; my $outbuffsz = 0; my @bytesret = []; my $overlap = []; if (DeviceIoControl($hDisk,$controlcode,$inbuff,$inbuffsz,$outbuff +,$outbuffsz,@bytesret,$overlap)){ print "Status = device is write enabled\n"; }else{ print "Status = $^E\n"; } }
In reply to Re: How to check to see if a CD drive is a writable on windows?
by terra incognita
in thread How to check to see if a CD drive is a writable on windows?
by swampyankee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |