Jump to content

wpQueryDriveLockStatus

From EDM2
Revision as of 02:10, 17 November 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:wpQueryDriveLockStatus}} This method is specific to version 2.1, or higher, of the OS/2 operating system. This instance method returns the lock status of a drive. ==Syntax== _wpQueryDriveLockStatus(somSelf, pulLockStatus, pulLockCount) ==Parameters== ;''somSelf'' (WPDisk *) - input :Pointer to the object on which the method is being invoked. :Points to an object of class WPDisk. ;''pulLockStatus'' (PULONG) - input :Pointer to the lock stat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This method is specific to version 2.1, or higher, of the OS/2 operating system.

This instance method returns the lock status of a drive.

Syntax

_wpQueryDriveLockStatus(somSelf, pulLockStatus, pulLockCount)

Parameters

somSelf (WPDisk *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPDisk.
pulLockStatus (PULONG) - input
Pointer to the lock status of the drive. Possible values are described in the following list:
  • **0** No media exists in the drive, and the drive is unlocked.
  • **1** Media exists in the drive.
  • **2** The drive is locked.
  • **3** Media exists in the drive, and the drive is locked.
pulLockCount (PULONG) - input
Number of locks against the drive.

Returns

rc (ULONG) - returns
Return code from **DosDevIOCtl** category **8** Function **66**. A return value of **NO_ERROR** indicates the drive does not support lock and eject.

How to Override

This method should not be overridden.

Usage

This method can be called at any time to verify the lock status of a drive.

Example Code

Declaration:

#define INCL_WINWORKPLACE
#include <os2.h>

WPDisk *somSelf; /* Pointer to the object on which the method is being invoked. */
PULONG *pulLockStatus; /* Pointer to the lock status of the drive. */
PULONG *pulLockCount; /* Number of locks against the drive. */
ULONG rc; /* Return code from DosDevIOCtl category 8 Function 66. */

rc = _wpQueryDriveLockStatus(somSelf, pulLockStatus,
        pulLockCount);

Example:

ULONG ulStatus    = 0;          /* Status returned from _wpLockDrive */
ULONG ulLockCount = 0;          /* Number of times drive is locked   */

            /* Lock the target drive */

   ulStatus = _wpLockDrive( self, TRUE );

   if (ulStatus & DRIVE_LOCK_NO_SUPPORT) {
     somPrintf("Drive does not support lock/unlock.\n");
   } else {

          /* Query the target drive */

     rc = _wpQueryDriveLockStatus( self                 /* Self pointer */
                                 , &ulStatus            /* Lock status  */
                                 , &ulLockCount );      /* Lock count   */

     if (rc == NO_ERROR) {

       somPrintf("_wpQueryDriveLockStatus reports:\n");

       if (ulStatus & DRIVE_LOCKED) {
         somLPrintf(1, "Drive is locked.\n");
         somLPrintf(1, "Lock count = %u\n", ulLockCount);
       }
     }

          /* Unlock the target drive */

     ulStatus = _wpLockDrive( self, FALSE );

   } /* endif */

Related Methods