Expand Minimize

SCardControl function

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.

Syntax


LONG WINAPI SCardControl(
  _In_   SCARDHANDLE hCard,
  _In_   DWORD dwControlCode,
  _In_   LPCVOID lpInBuffer,
  _In_   DWORD nInBufferSize,
  _Out_  LPVOID lpOutBuffer,
  _In_   DWORD nOutBufferSize,
  _Out_  LPDWORD lpBytesReturned
);

Parameters

hCard [in]

Reference value returned from SCardConnect.

dwControlCode [in]

Control code for the operation. This value identifies the specific operation to be performed.

lpInBuffer [in]

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.

nInBufferSize [in]

Size, in bytes, of the buffer pointed to by lpInBuffer.

lpOutBuffer [out]

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.

nOutBufferSize [in]

Size, in bytes, of the buffer pointed to by lpOutBuffer.

lpBytesReturned [out]

Pointer to a DWORD that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer.

Return value

This function returns different values depending on whether it succeeds or fails.

Return codeDescription
Success

SCARD_S_SUCCESS.

Failure

An error code. For more information, see Smart Card Return Values.

 

Remarks

The SCardControl function is a direct card access function. For more information on other direct access functions, see Direct Card Access Functions.

Examples

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");


Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winscard.h

Library

Winscard.lib

DLL

Winscard.dll

See also

SCardConnect
SCardDisconnect

 

 

Community Additions

ADD
Show:
© 2014 Microsoft