다음을 통해 공유


SmartcardT0Request (Windows Embedded CE 6.0)

1/6/2010

The SmartcardT0Request function copies data from the user buffer to the send buffer that the driver uses to transmit data to the reader.

Syntax

NTSTATUS SmartcardT0Request(
  PSMARTCARD_EXTENSION SmartcardExtension
);

Parameters

  • SmartcardExtension
    [in] Points to the smart card extension of the device.

Return Value

SmartcardT0Request returns an NTSTATUS value. Possible values are the following.

Value Description

STATUS_SUCCESS

Buffer successfully set up.

STATUS_BUFFER_OVERFLOW

The internal buffer is too small to hold the data to send to the smart card. To fix this error, allocate a larger send buffer. See SmartcardInitialize for details.

STATUS_BUFFER_TOO_SMALL

The user buffer is too small to hold the data.

Remarks

This function copies data from the user buffer to the Buffer member of the SmartcardRequest member of the SMARTCARD_EXTENSION structure pointed to by SmartcardExtension, and adjusts the value in the BufferLength member of the SmartcardRequest member of this structure to the number of bytes to be transmitted to the smart card. The driver then simply writes this buffer to the card and reads the bytes coming from the card into the Buffer member of the SmartcardReply member of this structure, as described in SmartcardT0Reply.

If your driver needs to send header data to the reader before the actual T=0 data, you should set the value in the BufferLength member of the SmartcardRequest member of this structure to the number of bytes that you need for your header before you call this function.

A usual T=0 transmission can be done in the following way.

// Copy data from user buffer to
SmartcardExtension->SmartcardRequest.Buffer
status = SmartcardT0Request(
        SmartcardExtension
        );
if (status != STATUS_SUCCESS)
    return status;
// Transmit SmartcardExtension->SmartcardRequest.Buffer to smart card
status = DriverSendDataToSmartcard(...);
if (status != STATUS_SUCCESS)
return status;
// Receive data from smart card into
SmartcardExtension->SmartcardReply.Buffer
status = DriverReceiveDataFromSmartcard(...);
if (status != STATUS_SUCCESS)
    return status;
// Copy data from SmartcardExtension->SmartcardReply.Buffer back to user buffer
// and return to caller
return SmartcardT0Reply(
SmartcardExtension
);

Requirements

Header smclib.h
Windows Embedded CE Windows CE 3.0 and later

See Also

Reference

Smart Card Driver Functions
SmartcardInitialize
SmartcardT0Reply