Jump to content

DSK_LOCKDRIVE

From EDM2
Revision as of 03:56, 19 May 2025 by Martini (talk | contribs)
Category
IOCTL_DISK (08h)
Function
DSK_LOCKDRIVE (00h)
Description
Lock Drive

Description

This function locks a drive and is used to exclude I/O by another process on the volume in the drive. The Lock Drive function succeeds only if there is one file handle open on the volume in the drive (that is, the file handle on which this function is issued). This is necessary because the desired result is to exclude all other I/O to this volume until "Function 01h - Unlock Drive" is issued.

Parameter Packet Format

Table Title (Optional)
Field Length C Datatype
Command Information BYTE UCHAR

Data Packet Format

Table Title (Optional)
Field Length C Datatype
Reserved. Set to 0. BYTE UCHAR

Returns

Possible values are shown in the following list:

   NO_ERROR
   ERROR_INVALID_FUNCTION
   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 obtaining a handle from DosOpen but before actually accessing the drive. Notice that it is necessary to call DSK_UNLOCKDRIVE before closing the drive.