Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 3ef085c66d4a743f8dec260630a0b19c > files > 91

pcsc-lite-doc-1.5.5-4.fc13.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>pcsc-lite: API</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>API</h1>
<p>This handles smartcard reader communications and forwarding requests over message queues.  
<a href="#_details">More...</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PCSC_API char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga132e20ab457d042a06f7df733f15b22d">pcsc_stringify_error</a> (const long pcscError)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function return a human readable text for the given PC/SC error code.  <a href="#ga132e20ab457d042a06f7df733f15b22d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67">SCardEstablishContext</a> (DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates an Application Context to the PC/SC Resource Manager.  <a href="#gaa1b8970169fd4883a6dc4a8f43f19b67"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga6aabcba7744c5c9419fdd6404f73a934">SCardReleaseContext</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function destroys a communication context to the PC/SC Resource Manager.  <a href="#ga6aabcba7744c5c9419fdd6404f73a934"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga812e35ead06d4690fa96aecf371c6255">SCardSetTimeout</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext, DWORD dwTimeout)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The function does not do anything except returning <a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>.  <a href="#ga812e35ead06d4690fa96aecf371c6255"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5">SCardConnect</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function establishes a connection to the reader specified in <code>szReader</code>.  <a href="#ga4e515829752e0a8dbc4d630696a8d6a5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gad5d4393ca8c470112ad9468c44ed8940">SCardReconnect</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function reestablishes a connection to a reader that was previously connected to using <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>.  <a href="#gad5d4393ca8c470112ad9468c44ed8940"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga4be198045c73ec0deb79e66c0ca1738a">SCardDisconnect</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, DWORD dwDisposition)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function terminates a connection made through <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>.  <a href="#ga4be198045c73ec0deb79e66c0ca1738a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861">SCardBeginTransaction</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function establishes a temporary exclusive access mode for doing a serie of commands in a transaction.  <a href="#gaddb835dce01a0da1d6ca02d33ee7d861"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gae8742473b404363e5c587f570d7e2f3b">SCardEndTransaction</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, DWORD dwDisposition)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function ends a previously begun transaction.  <a href="#gae8742473b404363e5c587f570d7e2f3b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga294d4c60b3631b9584a8c854ee8c3b1b">SCardCancelTransaction</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga18f33eebb45d9e0d2a091ca7a0511d26">SCardStatus</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function returns the current status of the reader connected to by <code>hCard</code>.  <a href="#ga18f33eebb45d9e0d2a091ca7a0511d26"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gad1db67ba2b7d143498257294b873c049">SCardGetStatusChange</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext, DWORD dwTimeout, <a class="el" href="structSCARD__READERSTATE__A.html">LPSCARD_READERSTATE_A</a> rgReaderStates, DWORD cReaders)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function receives a structure or list of structures containing reader names.  <a href="#gad1db67ba2b7d143498257294b873c049"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f">SCardControl</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function sends a command directly to the IFD Handler (reader driver) to be processed by the reader.  <a href="#gac3454d4657110fd7f753b2d3d8f4e32f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gaacfec51917255b7a25b94c5104961602">SCardGetAttrib</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function get an attribute from the IFD Handler (reader driver).  <a href="#gaacfec51917255b7a25b94c5104961602"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f">SCardSetAttrib</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, DWORD dwAttrId, LPCBYTE pbAttr, DWORD cbAttrLen)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function set an attribute of the IFD Handler.  <a href="#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gac60e9e6c93b04e61594a3a8f69ee1898">SCardTransmit</a> (<a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a> hCard, <a class="el" href="structSCARD__IO__REQUEST.html">LPCSCARD_IO_REQUEST</a> pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, <a class="el" href="structSCARD__IO__REQUEST.html">LPSCARD_IO_REQUEST</a> pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function sends an APDU to the smart card contained in the reader connected to by <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>.  <a href="#gac60e9e6c93b04e61594a3a8f69ee1898"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga93b07815789b3cf2629d439ecf20f0d9">SCardListReaders</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function returns a list of currently available readers on the system.  <a href="#ga93b07815789b3cf2629d439ecf20f0d9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga0522241e3180cb05dfd166e28930e961">SCardFreeMemory</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext, LPCVOID pvMem)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Releases memory that has been returned from the resource manager using the <a class="el" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0">SCARD_AUTOALLOCATE</a> length designator.  <a href="#ga0522241e3180cb05dfd166e28930e961"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga9d970d086d5218e080d0079d63f9d496">SCardListReaderGroups</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext, LPSTR mszGroups, LPDWORD pcchGroups)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function returns a list of currently available reader groups on the system.  <a href="#ga9d970d086d5218e080d0079d63f9d496"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6">SCardCancel</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function cancels all pending blocking requests on the <a class="el" href="group__API.html#gad1db67ba2b7d143498257294b873c049" title="This function receives a structure or list of structures containing reader names...">SCardGetStatusChange()</a> function.  <a href="#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">LONG&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__API.html#ga722eb66bcc44d391f700ff9065cc080b">SCardIsValidContext</a> (<a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> hContext)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if a <a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> is valid.  <a href="#ga722eb66bcc44d391f700ff9065cc080b"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>This handles smartcard reader communications and forwarding requests over message queues. </p>
<p>Here is exposed the API for client applications. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga132e20ab457d042a06f7df733f15b22d"></a><!-- doxytag: member="error.c::pcsc_stringify_error" ref="ga132e20ab457d042a06f7df733f15b22d" args="(const long pcscError)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">PCSC_API char* pcsc_stringify_error </td>
          <td>(</td>
          <td class="paramtype">const long&nbsp;</td>
          <td class="paramname"> <em>pcscError</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function return a human readable text for the given PC/SC error code. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>pcscError</em>&nbsp;</td><td>Error code to be translated to text.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Text representing the error code passed.</dd></dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LONG rv;
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 <span class="keywordflow">if</span> (rv != <a class="code" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75" title="error codes from http://msdn.microsoft.com/en-us/library/aa924526.aspx">SCARD_S_SUCCESS</a>)
     printf(<span class="stringliteral">&quot;SCardReleaseContext: %s (0x%lX)\n&quot;</span>,
         <a class="code" href="group__API.html#ga132e20ab457d042a06f7df733f15b22d" title="This function return a human readable text for the given PC/SC error code.">pcsc_stringify_error</a>(rv), rv);
</pre></div> 
<p>Definition at line <a class="el" href="error_8c_source.html#l00046">46</a> of file <a class="el" href="error_8c_source.html">error.c</a>.</p>

<p>References <a class="el" href="pcsclite_8h_source.html#l00072">SCARD_E_CANCELLED</a>, <a class="el" href="pcsclite_8h_source.html#l00084">SCARD_E_CANT_DISPOSE</a>, <a class="el" href="pcsclite_8h_source.html#l00098">SCARD_E_CARD_UNSUPPORTED</a>, <a class="el" href="pcsclite_8h_source.html#l00097">SCARD_E_DUPLICATE_READER</a>, <a class="el" href="pcsclite_8h_source.html#l00078">SCARD_E_INSUFFICIENT_BUFFER</a>, <a class="el" href="pcsclite_8h_source.html#l00091">SCARD_E_INVALID_ATR</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00075">SCARD_E_INVALID_TARGET</a>, <a class="el" href="pcsclite_8h_source.html#l00087">SCARD_E_INVALID_VALUE</a>, <a class="el" href="pcsclite_8h_source.html#l00076">SCARD_E_NO_MEMORY</a>, <a class="el" href="pcsclite_8h_source.html#l00116">SCARD_E_NO_READERS_AVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00082">SCARD_E_NO_SMARTCARD</a>, <a class="el" href="pcsclite_8h_source.html#l00086">SCARD_E_NOT_READY</a>, <a class="el" href="pcsclite_8h_source.html#l00092">SCARD_E_NOT_TRANSACTED</a>, <a class="el" href="pcsclite_8h_source.html#l00095">SCARD_E_PCI_TOO_SMALL</a>, <a class="el" href="pcsclite_8h_source.html#l00085">SCARD_E_PROTO_MISMATCH</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00096">SCARD_E_READER_UNSUPPORTED</a>, <a class="el" href="pcsclite_8h_source.html#l00100">SCARD_E_SERVICE_STOPPED</a>, <a class="el" href="pcsclite_8h_source.html#l00081">SCARD_E_SHARING_VIOLATION</a>, <a class="el" href="pcsclite_8h_source.html#l00088">SCARD_E_SYSTEM_CANCELLED</a>, <a class="el" href="pcsclite_8h_source.html#l00080">SCARD_E_TIMEOUT</a>, <a class="el" href="pcsclite_8h_source.html#l00083">SCARD_E_UNKNOWN_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00079">SCARD_E_UNKNOWN_READER</a>, <a class="el" href="pcsclite_8h_source.html#l00180">SCARD_E_UNSUPPORTED_FEATURE</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00071">SCARD_F_INTERNAL_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00090">SCARD_F_UNKNOWN_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00077">SCARD_F_WAITED_TOO_LONG</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="pcsclite_8h_source.html#l00179">SCARD_W_INSERTED_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00125">SCARD_W_REMOVED_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00124">SCARD_W_RESET_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00123">SCARD_W_UNPOWERED_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00122">SCARD_W_UNRESPONSIVE_CARD</a>, and <a class="el" href="pcsclite_8h_source.html#l00121">SCARD_W_UNSUPPORTED_CARD</a>.</p>

</div>
</div>
<a class="anchor" id="gaddb835dce01a0da1d6ca02d33ee7d861"></a><!-- doxytag: member="winscard_clnt.c::SCardBeginTransaction" ref="gaddb835dce01a0da1d6ca02d33ee7d861" args="(SCARDHANDLE hCard)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardBeginTransaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function establishes a temporary exclusive access mode for doing a serie of commands in a transaction. </p>
<p>You might want to use this when you are selecting a few files and then writing a large file so you can make sure that another application will not change the current file. If another application has a lock on this reader or this application is in <a class="el" href="pcsclite_8h.html#aedc5ddb6c12dd0e9f522d4c669ca9135">SCARD_SHARE_EXCLUSIVE</a> there will be no action taken.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid hCard handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_SHARING_VIOLATION</em>&nbsp;</td><td>Someone else has exclusive rights (<a class="el" href="pcsclite_8h.html#a81cd3fc9e7e84c66be2471294152235f">SCARD_E_SHARING_VIOLATION</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
 rv = <a class="code" href="group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861" title="This function establishes a temporary exclusive access mode for doing a serie of...">SCardBeginTransaction</a>(hCard);
 ...
 / * Do some transmit commands * /
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l01133">1133</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcscd_8h_source.html#l00045">PCSCLITE_LOCK_POLL_RATE</a>, <a class="el" href="pcsclite_8h_source.html#l00188">PCSCLITE_MAX_READERS_CONTEXTS</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="winscard__msg_8h_source.html#l00097">SCARD_BEGIN_TRANSACTION</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00081">SCARD_E_SHARING_VIOLATION</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, <a class="el" href="sys__unix_8c_source.html#l00099">SYS_USleep()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6"></a><!-- doxytag: member="winscard_clnt.c::SCardCancel" ref="gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6" args="(SCARDCONTEXT hContext)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardCancel </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function cancels all pending blocking requests on the <a class="el" href="group__API.html#gad1db67ba2b7d143498257294b873c049" title="This function receives a structure or list of structures containing reader names...">SCardGetStatusChange()</a> function. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hContext</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 DWORD cReaders;
 <a class="code" href="structSCARD__READERSTATE__A.html">SCARD_READERSTATE</a> rgReaderStates;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rgReaderStates.szReader = strdup(<span class="stringliteral">&quot;Reader X&quot;</span>);
 rgReaderStates.dwCurrentState = <a class="code" href="pcsclite_8h.html#aadf7badda42d372c2bc56d95a7720535" title="Card removed.">SCARD_STATE_EMPTY</a>;
 ...
 / * Spawn off thread <span class="keywordflow">for</span> following function * /
 ...
 rv = <a class="code" href="group__API.html#gad1db67ba2b7d143498257294b873c049" title="This function receives a structure or list of structures containing reader names...">SCardGetStatusChange</a>(hContext, 0, rgReaderStates, cReaders);
 rv = <a class="code" href="group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6" title="This function cancels all pending blocking requests on the SCardGetStatusChange()...">SCardCancel</a>(hContext);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l03495">3495</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcscd_8h_source.html#l00024">BLOCK_STATUS_RESUME</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00071">SCARD_F_INTERNAL_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>, and <a class="el" href="utils_8c_source.html#l00163">StatSynchronizeContext()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga294d4c60b3631b9584a8c854ee8c3b1b"></a><!-- doxytag: member="winscard_clnt.c::SCardCancelTransaction" ref="ga294d4c60b3631b9584a8c854ee8c3b1b" args="(SCARDHANDLE hCard)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardCancelTransaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000002">Deprecated:</a></b></dt><dd>This function is not in Microsoft(R) WinSCard API and is deprecated in pcsc-lite API.</dd></dl>

<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l01365">1365</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcsclite_8h_source.html#l00188">PCSCLITE_MAX_READERS_CONTEXTS</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga4e515829752e0a8dbc4d630696a8d6a5"></a><!-- doxytag: member="winscard_clnt.c::SCardConnect" ref="ga4e515829752e0a8dbc4d630696a8d6a5" args="(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardConnect </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCSTR&nbsp;</td>
          <td class="paramname"> <em>szReader</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwShareMode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwPreferredProtocols</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPSCARDHANDLE&nbsp;</td>
          <td class="paramname"> <em>phCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pdwActiveProtocol</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function establishes a connection to the reader specified in <code>szReader</code>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>szReader</em>&nbsp;</td><td>Reader name to connect to. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwShareMode</em>&nbsp;</td><td>Mode of connection type: exclusive or shared.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f">SCARD_SHARE_SHARED</a> - This application will allow others to share the reader.</li>
<li><a class="el" href="pcsclite_8h.html#aedc5ddb6c12dd0e9f522d4c669ca9135">SCARD_SHARE_EXCLUSIVE</a> - This application will NOT allow others to share the reader.</li>
<li><a class="el" href="pcsclite_8h.html#a440c31d5b68fda7dfe8f87f5ffe47bef">SCARD_SHARE_DIRECT</a> - Direct control of the reader, even without a card. <a class="el" href="pcsclite_8h.html#a440c31d5b68fda7dfe8f87f5ffe47bef">SCARD_SHARE_DIRECT</a> can be used before using <a class="el" href="group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f" title="This function sends a command directly to the IFD Handler (reader driver) to be processed...">SCardControl()</a> to send control commands to the reader even if a card is not present in the reader. Contrary to Windows winscard behavior, the reader is accessed in shared mode and not exclusive mode. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwPreferredProtocols</em>&nbsp;</td><td>Desired protocol use.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c">SCARD_PROTOCOL_T0</a> - Use the T=0 protocol.</li>
<li><a class="el" href="pcsclite_8h.html#a3c09cd155e07044f857130c183d64f03">SCARD_PROTOCOL_T1</a> - Use the T=1 protocol.</li>
<li><a class="el" href="pcsclite_8h.html#ab58a85ece18f4217fe5372981231d195">SCARD_PROTOCOL_RAW</a> - Use with memory type cards. <code>dwPreferredProtocols</code> is a bit mask of acceptable protocols for the connection. You can use (<a class="el" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c">SCARD_PROTOCOL_T0</a> | <a class="el" href="pcsclite_8h.html#a3c09cd155e07044f857130c183d64f03">SCARD_PROTOCOL_T1</a>) if you do not have a preferred protocol. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>phCard</em>&nbsp;</td><td>Handle to this connection. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pdwActiveProtocol</em>&nbsp;</td><td>Established protocol to this connection.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hContext</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_PARAMETER</em>&nbsp;</td><td><code>phCard</code> or <code>pdwActiveProtocol</code> is NULL (<a class="el" href="pcsclite_8h.html#a47a6da10ec4ea2cbebfcc4b2a93d786f">SCARD_E_INVALID_PARAMETER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid sharing mode, requested protocol, or reader name (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NOT_READY</em>&nbsp;</td><td>Could not allocate the desired port (<a class="el" href="pcsclite_8h.html#aad8800bcf34cd97d4a4b0c3fbd3d955e">SCARD_E_NOT_READY</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>Could not power up the reader or card (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_SHARING_VIOLATION</em>&nbsp;</td><td>Someone else has exclusive rights (<a class="el" href="pcsclite_8h.html#a81cd3fc9e7e84c66be2471294152235f">SCARD_E_SHARING_VIOLATION</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_UNKNOWN_READER</em>&nbsp;</td><td><code>szReader</code> is NULL (<a class="el" href="pcsclite_8h.html#a1bc24e84bfe33ef68be7251e2423190a">SCARD_E_UNKNOWN_READER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_UNSUPPORTED_FEATURE</em>&nbsp;</td><td>Protocol not supported (<a class="el" href="pcsclite_8h.html#aef39984cd0dd3822088099fffd9d5f96">SCARD_E_UNSUPPORTED_FEATURE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_INTERNAL_ERROR</em>&nbsp;</td><td>An internal consistency check failed (<a class="el" href="pcsclite_8h.html#a081a564acaf166f74592906f7dff2d86">SCARD_F_INTERNAL_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l00734">734</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="readerfactory_8h_source.html#l00130">ReaderContext::dwContexts</a>, <a class="el" href="readerfactory_8h_source.html#l00127">ReaderContext::dwLockId</a>, <a class="el" href="readerfactory_8h_source.html#l00112">ReaderContext::mMutex</a>, <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcscd_8h_source.html#l00045">PCSCLITE_LOCK_POLL_RATE</a>, <a class="el" href="prothandler_8c_source.html#l00055">PHGetAvailableProtocols()</a>, <a class="el" href="prothandler_8c_source.html#l00035">PHGetDefaultProtocol()</a>, <a class="el" href="prothandler_8c_source.html#l00080">PHSetProtocol()</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="readerfactory_8h_source.html#l00134">ReaderContext::readerState</a>, <a class="el" href="winscard__msg_8h_source.html#l00094">SCARD_CONNECT</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00087">SCARD_E_INVALID_VALUE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00082">SCARD_E_NO_SMARTCARD</a>, <a class="el" href="pcsclite_8h_source.html#l00085">SCARD_E_PROTO_MISMATCH</a>, <a class="el" href="pcsclite_8h_source.html#l00081">SCARD_E_SHARING_VIOLATION</a>, <a class="el" href="pcsclite_8h_source.html#l00079">SCARD_E_UNKNOWN_READER</a>, <a class="el" href="winscard_8c_source.html#l00189">SCARD_EXCLUSIVE_CONTEXT</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00071">SCARD_F_INTERNAL_ERROR</a>, <a class="el" href="winscard_8c_source.html#l00187">SCARD_NO_CONTEXT</a>, <a class="el" href="pcsclite_8h_source.html#l00159">SCARD_PRESENT</a>, <a class="el" href="winscard_8c_source.html#l00182">SCARD_PROTOCOL_ANY_OLD</a>, <a class="el" href="pcsclite_8h_source.html#l00143">SCARD_PROTOCOL_RAW</a>, <a class="el" href="pcsclite_8h_source.html#l00141">SCARD_PROTOCOL_T0</a>, <a class="el" href="pcsclite_8h_source.html#l00142">SCARD_PROTOCOL_T1</a>, <a class="el" href="pcsclite_8h_source.html#l00139">SCARD_PROTOCOL_UNDEFINED</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="pcsclite_8h_source.html#l00150">SCARD_SHARE_DIRECT</a>, <a class="el" href="pcsclite_8h_source.html#l00148">SCARD_SHARE_EXCLUSIVE</a>, <a class="el" href="pcsclite_8h_source.html#l00149">SCARD_SHARE_SHARED</a>, <a class="el" href="pcsclite_8h_source.html#l00160">SCARD_SWALLOWED</a>, <a class="el" href="pcsclite_8h_source.html#l00123">SCARD_W_UNPOWERED_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00122">SCARD_W_UNRESPONSIVE_CARD</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, <a class="el" href="utils_8c_source.html#l00087">StatSynchronize()</a>, <a class="el" href="sys__unix_8c_source.html#l00099">SYS_USleep()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gac3454d4657110fd7f753b2d3d8f4e32f"></a><!-- doxytag: member="winscard_clnt.c::SCardControl" ref="gac3454d4657110fd7f753b2d3d8f4e32f" args="(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardControl </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwControlCode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCVOID&nbsp;</td>
          <td class="paramname"> <em>pbSendBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>cbSendLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPVOID&nbsp;</td>
          <td class="paramname"> <em>pbRecvBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>cbRecvLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>lpBytesReturned</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function sends a command directly to the IFD Handler (reader driver) to be processed by the reader. </p>
<p>This is useful for creating client side reader drivers for functions like PIN pads, biometrics, or other extensions to the normal smart card reader that are not normally handled by PC/SC.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>the API of this function changed. In pcsc-lite 1.2.0 and before the API was not Windows(R) PC/SC compatible. This has been corrected.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwControlCode</em>&nbsp;</td><td>Control code for the operation.<br/>
 <a href="http://pcsclite.alioth.debian.org/pcsc-lite/node28.html">Click here</a> for a list of supported commands by some drivers. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>pbSendBuffer</em>&nbsp;</td><td>Command to send to the reader. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>cbSendLength</em>&nbsp;</td><td>Length of the command. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pbRecvBuffer</em>&nbsp;</td><td>Response from the reader. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>cbRecvLength</em>&nbsp;</td><td>Length of the response buffer. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>lpBytesReturned</em>&nbsp;</td><td>Length of the response.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid value was presented (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INSUFFICIENT_BUFFER</em>&nbsp;</td><td><code>cbSendLength</code> or <code>cbRecvLength</code> are too big (<a class="el" href="pcsclite_8h.html#aac3f8d945f8a0e667e0926daaa18dc57">SCARD_E_INSUFFICIENT_BUFFER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NOT_TRANSACTED</em>&nbsp;</td><td>Data exchange not successful (<a class="el" href="pcsclite_8h.html#ab02a33c2ef61f12a851dfe85c575d7cc">SCARD_E_NOT_TRANSACTED</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed(<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_W_REMOVED_CARD</em>&nbsp;</td><td>The card has been removed from the reader(<a class="el" href="pcsclite_8h.html#aa2efd953946973972b1afc5d0343820c">SCARD_W_REMOVED_CARD</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_W_RESET_CARD</em>&nbsp;</td><td>The card has been reset by another application (<a class="el" href="pcsclite_8h.html#a20fbb8319646f26c4ad7f237d1a64f0c">SCARD_W_RESET_CARD</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> LONG rv;
 <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol, dwSendLength, dwRecvLength;
 BYTE pbRecvBuffer[10];
 BYTE pbSendBuffer[] = { 0x06, 0x00, 0x0A, 0x01, 0x01, 0x10 0x00 };
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#ab58a85ece18f4217fe5372981231d195" title="Raw active protocol.">SCARD_PROTOCOL_RAW</a>, &amp;hCard, &amp;dwActiveProtocol);
 dwSendLength = <span class="keyword">sizeof</span>(pbSendBuffer);
 dwRecvLength = <span class="keyword">sizeof</span>(pbRecvBuffer);
 rv = <a class="code" href="group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f" title="This function sends a command directly to the IFD Handler (reader driver) to be processed...">SCardControl</a>(hCard, 0x42000001, pbSendBuffer, dwSendLength,
          pbRecvBuffer, <span class="keyword">sizeof</span>(pbRecvBuffer), &amp;dwRecvLength);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l02365">2365</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="winscard__clnt_8c_source.html#l00177">_psContextMap::dwClientID</a>, <a class="el" href="readerfactory_8h_source.html#l00123">ReaderContext::dwVersion</a>, <a class="el" href="ifdwrapper_8c_source.html#l00603">IFDControl()</a>, <a class="el" href="pcsclite_8h_source.html#l00201">MAX_BUFFER_SIZE</a>, <a class="el" href="pcsclite_8h_source.html#l00202">MAX_BUFFER_SIZE_EXTENDED</a>, <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcscd_8h_source.html#l00076">PCSCLITE_MAX_MESSAGE_SIZE</a>, <a class="el" href="pcsclite_8h_source.html#l00188">PCSCLITE_MAX_READERS_CONTEXTS</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="winscard__msg_8h_source.html#l00100">SCARD_CONTROL</a>, <a class="el" href="winscard__msg_8h_source.html#l00108">SCARD_CONTROL_EXTENDED</a>, <a class="el" href="pcsclite_8h_source.html#l00078">SCARD_E_INSUFFICIENT_BUFFER</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00180">SCARD_E_UNSUPPORTED_FEATURE</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, <a class="el" href="winscard__msg_8c_source.html#l00268">SHMMessageReceive()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga4be198045c73ec0deb79e66c0ca1738a"></a><!-- doxytag: member="winscard_clnt.c::SCardDisconnect" ref="ga4be198045c73ec0deb79e66c0ca1738a" args="(SCARDHANDLE hCard, DWORD dwDisposition)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardDisconnect </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwDisposition</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function terminates a connection made through <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwDisposition</em>&nbsp;</td><td>Reader function to execute.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#acf43bd7f99fbd970f331fc36ffbe8ca5">SCARD_LEAVE_CARD</a> - Do nothing.</li>
<li><a class="el" href="pcsclite_8h.html#a07feb710d597835d1afc5cfd2ef6ecef">SCARD_RESET_CARD</a> - Reset the card (warm reset).</li>
<li><a class="el" href="pcsclite_8h.html#a6f4f7f74e35ab4269f08381c967ee97b">SCARD_UNPOWER_CARD</a> - Unpower the card (cold reset).</li>
<li><a class="el" href="pcsclite_8h.html#a6d6346c6e1a1491965bb9ebe8ed02a95">SCARD_EJECT_CARD</a> - Eject the card.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful(<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid <code>dwDisposition</code> (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
 rv = <a class="code" href="group__API.html#ga4be198045c73ec0deb79e66c0ca1738a" title="This function terminates a connection made through SCardConnect().">SCardDisconnect</a>(hCard, <a class="code" href="pcsclite_8h.html#a6f4f7f74e35ab4269f08381c967ee97b" title="Power down on close.">SCARD_UNPOWER_CARD</a>);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l01030">1030</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="readerfactory_8h_source.html#l00130">ReaderContext::dwContexts</a>, <a class="el" href="readerfactory_8h_source.html#l00127">ReaderContext::dwLockId</a>, <a class="el" href="readerfactory_8h_source.html#l00125">ReaderContext::dwSlot</a>, <a class="el" href="ifdwrapper_8c_source.html#l00318">IFDPowerICC()</a>, <a class="el" href="pcsclite_8h_source.html#l00201">MAX_BUFFER_SIZE</a>, <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcscd_8h_source.html#l00045">PCSCLITE_LOCK_POLL_RATE</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="readerfactory_8h_source.html#l00134">ReaderContext::readerState</a>, <a class="el" href="pcsclite_8h_source.html#l00158">SCARD_ABSENT</a>, <a class="el" href="winscard__msg_8h_source.html#l00096">SCARD_DISCONNECT</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00087">SCARD_E_INVALID_VALUE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00082">SCARD_E_NO_SMARTCARD</a>, <a class="el" href="pcsclite_8h_source.html#l00155">SCARD_EJECT_CARD</a>, <a class="el" href="winscard_8c_source.html#l00189">SCARD_EXCLUSIVE_CONTEXT</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00152">SCARD_LEAVE_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00162">SCARD_NEGOTIABLE</a>, <a class="el" href="winscard_8c_source.html#l00187">SCARD_NO_CONTEXT</a>, <a class="el" href="pcsclite_8h_source.html#l00161">SCARD_POWERED</a>, <a class="el" href="pcsclite_8h_source.html#l00159">SCARD_PRESENT</a>, <a class="el" href="pcsclite_8h_source.html#l00139">SCARD_PROTOCOL_UNDEFINED</a>, <a class="el" href="pcscd_8h_source.html#l00020">SCARD_RESET</a>, <a class="el" href="pcsclite_8h_source.html#l00153">SCARD_RESET_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="pcsclite_8h_source.html#l00163">SCARD_SPECIFIC</a>, <a class="el" href="pcsclite_8h_source.html#l00160">SCARD_SWALLOWED</a>, <a class="el" href="pcsclite_8h_source.html#l00157">SCARD_UNKNOWN</a>, <a class="el" href="pcsclite_8h_source.html#l00154">SCARD_UNPOWER_CARD</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, <a class="el" href="utils_8c_source.html#l00087">StatSynchronize()</a>, <a class="el" href="sys__unix_8c_source.html#l00099">SYS_USleep()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gae8742473b404363e5c587f570d7e2f3b"></a><!-- doxytag: member="winscard_clnt.c::SCardEndTransaction" ref="gae8742473b404363e5c587f570d7e2f3b" args="(SCARDHANDLE hCard, DWORD dwDisposition)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardEndTransaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwDisposition</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function ends a previously begun transaction. </p>
<p>The calling application must be the owner of the previously begun transaction or an error will occur.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwDisposition</em>&nbsp;</td><td>Action to be taken on the reader. The disposition action is not currently used in this release.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#acf43bd7f99fbd970f331fc36ffbe8ca5">SCARD_LEAVE_CARD</a> - Do nothing.</li>
<li><a class="el" href="pcsclite_8h.html#a07feb710d597835d1afc5cfd2ef6ecef">SCARD_RESET_CARD</a> - Reset the card.</li>
<li><a class="el" href="pcsclite_8h.html#a6f4f7f74e35ab4269f08381c967ee97b">SCARD_UNPOWER_CARD</a> - Unpower the card.</li>
<li><a class="el" href="pcsclite_8h.html#a6d6346c6e1a1491965bb9ebe8ed02a95">SCARD_EJECT_CARD</a> - Eject the card.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid value for <code>dwDisposition</code> (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_SHARING_VIOLATION</em>&nbsp;</td><td>Someone else has exclusive rights (<a class="el" href="pcsclite_8h.html#a81cd3fc9e7e84c66be2471294152235f">SCARD_E_SHARING_VIOLATION</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
 rv = <a class="code" href="group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861" title="This function establishes a temporary exclusive access mode for doing a serie of...">SCardBeginTransaction</a>(hCard);
 ...
 / * Do some transmit commands * /
 ...
 rv = <a class="code" href="group__API.html#gae8742473b404363e5c587f570d7e2f3b" title="This function ends a previously begun transaction.">SCardEndTransaction</a>(hCard, <a class="code" href="pcsclite_8h.html#acf43bd7f99fbd970f331fc36ffbe8ca5" title="Do nothing on close.">SCARD_LEAVE_CARD</a>);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l01266">1266</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="readerfactory_8h_source.html#l00125">ReaderContext::dwSlot</a>, <a class="el" href="ifdwrapper_8c_source.html#l00318">IFDPowerICC()</a>, <a class="el" href="pcsclite_8h_source.html#l00201">MAX_BUFFER_SIZE</a>, <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcsclite_8h_source.html#l00188">PCSCLITE_MAX_READERS_CONTEXTS</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="readerfactory_8h_source.html#l00134">ReaderContext::readerState</a>, <a class="el" href="pcsclite_8h_source.html#l00158">SCARD_ABSENT</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00087">SCARD_E_INVALID_VALUE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00155">SCARD_EJECT_CARD</a>, <a class="el" href="winscard__msg_8h_source.html#l00098">SCARD_END_TRANSACTION</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00152">SCARD_LEAVE_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00162">SCARD_NEGOTIABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00161">SCARD_POWERED</a>, <a class="el" href="pcsclite_8h_source.html#l00159">SCARD_PRESENT</a>, <a class="el" href="pcsclite_8h_source.html#l00139">SCARD_PROTOCOL_UNDEFINED</a>, <a class="el" href="pcscd_8h_source.html#l00020">SCARD_RESET</a>, <a class="el" href="pcsclite_8h_source.html#l00153">SCARD_RESET_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="pcsclite_8h_source.html#l00163">SCARD_SPECIFIC</a>, <a class="el" href="pcsclite_8h_source.html#l00160">SCARD_SWALLOWED</a>, <a class="el" href="pcsclite_8h_source.html#l00157">SCARD_UNKNOWN</a>, <a class="el" href="pcsclite_8h_source.html#l00154">SCARD_UNPOWER_CARD</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, <a class="el" href="sys__unix_8c_source.html#l00099">SYS_USleep()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gaa1b8970169fd4883a6dc4a8f43f19b67"></a><!-- doxytag: member="winscard_clnt.c::SCardEstablishContext" ref="gaa1b8970169fd4883a6dc4a8f43f19b67" args="(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardEstablishContext </td>
          <td>(</td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwScope</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCVOID&nbsp;</td>
          <td class="paramname"> <em>pvReserved1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCVOID&nbsp;</td>
          <td class="paramname"> <em>pvReserved2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPSCARDCONTEXT&nbsp;</td>
          <td class="paramname"> <em>phContext</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates an Application Context to the PC/SC Resource Manager. </p>
<p>Creates an Application Context for a client.</p>
<p>This must be the first WinSCard function called in a PC/SC application. Each thread of an application shall use its own SCARDCONTEXT.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwScope</em>&nbsp;</td><td>Scope of the establishment. This can either be a local or remote connection.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#a4476ec1c5ae384961f0f059fa28fb1dc">SCARD_SCOPE_USER</a> - Not used.</li>
<li><a class="el" href="pcsclite_8h.html#a82f7392ae7f5e6702940d7fc64854dc2">SCARD_SCOPE_TERMINAL</a> - Not used.</li>
<li><a class="el" href="pcscd_8h.html#a44e87b3c0cca8a029dd654f0432f34e8">SCARD_SCOPE_GLOBAL</a> - Not used.</li>
<li><a class="el" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309">SCARD_SCOPE_SYSTEM</a> - Services on the local machine. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>pvReserved1</em>&nbsp;</td><td>Reserved for future use. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>pvReserved2</em>&nbsp;</td><td>Reserved for future use. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>phContext</em>&nbsp;</td><td>Returned Application Context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Connection status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_PARAMETER</em>&nbsp;</td><td><code>phContext</code> is null (<a class="el" href="pcsclite_8h.html#a47a6da10ec4ea2cbebfcc4b2a93d786f">SCARD_E_INVALID_PARAMETER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid scope type passed (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a> ) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_MEMORY</em>&nbsp;</td><td>There is no free slot to store <code>hContext</code> (<a class="el" href="pcsclite_8h.html#a81694393a1494d5091145734a2f0b36c">SCARD_E_NO_MEMORY</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_INTERNAL_ERROR</em>&nbsp;</td><td>An internal consistency check failed (<a class="el" href="pcsclite_8h.html#a081a564acaf166f74592906f7dff2d86">SCARD_F_INTERNAL_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l00305">305</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__clnt_8c_source.html#l00357">SCardEstablishContextTH()</a>, <a class="el" href="winscard__clnt_8c_source.html#l00254">SCardLockThread()</a>, and <a class="el" href="winscard__clnt_8c_source.html#l00264">SCardUnlockThread()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga0522241e3180cb05dfd166e28930e961"></a><!-- doxytag: member="winscard_clnt.c::SCardFreeMemory" ref="ga0522241e3180cb05dfd166e28930e961" args="(SCARDCONTEXT hContext, LPCVOID pvMem)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardFreeMemory </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCVOID&nbsp;</td>
          <td class="paramname"> <em>pvMem</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Releases memory that has been returned from the resource manager using the <a class="el" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0">SCARD_AUTOALLOCATE</a> length designator. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>pvMem</em>&nbsp;</td><td>pointer to allocated memory</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l03321">3321</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, and <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gaacfec51917255b7a25b94c5104961602"></a><!-- doxytag: member="winscard_clnt.c::SCardGetAttrib" ref="gaacfec51917255b7a25b94c5104961602" args="(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardGetAttrib </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwAttrId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPBYTE&nbsp;</td>
          <td class="paramname"> <em>pbAttr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pcbAttrLen</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function get an attribute from the IFD Handler (reader driver). </p>
<p>The list of possible attributes is available in the file <code><a class="el" href="reader_8h.html" title="This keeps a list of defines shared between the driver and the application.">reader.h</a></code>.</p>
<p>If <code>*pcbAttrLen</code> is equal to <a class="el" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0">SCARD_AUTOALLOCATE</a> then the function will allocate itself the needed memory. Use <a class="el" href="group__API.html#ga0522241e3180cb05dfd166e28930e961" title="Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE...">SCardFreeMemory()</a> to release it.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwAttrId</em>&nbsp;</td><td>Identifier for the attribute to get.</p>
<ul>
<li><a class="el" href="reader_8h.html#a2e87e6925548b9fcca3fa0026b82500d">SCARD_ATTR_ASYNC_PROTOCOL_TYPES</a></li>
<li><a class="el" href="reader_8h.html#ae450bada1fa917057610dd0446983784">SCARD_ATTR_ATR_STRING</a></li>
<li><a class="el" href="reader_8h.html#a8c38e24b650a967fbd052bb2a376c492">SCARD_ATTR_CHANNEL_ID</a></li>
<li><a class="el" href="reader_8h.html#a1ae75dff994bb9cede8b48f3c122b048">SCARD_ATTR_CHARACTERISTICS</a></li>
<li><a class="el" href="reader_8h.html#a0684ca7b1180d2f3ed44297005c7f9d4">SCARD_ATTR_CURRENT_BWT</a></li>
<li><a class="el" href="reader_8h.html#a447488ba15bce3e75f62f2c65b052030">SCARD_ATTR_CURRENT_CLK</a></li>
<li><a class="el" href="reader_8h.html#af83058f4dcd2051b74c2e3fc6e02781c">SCARD_ATTR_CURRENT_CWT</a></li>
<li><a class="el" href="reader_8h.html#a7940c3ad5296495fad9aa5e04f58c83b">SCARD_ATTR_CURRENT_D</a></li>
<li><a class="el" href="reader_8h.html#ae6d0cc32ff645d19e9180244c4ef3c81">SCARD_ATTR_CURRENT_EBC_ENCODING</a></li>
<li><a class="el" href="reader_8h.html#aab6a1f84654ddb09d47feab98d2be554">SCARD_ATTR_CURRENT_F</a></li>
<li><a class="el" href="reader_8h.html#afc64b5592340e1cce3479b54dd7560e9">SCARD_ATTR_CURRENT_IFSC</a></li>
<li><a class="el" href="reader_8h.html#a1ec6dd8c482a91b0d0bd9e52e5a383f8">SCARD_ATTR_CURRENT_IFSD</a></li>
<li><a class="el" href="reader_8h.html#a9c6ee3dccc23e924907e3dc2e29a50f6">SCARD_ATTR_CURRENT_IO_STATE</a></li>
<li><a class="el" href="reader_8h.html#aedeec28fe350408eccf5b8c98328aaf8">SCARD_ATTR_CURRENT_N</a></li>
<li><a class="el" href="reader_8h.html#a76c1d362b156a01b284e8169eaabd4fd">SCARD_ATTR_CURRENT_PROTOCOL_TYPE</a></li>
<li><a class="el" href="reader_8h.html#ad50deb32988b5a8168d7a63ebcf463a6">SCARD_ATTR_CURRENT_W</a></li>
<li><a class="el" href="reader_8h.html#afb122c686777ecf51f106bcc88836270">SCARD_ATTR_DEFAULT_CLK</a></li>
<li><a class="el" href="reader_8h.html#aa4e83e4f0024961638da8c8608c1c50e">SCARD_ATTR_DEFAULT_DATA_RATE</a></li>
<li><a class="el" href="reader_8h.html#a362e5f163fda06e0aa6d2964d2a4bbae">SCARD_ATTR_DEVICE_FRIENDLY_NAME</a></li>
<li><a class="el" href="reader_8h.html#a9ab15f1b788a302737415a13e1546eae">SCARD_ATTR_DEVICE_IN_USE</a></li>
<li><a class="el" href="reader_8h.html#abd1302e7451b1f101898b9bf7d079a6c">SCARD_ATTR_DEVICE_SYSTEM_NAME</a></li>
<li><a class="el" href="reader_8h.html#a529910b9e28448ee881a55125fc9916f">SCARD_ATTR_DEVICE_UNIT</a></li>
<li><a class="el" href="reader_8h.html#a1a1d31628ec9f49f79d2dda6651658d6">SCARD_ATTR_ESC_AUTHREQUEST</a></li>
<li><a class="el" href="reader_8h.html#a69d8dd84f5f433efbfa6e0fce2a95528">SCARD_ATTR_ESC_CANCEL</a></li>
<li><a class="el" href="reader_8h.html#a55df7896fb65a2a942780d383d815071">SCARD_ATTR_ESC_RESET</a></li>
<li><a class="el" href="reader_8h.html#a5fcd5c979018130c164a64c728f0716d">SCARD_ATTR_EXTENDED_BWT</a></li>
<li><a class="el" href="reader_8h.html#a222400e1955f63c956437e786197dd27">SCARD_ATTR_ICC_INTERFACE_STATUS</a></li>
<li><a class="el" href="reader_8h.html#ae9f8bb5f689263c35c0888bb37f2ca69">SCARD_ATTR_ICC_PRESENCE</a></li>
<li><a class="el" href="reader_8h.html#a2563696a9f7abd40684b46db714bfc8b">SCARD_ATTR_ICC_TYPE_PER_ATR</a></li>
<li><a class="el" href="reader_8h.html#a0a30cd55c56ceeb3f97d8c0c91e68d77">SCARD_ATTR_MAX_CLK</a></li>
<li><a class="el" href="reader_8h.html#a67cd46e2a022ae72ce6dde4b04c950ff">SCARD_ATTR_MAX_DATA_RATE</a></li>
<li><a class="el" href="reader_8h.html#a338aa843f02a567ea406b0c5bd488620">SCARD_ATTR_MAX_IFSD</a></li>
<li><a class="el" href="reader_8h.html#a42ea634deb1ec51e10722b661aa73d01">SCARD_ATTR_MAXINPUT</a></li>
<li><a class="el" href="reader_8h.html#a33c927bbe78a8eab44869c04783ea0d2">SCARD_ATTR_POWER_MGMT_SUPPORT</a></li>
<li><a class="el" href="reader_8h.html#a62d09db2a45663ea726239aeafaac747">SCARD_ATTR_SUPRESS_T1_IFS_REQUEST</a></li>
<li><a class="el" href="reader_8h.html#a2be4573e3c86834b1b35abf66d0053ad">SCARD_ATTR_SYNC_PROTOCOL_TYPES</a></li>
<li><a class="el" href="reader_8h.html#a86eb3bba6a8a463aa0eac4ada7704785">SCARD_ATTR_USER_AUTH_INPUT_DEVICE</a></li>
<li><a class="el" href="reader_8h.html#a60bf2dbb950d448099314aa86c14b2aa">SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE</a></li>
<li><a class="el" href="reader_8h.html#ae1143cec3f4ee0f37dee6cdaf8942e8b">SCARD_ATTR_VENDOR_IFD_SERIAL_NO</a></li>
<li><a class="el" href="reader_8h.html#a5667d6bcd2fb4b0aa5ea43f85a579518">SCARD_ATTR_VENDOR_IFD_TYPE</a></li>
<li><a class="el" href="reader_8h.html#a21105eef90f69895754548688e4b0721">SCARD_ATTR_VENDOR_IFD_VERSION</a></li>
<li><a class="el" href="reader_8h.html#a8c0b0539cf006d7bfef49db7136cda95">SCARD_ATTR_VENDOR_NAME</a></li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<p>Not all the <code>dwAttrId</code> values listed above may be implemented in the IFD Handler you are using. And some <code>dwAttrId</code> values not listed here may be implemented.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pbAttr</em>&nbsp;</td><td>Pointer to a buffer that receives the attribute. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pcbAttrLen</em>&nbsp;</td><td>[inout] Length of the <code>pbAttr</code> buffer in bytes.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INSUFFICIENT_BUFFER</em>&nbsp;</td><td>Reader buffer not large enough (<a class="el" href="pcsclite_8h.html#aac3f8d945f8a0e667e0926daaa18dc57">SCARD_E_INSUFFICIENT_BUFFER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NOT_TRANSACTED</em>&nbsp;</td><td>Data exchange not successful (<a class="el" href="pcsclite_8h.html#ab02a33c2ef61f12a851dfe85c575d7cc">SCARD_E_NOT_TRANSACTED</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> LONG rv;
 <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> pbAtr[<a class="code" href="pcsclite_8h.html#a7ac7915ff6f9baefa66886c98bdbb91e" title="Maximum ATR size.">MAX_ATR_SIZE</a>];
 DWORD dwAtrLen;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#ab58a85ece18f4217fe5372981231d195" title="Raw active protocol.">SCARD_PROTOCOL_RAW</a>, &amp;hCard, &amp;dwActiveProtocol);
 dwAtrLen = <span class="keyword">sizeof</span>(pbAtr);
 rv = <a class="code" href="group__API.html#gaacfec51917255b7a25b94c5104961602" title="This function get an attribute from the IFD Handler (reader driver).">SCardGetAttrib</a>(hCard, <a class="code" href="reader_8h.html#ae450bada1fa917057610dd0446983784" title="Answer to reset (ATR) string.">SCARD_ATTR_ATR_STRING</a>, pbAtr, &amp;dwAtrLen);
</pre></div><div class="fragment"><pre class="fragment"> LONG rv;
 <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *pbAttr;
 DWORD dwAttrLen;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#ab58a85ece18f4217fe5372981231d195" title="Raw active protocol.">SCARD_PROTOCOL_RAW</a>, &amp;hCard, &amp;dwActiveProtocol);
 dwAttrLen = <a class="code" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0" title="see SCardFreeMemory()">SCARD_AUTOALLOCATE</a>;
 rv = <a class="code" href="group__API.html#gaacfec51917255b7a25b94c5104961602" title="This function get an attribute from the IFD Handler (reader driver).">SCardGetAttrib</a>(hCard, <a class="code" href="reader_8h.html#ae450bada1fa917057610dd0446983784" title="Answer to reset (ATR) string.">SCARD_ATTR_ATR_STRING</a>, (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *)&amp;pbAttr, &amp;dwAttrLen);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l02658">2658</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="ifdwrapper_8c_source.html#l00275">IFDGetCapabilities()</a>, <a class="el" href="pcsclite_8h_source.html#l00201">MAX_BUFFER_SIZE</a>, <a class="el" href="pcsclite_8h_source.html#l00134">SCARD_AUTOALLOCATE</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00076">SCARD_E_NO_MEMORY</a>, <a class="el" href="pcsclite_8h_source.html#l00092">SCARD_E_NOT_TRANSACTED</a>, <a class="el" href="pcsclite_8h_source.html#l00180">SCARD_E_UNSUPPORTED_FEATURE</a>, <a class="el" href="winscard__msg_8h_source.html#l00105">SCARD_GET_ATTRIB</a>, and <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gad1db67ba2b7d143498257294b873c049"></a><!-- doxytag: member="winscard_clnt.c::SCardGetStatusChange" ref="gad1db67ba2b7d143498257294b873c049" args="(SCARDCONTEXT hContext, DWORD dwTimeout, LPSCARD_READERSTATE_A rgReaderStates, DWORD cReaders)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardGetStatusChange </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwTimeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structSCARD__READERSTATE__A.html">LPSCARD_READERSTATE_A</a>&nbsp;</td>
          <td class="paramname"> <em>rgReaderStates</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>cReaders</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function receives a structure or list of structures containing reader names. </p>
<p>It then blocks for a change in state to occur on any of the OR'd values contained in <code>dwCurrentState</code> for a maximum blocking time of <code>dwTimeout</code> or forever if INFINITE is used.</p>
<p>The new event state will be contained in <code>dwEventState</code>. A status change might be a card insertion or removal event, a change in ATR, etc.</p>
<p>To wait for a reader event (reader added or removed) you may use the special reader name <code>"\\?PnP?\Notification"</code>. If a reader event occurs the state of this reader will change and the bit <a class="el" href="pcsclite_8h.html#abd53085c631a1bade0fb5e974de90d48">SCARD_STATE_CHANGED</a> will be set.</p>
<div class="fragment"><pre class="fragment"> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
   LPCSTR szReader;          <span class="comment">// Reader name</span>
   LPVOID pvUserData;         <span class="comment">// User defined data</span>
   DWORD dwCurrentState;      <span class="comment">// Current state of reader</span>
   DWORD dwEventState;        <span class="comment">// Reader state after a state change</span>
   DWORD cbAtr;               <span class="comment">// ATR Length, usually MAX_ATR_SIZE</span>
   BYTE rgbAtr[<a class="code" href="pcsclite_8h.html#a7ac7915ff6f9baefa66886c98bdbb91e" title="Maximum ATR size.">MAX_ATR_SIZE</a>]; <span class="comment">// ATR Value</span>
 } <a class="code" href="structSCARD__READERSTATE__A.html">SCARD_READERSTATE</a>;
 ...
 <span class="keyword">typedef</span> <a class="code" href="structSCARD__READERSTATE__A.html">SCARD_READERSTATE</a> *PSCARD_READERSTATE, **LPSCARD_READERSTATE;
 ...
</pre></div><p>Value of <code>dwCurrentState</code> and <code>dwEventState:</code> </p>
<ul>
<li><a class="el" href="pcsclite_8h.html#ae73c6e4ff31781d4358b93bbde952cfe">SCARD_STATE_UNAWARE</a> The application is unaware of the current state, and would like to know. The use of this value results in an immediate return from state transition monitoring services. This is represented by all bits set to zero.</li>
<li><a class="el" href="pcsclite_8h.html#a0bfdd63120b09223fd4fed4884cbfeec">SCARD_STATE_IGNORE</a> This reader should be ignored</li>
<li><a class="el" href="pcsclite_8h.html#abd53085c631a1bade0fb5e974de90d48">SCARD_STATE_CHANGED</a> There is a difference between the state believed by the application, and the state known by the resource manager. When this bit is set, the application may assume a significant state change has occurred on this reader.</li>
<li><a class="el" href="pcsclite_8h.html#a96ab0fac1bb56525c5f216428e7dd8e7">SCARD_STATE_UNKNOWN</a> The given reader name is not recognized by the resource manager. If this bit is set, then <a class="el" href="pcsclite_8h.html#abd53085c631a1bade0fb5e974de90d48">SCARD_STATE_CHANGED</a> and <a class="el" href="pcsclite_8h.html#a0bfdd63120b09223fd4fed4884cbfeec">SCARD_STATE_IGNORE</a> will also be set</li>
<li><a class="el" href="pcsclite_8h.html#a781e4a27c9512c19935e3addaeaa152f">SCARD_STATE_UNAVAILABLE</a> The actual state of this reader is not available. If this bit is set, then all the following bits are clear.</li>
<li><a class="el" href="pcsclite_8h.html#aadf7badda42d372c2bc56d95a7720535">SCARD_STATE_EMPTY</a> There is no card in the reader. If this bit is set, all the following bits will be clear</li>
<li><a class="el" href="pcsclite_8h.html#a78d2639a9716b6b27f4d516e43470f8f">SCARD_STATE_PRESENT</a> There is a card in the reader</li>
<li><a class="el" href="pcsclite_8h.html#ab294bb6ccdc6bb035473a3f01697ed12">SCARD_STATE_ATRMATCH</a> There is a card in the reader with an ATR matching one of the target cards. If this bit is set, <a class="el" href="pcsclite_8h.html#a78d2639a9716b6b27f4d516e43470f8f">SCARD_STATE_PRESENT</a> will also be set. This bit is only returned on the SCardLocateCards() function.</li>
<li><a class="el" href="pcsclite_8h.html#ae371f8ad287d26aceb591537189f962a">SCARD_STATE_EXCLUSIVE</a> The card in the reader is allocated for exclusive use by another application. If this bit is set, <a class="el" href="pcsclite_8h.html#a78d2639a9716b6b27f4d516e43470f8f">SCARD_STATE_PRESENT</a> will also be set.</li>
<li><a class="el" href="pcsclite_8h.html#a56b01a133df54d0ca651b1541a7f11d5">SCARD_STATE_INUSE</a> The card in the reader is in use by one or more other applications, but may be connected to in shared mode. If this bit is set, <a class="el" href="pcsclite_8h.html#a78d2639a9716b6b27f4d516e43470f8f">SCARD_STATE_PRESENT</a> will also be set.</li>
<li><a class="el" href="pcsclite_8h.html#aba849aaf01b436d511218b18d96caf83">SCARD_STATE_MUTE</a> There is an unresponsive card in the reader.</li>
</ul>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwTimeout</em>&nbsp;</td><td>Maximum waiting time (in miliseconds) for status change, zero (or INFINITE) for infinite. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rgReaderStates</em>&nbsp;</td><td>[inout] Structures of readers with current states. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>cReaders</em>&nbsp;</td><td>Number of structures.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>Server is not running (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_PARAMETER</em>&nbsp;</td><td><code>rgReaderStates</code> is NULL and <code>cReaders</code> &gt; 0 (<a class="el" href="pcsclite_8h.html#a47a6da10ec4ea2cbebfcc4b2a93d786f">SCARD_E_INVALID_PARAMETER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid States, reader name, etc (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid hContext handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader is unavailable (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_TIMEOUT</em>&nbsp;</td><td>The user-specified timeout value has expired (<a class="el" href="pcsclite_8h.html#aa01265b3f55d4f18cdeb4f9cd736b508">SCARD_E_TIMEOUT</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="structSCARD__READERSTATE__A.html">SCARD_READERSTATE_A</a> rgReaderStates[2];
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 ...
 rgReaderStates[0].szReader = <span class="stringliteral">&quot;Reader X&quot;</span>;
 rgReaderStates[0].dwCurrentState = <a class="code" href="pcsclite_8h.html#ae73c6e4ff31781d4358b93bbde952cfe" title="App wants status.">SCARD_STATE_UNAWARE</a>;

 rgReaderStates[1].szReader = <span class="stringliteral">&quot;\\\\?PnP?\\Notification&quot;</span>;
 rgReaderStates[1].dwCurrentState = <a class="code" href="pcsclite_8h.html#ae73c6e4ff31781d4358b93bbde952cfe" title="App wants status.">SCARD_STATE_UNAWARE</a>;
 ...
 rv = <a class="code" href="group__API.html#gad1db67ba2b7d143498257294b873c049" title="This function receives a structure or list of structures containing reader names...">SCardGetStatusChange</a>(hContext, INFINITE, rgReaderStates, 2);
 printf(<span class="stringliteral">&quot;reader state: 0x%04X\n&quot;</span>, rgReaderStates[0].dwEventState);
 printf(<span class="stringliteral">&quot;reader state: 0x%04X\n&quot;</span>, rgReaderStates[1].dwEventState);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l01872">1872</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcscd_8h_source.html#l00025">BLOCK_STATUS_BLOCKING</a>, <a class="el" href="pcscd_8h_source.html#l00024">BLOCK_STATUS_RESUME</a>, <a class="el" href="pcsclite_8h_source.html#l00188">PCSCLITE_MAX_READERS_CONTEXTS</a>, <a class="el" href="pcscd_8h_source.html#l00044">PCSCLITE_STATUS_POLL_RATE</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="pcsclite_8h_source.html#l00158">SCARD_ABSENT</a>, <a class="el" href="pcsclite_8h_source.html#l00072">SCARD_E_CANCELLED</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00087">SCARD_E_INVALID_VALUE</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00080">SCARD_E_TIMEOUT</a>, <a class="el" href="pcsclite_8h_source.html#l00159">SCARD_PRESENT</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="pcsclite_8h_source.html#l00172">SCARD_STATE_ATRMATCH</a>, <a class="el" href="pcsclite_8h_source.html#l00167">SCARD_STATE_CHANGED</a>, <a class="el" href="pcsclite_8h_source.html#l00170">SCARD_STATE_EMPTY</a>, <a class="el" href="pcsclite_8h_source.html#l00173">SCARD_STATE_EXCLUSIVE</a>, <a class="el" href="pcsclite_8h_source.html#l00166">SCARD_STATE_IGNORE</a>, <a class="el" href="pcsclite_8h_source.html#l00174">SCARD_STATE_INUSE</a>, <a class="el" href="pcsclite_8h_source.html#l00175">SCARD_STATE_MUTE</a>, <a class="el" href="pcsclite_8h_source.html#l00171">SCARD_STATE_PRESENT</a>, <a class="el" href="pcsclite_8h_source.html#l00169">SCARD_STATE_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00165">SCARD_STATE_UNAWARE</a>, <a class="el" href="pcsclite_8h_source.html#l00168">SCARD_STATE_UNKNOWN</a>, <a class="el" href="pcsclite_8h_source.html#l00160">SCARD_SWALLOWED</a>, <a class="el" href="pcsclite_8h_source.html#l00157">SCARD_UNKNOWN</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>, and <a class="el" href="sys__unix_8c_source.html#l00099">SYS_USleep()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga722eb66bcc44d391f700ff9065cc080b"></a><!-- doxytag: member="winscard_clnt.c::SCardIsValidContext" ref="ga722eb66bcc44d391f700ff9065cc080b" args="(SCARDCONTEXT hContext)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardIsValidContext </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Check if a <a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a> is valid. </p>
<p>Call this function to determine whether a smart card context handle is still valid. After a smart card context handle has been set by <a class="el" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext()</a>, it may become not valid if the resource manager service has been shut down.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid Handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga722eb66bcc44d391f700ff9065cc080b" title="Check if a SCARDCONTEXT is valid.">SCardIsValidContext</a>(hContext);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l03543">3543</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, and <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga9d970d086d5218e080d0079d63f9d496"></a><!-- doxytag: member="winscard_clnt.c::SCardListReaderGroups" ref="ga9d970d086d5218e080d0079d63f9d496" args="(SCARDCONTEXT hContext, LPSTR mszGroups, LPDWORD pcchGroups)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardListReaderGroups </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPSTR&nbsp;</td>
          <td class="paramname"> <em>mszGroups</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pcchGroups</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function returns a list of currently available reader groups on the system. </p>
<p><code>mszGroups</code> is a pointer to a character string that is allocated by the application. If the application sends <code>mszGroups</code> as NULL then this function will return the size of the buffer needed to allocate in <code>pcchGroups</code>.</p>
<p>The group names is a multi-string and separated by a nul character (<code>'\0'</code>) and ended by a double nul character like <code>"SCard$DefaultReaders\\0Group 2\\0\\0"</code>.</p>
<p>If <code>*pcchGroups</code> is equal to <a class="el" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0">SCARD_AUTOALLOCATE</a> then the function will allocate itself the needed memory. Use <a class="el" href="group__API.html#ga0522241e3180cb05dfd166e28930e961" title="Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE...">SCardFreeMemory()</a> to release it.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>mszGroups</em>&nbsp;</td><td>List of groups to list readers. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pcchGroups</em>&nbsp;</td><td>[inout] Size of multi-string buffer including NUL's.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INSUFFICIENT_BUFFER</em>&nbsp;</td><td>Reader buffer not large enough (<a class="el" href="pcsclite_8h.html#aac3f8d945f8a0e667e0926daaa18dc57">SCARD_E_INSUFFICIENT_BUFFER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid Scope Handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LPSTR mszGroups;
 DWORD dwGroups;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga9d970d086d5218e080d0079d63f9d496" title="This function returns a list of currently available reader groups on the system.">SCardListReaderGroups</a>(hContext, NULL, &amp;dwGroups);
 mszGroups = malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>)*dwGroups);
 rv = <a class="code" href="group__API.html#ga9d970d086d5218e080d0079d63f9d496" title="This function returns a list of currently available reader groups on the system.">SCardListReaderGroups</a>(hContext, mszGroups, &amp;dwGroups);
</pre></div><div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LPSTR mszGroups;
 DWORD dwGroups;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 dwGroups = <a class="code" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0" title="see SCardFreeMemory()">SCARD_AUTOALLOCATE</a>;
 rv = <a class="code" href="group__API.html#ga9d970d086d5218e080d0079d63f9d496" title="This function returns a list of currently available reader groups on the system.">SCardListReaderGroups</a>(hContext, (LPSTR)&amp;mszGroups, &amp;dwGroups);
 rv = <a class="code" href="group__API.html#ga0522241e3180cb05dfd166e28930e961" title="Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE...">SCardFreeMemory</a>(hContext, mszGroups);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l03395">3395</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="pcsclite_8h_source.html#l00134">SCARD_AUTOALLOCATE</a>, <a class="el" href="pcsclite_8h_source.html#l00078">SCARD_E_INSUFFICIENT_BUFFER</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00076">SCARD_E_NO_MEMORY</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, and <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga93b07815789b3cf2629d439ecf20f0d9"></a><!-- doxytag: member="winscard_clnt.c::SCardListReaders" ref="ga93b07815789b3cf2629d439ecf20f0d9" args="(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardListReaders </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCSTR&nbsp;</td>
          <td class="paramname"> <em>mszGroups</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPSTR&nbsp;</td>
          <td class="paramname"> <em>mszReaders</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pcchReaders</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function returns a list of currently available readers on the system. </p>
<p><code>mszReaders</code> is a pointer to a character string that is allocated by the application. If the application sends <code>mszGroups</code> and <code>mszReaders</code> as NULL then this function will return the size of the buffer needed to allocate in <code>pcchReaders</code>.</p>
<p>If <code>*pcchReaders</code> is equal to <a class="el" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0">SCARD_AUTOALLOCATE</a> then the function will allocate itself the needed memory. Use <a class="el" href="group__API.html#ga0522241e3180cb05dfd166e28930e961" title="Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE...">SCardFreeMemory()</a> to release it.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mszGroups</em>&nbsp;</td><td>List of groups to list readers (not used). </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>mszReaders</em>&nbsp;</td><td>Multi-string with list of readers. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pcchReaders</em>&nbsp;</td><td>[inout] Size of multi-string buffer including NULL's.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Connection status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid Scope Handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_PARAMETER</em>&nbsp;</td><td><code>pcchReaders</code> is NULL (<a class="el" href="pcsclite_8h.html#a47a6da10ec4ea2cbebfcc4b2a93d786f">SCARD_E_INVALID_PARAMETER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INSUFFICIENT_BUFFER</em>&nbsp;</td><td>Reader buffer not large enough (<a class="el" href="pcsclite_8h.html#aac3f8d945f8a0e667e0926daaa18dc57">SCARD_E_INSUFFICIENT_BUFFER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LPSTR mszReaders;
 DWORD dwReaders;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga93b07815789b3cf2629d439ecf20f0d9" title="This function returns a list of currently available readers on the system.">SCardListReaders</a>(hContext, NULL, NULL, &amp;dwReaders);
 mszReaders = malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>)*dwReaders);
 rv = <a class="code" href="group__API.html#ga93b07815789b3cf2629d439ecf20f0d9" title="This function returns a list of currently available readers on the system.">SCardListReaders</a>(hContext, NULL, mszReaders, &amp;dwReaders);
</pre></div><div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LPSTR mszReaders;
 DWORD dwReaders;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 dwReaders = <a class="code" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0" title="see SCardFreeMemory()">SCARD_AUTOALLOCATE</a>
 rv = <a class="code" href="group__API.html#ga93b07815789b3cf2629d439ecf20f0d9" title="This function returns a list of currently available readers on the system.">SCardListReaders</a>(hContext, NULL, (LPSTR)&amp;mszReaders, &amp;dwReaders);
 rv = <a class="code" href="group__API.html#ga0522241e3180cb05dfd166e28930e961" title="Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE...">SCardFreeMemory</a>(hContext, mszReaders);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l03202">3202</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="pcsclite_8h_source.html#l00134">SCARD_AUTOALLOCATE</a>, <a class="el" href="pcsclite_8h_source.html#l00078">SCARD_E_INSUFFICIENT_BUFFER</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00076">SCARD_E_NO_MEMORY</a>, <a class="el" href="pcsclite_8h_source.html#l00116">SCARD_E_NO_READERS_AVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, and <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gad5d4393ca8c470112ad9468c44ed8940"></a><!-- doxytag: member="winscard_clnt.c::SCardReconnect" ref="gad5d4393ca8c470112ad9468c44ed8940" args="(SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardReconnect </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwShareMode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwPreferredProtocols</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwInitialization</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pdwActiveProtocol</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function reestablishes a connection to a reader that was previously connected to using <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </p>
<p>In a multi application environment it is possible for an application to reset the card in shared mode. When this occurs any other application trying to access certain commands will be returned the value <a class="el" href="pcsclite_8h.html#a20fbb8319646f26c4ad7f237d1a64f0c">SCARD_W_RESET_CARD</a>. When this occurs <a class="el" href="group__API.html#gad5d4393ca8c470112ad9468c44ed8940" title="This function reestablishes a connection to a reader that was previously connected...">SCardReconnect()</a> must be called in order to acknowledge that the card was reset and allow it to change it's state accordingly.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Handle to a previous call to connect. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwShareMode</em>&nbsp;</td><td>Mode of connection type: exclusive/shared.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f">SCARD_SHARE_SHARED</a> - This application will allow others to share the reader.</li>
<li><a class="el" href="pcsclite_8h.html#aedc5ddb6c12dd0e9f522d4c669ca9135">SCARD_SHARE_EXCLUSIVE</a> - This application will NOT allow others to share the reader. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwPreferredProtocols</em>&nbsp;</td><td>Desired protocol use.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c">SCARD_PROTOCOL_T0</a> - Use the T=0 protocol.</li>
<li><a class="el" href="pcsclite_8h.html#a3c09cd155e07044f857130c183d64f03">SCARD_PROTOCOL_T1</a> - Use the T=1 protocol.</li>
<li><a class="el" href="pcsclite_8h.html#ab58a85ece18f4217fe5372981231d195">SCARD_PROTOCOL_RAW</a> - Use with memory type cards. <code>dwPreferredProtocols</code> is a bit mask of acceptable protocols for the connection. You can use (SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1) if you do not have a preferred protocol. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwInitialization</em>&nbsp;</td><td>Desired action taken on the card/reader.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#acf43bd7f99fbd970f331fc36ffbe8ca5">SCARD_LEAVE_CARD</a> - Do nothing.</li>
<li><a class="el" href="pcsclite_8h.html#a07feb710d597835d1afc5cfd2ef6ecef">SCARD_RESET_CARD</a> - Reset the card (warm reset).</li>
<li><a class="el" href="pcsclite_8h.html#a6f4f7f74e35ab4269f08381c967ee97b">SCARD_UNPOWER_CARD</a> - Unpower the card (cold reset).</li>
<li><a class="el" href="pcsclite_8h.html#a6d6346c6e1a1491965bb9ebe8ed02a95">SCARD_EJECT_CARD</a> - Eject the card. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pdwActiveProtocol</em>&nbsp;</td><td>Established protocol to this connection.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_PARAMETER</em>&nbsp;</td><td><code>phContext</code> is null. (<a class="el" href="pcsclite_8h.html#a47a6da10ec4ea2cbebfcc4b2a93d786f">SCARD_E_INVALID_PARAMETER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid sharing mode, requested protocol, or reader name (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NOT_READY</em>&nbsp;</td><td>Could not allocate the desired port (<a class="el" href="pcsclite_8h.html#aad8800bcf34cd97d4a4b0c3fbd3d955e">SCARD_E_NOT_READY</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_UNSUPPORTED_FEATURE</em>&nbsp;</td><td>Protocol not supported (<a class="el" href="pcsclite_8h.html#aef39984cd0dd3822088099fffd9d5f96">SCARD_E_UNSUPPORTED_FEATURE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_SHARING_VIOLATION</em>&nbsp;</td><td>Someone else has exclusive rights (<a class="el" href="pcsclite_8h.html#a81cd3fc9e7e84c66be2471294152235f">SCARD_E_SHARING_VIOLATION</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol, dwSendLength, dwRecvLength;
 LONG rv;
 BYTE pbRecvBuffer[10];
 BYTE pbSendBuffer[] = {0xC0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00};
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
 ...
 dwSendLength = <span class="keyword">sizeof</span>(pbSendBuffer);
 dwRecvLength = <span class="keyword">sizeof</span>(pbRecvBuffer);
 rv = <a class="code" href="group__API.html#gac60e9e6c93b04e61594a3a8f69ee1898" title="This function sends an APDU to the smart card contained in the reader connected to...">SCardTransmit</a>(hCard, <a class="code" href="pcsclite_8h.html#afe9c9747a9359719e1094e2754580a9a" title="protocol control information (PCI) for T=0">SCARD_PCI_T0</a>, pbSendBuffer, dwSendLength,
          &amp;pioRecvPci, pbRecvBuffer, &amp;dwRecvLength);
 / * Card has been reset by another application * /
 <span class="keywordflow">if</span> (rv == <a class="code" href="pcsclite_8h.html#a20fbb8319646f26c4ad7f237d1a64f0c" title="The smart card has been reset, so any shared state information is invalid.">SCARD_W_RESET_CARD</a>)
 {
   rv = <a class="code" href="group__API.html#gad5d4393ca8c470112ad9468c44ed8940" title="This function reestablishes a connection to a reader that was previously connected...">SCardReconnect</a>(hCard, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>, <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>,
            <a class="code" href="pcsclite_8h.html#a07feb710d597835d1afc5cfd2ef6ecef" title="Reset on close.">SCARD_RESET_CARD</a>, &amp;dwActiveProtocol);
 }
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l00906">906</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="readerfactory_8h_source.html#l00130">ReaderContext::dwContexts</a>, <a class="el" href="ifdwrapper_8c_source.html#l00318">IFDPowerICC()</a>, <a class="el" href="ifdwrapper_8c_source.html#l00412">IFDStatusICC()</a>, <a class="el" href="pcsclite_8h_source.html#l00035">MAX_ATR_SIZE</a>, <a class="el" href="readerfactory_8h_source.html#l00112">ReaderContext::mMutex</a>, <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcsclite_8h_source.html#l00188">PCSCLITE_MAX_READERS_CONTEXTS</a>, <a class="el" href="prothandler_8c_source.html#l00055">PHGetAvailableProtocols()</a>, <a class="el" href="prothandler_8c_source.html#l00035">PHGetDefaultProtocol()</a>, <a class="el" href="prothandler_8c_source.html#l00080">PHSetProtocol()</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="readerfactory_8h_source.html#l00134">ReaderContext::readerState</a>, <a class="el" href="pcsclite_8h_source.html#l00158">SCARD_ABSENT</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00087">SCARD_E_INVALID_VALUE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00082">SCARD_E_NO_SMARTCARD</a>, <a class="el" href="pcsclite_8h_source.html#l00085">SCARD_E_PROTO_MISMATCH</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00081">SCARD_E_SHARING_VIOLATION</a>, <a class="el" href="winscard_8c_source.html#l00189">SCARD_EXCLUSIVE_CONTEXT</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00071">SCARD_F_INTERNAL_ERROR</a>, <a class="el" href="winscard_8c_source.html#l00185">SCARD_LAST_CONTEXT</a>, <a class="el" href="pcsclite_8h_source.html#l00152">SCARD_LEAVE_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00162">SCARD_NEGOTIABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00161">SCARD_POWERED</a>, <a class="el" href="pcsclite_8h_source.html#l00159">SCARD_PRESENT</a>, <a class="el" href="winscard_8c_source.html#l00182">SCARD_PROTOCOL_ANY_OLD</a>, <a class="el" href="pcsclite_8h_source.html#l00143">SCARD_PROTOCOL_RAW</a>, <a class="el" href="pcsclite_8h_source.html#l00141">SCARD_PROTOCOL_T0</a>, <a class="el" href="pcsclite_8h_source.html#l00142">SCARD_PROTOCOL_T1</a>, <a class="el" href="pcsclite_8h_source.html#l00139">SCARD_PROTOCOL_UNDEFINED</a>, <a class="el" href="winscard__msg_8h_source.html#l00095">SCARD_RECONNECT</a>, <a class="el" href="pcscd_8h_source.html#l00020">SCARD_RESET</a>, <a class="el" href="pcsclite_8h_source.html#l00153">SCARD_RESET_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="pcsclite_8h_source.html#l00150">SCARD_SHARE_DIRECT</a>, <a class="el" href="pcsclite_8h_source.html#l00148">SCARD_SHARE_EXCLUSIVE</a>, <a class="el" href="pcsclite_8h_source.html#l00149">SCARD_SHARE_SHARED</a>, <a class="el" href="pcsclite_8h_source.html#l00163">SCARD_SPECIFIC</a>, <a class="el" href="pcsclite_8h_source.html#l00160">SCARD_SWALLOWED</a>, <a class="el" href="pcsclite_8h_source.html#l00157">SCARD_UNKNOWN</a>, <a class="el" href="pcsclite_8h_source.html#l00154">SCARD_UNPOWER_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00125">SCARD_W_REMOVED_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00124">SCARD_W_RESET_CARD</a>, <a class="el" href="pcsclite_8h_source.html#l00122">SCARD_W_UNRESPONSIVE_CARD</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, <a class="el" href="utils_8c_source.html#l00087">StatSynchronize()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga6aabcba7744c5c9419fdd6404f73a934"></a><!-- doxytag: member="winscard_clnt.c::SCardReleaseContext" ref="ga6aabcba7744c5c9419fdd6404f73a934" args="(SCARDCONTEXT hContext)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardReleaseContext </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function destroys a communication context to the PC/SC Resource Manager. </p>
<p>This must be the last function called in a PC/SC application.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to be closed.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Connection status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hContext</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 LONG rv;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga6aabcba7744c5c9419fdd6404f73a934" title="This function destroys a communication context to the PC/SC Resource Manager.">SCardReleaseContext</a>(hContext);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l00576">576</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcscd_8h_source.html#l00043">PCSCLITE_MCLIENT_ATTEMPTS</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="winscard__msg_8h_source.html#l00092">SCARD_RELEASE_CONTEXT</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__clnt_8c_source.html#l03617">SCardGetContextIndice()</a>, <a class="el" href="winscard__clnt_8c_source.html#l00254">SCardLockThread()</a>, <a class="el" href="winscard__clnt_8c_source.html#l03665">SCardRemoveContext()</a>, <a class="el" href="winscard__clnt_8c_source.html#l00264">SCardUnlockThread()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga060f0038a4ddfd5dd2b8fadf3c3a2e4f"></a><!-- doxytag: member="winscard_clnt.c::SCardSetAttrib" ref="ga060f0038a4ddfd5dd2b8fadf3c3a2e4f" args="(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr, DWORD cbAttrLen)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardSetAttrib </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwAttrId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCBYTE&nbsp;</td>
          <td class="paramname"> <em>pbAttr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>cbAttrLen</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function set an attribute of the IFD Handler. </p>
<p>The list of attributes you can set is dependent on the IFD Handler you are using.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwAttrId</em>&nbsp;</td><td>Identifier for the attribute to set. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>pbAttr</em>&nbsp;</td><td>Pointer to a buffer that receives the attribute. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>cbAttrLen</em>&nbsp;</td><td>Length of the <code>pbAttr</code> buffer in bytes.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NOT_TRANSACTED</em>&nbsp;</td><td>Data exchange not successful (<a class="el" href="pcsclite_8h.html#ab02a33c2ef61f12a851dfe85c575d7cc">SCARD_E_NOT_TRANSACTED</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> LONG rv;
 <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> pbAttr[] = { 0x12, 0x34, 0x56 };
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#ab58a85ece18f4217fe5372981231d195" title="Raw active protocol.">SCARD_PROTOCOL_RAW</a>, &amp;hCard, &amp;dwActiveProtocol);
 rv = <a class="code" href="group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f" title="This function set an attribute of the IFD Handler.">SCardSetAttrib</a>(hCard, 0x42000001, pbAttr, <span class="keyword">sizeof</span>(pbAttr));
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l02732">2732</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="ifdwrapper_8c_source.html#l00233">IFDSetCapabilities()</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00092">SCARD_E_NOT_TRANSACTED</a>, <a class="el" href="pcsclite_8h_source.html#l00180">SCARD_E_UNSUPPORTED_FEATURE</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, and <a class="el" href="winscard__msg_8h_source.html#l00106">SCARD_SET_ATTRIB</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ga812e35ead06d4690fa96aecf371c6255"></a><!-- doxytag: member="winscard_clnt.c::SCardSetTimeout" ref="ga812e35ead06d4690fa96aecf371c6255" args="(SCARDCONTEXT hContext, DWORD dwTimeout)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardSetTimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f">SCARDCONTEXT</a>&nbsp;</td>
          <td class="paramname"> <em>hContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>dwTimeout</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The function does not do anything except returning <a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>. </p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd>This function is not in Microsoft(R) WinSCard API and is deprecated in pcsc-lite API.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hContext</em>&nbsp;</td><td>Connection context to the PC/SC Resource Manager. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dwTimeout</em>&nbsp;</td><td>New timeout value.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l00672">672</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcsclite_8h_source.html#l00180">SCARD_E_UNSUPPORTED_FEATURE</a>, and <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>.</p>

</div>
</div>
<a class="anchor" id="ga18f33eebb45d9e0d2a091ca7a0511d26"></a><!-- doxytag: member="winscard_clnt.c::SCardStatus" ref="ga18f33eebb45d9e0d2a091ca7a0511d26" args="(SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardStatus </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPSTR&nbsp;</td>
          <td class="paramname"> <em>mszReaderName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pcchReaderLen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pdwState</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pdwProtocol</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPBYTE&nbsp;</td>
          <td class="paramname"> <em>pbAtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pcbAtrLen</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function returns the current status of the reader connected to by <code>hCard</code>. </p>
<p>It's friendly name will be stored in <code>szReaderName</code>. <code>pcchReaderLen</code> will be the size of the allocated buffer for <code>szReaderName</code>, while <code>pcbAtrLen</code> will be the size of the allocated buffer for <code>pbAtr</code>. If either of these is too small, the function will return with <a class="el" href="pcsclite_8h.html#aac3f8d945f8a0e667e0926daaa18dc57">SCARD_E_INSUFFICIENT_BUFFER</a> and the necessary size in <code>pcchReaderLen</code> and <code>pcbAtrLen</code>. The current state, and protocol will be stored in pdwState and <code>pdwProtocol</code> respectively.</p>
<p>If <code>*pcchReaderLen</code> is equal to <a class="el" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0">SCARD_AUTOALLOCATE</a> then the function will allocate itself the needed memory for mszReaderName. Use <a class="el" href="group__API.html#ga0522241e3180cb05dfd166e28930e961" title="Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE...">SCardFreeMemory()</a> to release it.</p>
<p>If <code>*pcbAtrLen</code> is equal to <a class="el" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0">SCARD_AUTOALLOCATE</a> then the function will allocate itself the needed memory for pbAtr. Use <a class="el" href="group__API.html#ga0522241e3180cb05dfd166e28930e961" title="Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE...">SCardFreeMemory()</a> to release it.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>mszReaderName</em>&nbsp;</td><td>[inout] Friendly name of this reader. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pcchReaderLen</em>&nbsp;</td><td>[inout] Size of the <code>szReaderName</code> multistring. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pdwState</em>&nbsp;</td><td>Current state of this reader. <code>pdwState</code> is a DWORD possibly OR'd with the following values:</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#a8108c39f71de4ea806b0a411eb9906ab">SCARD_ABSENT</a> - There is no card in the reader.</li>
<li><a class="el" href="pcsclite_8h.html#a4d99b1aacfcda4e1a36198f5668ae520">SCARD_PRESENT</a> - There is a card in the reader, but it has not been moved into position for use.</li>
<li><a class="el" href="pcsclite_8h.html#a0feed8b3b5ce43d1411359a9b0a3d78c">SCARD_SWALLOWED</a> - There is a card in the reader in position for use. The card is not powered.</li>
<li><a class="el" href="pcsclite_8h.html#a73c52c7df905c748f00b22c88827d65a">SCARD_POWERED</a> - Power is being provided to the card, but the reader driver is unaware of the mode of the card.</li>
<li><a class="el" href="pcsclite_8h.html#af261075b3c31cd33def0d5af9eaed921">SCARD_NEGOTIABLE</a> - The card has been reset and is awaiting PTS negotiation.</li>
<li><a class="el" href="pcsclite_8h.html#af4eb99171c14cab34222d4a4a5d2a5be">SCARD_SPECIFIC</a> - The card has been reset and specific communication protocols have been established. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pdwProtocol</em>&nbsp;</td><td>Current protocol of this reader.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c">SCARD_PROTOCOL_T0</a> Use the T=0 protocol.</li>
<li><a class="el" href="pcsclite_8h.html#a3c09cd155e07044f857130c183d64f03">SCARD_PROTOCOL_T1</a> Use the T=1 protocol. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pbAtr</em>&nbsp;</td><td>Current ATR of a card in this reader. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pcbAtrLen</em>&nbsp;</td><td>Length of ATR.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INSUFFICIENT_BUFFER</em>&nbsp;</td><td>Not enough allocated memory for <code>szReaderName</code> or for <code>pbAtr</code> (<a class="el" href="pcsclite_8h.html#aac3f8d945f8a0e667e0926daaa18dc57">SCARD_E_INSUFFICIENT_BUFFER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_PARAMETER</em>&nbsp;</td><td><code>pcchReaderLen</code> or <code>pcbAtrLen</code> is NULL (<a class="el" href="pcsclite_8h.html#a47a6da10ec4ea2cbebfcc4b2a93d786f">SCARD_E_INVALID_PARAMETER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_W_REMOVED_CARD</em>&nbsp;</td><td>The smart card has been removed (<a class="el" href="pcsclite_8h.html#aa2efd953946973972b1afc5d0343820c">SCARD_W_REMOVED_CARD</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_W_RESET_CARD</em>&nbsp;</td><td>The smart card has been reset (<a class="el" href="pcsclite_8h.html#a20fbb8319646f26c4ad7f237d1a64f0c">SCARD_W_RESET_CARD</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 DWORD dwState, dwProtocol, dwAtrLen, dwReaderLen;
 BYTE pbAtr[<a class="code" href="pcsclite_8h.html#a7ac7915ff6f9baefa66886c98bdbb91e" title="Maximum ATR size.">MAX_ATR_SIZE</a>];
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
 ...
 dwAtrLen = <span class="keyword">sizeof</span>(pbAtr);
 rv = <a class="code" href="group__API.html#ga18f33eebb45d9e0d2a091ca7a0511d26" title="This function returns the current status of the reader connected to by hCard.">SCardStatus</a>(hCard, NULL, &amp;dwReaderLen, &amp;dwState, &amp;dwProtocol, pbAtr, &amp;dwAtrLen);
</pre></div><div class="fragment"><pre class="fragment"> <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol;
 DWORD dwState, dwProtocol, dwAtrLen, dwReaderLen;
 BYTE *pbAtr = NULL;
 <span class="keywordtype">char</span> *pcReader = NULL;
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
 ...
 dwReaderLen = <a class="code" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0" title="see SCardFreeMemory()">SCARD_AUTOALLOCATE</a>;
 dwAtrLen = <a class="code" href="pcsclite_8h.html#a67db0943aeb13f9f468eaae39b5ff1b0" title="see SCardFreeMemory()">SCARD_AUTOALLOCATE</a>;
 rv = <a class="code" href="group__API.html#ga18f33eebb45d9e0d2a091ca7a0511d26" title="This function returns the current status of the reader connected to by hCard.">SCardStatus</a>(hCard, (LPSTR)&amp;pcReader, &amp;dwReaderLen, &amp;dwState,
          &amp;dwProtocol, (LPBYTE)&amp;pbAtr, &amp;dwAtrLen);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l01532">1532</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="readerfactory_8h_source.html#l00107">ReaderContext::lpcReader</a>, <a class="el" href="pcsclite_8h_source.html#l00035">MAX_ATR_SIZE</a>, <a class="el" href="pcsclite_8h_source.html#l00201">MAX_BUFFER_SIZE</a>, <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcsclite_8h_source.html#l00188">PCSCLITE_MAX_READERS_CONTEXTS</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="readerfactory_8h_source.html#l00134">ReaderContext::readerState</a>, <a class="el" href="pcsclite_8h_source.html#l00134">SCARD_AUTOALLOCATE</a>, <a class="el" href="pcsclite_8h_source.html#l00078">SCARD_E_INSUFFICIENT_BUFFER</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00076">SCARD_E_NO_MEMORY</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00071">SCARD_F_INTERNAL_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__msg_8h_source.html#l00101">SCARD_STATUS</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="gac60e9e6c93b04e61594a3a8f69ee1898"></a><!-- doxytag: member="winscard_clnt.c::SCardTransmit" ref="gac60e9e6c93b04e61594a3a8f69ee1898" args="(SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, LPSCARD_IO_REQUEST pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG SCardTransmit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9">SCARDHANDLE</a>&nbsp;</td>
          <td class="paramname"> <em>hCard</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structSCARD__IO__REQUEST.html">LPCSCARD_IO_REQUEST</a>&nbsp;</td>
          <td class="paramname"> <em>pioSendPci</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPCBYTE&nbsp;</td>
          <td class="paramname"> <em>pbSendBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&nbsp;</td>
          <td class="paramname"> <em>cbSendLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structSCARD__IO__REQUEST.html">LPSCARD_IO_REQUEST</a>&nbsp;</td>
          <td class="paramname"> <em>pioRecvPci</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPBYTE&nbsp;</td>
          <td class="paramname"> <em>pbRecvBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&nbsp;</td>
          <td class="paramname"> <em>pcbRecvLength</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function sends an APDU to the smart card contained in the reader connected to by <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </p>
<p>The card responds from the APDU and stores this response in <code>pbRecvBuffer</code> and it's length in <code>pcbRecvLength</code>. <code>pioSendPci</code> and <code>pioRecvPci</code> are structures containing the following: </p>
<div class="fragment"><pre class="fragment"> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
    DWORD dwProtocol;    <span class="comment">// SCARD_PROTOCOL_T0 or SCARD_PROTOCOL_T1</span>
    DWORD cbPciLength;   <span class="comment">// Length of this structure - not used</span>
 } <a class="code" href="structSCARD__IO__REQUEST.html" title="Protocol Control Information (PCI).">SCARD_IO_REQUEST</a>;
</pre></div><dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>hCard</em>&nbsp;</td><td>Connection made from <a class="el" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect()</a>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pioSendPci</em>&nbsp;</td><td>[inout] Structure of Protocol Control Information.</p>
<ul>
<li><a class="el" href="pcsclite_8h.html#afe9c9747a9359719e1094e2754580a9a">SCARD_PCI_T0</a> - Pre-defined T=0 PCI structure.</li>
<li><a class="el" href="pcsclite_8h.html#ae07c084592ce8e0ae24384d93bd026e7">SCARD_PCI_T1</a> - Pre-defined T=1 PCI structure.</li>
<li><a class="el" href="pcsclite_8h.html#a884ba9fa57faa3e2537b4dafc9fe8b11">SCARD_PCI_RAW</a> - Pre-defined RAW PCI structure. </li>
</ul>
</td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>pbSendBuffer</em>&nbsp;</td><td>APDU to send to the card. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>cbSendLength</em>&nbsp;</td><td>Length of the APDU. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pioRecvPci</em>&nbsp;</td><td>[inout] Structure of protocol information. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>pbRecvBuffer</em>&nbsp;</td><td>Response from the card. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pcbRecvLength</em>&nbsp;</td><td>[inout] Length of the response.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Error code. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>SCARD_S_SUCCESS</em>&nbsp;</td><td>Successful (<a class="el" href="pcsclite_8h.html#a4a3c56f69570971d366642a563b34a75">SCARD_S_SUCCESS</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INSUFFICIENT_BUFFER</em>&nbsp;</td><td><code>cbSendLength</code> or <code>cbRecvLength</code> are too big (<a class="el" href="pcsclite_8h.html#aac3f8d945f8a0e667e0926daaa18dc57">SCARD_E_INSUFFICIENT_BUFFER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_HANDLE</em>&nbsp;</td><td>Invalid <code>hCard</code> handle (<a class="el" href="pcsclite_8h.html#a05bdea2f2341e78d920885d1cc357676">SCARD_E_INVALID_HANDLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_PARAMETER</em>&nbsp;</td><td><code>pbSendBuffer</code> or <code>pbRecvBuffer</code> or <code>pcbRecvLength</code> or <code>pioSendPci</code> is null (<a class="el" href="pcsclite_8h.html#a47a6da10ec4ea2cbebfcc4b2a93d786f">SCARD_E_INVALID_PARAMETER</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_INVALID_VALUE</em>&nbsp;</td><td>Invalid Protocol, reader name, etc (<a class="el" href="pcsclite_8h.html#a9ece9fd9e68e4f802e16e951f8f2a642">SCARD_E_INVALID_VALUE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NO_SERVICE</em>&nbsp;</td><td>The server is not runing (<a class="el" href="pcsclite_8h.html#ad4729ab109ff490285d2ad881c04bee8">SCARD_E_NO_SERVICE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_NOT_TRANSACTED</em>&nbsp;</td><td>APDU exchange not successful (<a class="el" href="pcsclite_8h.html#ab02a33c2ef61f12a851dfe85c575d7cc">SCARD_E_NOT_TRANSACTED</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_PROTO_MISMATCH</em>&nbsp;</td><td>Connect protocol is different than desired (<a class="el" href="pcsclite_8h.html#a36d821a0458f935ddbe345f10408a988">SCARD_E_PROTO_MISMATCH</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_E_READER_UNAVAILABLE</em>&nbsp;</td><td>The reader has been removed (<a class="el" href="pcsclite_8h.html#ad70bc694ffdf40c3b494d9239160d69d">SCARD_E_READER_UNAVAILABLE</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_F_COMM_ERROR</em>&nbsp;</td><td>An internal communications error has been detected (<a class="el" href="pcsclite_8h.html#a93d3cf468d69423eab1d478a7a870408">SCARD_F_COMM_ERROR</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_W_RESET_CARD</em>&nbsp;</td><td>The card has been reset by another application (<a class="el" href="pcsclite_8h.html#a20fbb8319646f26c4ad7f237d1a64f0c">SCARD_W_RESET_CARD</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SCARD_W_REMOVED_CARD</em>&nbsp;</td><td>The card has been removed from the reader (<a class="el" href="pcsclite_8h.html#aa2efd953946973972b1afc5d0343820c">SCARD_W_REMOVED_CARD</a>)</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><pre class="fragment"> LONG rv;
 <a class="code" href="pcsclite_8h.html#a3524142a16d7185916422baf6bb7883f" title="hContext returned by SCardEstablishContext()">SCARDCONTEXT</a> hContext;
 <a class="code" href="pcsclite_8h.html#a0ef8f5baf9ee6c07dbdc7644c641d0a9" title="hCard returned by SCardConnect()">SCARDHANDLE</a> hCard;
 DWORD dwActiveProtocol, dwSendLength, dwRecvLength;
 <a class="code" href="structSCARD__IO__REQUEST.html" title="Protocol Control Information (PCI).">SCARD_IO_REQUEST</a> pioRecvPci;
 BYTE pbRecvBuffer[10];
 BYTE pbSendBuffer[] = { 0xC0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00 };
 ...
 rv = <a class="code" href="group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67" title="Creates an Application Context for a client.">SCardEstablishContext</a>(<a class="code" href="pcsclite_8h.html#a01ffeed2d7fac470371c79fa86b1e309" title="Scope in system.">SCARD_SCOPE_SYSTEM</a>, NULL, NULL, &amp;hContext);
 rv = <a class="code" href="group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5" title="This function establishes a connection to the reader specified in szReader.">SCardConnect</a>(hContext, <span class="stringliteral">&quot;Reader X&quot;</span>, <a class="code" href="pcsclite_8h.html#a724a33782fe519553f1e05ee77940f6f" title="Shared mode only.">SCARD_SHARE_SHARED</a>,
          <a class="code" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c" title="T=0 active protocol.">SCARD_PROTOCOL_T0</a>, &amp;hCard, &amp;dwActiveProtocol);
 dwSendLength = <span class="keyword">sizeof</span>(pbSendBuffer);
 dwRecvLength = <span class="keyword">sizeof</span>(pbRecvBuffer);
 rv = <a class="code" href="group__API.html#gac60e9e6c93b04e61594a3a8f69ee1898" title="This function sends an APDU to the smart card contained in the reader connected to...">SCardTransmit</a>(hCard, <a class="code" href="pcsclite_8h.html#afe9c9747a9359719e1094e2754580a9a" title="protocol control information (PCI) for T=0">SCARD_PCI_T0</a>, pbSendBuffer, dwSendLength,
          &amp;pioRecvPci, pbRecvBuffer, &amp;dwRecvLength);
</pre></div> 
<p>Definition at line <a class="el" href="winscard__clnt_8c_source.html#l02915">2915</a> of file <a class="el" href="winscard__clnt_8c_source.html">winscard_clnt.c</a>.</p>

<p>References <a class="el" href="pcsclite_8h_source.html#l00055">SCARD_IO_REQUEST::cbPciLength</a>, <a class="el" href="winscard__clnt_8c_source.html#l00177">_psContextMap::dwClientID</a>, <a class="el" href="pcsclite_8h_source.html#l00054">SCARD_IO_REQUEST::dwProtocol</a>, <a class="el" href="ifdwrapper_8c_source.html#l00657">IFDTransmit()</a>, <a class="el" href="pcsclite_8h_source.html#l00201">MAX_BUFFER_SIZE</a>, <a class="el" href="pcsclite_8h_source.html#l00202">MAX_BUFFER_SIZE_EXTENDED</a>, <a class="el" href="pcscd_8h_source.html#l00042">PCSCLITE_CLIENT_ATTEMPTS</a>, <a class="el" href="pcscd_8h_source.html#l00076">PCSCLITE_MAX_MESSAGE_SIZE</a>, <a class="el" href="winscard__clnt_8c.html#ae302184e5b19da694c09713cb5bcbb8a">psContextMap</a>, <a class="el" href="readerfactory_8h_source.html#l00134">ReaderContext::readerState</a>, <a class="el" href="pcsclite_8h_source.html#l00158">SCARD_ABSENT</a>, <a class="el" href="pcsclite_8h_source.html#l00078">SCARD_E_INSUFFICIENT_BUFFER</a>, <a class="el" href="pcsclite_8h_source.html#l00073">SCARD_E_INVALID_HANDLE</a>, <a class="el" href="pcsclite_8h_source.html#l00074">SCARD_E_INVALID_PARAMETER</a>, <a class="el" href="pcsclite_8h_source.html#l00099">SCARD_E_NO_SERVICE</a>, <a class="el" href="pcsclite_8h_source.html#l00082">SCARD_E_NO_SMARTCARD</a>, <a class="el" href="pcsclite_8h_source.html#l00085">SCARD_E_PROTO_MISMATCH</a>, <a class="el" href="pcsclite_8h_source.html#l00093">SCARD_E_READER_UNAVAILABLE</a>, <a class="el" href="pcsclite_8h_source.html#l00089">SCARD_F_COMM_ERROR</a>, <a class="el" href="pcsclite_8h_source.html#l00146">SCARD_PROTOCOL_ANY</a>, <a class="el" href="winscard_8c_source.html#l00182">SCARD_PROTOCOL_ANY_OLD</a>, <a class="el" href="pcsclite_8h_source.html#l00143">SCARD_PROTOCOL_RAW</a>, <a class="el" href="pcsclite_8h_source.html#l00142">SCARD_PROTOCOL_T1</a>, <a class="el" href="pcsclite_8h_source.html#l00070">SCARD_S_SUCCESS</a>, <a class="el" href="winscard__msg_8h_source.html#l00099">SCARD_TRANSMIT</a>, <a class="el" href="winscard__msg_8h_source.html#l00107">SCARD_TRANSMIT_EXTENDED</a>, <a class="el" href="winscard__clnt_8c_source.html#l03790">SCardCheckDaemonAvailability()</a>, <a class="el" href="winscard__msg_8c_source.html#l00057">SHMClientRead()</a>, <a class="el" href="winscard__msg_8c_source.html#l00268">SHMMessageReceive()</a>, and <a class="el" href="winscard__msg_8c_source.html#l00412">WrapSHMWrite()</a>.</p>

<p>Referenced by <a class="el" href="winscard__svc_8c_source.html#l00256">MSGFunctionDemarshall()</a>.</p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>