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

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: Win32::API arguments by BrowserUk
in thread Win32::API arguments by VMat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.