Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

WinSCard (winscard)
 
.
Summary
TODO - a short description

C# Signature:

    [DllImport("WINSCARD.DLL")]
    internal static extern uint SCardGetStatusChange(IntPtr hContext, UInt32 dwTimeout, [In, Out] SCARD_READERSTATE[] rgReaderStates, UInt32 cReaders);

VB Signature:

Declare Function WinSCard Lib "winscard.dll" (TODO) As TODO

User-Defined Types:

  [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    internal struct SCARD_READERSTATE
    {
    /// <summary>
    /// Reader
    /// </summary>
    internal string szReader;
    /// <summary>
    /// User Data
    /// </summary>
    internal IntPtr pvUserData;
    /// <summary>
    /// Current State
    /// </summary>
    internal UInt32 dwCurrentState;
    /// <summary>
    /// Event State/ New State
    /// </summary>
    internal UInt32 dwEventState;
    /// <summary>
    /// ATR Length
    /// </summary>
    internal UInt32 cbAtr;
    /// <summary>
    /// Card ATR
    /// </summary>
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
    internal byte[] rgbAtr;
    }

    And

    internal enum SCardState
    {
    /// <summary>
    /// Unware
    /// </summary>
    UNAWARE = 0x00000000,
    /// <summary>
    /// State Ignored
    /// </summary>
    IGNORE = 0x00000001,
    /// <summary>
    /// State changed
    /// </summary>
    CHANGED = 0x00000002,
    /// <summary>
    /// State Unknown
    /// </summary>
    UNKNOWN = 0x00000004,
    /// <summary>
    /// State Unavilable
    /// </summary>
    UNAVAILABLE = 0x00000008,
    /// <summary>
    /// State empty
    /// </summary>
    EMPTY = 0x00000010,
    /// <summary>
    /// Card Present
    /// </summary>
    PRESENT = 0x00000020,
    /// <summary>
    /// ATR mathched
    /// </summary>
    ATRMATCH = 0x00000040,
    /// <summary>
    /// In exclusive use
    /// </summary>
    EXCLUSIVE = 0x00000080,
    /// <summary>
    /// In use
    /// </summary>
    INUSE = 0x00000100,
    /// <summary>
    /// Mute State
    /// </summary>
    MUTE = 0x00000200,
    /// <summary>
    /// Card unpowered
    /// </summary>
    UNPOWERED = 0x00000400
    }    

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

UInt32 nbReaders = 1;

SCARD_READERSTATE[] readerState = new SCARD_READERSTATE[nbReaders];

readerState[0].szReader = "Reader X";

readerState[0].dwCurrentState = (UInt32)SCardState.UNAWARE;

errorCode = SCardGetStatusChange(hContext, 0, readerState, nbReaders);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
WinSCard on MSDN

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions