void CGeneralPage::UpdateUnitDeviceData(ndas::UnitDevice* pUnitDevice) { pUnitDevice->UpdateStatus(); pUnitDevice->UpdateInfo(); pUnitDevice->UpdateHostStats(); const NDAS_UNITDEVICE_HW_INFORMATION* pHWI = pUnitDevice->GetHWInfo(); CString str; str.Format(_T("%d"), pUnitDevice->GetROHostCount()); // hwi.nROHosts); m_edtUnitDevROHosts.SetWindowText(str); str.Format(_T("%d"), pUnitDevice->GetRWHostCount()); // hwi.nRWHosts); m_edtUnitDevRWHosts.SetWindowText(str); if (NULL != pHWI) { pCapacityString(str, pHWI->SectorCountLowPart, pHWI->SectorCountHighPart); m_edtUnitDevCapacity.SetWindowText(str); } NDAS_UNITDEVICE_TYPE type = pUnitDevice->GetType(); NDAS_UNITDEVICE_SUBTYPE subType = pUnitDevice->GetSubType(); CString strType; pUnitDeviceTypeString(strType, type, subType); m_edtUnitDevType.SetWindowText(strType); if (NDAS_UNITDEVICE_TYPE_CDROM == type) { m_hUnitDevIcon = LoadIcon( _Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_CD_DRIVE)); m_wndUnitDevIcon.SetIcon(m_hUnitDevIcon); } else if (NDAS_UNITDEVICE_TYPE_DISK == type) { m_hUnitDevIcon = LoadIcon( _Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_DISK_DRIVE)); m_wndUnitDevIcon.SetIcon(m_hUnitDevIcon); } else { // no icon will show } NDAS_UNITDEVICE_STATUS status = pUnitDevice->GetStatus(); CString strStatus; pUnitDeviceStatusString(strStatus, status); m_edtUnitDevStatus.SetWindowText(strStatus); }
CString& pCapacityString( IN OUT CString& str, IN DWORD lowPart, IN DWORD highPart) { // // Sector Size = 512 Bytes = 0x200 Bytes // // 1024 = 0x400 // // sectors = high * 0x1,0000,00000 + low // bytes = high * 0x1,0000,0000 + low * 0x0200 // = high * 0x200,0000,0000 + low * 0x200 // kilobytes = high * 0x8000,0000 + low / 0x2 // megabytes = high * 0x20,0000 + low / 0x800 // gigabytes = high * 0x800 + low / 0x20,0000 // terabytes = high * 0x2 + low / 0x8000,0000 // UINT64 cb = (static_cast<UINT64>(lowPart)) + (static_cast<UINT64>(highPart) * 0x100000000); return pCapacityString(str, cb); }