wpLockDrive - Example Code

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


[Back: wpLockDrive - Related Methods]
[Next: wpLockDrive - Topics]