Share via


SmartcardAcquireRemoveLockWithTag (WDM) routine

The SmartcardAcquireRemoveLockWithTag routine increments a counter of references to the driver, and saves the pointer to the current IRP as the tag. This tag is inspected when the lock is released to make sure that the same IRP was used to both obtain and release the lock.

Syntax

NTSTATUS  SmartcardAcquireRemoveLockWithTag(
   PSMARTCARD_EXTENSION SmartcardExtension
);

Parameters

  • SmartcardExtension
    A pointer to a SMARTCARD_EXTENSION structure that contains the device extension of the smart card device which, in turn, contains the reference counter to increment. It also contains the pointer to the current IRP.

Return value

SmartcardAcquireRemoveLockWithTag returns one of the following NTSTATUS values:

Return code Description
STATUS_SUCCESS

The lock was obtained successfully.

STATUS_DELETE_PENDING

The driver is about to unload.

 

Remarks

If the driver is about to unload, no additional code should be executed (in other words, SmartcardAcquireRemoveLockWithTag should return immediately).

SmartcardAcquireRemoveLockWithTag should be called whenever an entry-point routine to the driver is called (for example, whenever the device I/O control routine is called). SmartcardAcquireRemoveLockWithTag makes sure that the driver does not unload while other driver code is being executed.

Requirements

Target platform

Desktop

Version

Available in Windows XP and later versions of Windows.

Header

Smclib.h (include Smclib.h)

Library

Smclib.lib

IRQL

<= DISPATCH_LEVEL

See also

SMARTCARD_EXTENSION

 

 

Send comments about this topic to Microsoft