[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-smartcardsdk
Subject:    Re: SCardGetStatusChange not blocking
From:       Doug Barlow <dbarlow () MICROSOFT ! COM>
Date:       1999-06-23 17:11:44
[Download RAW message or body]


Modify the code as noted below.  It will then block on the second call.

It looks at your structure's dwCurrentState member to see what state you
think things are in, and then returns when it's different, placing the
actual state into the dwEventState member.  Since you never copied the
dwEventState to dwCurrentState, it was always different, and returned
immediately.

Doug

 -----Original Message-----
From:   Mark Zuber [mailto:mzuber@PERVASIVE.COM]
Sent:   Wednesday, June 23, 1999 8:04 AM
To:     SmartCardSDK@DISCUSS.MICROSOFT.COM
Subject:        SCardGetStatusChange not blocking

I'm trying to block for card change notification (specifically
insertion/removal) and SCardGetStatusChange does not block.  It always
returns immediately, even though the information in the SCARD_READERSTATE
structure does not change.  I'm on Windows NT 4.0 with a Litronic 210 reader
and the CyberFlex Access Non-Crypto card.

here's the code...

        SCARD_READERSTATE readerstate;
        memset(&readerstate, 0, sizeof(SCARD_READERSTATE));
        readerstate.szReader = PS_T("Litronic 210 0");
        readerstate.pvUserData = 0;
        readerstate.dwCurrentState = SCARD_STATE_UNAWARE;

        // call first time to setup the values
        PS_DWORD dwResult = SCardGetStatusChange(m_cardContext, 10000,
&readerstate, 1);
        // call again with same values to wait for state change
        while (true)
        {
                             readerstate.dwCurrentState =
readerstate.dwEventState;
                dwResult = SCardGetStatusChange(m_cardContext, 0,
&readerstate, 0);
        }
        return dwResult;


yes, i know this is an infinite loop, but I'm using this code to test that
the blocking works, which it doesn't.   I'll clean it up once I figure out
how to get it to work.

thanks for your help...
Mark Zuber
mzuber@pervasive.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic