[Pcsclite-cvs-commit] PCSC/src testpcsc.c,1.6,1.7
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv20900
Modified Files:
testpcsc.c
Log Message:
test SCardListReaderGroups()
Index: testpcsc.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/testpcsc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- testpcsc.c 15 Jan 2004 21:07:52 -0000 1.6
+++ testpcsc.c 13 Apr 2004 15:03:31 -0000 1.7
@@ -29,7 +29,8 @@
unsigned long dwPref, dwReaders;
char *pcReaders, *mszReaders;
unsigned char pbAtr[MAX_ATR_SIZE];
- const char *mszGroups;
+ char *mszGroups;
+ unsigned long dwGroups;
long rv;
int i, p, iReader;
int iList[16];
@@ -59,6 +60,39 @@
{
SCardReleaseContext(hContext);
return -1;
+ }
+
+ printf("Testing SCardListReaderGroups : ");
+
+ rv = SCardListReaderGroups(hContext, 0, &dwGroups);
+
+ printf("%s\n", pcsc_stringify_error(rv));
+
+ if (rv != SCARD_S_SUCCESS)
+ {
+ SCardReleaseContext(hContext);
+ return -1;
+ }
+
+ mszGroups = (char *) malloc(sizeof(char) * dwGroups);
+ rv = SCardListReaderGroups(hContext, mszGroups, &dwGroups);
+
+ if (rv != SCARD_S_SUCCESS)
+ {
+ SCardReleaseContext(hContext);
+ return -1;
+ }
+
+ /*
+ * Have to understand the multi-string here
+ */
+ p = 0;
+ for (i = 0; i < dwGroups - 1; i++)
+ {
+ ++p;
+ printf("Group %02d: %s\n", p, &mszGroups[i]);
+ iList[p] = i;
+ while (mszGroups[++i] != 0) ;
}
printf("Testing SCardListReaders : ");