You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Here is code for an application that will display this information:
Code:
%AX = 1
%BX = 2
%CX = 3
%DX = 4
%SI = 5
%DI = 6
%BP = 7
%DS = 8
%ES = 9
%FLAGS = 0
%CF = 0
%FALSE = 0
%TRUE = NOT %FALSE
TYPE structDiscInfo
InfoLevel AS WORD
DiscSerialNumber AS DWORD
VolumeLabel AS STRING * 11
FileSystem AS STRING * 8
END TYPE
DECLARE FUNCTION GetDiscSerialNumber( BYVAL sDrive AS STRING, nSerialNumber AS DWORD, sVolumeLabel AS STRING, sFileSystem AS STRING ) AS INTEGER
StartHere:
DIM nSerial AS DWORD
DIM sDrive AS STRING
DIM sLabel AS STRING
DIM sFileSys AS STRING
DIM sSerial AS STRING
LET sDrive = UCASE$( TRIM$( COMMAND$ ) )
IF GetDiscSerialNumber( sDrive, nSerial, sLabel, sFileSys ) THEN
LET sSerial = RIGHT$( STRING$( 7, "0" ) + HEX$( nSerial ), 8 )
STDOUT " Volume in drive " + sDrive + " is " + sLabel
STDOUT " Serial number is " + LEFT$( sSerial, 4 ) + ":" + RIGHT$( sSerial, 4 )
STDOUT " File system is " + sFileSys
END IF
END 0
FUNCTION GetDiscSerialNumber( BYVAL sDrive AS STRING, nSerialNumber AS DWORD, sVolumeLabel AS STRING, sFileSystem AS STRING ) PRIVATE AS INTEGER
DIM bRet AS INTEGER
DIM nFlags AS WORD
DIM oDiscInfo AS structDiscInfo
LET bRet = %TRUE
LET sDrive = TRIM$( UCASE$( sDrive ) )
IF LEFT$( sDrive, 1 ) < "A" OR LEFT$( sDrive, 1 ) > "Z" THEN LET bRet = %FALSE
IF ISTRUE bRet THEN
REG %AX, &H6900
REG %BX, ASC( sDrive ) - 64
REG %DS, VARSEG( oDiscInfo )
REG %DX, VARPTR( oDiscInfo )
CALL INTERRUPT &H21
LET nFlags = REG( %FLAGS )
IF ISFALSE BIT( nFlags, %CF ) THEN
LET nSerialNumber = oDiscInfo.DiscSerialNumber
LET sVolumeLabel = oDiscInfo.VolumeLabel
LET sFileSystem = oDiscInfo.FileSystem
END IF
END IF
FUNCTION = bRet
END FUNCTION
N.B. The method used by this application to determine the file system type is not official, nor recommended. Also, it will only work on local drives.
[This message has been edited by Matthew Berg (edited November 06, 2000).]
If you try to make something idiot-proof, someone will invent a better idiot.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment