Problems with SCardStatus!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

i do not know the right p/invoke calling, i receive 2 different kinds of
errors.

1) System.Execution Engine error when i try to debug that line of code

OR

2) I receive the Invalid Paremeter from the SCardErr - 0x8010004

This is my P/Invoke for SCardStatus, do you think is correct (the
www.pinvoke.net SCardStatus does not seem to be right)

[DllImport("Winscard.dll", CharSet=CharSet.Auto, SetLastError=true)]

private static extern Int32 SCardStatus(

UIntPtr hCard,

[MarshalAs(UnmanagedType.LPTStr)]

ref string readerName,

ref UInt32 readerLength,

out UInt32 state,

out UInt32 protocol,

//[MarshalAs(UnmanagedType.ByValArray, SizeConst=33)]

out byte[] attribute,

ref UInt32 attributeLength);

// attributeLength is depends on the byte[] attribute

Any idea how to fix this problem? I just to modify many things, like 2nd
paremeter, no marshalling just a normal string, still the same.

Thanks.
 
This is my P/Invoke for SCardStatus, do you think is correct

No it isn't. Remove the ref/out modifier on the readerName and
attribute parameters.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top