Редагувати

Поділитися через


ISCardISO7816::PutData method

[The PutData method is available for use in the operating systems specified in the Requirements section. It is not available for use in Windows Server 2003 with Service Pack 1 (SP1) and later, Windows Vista, Windows Server 2008, and subsequent versions of the operating system. The Smart Card Modules provide similar functionality.]

The PutData method constructs an application protocol data unit (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.

Syntax

HRESULT PutData(
  [in]      BYTE         byP1,
  [in]      BYTE         byP2,
  [in]      LPBYTEBUFFER pData,
  [in, out] LPSCARDCMD   *ppCmd
);

Parameters

byP1 [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

 

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 using the ppCmd pointer.

Return value

The method returns one of the following possible values.

Return code Description
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 this 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 more information, see Smart Card Return Values.

Requirements

Requirement Value
Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
End of client support
Windows XP
End of server support
Windows Server 2003
Header
Scardssp.h
Type library
Scardsrv.tlb
DLL
Scardssp.dll
IID
IID_ISCardISO7816 is defined as 53B6AA68-3F56-11D0-916B-00AA00C18068

See also

GetData

ISCardISO7816