Edit

Share via


RDF_TRANSMIT callback function

The RDF_TRANSMIT callback function performs data transmissions.

Syntax

NTSTATUS  (*ReaderFunction[RDF_TRANSMIT])(
   PSMARTCARD_EXTENSION SmartcardExtension
);

Parameters

  • SmartcardExtension
    A pointer to the smart card extension, SMARTCARD_EXTENSION, of the device.

Return value

This function returns an NTSTATUS value. Possible values include the following:

Return code Description
STATUS_SUCCESS

Transmission successful.

STATUS_NO_MEDIA

No smart card is inserted in the reader.

STATUS_IO_TIMEOUT

The request timed out.

STATUS_INVALID_DEVICE_REQUEST

The protocol, defined by dwProtocol, is invalid.

Remarks

Smart card reader drivers must implement this callback function.

On input, the caller must pass the following values to the function:

  • SmartcardExtension->MajorIoControlCode
    Contains IOCTL_SMARTCARD_TRANSMIT.

  • SmartcardExtension->IoRequest.RequestBuffer
    A pointer to an SCARD_IO_REQUEST structure followed by data to transmit to the card.

  • SmartcardExtension->IoRequest.RequestBufferLength
    The number of bytes to transmit to the card.

  • SmartcardExtension->IoRequest.ReplyBufferLength
    The size, in bytes, of the reply buffer.

The request returns the following values:

  • SmartcardExtension->IoRequest.ReplyBuffer
    A pointer to the buffer that receives the SCARD_IO_REQUEST structure, plus the result of the card.

  • SmartcardExtension->IoRequest.Information
    Receives the actual number of bytes returned by the smart card, plus the size of the SCARD_IO_REQUEST structure. For a definition of the SCARD_IO_REQUEST structure, see IOCTL_SMARTCARD_TRANSMIT.

When this function is called, SmartcardExtension->IoRequest.RequestBuffer points to an SCARD_IO_REQUEST structure followed by the data to transmit.

typedef struct _SCARD_IO_REQUEST{
  DWORD  dwProtocol;   // Protocol identifier
  DWORD  cbPciLength;  // Protocol Control Information Length
} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;

The dwProtocol member must contain the protocol identifier that is returned by a call to IOCTL_SMARTCARD_SET_PROTOCOL.

The cbPciLength member contains the size, in bytes, of the SCARD_IO_REQUEST structure. The size of this structure is usually 8 bytes.

The SCARD_IO_REQUEST structure is followed by (protocol) data to transmit to the card. Depending on the protocol to use for the transmission, the library offers several support functions. For more information about these support functions, see SmartcardT0Request (WDM) and SmartcardT1Request (WDM).

RequestBuffer and ReplyBuffer point to the same system buffer. If you use the library function SmartcardxxRequest and SmartcardxxReply, you will not overwrite the input buffer. If you do not use these functions, make a copy of the RequestBuffer before you start transmissions.

You must copy the SCARD_IO_REQUEST structure to the ReplyBuffer parameter, followed by the data received from the card. Again, if you use the SmartcardxxRequest and SmartcardxxReply functions, the library will copy the structure for you.

Requirements

Target platform

Desktop

Header

Smclib.h (include Smclib.h)

See also

IOCTL_SMARTCARD_SET_PROTOCOL

IOCTL_SMARTCARD_TRANSMIT

SmartcardT0Request (WDM)

SmartcardT1Request (WDM)

SMARTCARD_EXTENSION