[KMDF 1.9] how to "destroy" device interface

Hi all,
I try to develop an USB smartcard reader driver with multiple smartcard slot ( 3 device interface for 3 slot smartcard reader )

now I try to validate all pnp and power management process.

sequence of surpriseRemoval :
0) Call deviceSurpriseRemoval

  1. Call DeviceExitD0,
  2. Call DeviceReleaseHardware
    and after close all deviceinterface
  3. fileIoCanceledOnQueue ( per device interface)
  4. fileCleanUp ( per device interface)
  5. fileClose ( per device interface)
  6. and Finish with driverCleanUp

This process seems to be ok and work fine.

In device manager, if I disable the device :
Sequence is:
0) fileIoCanceledOnQueue ( per device interface)

  1. fileCleanUp ( per device interface)
  2. fileClose ( per device interface)
    and after remove the USB PDO
  3. DeviceQueryRemove
  4. DeviceD0Exit
  5. DeviceReleaseHardware
  6. DriverCleanUp

This process seems to be ok and work fine

Now the problem is when I launch a smartcard tool,
sequence is the same but the device manager refuse to remove the device ( dialogBox appear with message “need to reboot the machine” )
sequence is :
0) fileIoCanceledOnQueue ( called 2 times but never called for the third device interface )

  1. fileCleanUp ( called for canceled success )
  2. fileClose ( called for cleanUp success )

The smartcard tools continue to exchange DATA with the Third device interface and refuse to remove the device.

My question is how to “inform” device interfaces that the reader is in “removal” process ?

is it a problem of delay ? because 2 first interface are correctly cloed and cleaned but not the third.

I suppose if device interface is alive the device could not removed ?

Thanks in advance,

Best regards,

Moulefrite

, all device interface are closed and deleted ( cleanUp and close callback called) before

If I launch a smartcard tool

Everything is behaving tgebway it should. The os sends notifications of removal to all handles whose process has registered for notifications. The smard card test app does not register or it has a bug in it where it only processes two notifications. Either way, there is nothing more to di in your driver to handle this scenario from a notification point of view.

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Wednesday, March 23, 2011 4:15 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] [KMDF 1.9] how to “destroy” device interface

Hi all,
I try to develop an USB smartcard reader driver with multiple smartcard slot ( 3 device interface for 3 slot smartcard reader )

now I try to validate all pnp and power management process.

sequence of surpriseRemoval :
0) Call deviceSurpriseRemoval

  1. Call DeviceExitD0,
  2. Call DeviceReleaseHardware
    and after close all deviceinterface
  3. fileIoCanceledOnQueue ( per device interface)
  4. fileCleanUp ( per device interface)
  5. fileClose ( per device interface)
  6. and Finish with driverCleanUp

This process seems to be ok and work fine.

In device manager, if I disable the device :
Sequence is:
0) fileIoCanceledOnQueue ( per device interface)

  1. fileCleanUp ( per device interface)
  2. fileClose ( per device interface)
    and after remove the USB PDO
  3. DeviceQueryRemove
  4. DeviceD0Exit
  5. DeviceReleaseHardware
  6. DriverCleanUp

This process seems to be ok and work fine

Now the problem is when I launch a smartcard tool,
sequence is the same but the device manager refuse to remove the device ( dialogBox appear with message “need to reboot the machine” )
sequence is :
0) fileIoCanceledOnQueue ( called 2 times but never called for the third device interface )

  1. fileCleanUp ( called for canceled success )
  2. fileClose ( called for cleanUp success )

The smartcard tools continue to exchange DATA with the Third device interface and refuse to remove the device.

My question is how to “inform” device interfaces that the reader is in “removal” process ?

is it a problem of delay ? because 2 first interface are correctly cloed and cleaned but not the third.

I suppose if device interface is alive the device could not removed ?

Thanks in advance,

Best regards,

Moulefrite

, all device interface are closed and deleted ( cleanUp and close callback called) before

If I launch a smartcard tool


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thank you Doron for your reply.
So you confirm me that the smartcard tool have a bug and my driver react well.
And It’s possible to “force” to close an Handle caught by user land ?

Thanks in advance,

Moulefrite

No way to force the handle to be closed

d

dent from a phine with no keynoard

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Wednesday, March 23, 2011 7:47 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] [KMDF 1.9] how to “destroy” device interface

Thank you Doron for your reply.
So you confirm me that the smartcard tool have a bug and my driver react well.
And It’s possible to “force” to close an Handle caught by user land ?

Thanks in advance,

Moulefrite


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Ok Doron thanks a lot for your help

Best regards,

Moulefrite