The GetCdRomDrives scans for Cd-Rom installed on the system and retrie +ves informations over the Cd-Rom drive. function GetCdRomDrives(var CdRoms: TCdRoms): Boolean; Parameters CdRoms Return Values If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.
TCdRom = record HaId : Byte; Target : Byte; Lun : Byte; Vendor : ShortString; ProductId : ShortString; Revision : ShortString; VendorSpec: ShortString; end; TCdRoms = record CdRomCount: Byte; CdRom : array[0..25] of TCdRom; end;
#!/usr/bin/perl use Win32::API::Prototype; Win32::API::Struct->typedef( TCdRom => qw{ int HaId; int Target; int Lun; char Vendor[256]; char ProductId[256]; char Revision[256]; char VendorSpec[256]; }); Win32::API::Struct->typedef( TCdRoms => qw{ BYTE CdRomCount; TCdRom Drive[26]; }); ApiLink( 'DiscIdCalcDLL.dll', 'int GetCdRomDrives(LPTCdRoms CdRoms)' ) + || die; $cds = Win32::API::Struct->new('TCdRoms'); for (my $i = 0; $i < 26; $i++) { $drvs[$i] = Win32::API::Struct->new('TCdRom'); $cds->{Drive}[$i] = $drvs[$i]; } $x = GetCdRomDrives(\$cds); ########## (ETC) #########################
DB<4> x $cds 0 Win32::API::Struct=HASH(0x1c3dc30) 'Drive' => ARRAY(0x1c3e050) 0 Win32::API::Struct=HASH(0x1c12730) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) 0 ARRAY(0x1c12760) 0 'HaId' 1 'i' 2 'int' 1 ARRAY(0x1c127a8) 0 'Target' 1 'i' 2 'int' 2 ARRAY(0x1c127c0) 0 'Lun' 1 'i' 2 'int' 3 ARRAY(0x1c127fc) 0 'Vendor' 1 'c*256' 2 'char' 4 ARRAY(0x1c12838) 0 'ProductId' 1 'c*256' 2 'char' 5 ARRAY(0x1c12874) 0 'Revision' 1 'c*256' 2 'char' 6 ARRAY(0x1c128b0) 0 'VendorSpec' 1 'c*256' 2 'char' 1 Win32::API::Struct=HASH(0x1c3e158) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) -> REUSED_ADDRESS 2 Win32::API::Struct=HASH(0x1c3e194) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) -> REUSED_ADDRESS 3 Win32::API::Struct=HASH(0x1c3e1d0) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) -> REUSED_ADDRESS 4 Win32::API::Struct=HASH(0x1c3e20c) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) -> REUSED_ADDRESS ###### Repeat for indexes 5 through 23, and... ####### 24 Win32::API::Struct=HASH(0x1c3e6bc) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) -> REUSED_ADDRESS 25 Win32::API::Struct=HASH(0x1c3e6f8) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) -> REUSED_ADDRESS 'Drive[26]' => Win32::API::Struct=HASH(0x1c3e05c) '__typedef__' => 'TCdRom' 'typedef' => ARRAY(0x1c12550) -> REUSED_ADDRESS '__typedef__' => 'TCdRoms' 'typedef' => ARRAY(0x1c12778) 0 ARRAY(0x1c1276c) 0 'CdRomCount' 1 'C' 2 'BYTE' 1 ARRAY(0x1c12988) 0 'Drive[26]' 1 '>' 2 'TCdRom' ###################
In reply to Win32::API arguments by VMat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |