Announcement

Collapse
No announcement yet.

DISK INFORMATION DISKID.BAS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Richard L Bianchi
    replied
    Thanks Tom, thats what I was looking for, Rick

    ------------------

    Leave a comment:


  • Tom Hanlin
    replied
    Ah. Well, IOCTL's a bit quaint. The function doesn't seem to work
    well under Win2k, certainly.

    Since MS-DOS 4.0, there have actually been two volume labels. I
    suspect the IOCTL function is supposed to retrieve the second kind.
    The usual kind of volume label is readily retrieved using plain
    PowerBASIC code:
    Code:
       Vol$ = DIR$(Drive$ + ":\*.*", 8)
    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Richard L Bianchi
    replied
    ===========================================================================
    ' Subject: REPORTS DISK INFORMATION Date: 06-20-95 (00:00)
    ' Author: Dave Navarro, Jr. Code: PB
    ' Origin: Christy Gemmell Packet: DISK.ABC
    '===========================================================================
    ' DISKID.BAS reports disk volume and serial number from boot sector
    '
    ' Author: Christy Gemmell ([email protected])
    ' Date: 12/4/1992
    '
    ' Captured from alt.lang.basic newsgroup on July 20, 1995 and converted
    ' to PowerBASIC by Dave Navarro, Jr. ([email protected])

    TYPE ParaBlock
    Info AS INTEGER ' Call information level
    SerNo AS LONG ' Disk serial number
    Label AS STRING * 11 ' Volume label
    FlSys AS STRING * 8 ' File system type
    END TYPE

    INPUT "Which drive - <Enter> for default"; D$

    GetDiskID D$, S$, V$, F$
    PRINT
    PRINT "Disk information for drive "; D$
    PRINT "----------------------------"
    PRINT "Volume label : "; V$
    PRINT "Serial number : "; S$
    PRINT "File system : "; F$
    END

    SUB GetDiskID (Drive$, Serial$, Volume$, FileSys$)
    DIM Para AS ParaBlock ' Buffer for drive parameter block
    Para.Info = 0 ' Information level always zero
    REG 1, &H440D ' Generic IOCTL device request
    IF Drive$ = "" THEN ' If no drive specified
    REG 2, 0 ' then use default
    ELSE ' Otherwise convert
    REG 2, ASC(UCASE$(Drive$)) - 64 ' drive letter to number
    END IF ' A: = 1, B: = 2 etc
    REG 3, &H866 ' Subfunction: get drive ID
    REG 8, VARSEG(Para) ' Segment of buffer
    REG 4, VARPTR(para) ' Offset of buffer
    CALL INTERRUPT &H21 ' Invoke DOS
    Serial$ = HEX$(Para.SerNo) ' Get serial number
    Volume$ = Para.Label ' Get volume label
    FileSy$ = Para.FlSys ' Get file system type
    END SUB

    this routine does not return the Volume$, I assumed its a Windows
    95 thing.

    Rick

    ------------------

    Leave a comment:


  • Tom Hanlin
    replied
    Ehhhh... what? Could you round that out with a few more sentences? Thanks!

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Richard L Bianchi
    started a topic DISK INFORMATION DISKID.BAS

    DISK INFORMATION DISKID.BAS

    DISKID.BAS - ALL BASIC CODE
    Doesn't give LABEL with Win95, boot to DOS or DOS Window.

    Thanks

    ------------------
Working...
X