Jump to content

DSK_SETDEVICEPARAMS

From EDM2
Revision as of 04:18, 19 May 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:DSK_SETDEVICEPARAMS}} ;Category:IOCTL_DISK (08h) ;Function:DSK_SETDEVICEPARAMS (43h) ;Description:Set Device Parameters ==Description== This function sets the parameters for a specified device. ==Parameter Packet Format== {| class="wikitable" |+ Parameter Packet |- ! Field ! Length ! C Datatype |- | Command Information | BYTE | UCHAR |- | Drive Unit | BYTE | UCHAR |} ==Data Packet Format== {| class="wikitable" |+ Data Packet |- ! Field ! Length !...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Category
IOCTL_DISK (08h)
Function
DSK_SETDEVICEPARAMS (43h)
Description
Set Device Parameters

Description

This function sets the parameters for a specified device.

Parameter Packet Format

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

Data Packet Format

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

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
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

The Command Information field uses the two low bits to indicate one of three actions: 00 (revert to building the BIOS Parameter Block (BPB) off the medium for all subsequent Build BPB functions, typically used after a format to reset device parameters), 01 (change the default BPB for the physical device, altering the drive's physical parameters), or 10 (change the BPB for the medium to the specified BPB and return the new BPB for subsequent Build BPB calls, used to prepare for a format operation). All other bits are reserved and must be set to 0. The Drive Unit field (0=A, 1=B, 2=C, etc.) is used only when the IOCtl is issued without a previously allocated file handle (using a file handle of -1) and when Command Information is set to 01; media in the drive is not required.

The Extended BPB describes the media structure and physical drive layout (heads, tracks, sectors) with fields: Bytes per Sector (WORD), Sectors per Cluster (BYTE), Reserved Sectors (WORD), Number of FATs (BYTE), Root Directory Entries (WORD), Total Sectors (WORD), Media Descriptor (BYTE), Sectors per FAT (WORD), Sectors per Track (WORD), Number of Heads (WORD), Hidden Sectors (DWORD), Large Total Sectors (DWORD), and Reserved (6 BYTES). The Number of Cylinders indicates the cylinders defined for the physical device. Device Type specifies the physical layout: 0 (48 TPI low-density diskette), 1 (96 TPI high-density diskette), 2 (3.5-inch 720KB), 3 (8-inch single-density diskette), 4 (8-inch double-density diskette), 5 (fixed disk), 6 (tape drive), 7 (other, including 1.44MB 3.5-inch diskette), 8 (R/W optical disk), or 9 (3.5-inch 4.0MB diskette). Device Attributes is a bit field: Bit 0 (1 for non-removable media, 0 for removable), Bit 1 (1 if the device supports detecting media removal since the last I/O, 0 otherwise, requiring a Media Check via Strategy Command 1h).

The BIOSPARAMETERBLOCK data structure can be used by C programmers by defining INCL_DOSDEVIOCTL before including OS2.H.