Win7 driver verifier bugcheck

Hi,

I could use some help understanding how to make driver verifier happy on Win7. We’ve got a hid minidriver that bugchecks when I turn on verifier. The stop code is 0xc9 arg1:0x22e which says that we are completing the irp will success but not passing it down.

It blames the section that handles IRP_MN_START_DEVICE.
Here’s the code for that:

PNP code…
case IRP_MN_START_DEVICE:
{
KEVENT startEvent;
IO_COMPLETION_ROUTINE PnPComplete;

KeInitializeEvent(&startEvent, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(pIrp_I);
IoSetCompletionRoutine(pIrp_I, PnPComplete, &startEvent, TRUE, TRUE, TRUE);
ntStatus = IoCallDriver(GET_NEXT_DEVICE_OBJECT(pDeviceObject_I), pIrp_I);
if (STATUS_PENDING == ntStatus)
{
KeWaitForSingleObject(&startEvent, Executive, KernelMode, FALSE, NULL);
ntStatus = pIrp_I->IoStatus.Status;
}

pIrp_I->IoStatus.Status = ntStatus;
IoCompleteRequest(pIrp_I, IO_NO_INCREMENT);
return ntStatus;
}
break;

//PNP Callback
NTSTATUS PnPComplete(
IN PDEVICE_OBJECT pDeviceObject_I,
IN PIRP pIrp_I,
IN PVOID pContext_I)
{
UNREFERENCED_PARAMETER(pDeviceObject_I);

if (pIrp_I->PendingReturned)
{
KeSetEvent((PKEVENT)pContext_I, 0, FALSE);
}
return STATUS_MORE_PROCESSING_REQUIRED;
}

I can’t see what I’m doing wrong here. The irp is being passed down prior to completion. StaticDV gives it a clean bill of health and it works fine on Vista. Any hints would be greatly appreciated.

Hi Dan,

Verifier thinks that your driver was the first driver that called IoCompleteRequest for this IRP. The lower driver should have done that before your driver. Are you seeing the lowest driver on the stack calling IoCompleteRequest, as they should have?

I work on Verifier at MS so please feel free to send me email directly if you want to continue the discussion through email.

I expect that you will see the same type of break on Vista (and XP, etc.) if you enable Verifier Enhanced I/O Checking. The difference in Win7 is that Enhanced I/O Checking doesn’t exist anymore and its checks are now performed by the “regular” Verifier I/O Checking.

Thanks,
Dan

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@wacom.com
Sent: Friday, May 15, 2009 12:33 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Win7 driver verifier bugcheck

Hi,

I could use some help understanding how to make driver verifier happy on Win7. We’ve got a hid minidriver that bugchecks when I turn on verifier. The stop code is 0xc9 arg1:0x22e which says that we are completing the irp will success but not passing it down.

It blames the section that handles IRP_MN_START_DEVICE.
Here’s the code for that:

PNP code…
case IRP_MN_START_DEVICE:
{
KEVENT startEvent;
IO_COMPLETION_ROUTINE PnPComplete;

KeInitializeEvent(&startEvent, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(pIrp_I);
IoSetCompletionRoutine(pIrp_I, PnPComplete, &startEvent, TRUE, TRUE, TRUE);
ntStatus = IoCallDriver(GET_NEXT_DEVICE_OBJECT(pDeviceObject_I), pIrp_I);
if (STATUS_PENDING == ntStatus)
{
KeWaitForSingleObject(&startEvent, Executive, KernelMode, FALSE, NULL);
ntStatus = pIrp_I->IoStatus.Status;
}

pIrp_I->IoStatus.Status = ntStatus;
IoCompleteRequest(pIrp_I, IO_NO_INCREMENT);
return ntStatus;
}
break;

//PNP Callback
NTSTATUS PnPComplete(
IN PDEVICE_OBJECT pDeviceObject_I,
IN PIRP pIrp_I,
IN PVOID pContext_I)
{
UNREFERENCED_PARAMETER(pDeviceObject_I);

if (pIrp_I->PendingReturned)
{
KeSetEvent((PKEVENT)pContext_I, 0, FALSE);
}
return STATUS_MORE_PROCESSING_REQUIRED;
}

I can’t see what I’m doing wrong here. The irp is being passed down prior to completion. StaticDV gives it a clean bill of health and it works fine on Vista. Any hints would be greatly appreciated.


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

You code looks correct. Can you send the full output of !analyze -v?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@wacom.com
Sent: Friday, May 15, 2009 12:33 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Win7 driver verifier bugcheck

Hi,

I could use some help understanding how to make driver verifier happy on Win7. We’ve got a hid minidriver that bugchecks when I turn on verifier. The stop code is 0xc9 arg1:0x22e which says that we are completing the irp will success but not passing it down.

It blames the section that handles IRP_MN_START_DEVICE.
Here’s the code for that:

PNP code…
case IRP_MN_START_DEVICE:
{
KEVENT startEvent;
IO_COMPLETION_ROUTINE PnPComplete;

KeInitializeEvent(&startEvent, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(pIrp_I);
IoSetCompletionRoutine(pIrp_I, PnPComplete, &startEvent, TRUE, TRUE, TRUE);
ntStatus = IoCallDriver(GET_NEXT_DEVICE_OBJECT(pDeviceObject_I), pIrp_I);
if (STATUS_PENDING == ntStatus)
{
KeWaitForSingleObject(&startEvent, Executive, KernelMode, FALSE, NULL);
ntStatus = pIrp_I->IoStatus.Status;
}

pIrp_I->IoStatus.Status = ntStatus;
IoCompleteRequest(pIrp_I, IO_NO_INCREMENT);
return ntStatus;
}
break;

//PNP Callback
NTSTATUS PnPComplete(
IN PDEVICE_OBJECT pDeviceObject_I,
IN PIRP pIrp_I,
IN PVOID pContext_I)
{
UNREFERENCED_PARAMETER(pDeviceObject_I);

if (pIrp_I->PendingReturned)
{
KeSetEvent((PKEVENT)pContext_I, 0, FALSE);
}
return STATUS_MORE_PROCESSING_REQUIRED;
}

I can’t see what I’m doing wrong here. The irp is being passed down prior to completion. StaticDV gives it a clean bill of health and it works fine on Vista. Any hints would be greatly appreciated.


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