Disable virtual storport miniport driver

Hi,

I want to disable my running virtual storport miniport driver using devcon.exe (devcon.exe disable …) or the device manager.

When I disable the driver right after initialization (HwStorInitialize) without doing anything else, it works fine. It works also fine after I created and reported a new virtual disk.

But when I sent a device io control code from my userspace application I cant disable the driver anymore (device manager and devcon.exe are stuck without doing anything).
My driver is not getting any message (no pnp, no adapter control code, nothing).
I have no idea how to debug this…

What I tried so far:
1)

  • Install/Start driver and initialize it.
  • Disable driver
  • Works, no problem
  • Install/Start driver and initialize it.
  • Create and report new virtual disk
  • Disable driver
  • Works, no problem
  • Install/Start driver and initialize it.
  • Send a code with DeviceIoControl to my driver:
    Use_decl_annotations
    VOID HwStorProcessServiceRequest(
    In PVOID DeviceExtension,
    In PVOID Irp
    )
    {
    // doing nothing for this test
    PIRP irp;
    irp = (PIRP)Irp;
    irp->IoStatus.Status = STATUS_SUCCESS;
    irp->IoStatus.Information = 0;
    IoCompleteRequest(irp, IO_NO_INCREMENT);
    }
  • Close the userspace application to close the opened handle
  • Disable driver
  • devcon and device manager stuck without notifying my driver about anythig.

I have no idea how to debug this…

Thank you…

You should be using StorPortCompleteServiceIrp instead of IoCompleteRequest.

Thats it, I have no idea why I did not find and read this!
Thank you so much!