Share via


SmartcardT1Request (Windows CE 5.0)

Send Feedback

The SmartcardT1Request function copies data from the user buffer to a send buffer and checks the T=1 protocol status.

NTSTATUS SmartcardT1Request(PSMARTCARD_EXTENSION SmartcardExtension);

Parameters

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

Return Values

SmartcardT1Request returns an NTSTATUS value; STATUS_SUCCESS indicates that the buffer was successfully set up.

Remarks

Do not change any members of the T1_DATA structure. They will be initialized automatically. The only member that can be safely modified is the NAD value. Changing of any member might lead to protocol errors.

SmartcardT1Request copies the data from the user buffer to SmartcardExtension->SmartcardRequest.Buffer embedded in a T=1 protocol frame and adjusts SmartcardExtension->SmartcardRequest.BufferLength. The driver must send this buffer to the smart card and read the answer of the card into SmartcardExtension->SmartcardReply.Buffer. The driver must then call SmartcardT1Reply, which checks the incoming protocol frame.

You can copy your header data to the buffer either before or after a call to SmartcardT1Request, depending on which is easier to do in your driver. If your driver needs to send header data to the reader before the actual T=1 data, you should set SmartcardExtension->SmartcardRequest.BufferLength to the number of bytes you need for your header before you call this function. The packet consists of your header data followed by the T= 1 data.

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

// Run this loop as long as the protocol requires to send data
do {
    // Copy data to SmartcardExtension->SmartcardRequest.Buffer
    // embedded in a T=1 frame
    status = SmartcardT1Request(SmartcardExtension);
    if (status != STATUS_SUCCESS)
        return status;

    // Send T=1 frame to smart card
    status = DriverSendDataToSmartcard(...);
    if (status != STATUS_SUCCESS)
        return status;

// Now set appropiate timeout (This example calculates. the time-out in ms)
// Timeout = SmartcardExtension->CardCapabilities.T1.BWT *
//    (SmartcardExtension->T1.Wtx ? SmartcardExtension->T1.Wtx : 1);


    // receive T=1 frame from smart card
    status = DriverReceiveDataFromSmartcard(...);
    if (status != STATUS_SUCCESS)
        return status;

    // Check T=1 protocol status and copy any data back to user buffer
    status = SmartcardT1Reply(SmartcardExtension);

} while (status == STATUS_MORE_PROCESSING_REQUIRED);

return status;

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Smclib.h.

See Also

T1_DATA | SmartcardT1Reply

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.