loading drivers at windows startup

//smart card reader driver

Two simple problems i can’t get over with:

  1. Driver installs, reader is visible in SCListReaders() after installation, but after system restart it is not visible in that list any more.
    I use connection with serial driver, that could be the problem, but i set up this connection just before first communication session with card, and i close it after end of entire session.

  2. While developing i had some simplifications like forcing “SCARD_PRESENT” always.
    Now i would like driver to load (at install & at sytem boot) with SCARD_ABSENT and
    then set it on “SCARD_PRESENT” when in use by app.
    I guess somewhere when “OpenCard” or “connect to reader” command comes to driver.

Problem is that I can’t switch to SCARD_PRESENT after loading

driver loading stops here:

SCardSvr!CalaisHandlerEx *WARNING* New device ‘\?\ROOT#SMARTCARDREADER#0000#{50dd5230-ba8a-11d1-bf5d-0000f805f530}’ added.
>> BtscEvtIoDeviceControl
IOCTL_SMARTCARD_IS_PRESENT
Request: 0x7d8d40b0
ATTRIBUTE - 81d458f4

> ReaderFunction[RDF_CARD_TRACKING]
<< ReaderFunction[RDF_CARD_TRACKING], NTStatus 0x103
<< BtscEvtIoDeviceControl

and when i try to “open reader” ( [GetATR] button in my case ) :

SCardSvr!CServiceThread::DoConnect *WARNING* Failed to Connect to reader

and app informs me that theres no card. I use some freeware apps for testing.

I don’t know where to put “SCARD_PRESENT” since there’s no call to any of driver functions when pressing [GetATR] button.

  1. debugging question : how to get info on this “ATTRIBUTE - 81d458f4” when IOCTL_SMARTCARD_GET_ATTRIBUTE is called? i would like to know what attribute it gets.