Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Include "windows.bi"
- #Include "win/winioctl.bi"
- Type FAT_Header
- BS_jmpBoot(2) As UByte
- BS_OEMName(7) As UByte
- BPB_BytesPerSec As UShort
- BPB_SecPerClus As UByte
- BPB_RsvdSecCnt As UShort
- BPB_NumFATs As UByte
- BPB_RootEntCnt As UShort
- BPB_TotSec16 As UShort
- BPB_Media As UByte
- BPB_FATSz16 As UShort
- BPB_SecPerTrk As UShort
- BPB_NumHeads As UShort
- BPB_HiddSec As ULong
- BPB_TotSec32 As ULong
- BPB_FATSz32 As ULong
- BPB_ExtFlags As UShort
- BPB_FSVer As UShort
- BPB_RootClus As ULong
- BPB_FSInfo As UShort
- BPB_BkBootSec As UShort
- BPB_Reserved(11) As UByte
- BS_DrvNum As UByte
- BS_Reserved1 As UByte
- BS_BootSig As UByte
- BS_VolID As ULong
- BS_VolLab(10) As UByte
- BS_FilSysType(7) As UByte
- End Type
- type STORAGE_DEVICE_NUMBER
- DeviceType as DEVICE_TYPE
- DeviceNumber as ULONG
- PartitionNumber as ULONG
- end Type
- Dim hDevice As HANDLE
- Dim sds As STORAGE_DEVICE_NUMBER
- Dim bResult As Integer
- 'Dim fh As FAT_Header
- Dim As String TempString = Space(1024)
- Dim bytes_ret As DWORD
- Dim szReturn As Integer
- Dim ov As OVERLAPPED
- hDevice = CreateFile("\\.\G:", GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL)
- If hDevice = INVALID_HANDLE_VALUE Then
- Print "Error, unable to open device!"
- GoTo Ending
- EndIf
- bResult = DeviceIoControl(hDevice, IOCTL_STORAGE_GET_DEVICE_NUMBER, NULL, 0, Cast(Any Ptr, @sds), SizeOf(sds), @bytes_ret, @ov)
- bResult = ReadFile(hDevice, StrPtr(TempString), 1204, @szReturn, NULL)
- If bResult = 0 Then
- Print "Error, unable to read file!"
- Print "Last error was "; GetLastError(); "."
- GoTo Ending
- EndIf
- 'Print "BS_OEMName contains "; fh.BS_OEMName(0);fh.BS_OEMName(1);fh.BS_OEMName(2);fh.BS_OEMName(3);fh.BS_OEMName(4);fh.BS_OEMName(5);fh.BS_OEMName(6); fh.BS_OEMName(7); "."
- Ending:
- Sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement