The ManageChannel method constructs an APDU command that opens and closes logical channels.
The open function opens a new logical channel other than the basic one. Options are provided for the card to assign a logical channel number, or for the logical channel number to be supplied to the card.
The close function explicitly closes a logical channel other than the basic one. After the successful closing, the logical channel shall be available for re-use.
HRESULT ManageChannel(
BYTE byChannelState,
BYTE byChannel,
LPSCARDCMD *ppCmd
);
P1 = '00' to open
P1 = '80' to close
Other values are RFU
When b1 and b2 of P2 are NULL, then the card will assign a logical channel number that will be returned in bits b1 and b2 of the data field.
When b1 and/or b2 of P2 are not NULL, they code a logical channel number other than the basic one; then the card will open the externally assigned logical channel number.
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.
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. |
When the open function is successfully performed from the basic logical channel, the MF shall be implicitly selected as the current DF and the security status of the new logical channel should be the same as the basic logical channel after ATR. The security status of the new logical channel should be separate from that of any other logical channel.
When the open function is successfully performed from a logical channel, which is not the basic one, the current DF of the logical channel that issued the command will be selected as the current DF. In addition, the security status for the new logical channel should be the same as the security status of the logical channel from which the open function was performed.
After a successful close function, the security status related to this logical channel is lost.
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.
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.