Question

I am calling winscard.dll methods from C# and everything has been working fine in a test app. I am having difficulty establishing context when moving the code into a larger project.

My call to establish context is as follows:

[DllImport("winscard.dll")]
        public static extern int SCardEstablishContext(int scope, int res1, int res2, ref int pntContext);

In my test app when I call this the pntContext variable appears to get set properly. But, in the new project its not getting set. But strangely enough the return code is still 0 (success).

So, I'm just wondering what are the circumstances that could cause this, or what other things could I be doing wrong?

Any ideas are greatly appreciated.

Was it helpful?

Solution

The problem appears to be cause by a driver / architecture issue.

For me there were two projects involved (API and Client).

To solve the problem I changed "CPU Type" (Project Properties->Build) to Any CPU.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top