[Pcsclite-cvs-commit] r3067 - /trunk/PCSC/src/testpcsc.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Wed Jul 30 13:55:38 UTC 2008
Author: rousseau
Date: Wed Jul 30 13:55:37 2008
New Revision: 3067
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3067
Log:
use buf[] and dwBufLen for an temporary buffer instead of pbAtr[] and
dwAtrLen
Modified:
trunk/PCSC/src/testpcsc.c
Modified: trunk/PCSC/src/testpcsc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/testpcsc.c?rev=3067&op=diff
==============================================================================
--- trunk/PCSC/src/testpcsc.c (original)
+++ trunk/PCSC/src/testpcsc.c Wed Jul 30 13:55:37 2008
@@ -62,6 +62,8 @@
DWORD dwPref, dwReaders = 0;
char *pcReaders, *mszReaders;
unsigned char pbAtr[MAX_ATR_SIZE];
+ unsigned char buf[100];
+ DWORD dwBufLen;
unsigned char *pbAttr = NULL;
DWORD pcbAttrLen;
char *mszGroups;
@@ -297,32 +299,32 @@
#endif
printf("Testing SCardGetAttrib\t\t: ");
- dwAtrLen = sizeof(pbAtr);
- rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_IFD_VERSION, pbAtr, &dwAtrLen);
+ dwBufLen = sizeof(buf);
+ rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_IFD_VERSION, buf, &dwBufLen);
test_rv(rv, hContext, DONT_PANIC);
if (rv == SCARD_S_SUCCESS)
printf("Vendor IFD version\t\t: " GREEN "0x%08lX\n" NORMAL,
- ((DWORD *)pbAtr)[0]);
-
- printf("Testing SCardGetAttrib\t\t: ");
- dwAtrLen = sizeof(pbAtr);
- rv = SCardGetAttrib(hCard, SCARD_ATTR_MAXINPUT, pbAtr, &dwAtrLen);
- test_rv(rv, hContext, DONT_PANIC);
- if (rv == SCARD_S_SUCCESS)
- {
- if (dwAtrLen == sizeof(uint32_t))
+ ((DWORD *)buf)[0]);
+
+ printf("Testing SCardGetAttrib\t\t: ");
+ dwBufLen = sizeof(buf);
+ rv = SCardGetAttrib(hCard, SCARD_ATTR_MAXINPUT, buf, &dwBufLen);
+ test_rv(rv, hContext, DONT_PANIC);
+ if (rv == SCARD_S_SUCCESS)
+ {
+ if (dwBufLen == sizeof(uint32_t))
printf("Max message length\t\t: " GREEN "%d\n" NORMAL,
- *(uint32_t *)pbAtr);
+ *(uint32_t *)buf);
else
printf(RED "Wrong size" NORMAL);
}
printf("Testing SCardGetAttrib\t\t: ");
- dwAtrLen = sizeof(pbAtr);
- rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_NAME, pbAtr, &dwAtrLen);
- test_rv(rv, hContext, DONT_PANIC);
- if (rv == SCARD_S_SUCCESS)
- printf("Vendor name\t\t\t: " GREEN "%s\n" NORMAL, pbAtr);
+ dwBufLen = sizeof(buf);
+ rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_NAME, buf, &dwBufLen);
+ test_rv(rv, hContext, DONT_PANIC);
+ if (rv == SCARD_S_SUCCESS)
+ printf("Vendor name\t\t\t: " GREEN "%s\n" NORMAL, buf);
printf("Testing SCardSetAttrib\t\t: ");
rv = SCardSetAttrib(hCard, SCARD_ATTR_ATR_STRING, (LPCBYTE)"", 1);
More information about the Pcsclite-cvs-commit
mailing list