Jump to content

DSK_GETDEVICEPARAMS

From EDM2
Revision as of 04:28, 19 May 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:DSK_GETDEVICEPARAMS}} ;Category:IOCTL_DISK (08h) ;Function:DSK_GETDEVICEPARAMS (63h) ;Description:Query Device Parameters ==Description== Returns the device parameters. ==Command Information== A byte with bit 0 defined as follows: * 0: Return the recommended BPB for the drive, which is the BPB for the physical device, unless it is a formatted fixed media. Then, it is the BPB that was on the media when the system was booted. * 1: Return the BPB for t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Category
IOCTL_DISK (08h)
Function
DSK_GETDEVICEPARAMS (63h)
Description
Query Device Parameters

Description

Returns the device parameters.

Command Information

A byte with bit 0 defined as follows:

  • 0: Return the recommended BPB for the drive, which is the BPB for the physical device, unless it is a formatted fixed media. Then, it is the BPB that was on the media when the system was booted.
  • 1: Return the BPB for the media currently in the drive. This always reads the BPB off the current media in the drive. An error is returned if the media is unformatted.
  • All other bits are reserved, and must be set to 0.

Parameter Packet Format

Parameter Packet
Field Length C Datatype
Command Information BYTE UCHAR
Drive Unit BYTE UCHAR

Extended BPB for Device

The physical device driver maintains two BPBs for each drive. One is the current BPB that corresponds to the media in the drive. The other is a recommended BPB based on the type of media that corresponds to the physical device. (For example, for a high-density drive, the BPB is for a 96 tracks-per-inch (TPI); for a low-density drive, the BPB is for a 48 TPI.) The low bit of the Command Information field indicates which BPB the application needs to see.

Data Packet Format

Data Packet
Field Length C Datatype
Extended BPB for Device 31 BYTES UCHAR[31]
Number of Cylinders WORD USHORT
Device Type BYTE UCHAR
Device Attributes WORD USHORT

Device Type

Describes the physical layout of the device specified, and has one of the following values:

  • 0: 48 TPI low-density diskette drive
  • 1: 96 TPI high-density diskette drive
  • 2: 3.5-inch 720KB diskette drive
  • 3: 8-Inch single-density diskette drive
  • 4: 8-Inch double-density diskette drive
  • 5: Fixed disk
  • 6: Tape drive
  • 7: Other (includes 1.44MB 3.5-inch diskette drive)
  • 8: R/W optical disk
  • 9: 3.5-inch 4.0MB diskette drive (2.88MB formatted)

Device Attributes

A bit field that returns flag information about the specified drive:

  • Bit 0: Removable Media flag. This bit is set to 1 if the media cannot be removed. It is set to 0 if the media is removable.
  • Bit 1: Changeline flag. This bit is set to 1, if the device support determines that the media was removed since the last I/O operation. To query whether the media has changed, call the physical device driver Strategy Command "1h - media check". (Refer to "Physical Device Driver Strategy Commands" in the Physical Device Driver Reference for more information.) If this bit is set to 0, then the physical device driver can return the value 0, Unsure if media has changed, from the Media Check function.
  • Bit 2: Greater than 16MB Support flag. If this bit is set to 1, the physical device driver supports physical addresses greater than 16MB.

Returns

Possible values are shown in the following list:

Code Description
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
6 ERROR_INVALID_HANDLE
15 ERROR_INVALID_DRIVE
31 ERROR_GEN_FAILURE
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
115 ERROR_PROTECTION_VIOLATION
117 ERROR_INVALID_CATEGORY
119 ERROR_BAD_DRIVER_LEVEL
163 ERROR_UNCERTAIN_MEDIA
165 ERROR_MONITORS_NOT_SUPPORTED

Remarks

This function gets the parameters for a specified device. The Drive Unit field is used only when this IOCtl is issued without using a previously allocated file handle and when Command Information is set to 0. A file handle of -1 must be used. Notice that media in the drive is not required. Drive Unit values are 0=A, 1=B, 2=C, and so forth.