firming up this API: USBStorageDevicesChanged is "calling

GetUSBStorageDevices may return different devices"; calling
it twice in a row should have the same result
This commit is contained in:
Glenn Maynard
2005-12-10 02:11:34 +00:00
parent cdb44c71be
commit 03708b636a
@@ -73,6 +73,9 @@ static bool IsFloppyDrive( char c )
void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut ) void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut )
{ {
DWORD dwLogicalDrives = ::GetLogicalDrives();
m_dwLastLogicalDrives = dwLogicalDrives;
const int MAX_DRIVES = 26; const int MAX_DRIVES = 26;
for( int i=0; i<MAX_DRIVES; ++i ) for( int i=0; i<MAX_DRIVES; ++i )
{ {
@@ -115,17 +118,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( vector<UsbStorageDe
bool MemoryCardDriverThreaded_Windows::USBStorageDevicesChanged() bool MemoryCardDriverThreaded_Windows::USBStorageDevicesChanged()
{ {
/* Nothing needs a write test (or we can't do it right now). If no devices return ::GetLogicalDrives() != m_dwLastLogicalDrives;
* have changed, either, we have nothing to do. */
DWORD dwLogicalDrives = ::GetLogicalDrives();
if( dwLogicalDrives != m_dwLastLogicalDrives )
{
m_dwLastLogicalDrives = dwLogicalDrives;
return true;
}
/* Nothing to do. */
return false;
} }
bool MemoryCardDriverThreaded_Windows::Mount( UsbStorageDevice* pDevice ) bool MemoryCardDriverThreaded_Windows::Mount( UsbStorageDevice* pDevice )