Function 440Dh Minor Code 60h Get Device Parameters

mov bx, Drive ;0 = default, 1 = A, 2 = B, etc.

mov ch, 08h ;device category (must be 08h)

mov cl, 60h ;Get Device Parameters

mov dx, seg DriveDP

mov ds, dx

mov dx, offset DriveDP ;ds:dx points to DEVICEPARAMS structure

mov ax, 440Dh ;IOCTL for Block Device

int 21h

jc error_handler ;carry set means error

Get Device Parameters (Function 440Dh Minor Code 60h) returns the device parameters for the specified block device.

Parameters

Drive

Specifies the drive for which parameters are requested (0 = default drive, 1 = A, 2 = B, etc.).

DriveDP

Points to a DEVICEPARAMS structure that receives information on the device's storage capacity and characteristics. The DEVICEPARAMS structure has the following form:

DEVICEPARAMS STRUC

dpSpecFunc db ? ;special functions

dpDevType db ? ;device type

dpDevAttr dw ? ;device attributes

dpCylinders dw ? ;number of cylinders

dpMediaType db ? ;media type

;Start of BIOS parameter block (BPB)

dpBytesPerSec dw ? ;bytes per sector

dpSecPerClust db ? ;sectors per cluster

dpResSectors dw ? ;number of reserved sectors

dpFATs db ? ;number of file allocation tables

dpRootDirEnts dw ? ;number of root-directory entries

dpSectors dw ? ;total number of sectors

dpMedia db ? ;media descriptor

dpFATsecs dw ? ;number of sectors per FAT

dpSecPerTrack dw ? ;sectors per track

dpHeads dw ? ;number of heads

dpHiddenSecs dd ? ;number of hidden sectors

dpHugeSectors dd ? ;number of sectors if dpSectors = 0

;End of BIOS parameter block (BPB)

DEVICEPARAMS ENDS

The dpSpecFunc field determines whether the function retrieves current or default information. If the field is set to 1, the function retrieves information about the current medium in the drive; if the field is set to 0, the function retrieves information about the default medium for the drive.

For a full description of the DEVICEPARAMS structure, see Chapter 3, “File System.”

Return Value

If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following:

Value Name

0001h ERROR_INVALID_FUNCTION
0002h ERROR_FILE_NOT_FOUND
0005h ERROR_ACCESS_DENIED

Comment

Get Device Parameters returns 0002h (ERROR_FILE_NOT_FOUND) if the specified drive number is invalid.

See Also

Function 440Dh Minor Code 40h Set Device Parameters