Hi all,
I have a behavoir which I do not understand why this happen.
I have the changed SysVad-Audio driver as a child device of my USB driver and I use a DeviceExtentione more less the same way like in the sample driver.
if I get a call into my PnpHandle IRP_MN_REMOVE_DEVICE I will delete the allocated memory in my DeviceExtention
case IRP_MN_QUERY_REMOVE_DEVICE:
case IRP_MN_REMOVE_DEVICE:
case IRP_MN_SURPRISE_REMOVAL:
case IRP_MN_REMOVE_DEVICE:
pExt = static_cast<MyInterFace*>(_DeviceObject->DeviceExtension);
if (pExt->m_pCommonAdapter != NULL)
{
RemoveAllCaptureFilters(pExt->m_pCommonAdapter);
RemoveAllRenderFilters(pExt->m_pCommonAdapter);
pExt->m_pCommonAdapter->Cleanup();
pExt->m_pCommonAdapter->Release();
if (stack->MinorFunction == IRP_MN_REMOVE_DEVICE)
{
if (pExt->m_pCommonAdapter)
{
delete pExt->m_pCommonAdapter;
pExt->m_pCommonAdapter = NULL;
}
}
}
break;
during unplug. Everything is fine and the code works.
If I do an uninstall of the driver the code above bugchecks right after a delte the pExt->m_pCommonAdapter and I pass it over into
ntStatus = PcDispatchIrp(_DeviceObject, _Irp);
with this:
PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced. This cannot be protected by try-except.
Typically the address is just plain bad or it is pointing at freed memory.
Arguments:
Arg1: ffffd80755a7cf88, memory referenced.
Arg2: 0000000000000000, value 0 = read operation, 1 = write operation.
Arg3: fffff80422a3ce4f, If non-zero, the instruction address which referenced the bad memory
address.
Arg4: 0000000000000002, (reserved)
Debugging Details:
------------------
KEY_VALUES_STRING: 1
STACKHASH_ANALYSIS: 1
TIMELINE_ANALYSIS: 1
DUMP_CLASS: 1
DUMP_QUALIFIER: 0
BUILD_VERSION_STRING: 19041.1.amd64fre.vb_release.191206-1406
DUMP_TYPE: 0
BUGCHECK_P1: ffffd80755a7cf88
BUGCHECK_P2: 0
BUGCHECK_P3: fffff80422a3ce4f
BUGCHECK_P4: 2
READ_ADDRESS: Unable to get offset of nt!_MI_VISIBLE_STATE.SpecialPool
Unable to get value of nt!_MI_VISIBLE_STATE.SessionSpecialPool
ffffd80755a7cf88 Nonpaged pool
FAULTING_IP:
portcls!PnpStopDevice+223
fffff804`22a3ce4f 488b01 mov rax,qword ptr [rcx]
This will only happen if I enable verifier with the standard settings for my driver and just when I do a “uninstall” of the driver.
Not if I unplug the device.
Any idea what happen?
Thanks!
K_W