locked
SmartCards API using unmanaged library (winscard.dll) in Windows Store app? RRS feed

  • Question

  • Greetings!

    Lately, I posted my question on StackOverflow and samples forum about reading Smart Card's ID using Smart Card API for Windows Store App (Windows 8.1) but couldn't get any answer for that.

    Now, I got an idea of using unmanaged dlls for Smart Cards available in Windows (winscards.dll) as one of my .NET samples is still referencing it and giving me desired output. However, I am not able to read it using WinRT (for Windows Store app) with DllImport.

    Can anyone tell me if why am I not able to read that?

    Thanks in advance.

    Arafat

    Monday, December 30, 2013 8:56 PM

All replies

  • First, I am not sure if it's Store-certifiable.  Second, it's likely using some libraries that are not in the C++ Store API set.  What's the actual error that you're getting?


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 31, 2013 2:21 PM
    Moderator
  • Thanks for the reply, Matt.

    First, I am not worried about Certification of an app as it will only be running on selected machines where downloading from Store is not mandatory.

    Secondly, I am not able to get anything out of it. It just returns me a value which is not expected (you can say, I am getting a different value in .NET forms than WinRT) 

    I would also like to know why am I not able to read Smart Card's ID using GetIDAsync function from SmartCards API. If you want more detail, I have written a question here on the sample pages (http://code.msdn.microsoft.com/windowsapps/Smart-card-sample-c7d342e0/view/Discussions#content). 

    Appreciate if you could answer :)

    Much thanks

    Arafat

    Tuesday, December 31, 2013 3:07 PM
  • Can you post a sample app that uses it, so I can play with it?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 31, 2013 8:05 PM
    Moderator
  • Thanks again Matt.

    This is the sample I am using. Just try to get the ID / Name of a card. You can make another property in Scenario 7 along with the CardName and ReaderName and check what does it do after reading GetIDAsync function (it returns and exception).

    async void reader_CardAdded(SmartCardReader sender, CardAddedEventArgs args) { SmartCardProvisioning provision = await SmartCardProvisioning.FromSmartCardAsync(args.SmartCard); Guid cardID = await provision.GetIdAsync(); var card = await args.SmartCard.GetAnswerToResetAsync(); }

    Arafat

     

    Tuesday, December 31, 2013 11:04 PM