#1 Burning Software

It is currently Fri Dec 20, 2024 9:04 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Fast device scan
PostPosted: Fri May 05, 2006 11:18 am 
Offline

Joined: Tue Dec 06, 2005 9:44 am
Posts: 11
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)......


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 05, 2006 6:31 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
ASPI-based FindDevice uses polling to workaround some bugs present inside old version of ASPI shipped with Windows 95 and Windows 98 pre "Gold". If you don't need Windows 9x/Me compatibilty (and I think you don't as it's almost dead OSes now) - take a look at the FindDevicEx sample. It uses SPTI-based enumeration and works like a charm.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 8:14 am 
Offline

Joined: Tue Dec 06, 2005 9:44 am
Posts: 11
anton (staff) wrote:
take a look at the FindDevicEx sample.


Do you mean the one using GetDriveType API?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 8:23 am 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
YES

koger wrote:
anton (staff) wrote:
take a look at the FindDevicEx sample.


Do you mean the one using GetDriveType API?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group