locked
How do I get past unresolved external symbol error with _CLSID_CSCardCmd and _IID_ISCardCmd? RRS feed

  • Question

  • I am working on a C++ application.  I would like the user to authenticate using a smart card.  The application is C++ and I am using Visual Studio.

    I have been able to follow the examples in MSDN to do the following:

    1. Use the SCardEstablishContext function to get a context

    2. Use the SCardListReaders function to get a list of available readers

    3. Use the SCardConnect function to establish a connection with a Smart Card

    4. Use the SCardStatus function to get the Smart Card status

    5. I am also able to use the SCardBeginTransaction, SCardEndTransaction, SCardDisconnect, and SCardFreeMemory functions.

    Yet, I cannot use either of the two following functions: 

     hresult = CoCreateInstance(CLSID_CSCardCmd,
       NULL,
       CLSCTX_ALL,
       IID_ISCardCmd,
       (LPVOID*) &g_pISCardCmd);
     
     // Create an ISCardISO7816 object.
     hresult2 = CoCreateInstance(CLSID_CSCardISO7816,
       NULL,
       CLSCTX_ALL,
       IID_ISCardISO7816,
       (LPVOID*) &g_pISCardISO7816);
    


    The errors I get are unresoleved external symbols for _CLSID_CSCardCmd and _IID_ISCardCmd.

    The linker makes includes Uuid.lib and winscard.lib

    In addition, I have the following includes:

    #include "stdafx.h"
    #include <Objbase.h>
    #include<windows.h>
    #include "Winscard.h"
    #include<scardssp.h>
    #include<scarderr.h>

    There are more but those are the essential ones related to the smart card win32API. 

    Can anyone help me out? What am I missing?

    Friday, April 23, 2010 3:56 PM

All replies

  • I determined I am trying to do things the complicated way.

    I have successfully made use of the CredUIPromptForCredentials function.  I set the parameters to where it required a certificate.  Does this function test the supplied pin against the smart card? 

    If not then how do I validate the "username" and pin for a Smart Card certificate once I have obtained them programmatically? 

     

    Friday, April 23, 2010 5:23 PM
  • The CredUIPromptForCredentials function does not check. 

     

    How do I validate the credentials supplied with a smart card through the CredUIPromptForCredentials function?

    Friday, April 23, 2010 7:09 PM