Unexpected RPC issue

1,122 views
Skip to first unread message

Adrian Fulias

unread,
Sep 2, 2016, 11:09:09 AM9/2/16
to eID Middleware Dev
Hello,

We're trying to test a library with a small app and Virtual cards.
The Test.exe is build for Win32 ( on a x64 machine ) using Visual Studio Community 2015

If I copy the PCSCProxy Win32 winscard.dll in the same directory as our Test.exe , after seeing the library being loaded we get the exception below:

Exception thrown at 0x761BC54F (KernelBase.dll) in Test.exe: 0x000006BA: The RPC server is unavailable.
Exception thrown at 0x761BC54F in Test.exe: Microsoft C++ exception: unsigned long at memory location 0x0017D608.
Exception thrown at 0x761BC54F in Test.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x761BC54F (KernelBase.dll) in Test.exe: 0x0000071A: The remote procedure call was canceled, or if a call time-out was specified, the call timed out.

(I saw that the RPC service is started in Services)

Has any of you encountered this before, or has any idea about it ?

Thank you

Frederik Vernelen

unread,
Sep 6, 2016, 5:55:05 AM9/6/16
to eID Middleware Dev
Hello Adrian,

I'm not sure what is causing this, but when the PCSCProxy gets attached, we call GetSystemDirector to find the system directory, and load the original winscard.dll.

If you'd like to debug into the pcscproxy, you can find the project (and VS solution file) here:
https://github.com/Fedict/eid-test-cards/tree/master/pcscproxy

Wkr,
 Frederik



--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adrian Fulias

unread,
Sep 7, 2016, 11:00:36 AM9/7/16
to eID Middleware Dev
Hi Frederik

Thank you for pointing me to pcscproxy source code.
Did some changes and got it reading the card...  but this is far from a perfect fix ( ... as you will see there are still some issues ).
This changes helped our little test and I've attached a patch maybe it will help other and you also ...

BR,
Adrian
0001-Quick-fix-to-make-it-work-and-read-vcard-data.patch

Wouter Verhelst

unread,
Sep 7, 2016, 11:03:05 AM9/7/16
to eid-middl...@googlegroups.com
Hi Adrian,

Could you perhaps fork the repository on github and file a pull request?
That makes it easier to review and possibly merge your suggested
solution -- and if we decide that it's too ugly, we'd still have an open
issue to track the solution.

Thanks,
> eid-middleware-...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to eid-middleware-...@googlegroups.com
> <mailto:eid-middleware-...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

Frederik Vernelen

unread,
Sep 8, 2016, 3:16:40 AM9/8/16
to eID Middleware Dev
Hello Adrian,

I've taken a look at your change in SCardListReaders with mszReaders = NULL. (the other changes you made were to support your change here I think).

In our pcscproxy we also crreate 'soft readers' (more about them below) (their names start with an exclamation mark '!'),
So in the above function we cannot just call pSCardListReaders(hContext, mszGroups, NULL, pcchReaders); ,
as we also have to calculate the space needed for the names of those 'soft readers'. (which is done in srmngr->calcListReadersLength(buf, buflen))

Can you let me know what exactly went wrong in that function (SCardListReaders with mszReaders = NULL) ?


About the soft reader:
The physical eid (test) cards have static data on them, which will be returned when you select the 'hard reader' (the card reader where the physical card is in).
But if you would like to use the virtual card data that you created for your test card, you need to select the soft reader the card is in (same name as the hard reader, but with ! in front of it).

So our pcscproxy doubles the number of cardreaders found (it adds a soft card reader for each hard card reader)
That soft cardreader can be used to retrieve the virtual (software) content you created for the test card in that hard card reader).

I hope I didn't wrote that too confusingly.

Wkr,
 Frederik



To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Adrian Fulias

unread,
Sep 12, 2016, 4:53:58 AM9/12/16
to eID Middleware Dev
Hello Frederik,

Thank you for your replay and explanations related to pcscproxy 

What went wrong and determined me make the changes and call SCardListReaders  directly with mszReaders = NULL

In  SoftReaderManager::takeFromMultiString()
I got a Read access violation char c = mszReaders[mszReaders_offset++];  ( and  buffer overrun of buf[buf_offset] )
Increasing the buf size did not help much since the result of pSCardListReaders previously called in WinscardImpl::SCardListReaders() 
//get hard readers names with buffer
result = pSCardListReaders(hContext, mszGroups, buf, &buflen);
result was != SCARD_S_SUCCESS  ( probably the cause of the issue in takeFromMultiString () )

Hope this helps 

BR,
Adrian
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Frederik Vernelen

unread,
Sep 13, 2016, 7:01:41 AM9/13/16
to eID Middleware Dev
Hello Adrian,

Thank you for your help.
The return value:  'result = pSCardListReaders(hContext, mszGroups, buf, &buflen);' wasn't checked indeed.
It should return the error when result != SCARD_S_SUCCESS, I'll change that.

Could it be that you are testing without a card reader attached?

Wkr,
 Frederik

To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages