Board index » delphi » ???? Getting Hardware device name ????

???? Getting Hardware device name ????

How can I get a hardware device name from a drive.
I am running Win95 / Delphi 4.
In some programs you see when displaying a cd drive the drive letter and
the manufacturer. e.g. D: COMPAQ, or D: 24-Speed drive etc.
How is this done?????
How can I read the Hardware information on the device?

Thanks anyway
Ido de Lepper
ilep...@fac.fbk.eur.nl

 

Re:???? Getting Hardware device name ????


Quote

> How can I get a hardware device name from a drive.
> I am running Win95 / Delphi 4.
> In some programs you see when displaying a cd drive the drive letter and
> the manufacturer. e.g. D: COMPAQ, or D: 24-Speed drive etc.
> How is this done?????
> How can I read the Hardware information on the device?

Ido,

what you see is probably the volume label of the CD. You can get that using the
GetVolumeInformation API function.

program Test;
{$APPTYPE CONSOLE}
uses
  Windows, SysUtils;
Var
  volName: Array [0..80] of Char;
  serNum : Cardinal;
  maxCompLen,
  FileSysFlags: DWORD;
  FileSysName: Array [0..20] of Char;

begin
  If GetVolumeInformation(
    'K:\',
    volName,
    Sizeof( volName ),
    @serNum,
    maxCompLen,
    FileSysFlags,
    FileSysName,
    Sizeof( FileSysname ))
  Then
    WriteLn('Volume information for K:',
            #13#10'  Volume name: ', volName,
            #13#10'  Serial number: ',
              Format('%4x:%4x', [HiWord(serNum), LoWord(serNum)]),
            #13#10'  Max component length: ', maxCompLen,
            #13#10'  File system flags: ', Format( '0x%x', [FileSysFlags]),
            #13#10'  File system name: ', FileSysname )
  Else
    WriteLn( 'GetVolumeInformation failed!' );
  WriteLn( #13#10'Hit Enter to terminate...');
  ReadLn;
end.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Re:???? Getting Hardware device name ????


No, in for example cd-recording software you can select what cd drive to
use, it not only displays the drive letter but also the type or
manufacturer. Maybe it gets it from the ASPI driver or scsi driver??

An other example: When installing a new HD and selecting it in the BIOS
config. you also see the name seagate or something, how does the BIOS
know??

Anyway thanks

Re:???? Getting Hardware device name ????


Quote
In article <MPG.1086bf90d5ac97e2989...@forums.inprise.com>, Ilepper wrote:
> Maybe it gets it from the ASPI driver or scsi driver??

Probably, but i don't know how to access that info from a Win32 program,
sorry.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Other Threads