Changeset 400 for trunk/Include/Classes/System/IO/DriveInfo.ab
- Timestamp:
- Jan 22, 2008, 9:19:59 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/IO/DriveInfo.ab
r288 r400 21 21 debug 22 22 End If 23 driveName.ToUpper() 24 m_DriveName = driveName + ":\" 23 m_DriveName = driveName.ToUpper() + ":\" 25 24 End Sub 26 25 … … 30 29 'property 31 30 Function AvailableFreeSpace() As QWord 32 Dim availableFreeSpace As ULARGE_INTEGER 33 If GetDiskFreeSpaceEx(m_DriveName, availableFreeSpace, ByVal 0, ByVal 0) Then 34 Return (availableFreeSpace.HighPart << 32) Or availableFreeSpace.LowPart 35 Else 36 'IOException 31 If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal VarPtr(AvailableFreeSpace) As *ULARGE_INTEGER, ByVal 0, ByVal 0) = FALSE Then 32 Throw New IOException("DriveInfo.AvailableFreeSpace: Failed to GetDiskFreeSpaceEx.") 37 33 End If 38 34 End Function … … 40 36 Function DriveFormat() As String 41 37 Dim systemName[15] As TCHAR 42 If GetVolumeInformation(m_DriveName, NULL, 0, NULL, NULL, NULL, systemName, Len (systemName)) Then 43 Dim resultStr = New String( systemName ) 44 Return resultStr 38 If GetVolumeInformation(ToTCStr(m_DriveName), NULL, 0, NULL, NULL, NULL, systemName, Len (systemName) \ SizeOf (TCHAR)) Then 39 DriveFormat = New String( systemName ) 45 40 Else 46 'IOException41 Throw New IOException("DriveInfo.DriveFormat: Failed to GetVolumeInformation.") 47 42 End If 48 43 End Function 49 44 50 45 Function DriveType() As Long 51 Return GetDriveType( m_DriveName)46 Return GetDriveType(ToTCStr(m_DriveName)) 52 47 End Function 53 48 54 49 Function IsReady() As Boolean 55 If GetVolumeInformation( m_DriveName, NULL, 0, NULL, NULL, NULL, NULL, 0) Then50 If GetVolumeInformation(ToTCStr(m_DriveName), NULL, 0, NULL, NULL, NULL, NULL, 0) Then 56 51 Return True 57 52 Else … … 68 63 69 64 Function TotalFreeSpace() As QWord 70 Dim totalFreeSpace As ULARGE_INTEGER 71 If GetDiskFreeSpaceEx(m_DriveName, ByVal 0, ByVal 0, totalFreeSpace) Then 72 Return (totalFreeSpace.HighPart << 32) Or totalFreeSpace.LowPart 73 Else 74 'IOException 65 If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal 0, ByVal 0, ByVal VarPtr(TotalFreeSpace) As *ULARGE_INTEGER) = FALSE Then 66 Throw New IOException("DriveInfo.TotalFreeSpace: Failed to GetDiskFreeSpaceEx.") 75 67 End If 76 68 End Function 77 69 78 70 Function TotalSize() As QWord 79 Dim totalSize As ULARGE_INTEGER 80 If GetDiskFreeSpaceEx(m_DriveName, ByVal 0, totalSize, ByVal 0) Then 81 Return (totalSize.HighPart << 32) Or totalSize.LowPart 82 Else 83 'IOException 71 If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal 0, ByVal VarPtr(TotalSize) As *ULARGE_INTEGER, ByVal 0) = FALSE Then 72 Throw New IOException("DriveInfo.TotalSize: Failed to GetDiskFreeSpaceEx.") 84 73 End If 85 74 End Function … … 87 76 Function VolumeLabel() As String 88 77 Dim volumeName[63] As TCHAR 89 If GetVolumeInformation(m_DriveName, volumeName, 64, NULL, NULL, NULL, NULL, 0) Then 90 Dim resultStr = New String( volumeName ) 91 Return resultStr 78 If GetVolumeInformation(ToTCStr(m_DriveName), volumeName, Len (volumeName) \ SizeOf (TCHAR), NULL, NULL, NULL, NULL, 0) Then 79 VolumeLabel = New String( volumeName ) 92 80 Else 93 'IOException81 Throw New IOException("DriveInfo.VolumeLabel: Failed to GetVolumeInformation.") 94 82 End If 95 83 End Function
Note:
See TracChangeset
for help on using the changeset viewer.