Jump to content

DSK_REDETERMINEMEDIA

From EDM2
Revision as of 04:08, 19 May 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:DSK_REDETERMINEMEDIA}} ;Category:IOCTL_DISK (08h) ;Function:DSK_REDETERMINEMEDIA (02h) ;Description:Redetermine Media ==Description== This function redetermines media (ends format). It rebuilds the device parameters (including the Volume Parameter Block (VPB) used by the operating system to identify the volume), simulates a close on the current device handle, and forces a mount on the volume. Function 02h dismounts the volume from the current file sys...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Category
IOCTL_DISK (08h)
Function
DSK_REDETERMINEMEDIA (02h)
Description
Redetermine Media

Description

This function redetermines media (ends format). It rebuilds the device parameters (including the Volume Parameter Block (VPB) used by the operating system to identify the volume), simulates a close on the current device handle, and forces a mount on the volume. Function 02h dismounts the volume from the current file system driver (FSD), attaches the new FSD, and reattaches the current handle to the volume's new FSD. It is typically called after a new boot sector has been written to a volume (after a format has been done). The caller must have the disk or diskette locked when calling this function; otherwise, the function fails with the error ERROR_LOCK_VIOLATION. The caller can have only one file open to refer to the disk or diskette. If other processes have the volume open or the calling process has opened the volume multiple times, the call fails and ERROR_DRIVE_BUSY is returned.

Parameter Packet Format

Parameter Packet
Field Length C Datatype
Command Information BYTE UCHAR

Data Packet Format

Data Packet
Field Length C Datatype
Reserved. Set to 0. BYTE UCHAR

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 should be called after a new boot sector has been written to a volume, typically post-format, with the disk or diskette locked. Ensure that only one file handle is open to the volume to avoid the ERROR_DRIVE_BUSY error.