why my code not run ?
Thanks
Code: Select all
#IOCTL_STORAGE_GET_DEVICE_NUMBER = $2d1080
Structure STORAGE_DEVICE_NUMBER
DeviceType.l ;// The FILE_DEVICE_XXX type For this device.
DeviceNumber.l ;// The number of this device
PartitionNumber.l ;// If the device is partitionable, the partition number of the device. Otherwise -1
EndStructure
Procedure.s Drive_GetNumber()
Protected DriveInfo.STORAGE_DEVICE_NUMBER, lpBytesReturned, Ret$="?:?", hDevice
For iDiskCurr = 0 To 25; alphabet (A = 0)
hDevice = CreateFile_("\\.\" + Chr(65 + iDiskCurr) + ":", 0, 0, 0, #OPEN_EXISTING, #FILE_ATTRIBUTE_NORMAL, #NUL)
If hDevice <> #INVALID_HANDLE_VALUE
If DeviceIoControl_(hDevice,#IOCTL_STORAGE_GET_DEVICE_NUMBER, 0, 0, DriveInfo, SizeOf(STORAGE_DEVICE_NUMBER), @lpBytesReturned, #NUL)
Ret$ = Str(DriveInfo\DeviceNumber) + ":" + Str(DriveInfo\PartitionNumber)
EndIf
CloseHandle_(hDevice)
EndIf
ProcedureReturn Ret$
Next
EndProcedure
Debug Drive_GetNumber()