in reply to Win32::API arguments
Are you sure that your optical drives are SCSI? Because they are the only type that dll looks for. I tried it on my system (which uses IDE drives) and I get no errors, but no information (as you might expect).
#! perl -slw use strict; use Win32::API::Prototype; ApiLink( 'DiscIdCalcDLL', q[ int GetCdRomDrives( LPVOID p ) ], ) or die $^E; my $struc = chr(0) x ( 4 + 1036*3 ); GetCdRomDrives( $struc ) or die $^E; print "'$_'" for unpack 'v( VVV (a256)4 )3', $struc; __END__ c:\test>DiskId.pl '0' '0' '0' '0' ' ' ' ' '0' '0' '0' ' ' ' ' '0' '0' '0' ' ' ' '
However, you can query most everything about your system using DBD-WMI (though working out the right classnames can be a pain):
#! perl -slw use strict; use DBI; my $dbh = DBI->connect('dbi:WMI:'); my $sth = $dbh->prepare(<<WQL); SELECT Caption, Name, Drive FROM Win32_CDROMDrive WQL $sth->execute(); while( my @row = $sth->fetchrow ) { printf "Caption: %25s Name:%30s Drive; %s\n", @row; } __END__ c:\test>junk Caption: HL-DT-ST CD-ROM GCR-8481B Name: HL-DT-ST CD-ROM GCR-8481B D +rive; R: Caption: LITE-ON DVDRW SOHW-1693S Name: LITE-ON DVDRW SOHW-1693S D +rive; D:
There are a whole bunch of other fields besides the 3 I've queried. They include:
Availability Capabilities CapabilityDescriptions Caption CompressionMethod ConfigManagerErrorCode ConfigManagerUserConfig CreationClassName DefaultBlockSize Description DeviceID + Drive DriveIntegrity ErrorCleared ErrorDescription ErrorMethodology FileSystemFlags FileSystemFlagsEx Id InstallDate LastErrorCode Manufacturer MaxBlockSize MaximumComponentLength MaxMediaSize MediaLoaded MediaType MfrAssignedRevisionLevel MinBlockSize Name NeedsCleaning NumberOfMediaSupported PNPDeviceID + PowerManagementCapabilities PowerManagementSupported RevisionLevel SCSIBus SCSILogicalUnit SCSIPort SCSITargetId Size Status StatusInfo SystemCreationClassName SystemName TransferRate VolumeName VolumeSerialNumber
|
|---|