ISCardISO7816::PutData

The PutData method constructs an APDU command that stores a single primitive data object or the set of data objects contained in a constructed data object, depending on the file selected.

How the objects are stored (writing once and/or updating and/or appending) depends on the definition or the nature of the data objects.

HRESULT PutData(
  BYTE byP1,
  BYTE byP2,
  LPBYTEBUFFER pData,
  LPSCARDCMD *ppCmd
);
 

Parameters

byP1, byP2 [in]
Coding of P1-P2:
Value Meaning
0000 - 003F RFU
0040 - 00FF BER-TLV tag (1 byte) in P2
0100 - 01FF Application data (proprietary coding)
0200 - 02FF SIMPLE-TLV tag in P2
0300 - 03FF RFU
0400 - 04FF BER-TLV tag (2 bytes) in P1-P2

pData [in]
Pointer to a byte buffer that contains the parameters and data to be written.
ppCmd [in, out]
On input, a pointer to an ISCardCmd interface object or NULL.

On return, it is filled with the APDU command constructed by this operation. If ppCmd was set to NULL, a smart card ISCardCmd object is internally created and returned via the ppCmd pointer.

Return Values

The possible return values are the following:

Value Meaning
S_OK Operation completed successfully.
E_INVALIDARG Invalid parameter.
E_POINTER A bad pointer was passed in.
E_OUTOFMEMORY Out of memory.

Remarks

The command can be performed only if the security status satisfies the security conditions defined by the application within the context for the function.

Store Application Data
When the value of P1-P2 lies in the range from 0100 to 01FF, the value of P1-P2 shall be an identifier reserved for card internal tests and for proprietary services meaningful within a given application context.
Store Data Objects
When the value P1-P2 lies in the range from 0040 to 00FF, the value of P2 shall be a BER-TLV tag on a single byte. The value of 00FF is reserved for indicating that the data field carries BER-TLV data objects.

When the value of P1-P2 lies in the range 0200 to 02FF, the value of P2 shall be a SIMPLE-TLV tag. The value 0200 is RFU. The value 02FF is reserved for indicating that the data field carries SIMPLE-TLV data objects.

When the value of P1-P2 lies in the range from 4000 to FFFF, the value of P1-P2 shall be a BER-TLV tag on two bytes. The values 4000 to FFFF are RFU.

When a primitive data object is provided, the data field of the command message shall contain the value of the corresponding primitive data object.

When a constructed data object is provided, the data field of the command message shall contain the value of the constructed data object (that is, data objects including their tag, length, and value).

For a list of all the methods provided by the ISCardISO7816 interface, see ISCardISO7816.

In addition to the COM error codes listed above, this interface may return a smart card error code if a smart card function was called to complete the request. For information on smart card error codes, see Error Codes.

QuickInfo

  Windows NT: Use version 4.0 SP3 and later.
  Windows: Use Windows 95 OSR2.1.
  Windows CE: Unsupported.
  Header: Declared in scardsrv.h.
  Import Library: scardsrv.tlb.

See Also

GetData, ISCardISO7816