Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Получение номера диска и раздела, из буквы раздела
- Procedure.s DriveGetNumber(DriveLetter$)
- Protected DriveInfo.STORAGE_DEVICE_NUMBER, Nul , Ret$="?:?", hDevice
- hDevice = CreateFile_("\\.\" + DriveLetter$, 0, 0, 0, #OPEN_EXISTING, #FILE_ATTRIBUTE_NORMAL, #NUL)
- If hDevice
- If DeviceIoControl_(hDevice,#IOCTL_STORAGE_GET_DEVICE_NUMBER, 0, 0, DriveInfo, SizeOf(STORAGE_DEVICE_NUMBER), @Nul, #NUL)
- Ret$=Str(DriveInfo\DeviceNumber) + ":" + Str(DriveInfo\PartitionNumber)
- EndIf
- CloseHandle_(hDevice)
- EndIf
- ProcedureReturn Ret$
- EndProcedure
- Define.l Serial, type, disk_mask
- Define.s Drive, FileSystem, VolName, Letter, NumDsk
- Define.q total_bytes, StartTime
- FileSystem = Space(256)
- VolName= Space(256)
- Letter = "C"
- Drive=Letter+":\"
- StartTime=ElapsedMilliseconds()
- disk_mask = GetLogicalDrives_()
- Debug Str(ElapsedMilliseconds()-StartTime) + " мсек - время GetLogicalDrives_ "
- StartTime=ElapsedMilliseconds()
- Type = GetDriveType_(Drive)
- Debug Str(ElapsedMilliseconds()-StartTime) + " мсек - время GetDriveType_ "
- StartTime=ElapsedMilliseconds()
- GetDiskFreeSpaceEx_(Drive, 0, @total_bytes, 0)
- Debug Str(ElapsedMilliseconds()-StartTime) + " мсек - время GetDiskFreeSpaceEx_ "
- StartTime=ElapsedMilliseconds()
- GetVolumeInformation_(@Drive, @VolName, 255, @Serial, 0, 0, @FileSystem, 255)
- Debug Str(ElapsedMilliseconds()-StartTime) + " мсек - время GetVolumeInformation_ "
- StartTime=ElapsedMilliseconds()
- NumDsk = DriveGetNumber(Letter + ":")
- Debug Str(ElapsedMilliseconds()-StartTime) + " мсек - время DriveGetNumber "
- Debug #CRLF$ + "Проверяем что работает" + #CRLF$
- Debug "disk_mask = " + ReverseString(RSet(Bin(disk_mask, #PB_Long), 32, "0"))
- Debug "total_bytes = " + Str(total_bytes / 1024 / 1024) ; Мб
- Debug "Type = " + Str(Type)
- Debug "FileSystem, VolName, Serial = " + FileSystem + " - " + VolName + " - " + Str(Serial)
- Debug "NumDsk = " + NumDsk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement