Hi,

I've tried this..

=======================================
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<unistd.h>
#include<string.h>

#include<PCSC/winscard.h>
#include<PCSC/wintypes.h>
#include<pcsclite.h>

int main()
{

        SCARDCONTEXT hContext;
        LONG         rv;        
        

        rv = SCardEstablishContext(SCARD_SCOPE_USER,NULL,NULL,&hContext);

        if( rv == SCARD_S_SUCCESS )
        {
                printf("Return code : %08X : ", rv);
                printf("Success\n");
        }
        else if(SCARD_E_INVALID_VALUE)
        {
                printf("Return code : %08X : ", rv);
                printf("Failure\n");
        }
        else
        {
                printf("Return code : %08X : ", rv);
        }
        return 0;
}
==============================================

I've got the following message..

Return Code: 80100013
Failure.

===================
Once I've got "RPC transport error" as well.
What could be the problem? Kindly let me know.
If you need any further information, please do not hesitate to contact me.

Cheers,

Naveen.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, 5 April 2005 2:23 PM
To: MUSCLE
Subject: Antwort: [Muscle] SCardEstablishContext question..





Good Morning !

You need to run pcscd to use you SmartCard Reader, If it runs in background
or manually started with "pcscd -f -d stdout" doesn't matter.

pcsc is the demon which interacts with you CardReader, load the right
driver file and so on, just like the ResourceManager in Windows. if it is
not started, there is no interaction with your reader.

You need not insert a card to SCardEstablishContext(...), Card insertion is
needed by SCardConnect(...).

General Hint: If you do get any error from an SCard function print the
errorcode, f.e. "printf("SCardConnect returns: %08X",returncode);". It is
much easier to determine the problem you have with the right errormessage
instead of SUCCESS / FAILURE.

---
Mit freundlichen Gr��en
Best regards,

Martin F�hrlinger
Software Developer

OMNIKEY
Ferihumerstrasse 13
A-4040 Linz
Austria

Tel        +43 (0) 732 / 602220  - 35
E-Mail    [EMAIL PROTECTED]
Web       www.omnikey.com


                                                                           
             "Naveen Mukkelli"                                             
             <[EMAIL PROTECTED]                                             
             t.com.au>                                                  An 
             Gesendet von:              <[email protected]>      
             [EMAIL PROTECTED]                                       Kopie 
             sts.musclecard.co                                             
             m                                                       Thema 
                                        [Muscle] SCardEstablishContext     
                                        question..                         
             05.04.2005 04:22                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                     
                  MUSCLE                                                   
             <[EMAIL PROTECTED]                                             
               clecard.com>                                                
                                                                           
                                                                           




Hi,

 I'm learning to write application for Smart cards using  "winscard.h"

 I've written the following code,


#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<unistd.h>
#include<string.h>

#include<PCSC/winscard.h>
#include<PCSC/wintypes.h>
#include<pcsclite.h>

int main()
{

            SCARDCONTEXT hContext;
            LONG         rv;


            rv =
SCardEstablishContext(SCARD_SCOPE_SYSTEM,NULL,NULL,&hContext);

            if( rv == SCARD_S_SUCCESS )
            {
                        printf("Success\n");
            }
            else
            {
                        printf("Failure\n");
            }
            return 0;
}

When I run this code, I'm getting "Failure" after couple of minutes. But
when I use "pcscd -f -d stdout" and insert the same card in the card
reader, it is working.  What could be the problem?

Kindly let me know.


Cheers,

Naveen.
 _______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to