The SCardControl function gives you direct control of the reader. You can call it any time after a successful call to SCardConnect and before a successful call to SCardDisconnect. The effect on the state of the reader depends on the control code.
LONG SCardControl( SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID lpInBuffer, DWORD cbInBufferSize, LPVOID lpOutBuffer, DWORD cbOutBufferSize, LPDWORD lpBytesReturned );
Reference value returned from SCardConnect.
Control code for the operation. This value identifies the specific operation to be performed.
Pointer to a buffer that contains the data required to perform the operation. This parameter can be NULL if the dwControlCode parameter specifies an operation that does not require input data.
Size, in bytes, of the buffer pointed to by lpInBuffer.
Pointer to a buffer that receives the operation's output data. This parameter can be NULL if the dwControlCode parameter specifies an operation that does not produce output data.
Size, in bytes, of the buffer pointed to by lpOutBuffer.
Pointer to a DWORD that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer.
This function returns different values depending on whether it succeeds or fails.
||An error code. For more information, see Smart Card Return Values.|
The SCardControl function is a direct card access function. For more information on other direct access functions, see Direct Card Access Functions.
The following example issues a control code. The example assumes that hCardHandle is a valid handle received from a previous call to SCardConnect and that dwControlCode is a variable of type DWORD previously initialized to a valid control code. This particular control code requires no input data and expects no output data.
lReturn = SCardControl( hCardHandle, dwControlCode, NULL, 0, NULL, 0, 0 ); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardControl\n");
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|