Jump to content

DSK LOCKDRIVE: Difference between revisions

From EDM2
No edit summary
 
Line 37: Line 37:
==Returns==
==Returns==
Possible values are shown in the following list:
Possible values are shown in the following list:
 
{| class="wikitable"
    NO_ERROR
! Code
    ERROR_INVALID_FUNCTION
! Description
    ERROR_INVALID_HANDLE
|-
    15
| 0
        ERROR_INVALID_DRIVE 31
| NO_ERROR
        ERROR_GEN_FAILURE 87
|-
        ERROR_INVALID_PARAMETER 111
| 1
        ERROR_BUFFER_OVERFLOW 115
| ERROR_INVALID_FUNCTION
        ERROR_PROTECTION_VIOLATION 117
|-
        ERROR_INVALID_CATEGORY 119
| 6
        ERROR_BAD_DRIVER_LEVEL 163
| ERROR_INVALID_HANDLE
        ERROR_UNCERTAIN_MEDIA 165
|-
        ERROR_MONITORS_NOT_SUPPORTED
| 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==
==Remarks==

Latest revision as of 03:58, 19 May 2025

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:

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