Hello
I use some code like this to scan for devices, the problem is that it's quite slow, it takes around 5 seconds, is there a faster way to scan for installed devices?
procedure Rescan;
begin
StarBurn_FindDevice(SCSI_DEVICE_RO_DIRECT_ACCESS,
False,
FindCallback,
nil);
end;
procedure TDeviceManager.FindCallback(
const p__CALLBACK_NUMBER: CALLBACK_NUMBER;
p__PVOID__CallbackContext: Pointer;
p__PVOID__CallbackSpecial1,
p__PVOID__CallbackSpecial2: Pointer
);
var
NewDevice: TDevice;
l__ULONG__Status: DWORD;
l__CHAR__VendorID: array[0..1023] of Char;
l__CHAR__ProductID: array[0..1023] of Char;
l__CHAR__FirmwareVersion: array[0..1023] of Char;
l__CHAR__DeviceName: array[0..1023] of Char;
l__ULONG__BufferSizeInUCHARs: DWORD;
l__PVOID__CdvdBurnerGrabber: Pointer;
l__CHAR__ExceptionText: array[0..1023] of Char;
l__CDB_FAILURE_INFORMATION: CDB_FAILURE_INFORMATION;
l__PSCSI_DEVICE_ADDRESS: PSCSI_DEVICE_ADDRESS;
l__BOOLEAN__IsCDRRead, l__BOOLEAN__IsCDERead, l__BOOLEAN__IsDvdROMRead, l__BOOLEAN__IsDvdRRead, l__BOOLEAN__IsDvdRAMRead, l__BOOLEAN__IsTestWrite, l__BOOLEAN__IsCDRWrite, l__BOOLEAN__IsCDEWrite, l__BOOLEAN__IsDvdRWrite, l__BOOLEAN__IsDvdRAMWrite, l__BOOLEAN__IsDvdPLUSRWRead, l__BOOLEAN__IsDvdPLUSRRead, l__BOOLEAN__IsDvdPLUSRDLRead, l__BOOLEAN__IsDvdPLUSRWWrite, l__BOOLEAN__IsDvdPLUSRWrite, l__BOOLEAN__IsDvdPLUSRDLWrite: Boolean;
l__BOOLEAN__IsBUPEnabled, l__BOOLEAN__IsBUPSupported: Boolean;
begin
//Process depending of callback number.
case p__CALLBACK_NUMBER of
//if this is FIND_DEVICE
CN_FIND_DEVICE:
begin
StarBurn_CdvdBurnerGrabber_Create(l__PVOID__CdvdBurnerGrabber,
l__CHAR__ExceptionText,
SizeOf(l__CHAR__ExceptionText),
l__ULONG__Status,
@l__CDB_FAILURE_INFORMATION,
nil, //Do not need callback notifications here
nil,
l__PSCSI_DEVICE_ADDRESS^.m__UCHAR__PortID,
l__PSCSI_DEVICE_ADDRESS^.m__UCHAR__BusID,
l__PSCSI_DEVICE_ADDRESS^.m__UCHAR__TargetID,
l__PSCSI_DEVICE_ADDRESS^.m__UCHAR__LUN,
1)......
|