add volume size
This commit is contained in:
@@ -22,6 +22,7 @@ struct UsbStorageDevice
|
|||||||
sVendor = "";
|
sVendor = "";
|
||||||
sProduct = "";
|
sProduct = "";
|
||||||
sVolumeLabel = "";
|
sVolumeLabel = "";
|
||||||
|
iVolumeSizeMB = 0;
|
||||||
};
|
};
|
||||||
int iBus;
|
int iBus;
|
||||||
int iPort;
|
int iPort;
|
||||||
@@ -60,6 +61,7 @@ struct UsbStorageDevice
|
|||||||
CString sVendor;
|
CString sVendor;
|
||||||
CString sProduct;
|
CString sProduct;
|
||||||
CString sVolumeLabel;
|
CString sVolumeLabel;
|
||||||
|
int iVolumeSizeMB;
|
||||||
|
|
||||||
bool IsBlank() const { return m_State == STATE_NONE; }
|
bool IsBlank() const { return m_State == STATE_NONE; }
|
||||||
void SetOsMountDir( const CString &s );
|
void SetOsMountDir( const CString &s );
|
||||||
|
|||||||
@@ -101,6 +101,21 @@ bool MemoryCardDriverThreaded_Windows::DoOneUpdate( bool bMount, vector<UsbStora
|
|||||||
else
|
else
|
||||||
usbd.SetError( "MountFailed" );
|
usbd.SetError( "MountFailed" );
|
||||||
|
|
||||||
|
// find volume size
|
||||||
|
DWORD dwSectorsPerCluster;
|
||||||
|
DWORD dwBytesPerSector;
|
||||||
|
DWORD dwNumberOfFreeClusters;
|
||||||
|
DWORD dwTotalNumberOfClusters;
|
||||||
|
if( GetDiskFreeSpace(
|
||||||
|
sDrive,
|
||||||
|
&dwSectorsPerCluster,
|
||||||
|
&dwBytesPerSector,
|
||||||
|
&dwNumberOfFreeClusters,
|
||||||
|
&dwTotalNumberOfClusters ) )
|
||||||
|
{
|
||||||
|
usbd.iVolumeSizeMB = (int)roundf( dwTotalNumberOfClusters * (float)dwSectorsPerCluster * dwBytesPerSector / (1024*1024) );
|
||||||
|
}
|
||||||
|
|
||||||
// read name
|
// read name
|
||||||
this->Mount( &usbd );
|
this->Mount( &usbd );
|
||||||
FILEMAN->Mount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
|
FILEMAN->Mount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
|
||||||
|
|||||||
Reference in New Issue
Block a user