Post by ernie on Apr 29, 2020 17:16:10 GMT -5
Hello,
I love Liberty Basic! But I am having problems getting a program (below) to run compiled.
This Liberty Basic .BAS file works fine uncompiled. But when it is compiled, it produces a brief (so brief as to be unreadable) activity on the screen that disappears almost immediately, nothing else. There is no error.log in the directory in which the executable is created, no error.log where LB is installed. Works before compiling, doesn't work after compiling.
I am stumped. Any ideas?
I love Liberty Basic! But I am having problems getting a program (below) to run compiled.
This Liberty Basic .BAS file works fine uncompiled. But when it is compiled, it produces a brief (so brief as to be unreadable) activity on the screen that disappears almost immediately, nothing else. There is no error.log in the directory in which the executable is created, no error.log where LB is installed. Works before compiling, doesn't work after compiling.
I am stumped. Any ideas?
letter$ = "A:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "B:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "C:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "D:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "E:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "F:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "G:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "H:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "I:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "J:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "K:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "L:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "M:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "N:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
letter$ = "O:\" : r = GetVolumeInformation(letter$, volname$, 32, serial, maxcmplen, fsflags, fsname$, 32) : if letter$ <> "" and volname$ <> "" then Print letter$; " "; volname$
End
Function GetVolumeInformation( RootPathName$, ByRef VolumeNameBuffer$, VolumeNameSize, ByRef VolumeSerialNumber, ByRef MaximumComponentLength, ByRef FileSystemFlags, ByRef FileSystemNameBuffer$, FileSystemNameSize )
If VolumeNameSize <= 0 Then
VolumeNameSize = 0
Else
If Len(VolumeNameBuffer$) < VolumeNameSize Then
VolumeNameBuffer$ = Space$(VolumeNameSize)
End If
End If
Struct local1, VolumeSerialNumber As ULong
Struct local2, MaximumComponentLength As ULong
Struct local3, FileSystemFlags As ULong
If FileSystemNameSize <= 0 Then
FileSystemNameSize = 0
Else
If Len(FileSystemNameBuffer$) < FileSystemNameSize Then
FileSystemNameBuffer$ = Space$(FileSystemNameSize)
End If
End If
CallDLL #kernel32, "GetVolumeInformationA", _
RootPathName$ As Ptr, _
VolumeNameBuffer$ As Ptr, VolumeNameSize As ULong, _
local1 As Struct, local2 As Struct, local3 As Struct, _
FileSystemNameBuffer$ As Ptr, FileSystemNameSize As ULong, _
GetVolumeInformation As Long
VolumeNameBuffer$ = Trim$(VolumeNameBuffer$)
VolumeSerialNumber = local1.VolumeSerialNumber.struct
MaximumComponentLength = local2.MaximumComponentLength.struct
FileSystemFlags = local3.FileSystemFlags.struct
FileSystemNameBuffer$ = Trim$(FileSystemNameBuffer$)
End Function