PFN_SMC_ASSIGN_CARD_POWER function pointer

Mandatory. Handles the request to reset or turn off an inserted smart card.

Syntax

typedef NTSTATUS ( *PFN_SMC_ASSIGN_CARD_POWER)(
  _In_  WDFDEVICE  FxDevice,
  _In_  WDFREQUEST FxRequest,
  _In_  ULONG      MinorControlCode,
  _Out_ UCHAR      *OutputBuffer,
  _In_  size_t     OutputBufferSizeInBytes
);

Parameters

  • FxDevice [in]
    Handle to the framework device object.

  • FxRequest [in]
    Handle to the framework request object.

  • MinorControlCode [in]
    The minor codes that indicates the request type. The possible values are:

    • SCARD_COLD_RESET (0) to turn off the smart card, and then turn it on again.
    • SCARD_WARM_RESET (1) to reset without requiring a power cycle of the smart card.
    • SCARD_POWER_DOWN (2) to turn off smart card power.
  • OutputBuffer [out]
    Pointer to the output buffer that contains the answer-to-request (ATR) returned by the smart card.

  • OutputBufferSizeInBytes [in]
    Length of the buffer pointed to by OutputBuffer. Must be at least 33 bytes (MAXIMUM_ATR_LENGTH defined in Smclib.h) to hold the ATR data.

Return value

If the function encounters no errors, it must return STATUS_SUCCESS. Otherwise, one of the appropriate NTSTATUS values.

Remarks

The client driver must register its implementation with the smart card call extension in the driver's EvtDriverDeviceAdd callback function. For example code that shows how to register, see SmcDeviceInitConfig.

The smart card class extension invokes client driver's PFN_SMC_ASSIGN_CARD_POWER callback function when the class extension receives an IOCTL_SMARTCARD_POWER request from the caller (another driver or an application). The caller supplies a populated SCARD_IO_REQUEST structure in which it requests a specific protocol for the I/O transfer. The framework request object contains that structure.

Before invoking the function, the class extension performs certain validation checks on the incoming request and completes the request with a failure code if the call fails validation checks.

Based on those checks, the client driver can assume the following:

  • The card is inserted in the reader.
  • SCARD_CARD_CAPABILITIES structure is initialized and the client driver can get a pointer to the structure by calling SmcCxGetCardCapabilities.
  • For SCARD_WARM_RESET, the specified output buffer is large enough to hold ATR data.

It is mandatory for smart card reader drivers to implement this callback function. The driver assesses the requested MinorControlCode value, prepares a request buffer, and sends the request to the card. The driver receives the ATR returned by the smart card and copies it to the supplied output buffer. The driver must also transfer the ATR to the ATR.Buffer member of the SCARD_CARD_CAPABILITIES structure and update the length in the ATR.Length member

Requirements

Target platform

Desktop

Header

SmcCx.h on Windows 10

See also

SmcDeviceInitConfig

EvtDriverDeviceAdd

SCARD_CARD_CAPABILITIES

 

 

Send comments about this topic to Microsoft