Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: 16/32 bit Disk type routines 1998-12-20 -- Roberto Artigas Jr. Heavenes - The Get the Disk Type Routine has been discussed in several
threads in C4/C5 for both 16 and 32 Bit. The Headers and Prototypes are
already available. This is a routine right out of my library. It has been
created out of code posted in this newgroup. It has been compiled and tested
under 16 bit and 32 bit.
Enjoy!
Roberto Artigas Jr
==========
sysDiskType PROCEDURE (xDriveName) ! Declare Procedure
! Start of "Data Section"
! [Priority 5000]
DRIVE_UNKNOWN EQUATE( 0 )
DRIVE_NO_ROOT_DIR EQUATE( 1 )
DRIVE_FIXED EQUATE( 2 )
DRIVE_REMOVABLE EQUATE( 3 )
DRIVE_REMOTE EQUATE( 4 )
DRIVE_CDROM EQUATE( 5 )
DRIVE_RAMDISK EQUATE( 6 )
DriveName CSTRING(4)
DriveType SHORT(0)
DriveNumber SHORT(0)
IRetVal SHORT(0)
inregs LIKE(REGS)
outregs LIKE(REGS)
! End of "Data Section"
CODE
! Start of "Processed Code"
! [Priority 5000]
!Pass drive name to Cstring
DriveName = UPPER(xDriveName[1])
DriveNumber = INSTRING(DriveName[1], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 1,
1)
DriveName[2:3] = ':\'
! Get Drive Type
! Return string describing drive type.
DriveType = GetDriveType(DriveName)
!
! This is 16Bit Code to determine if the DRIVE_REMOTE is a
! CDROM or a NETWORK drive. It checks for the existance of
! MSCDEX and then queries if the DriveNumber is a CD-ROM.
!
OMIT('***',_Width32_)
IF (DriveType = DRIVE_REMOTE) THEN
inregs.wordregs.ax = 1500H
inregs.wordregs.bx = 0
IRetVal = int86(2FH, inregs, outregs)
IF (outregs.wordregs.bx <> 0) THEN
inregs.wordregs.ax = 150BH
inregs.wordregs.cx = DriveNumber - 1
IRetVal = int86(2FH, inregs, outregs)
IF (outregs.wordregs.ax <> 0) THEN
DriveType = DRIVE_CDROM
END
END
END
***
CASE (DriveType)
OF DRIVE_UNKNOWN
RETURN('0 - UNKNOWN')
OF DRIVE_NO_ROOT_DIR
RETURN('1 - NOROOTDIR')
OF DRIVE_FIXED
RETURN('2 - FIXED')
OF DRIVE_REMOVABLE
RETURN('3 - REMOVABLE')
OF Drive_Remote
RETURN('4 - NETWORK')
OF DRIVE_CDROM
RETURN('5 - CDROM')
OF DRIVE_RAMDISK
RETURN('6 - RAMDISK')
END
! End of "Processed Code"
==========
Today is November 21, 2024, 3:55 am This article has been viewed 35219 times.
|
|