Am using the following code::: to find the bus type.. but nothing works
please help me to fix this..
unsigned long ReturnLen;
STORAGE_ADAPTER_DESCRIPTOR AdapDesc;
PSTORAGE_ADAPTER_DESCRIPTOR pAdapDesc;
STORAGE_PROPERTY_QUERY Query; // input param for query
Query.PropertyId = StorageAdapterProperty ;
Query.QueryType = PropertyStandardQuery;
pAdapDesc = &AdapDesc;
pAdapDesc->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
// Query using IOCTL_STORAGE_QUERY_PROPERTY
if (!DeviceIoControl( m_hDev,
IOCTL_STORAGE_QUERY_PROPERTY,
&Query,
sizeof(STORAGE_PROPERTY_QUERY),
pAdapDesc,
pAdapDesc->Size*2,
&ReturnLen,
(LPOVERLAPPED)NULL))
{
pLogFile.LogFileWrite((const char *)"SATA/SCSI Interface Determination ERROR Returning 0\r\n");
return 0;
}
if((pAdapDesc->BusType == BusTypeAta) || (pAdapDesc->BusType == 3) || (pAdapDesc->BusType == 11))
return 2;
else if((pAdapDesc->BusType == BusTypeScsi) || (pAdapDesc->BusType == 10))
return 1;
}
unsigned long ReturnLen;
STORAGE_ADAPTER_DESCRIPTOR AdapDesc;
PSTORAGE_ADAPTER_DESCRIPTOR pAdapDesc;
STORAGE_PROPERTY_QUERY Query; // input param for query
Query.PropertyId = StorageAdapterProperty ;
Query.QueryType = PropertyStandardQuery;
pAdapDesc = &AdapDesc;
pAdapDesc->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
// Query using IOCTL_STORAGE_QUERY_PROPERTY
if (!DeviceIoControl( m_hDev,
IOCTL_STORAGE_QUERY_PROPERTY,
&Query,
sizeof(STORAGE_PROPERTY_QUERY),
pAdapDesc,
pAdapDesc->Size*2,
&ReturnLen,
(LPOVERLAPPED)NULL))
{
pLogFile.LogFileWrite((const char *)"SATA/SCSI Interface Determination ERROR Returning 0\r\n");
return 0;
}
if((pAdapDesc->BusType == BusTypeAta) || (pAdapDesc->BusType == 3) || (pAdapDesc->BusType == 11))
return 2;
else if((pAdapDesc->BusType == BusTypeScsi) || (pAdapDesc->BusType == 10))
return 1;
}
To copy to clipboard, switch view to plain text mode
Bookmarks