fixed compiling for windows
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@365 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -311,8 +311,10 @@ main(int argc, char *argv[])
|
|||||||
(int)recvlen);
|
(int)recvlen);
|
||||||
|
|
||||||
r = parse_EstablishPACEChannel_OutputData(recvbuf, recvlen);
|
r = parse_EstablishPACEChannel_OutputData(recvbuf, recvlen);
|
||||||
if (r != SCARD_S_SUCCESS)
|
if (r != SCARD_S_SUCCESS) {
|
||||||
|
printb("EstablishPACEChannel", recvbuf, recvlen);
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
printf("Established PACE channel returned in %.0fs.\n",
|
printf("Established PACE channel returned in %.0fs.\n",
|
||||||
difftime(t_end, t_start));
|
difftime(t_end, t_start));
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
LONG
|
LONG
|
||||||
pcsc_connect(unsigned int readernum, DWORD dwShareMode, DWORD dwPreferredProtocols,
|
pcsc_connect(unsigned int readernum, DWORD dwShareMode, DWORD dwPreferredProtocols,
|
||||||
SCARDCONTEXT *hContext, LPSTR *readers, LPSCARDHANDLE phCard,
|
LPSCARDCONTEXT phContext, LPSTR *readers, LPSCARDHANDLE phCard,
|
||||||
LPDWORD pdwActiveProtocol)
|
LPDWORD pdwActiveProtocol)
|
||||||
{
|
{
|
||||||
LONG r;
|
LONG r;
|
||||||
@@ -31,7 +31,7 @@ pcsc_connect(unsigned int readernum, DWORD dwShareMode, DWORD dwPreferredProtoco
|
|||||||
char *reader;
|
char *reader;
|
||||||
size_t l, i;
|
size_t l, i;
|
||||||
|
|
||||||
r = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
|
r = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, phContext);
|
||||||
if (r != SCARD_S_SUCCESS) {
|
if (r != SCARD_S_SUCCESS) {
|
||||||
fprintf(stderr, "Could not connect to PC/SC Service\n");
|
fprintf(stderr, "Could not connect to PC/SC Service\n");
|
||||||
goto err;
|
goto err;
|
||||||
@@ -39,7 +39,7 @@ pcsc_connect(unsigned int readernum, DWORD dwShareMode, DWORD dwPreferredProtoco
|
|||||||
|
|
||||||
|
|
||||||
readerslen = SCARD_AUTOALLOCATE;
|
readerslen = SCARD_AUTOALLOCATE;
|
||||||
r = SCardListReaders(hContext, NULL, (LPSTR) readers, &readerslen);
|
r = SCardListReaders(*phContext, NULL, (LPSTR) readers, &readerslen);
|
||||||
if (r != SCARD_S_SUCCESS) {
|
if (r != SCARD_S_SUCCESS) {
|
||||||
fprintf(stderr, "Could not get readers\n");
|
fprintf(stderr, "Could not get readers\n");
|
||||||
goto err;
|
goto err;
|
||||||
@@ -58,7 +58,7 @@ pcsc_connect(unsigned int readernum, DWORD dwShareMode, DWORD dwPreferredProtoco
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
r = SCardConnect(hContext, reader, dwShareMode, dwPreferredProtocols,
|
r = SCardConnect(*phContext, reader, dwShareMode, dwPreferredProtocols,
|
||||||
phCard, pdwActiveProtocol);
|
phCard, pdwActiveProtocol);
|
||||||
if (r != SCARD_S_SUCCESS) {
|
if (r != SCARD_S_SUCCESS) {
|
||||||
fprintf(stderr, "Could not connect to %s\n", reader);
|
fprintf(stderr, "Could not connect to %s\n", reader);
|
||||||
|
|||||||
@@ -24,11 +24,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <winscard.h>
|
||||||
#ifdef HAVE_PCSCLITE_H
|
#ifdef HAVE_PCSCLITE_H
|
||||||
#include <pcsclite.h>
|
#include <pcsclite.h>
|
||||||
#define stringify_error(r) { if (r != SCARD_S_SUCCESS) fputs(pcsc_stringify_error(r), stderr); }
|
#define stringify_error(r) { if (r != SCARD_S_SUCCESS) fputs(pcsc_stringify_error(r), stderr); }
|
||||||
#else
|
#else
|
||||||
#define stringify_error(r) { if (r != SCARD_S_SUCCESS) fprintf(stderr, "PC/SC error code %u\n", (unsigned int) r); }
|
#define stringify_error(r) { if (r != SCARD_S_SUCCESS) fprintf(stderr, "PC/SC error code %u\n", (unsigned int) r); }
|
||||||
|
#define SCARD_PROTOCOL_ANY (SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_READER_H
|
#ifdef HAVE_READER_H
|
||||||
|
|||||||
Reference in New Issue
Block a user