DeviceInfo.pas
上传用户:wanyu_2000
上传日期:2021-02-21
资源大小:527k
文件大小:3k
源码类别:

DVD

开发平台:

Delphi

  1. {-----------------------------------------------------------------------------
  2.  Unit Name: DeviceInfo
  3.  Author:    Paul Fisher / Andrew Semack
  4.  Purpose:   Class to store device information
  5.  History:
  6. -----------------------------------------------------------------------------}
  7. unit DeviceInfo;
  8. interface
  9. uses
  10.   Windows, DeviceTypes, Classes, SysUtils;
  11. type
  12.   TDeviceInfo = class
  13.   private
  14.     FInfoRecord: PCDBurnerInfo;
  15.     function GetDriveID: DWORD;
  16.     function GetDriveIndex: Integer;
  17.     function GetDriveLetter: Char;
  18.     function GetHaId: Byte;
  19.     function GetLun: Byte;
  20.     function GetProductID: string;
  21.     function GetRevision: string;
  22.     function GetSptiHandle: THandle;
  23.     function GetTarget: Byte;
  24.     function GetVendorID: string;
  25.     function GetVendorName: string;
  26.     function GetVendorSpec: string;
  27.     function GetDriveName: string;
  28.   public
  29.     property DriveIndex: Integer read GetDriveIndex;
  30.     property DriveLetter: Char read GetDriveLetter;
  31.     property DriveName: string read GetDriveName;
  32.     property DriveID: DWORD read GetDriveID;
  33.     property ProductID: string read GetProductID;
  34.     property VendorID: string read GetVendorID;
  35.     property VendorName: string read GetVendorName;
  36.     property VendorSpec: string read GetVendorSpec;
  37.     property Revision: string read GetRevision;
  38.     property SptiHandle: THandle read GetSptiHandle;
  39.     property HaId: Byte read GetHaId;
  40.     property Target: Byte read GetTarget;
  41.     property Lun: Byte read GetLun;
  42.     constructor Create(InfoRecord: PCDBurnerInfo);
  43.   end;
  44. implementation
  45. { TInfoRecord }
  46. constructor TDeviceInfo.Create(InfoRecord: PCDBurnerInfo);
  47. begin
  48.   FInfoRecord := InfoRecord;
  49. end;
  50. function TDeviceInfo.GetDriveIndex: Integer;
  51. begin
  52.   Result := FInfoRecord.DriveIndex;
  53. end;
  54. function TDeviceInfo.GetDriveLetter: Char;
  55. begin
  56.   Result := FInfoRecord.DriveLetter;
  57. end;
  58. function TDeviceInfo.GetRevision: string;
  59. begin
  60.   Result := FInfoRecord.Revision;
  61. end;
  62. function TDeviceInfo.GetVendorID: string;
  63. begin
  64.   Result := FInfoRecord.VendorID;
  65. end;
  66. function TDeviceInfo.GetLun: Byte;
  67. begin
  68.   Result := FInfoRecord.Lun;
  69. end;
  70. function TDeviceInfo.GetProductID: string;
  71. begin
  72.   Result := FInfoRecord.ProductID;
  73. end;
  74. function TDeviceInfo.GetTarget: Byte;
  75. begin
  76.   Result := FInfoRecord.Target;
  77. end;
  78. function TDeviceInfo.GetVendorName: string;
  79. begin
  80.   Result := FInfoRecord.VendorName;
  81. end;
  82. function TDeviceInfo.GetHaId: Byte;
  83. begin
  84.   Result := FInfoRecord.HaId;
  85. end;
  86. function TDeviceInfo.GetVendorSpec: string;
  87. begin
  88.   Result := FInfoRecord.VendorSpec;
  89. end;
  90. function TDeviceInfo.GetSptiHandle: THandle;
  91. begin
  92.   Result := FInfoRecord.SptiHandle;
  93. end;
  94. function TDeviceInfo.GetDriveID: DWORD;
  95. begin
  96.   Result := FInfoRecord.DriveID;
  97. end;
  98. function TDeviceInfo.GetDriveName: string;
  99. begin
  100.   Result := Format('%s:', [FInfoRecord.DriveLetter]);
  101. end;
  102. end.