Share via


PFN_SMC_SET_PROTOCOL function pointer

Mandatory. Handles the request to select a transmission protocol for the inserted smart card.

Syntax

typedef NTSTATUS ( *PFN_SMC_SET_PROTOCOL)(
  _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]
    Contains a bitwise OR of one or more protocols that are acceptable for the following transmissions. The driver must select a protocol that the inserted smart card supports. We recommend that the T = 1 protocol is given precedence over the T = 0 protocol.

    • SCARD_PROTOCOL_RAW
    • SCARD_PROTOCOL_T0
    • SCARD_PROTOCOL_T1
    • SCARD_PROTOCOL_DEFAULT
    • SCARD_PROTOCOL_OPTIMAL

    The last two values are additional bit definitions that indicate that the driver must either explicitly perform protocol type selection (PTS) with the best possible communication parameters (SCARD_PROTOCOL_OPTIMAL) or use the implicit protocol of the card with standard parameters (SCARD_PROTOCOL_DEFAULT). If the card supports only one protocol with one set of communication parameters, the bits are ignored.

  • OutputBuffer [out]
    Pointer to a buffer that contains the selected protocol.

  • OutputBufferSizeInBytes [in]
    Length of the buffer pointed to by OutputBuffer.

Return value

If the function encounters no errors, it must return STATUS_SUCCESS. Otherwise one of the following 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_SET_PROTOCOL callback function when the class extension receives an IOCTL_SMARTCARD_SET_PROTOCOL request from another driver or an application. 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 supplied OutputBufferSizeInBytes is large enough to buffer that contains the selected protocol.
  • The card is inserted in the reader and is not already in a specific state.
  • The caller requested protocol T=0 or T=1 and is supported by the card.

The client driver allocates the memory for the request buffer, prepares the request for the card, and sends the request to the card. Upon completion, the driver should update the card state SmcCxSetCardState and the Protocol.Selected member of the SCARD_CARD_CAPABILITIES structure. Before returning, the driver fills the selected protocol in the OutputBuffer parameter.

Requirements

Target platform

Desktop

Header

SmcCx.h on Windows 10

See also

IOCTL_SMARTCARD_SET_PROTOCOL

SCARD_CARD_CAPABILITIES

SmcCxSetCardState

 

 

Send comments about this topic to Microsoft