DriverEntry and DriverUnload.

Hi All,

I am working on a WDI model based driver for a SDIO wireless card. While installing the driver, DriverEntry gets called and is soon followed by a DriverUnload. There are no calls to other handlers in between.
I checked the call stack at the time of unload and it is as below:

00 ffffe6003ea6e658 fffff80bd3ec1499 QcaWdiSdio10x64!DriverUnload
01 ffffe6003ea6e660 fffff80bd3ec1406 ndis!ndisMInvokeDriverUnload+0x2d
02 ffffe6003ea6e690 fffff80bd2dfb3db ndis!ndisMUnloadEx+0x56
03 ffffe6003ea6e6d0 fffff802d57c022f VerifierExt!xdv_DriverUnload_wrapper+0x7b
04 ffffe6003ea6e700 fffff802d57c0025 nt!IopUnloadDriver+0x1f3
05 ffffe6003ea6e830 fffff802d53235e2 nt!PnpUnloadAttachedDriver+0x9d
06 ffffe6003ea6e880 fffff802d5766d1a nt!PnpRemoveLockedDeviceNode+0x22e
07 ffffe6003ea6e8e0 fffff802d5766a5a nt!PnpDeleteLockedDeviceNode+0x4e
08 ffffe6003ea6e920 fffff802d5765acd nt!PnpDeleteLockedDeviceNodes+0xbe
09 ffffe6003ea6e990 fffff802d566d846 nt!PnpProcessQueryRemoveAndEject+0x339
0a ffffe6003ea6eac0 fffff802d5677e24 nt!PnpProcessTargetDeviceEvent+0xf2
0b ffffe6003ea6eaf0 fffff802d523e158 nt!PnpDeviceEventWorker+0x254
0c ffffe6003ea6eb80 fffff802d52dcf77 nt!ExpWorkerThread+0xd8
0d ffffe6003ea6ec10 fffff802d5371a06 nt!PspSystemThreadStartup+0x47
0e ffffe6003ea6ec60 0000000000000000 nt!KiStartSystemThread+0x1

The card is inserted at this point and sits on a PCIe to SDIO adapter. The target system being used is a 64 bit machine running 15063 build of the OS.

I checked the setupapi logs and a snippet of it shows “timed out” message:

!!! dvi: Timed out waiting for device post-install to complete. 13:18:59.522
ump: Server install process exited with code 0x000005b4 13:19:00.332
ump: {Plug and Play Service: Device Install exit(000005b4)}
!!! ndv: Device install failed for device.
!!! ndv: Error 1460: This operation returned because the timeout period expired.
ndv: Installing NULL driver.
ndv: Marking non-present device ‘SD\VID_0271&PID_0701\5&13199BF9&0&0’ for reinstall

A full log of the process is pasted here:
https://pastebin.com/2hcXEFBS

I am not sure why PnpProcessQueryRemoveAndEject is being called.

A reboot of the device seems to bring up the module just fine.

Any guidance or help is welcome.

Regards,
Balaji.