RE: Problem manually creating IRP to submit from one driv er to another

Wouldn’t ExCreateCallback and friends do a better job here ?


-----Original Message-----
From: David West []
Sent: Thursday, October 09, 2003 11:40 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Problem manually creating IRP to submit from one driver to


I’m trying to send a simple IOCTL to a driver from another driver, by
manually creating an IRP and submitting it (Is there another way to do this
from within a driver?). Unfortunately I am getting a BugCheck 7E,
(exception c0000005, indicating a memory access violation), when the driver
that is being called calls the IoComplete request function.

When I test sending the IOCTL with a user mode application, using the
DeviceIoControl function, it executes without any problems.

This is the code I am using, is there any obvious problems/ommisions? Am I
forgetting to initialise some part of the IRP or something? I’ve been stuck
on this for ages, please help!

ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);

status = IoGetDeviceObjectPointer(


pIrp = IoAllocateIrp(m_pMyDeviceObject->StackSize, FALSE);

if(pIrp == NULL){

pIrp->AssociatedIrp.SystemBuffer = pBuffer;
IoSetCompletionRoutine(pIrp, NULL, NULL, FALSE, FALSE, FALSE);
_IRPSP = IoGetNextIrpStackLocation(pIrp);
_IRPSP->MinorFunction = 0;
_IRPSP->DeviceObject = m_pMyDeviceObject;
_IRPSP->FileObject = m_pMyFileObject;
_IRPSP->Parameters.DeviceIoControl.IoControlCode = IOCTL_DO_SOMETHING;
_IRPSP->Parameters.DeviceIoControl.InputBufferLength =
_IRPSP->Parameters.DeviceIoControl.OutputBufferLength = 0;
_IRPSP->Parameters.DeviceIoControl.Type3InputBuffer = 0;

//Go ahead and submit the request
status = IoCallDriver(m_pMyDeviceObject, pIrp);


Questions? First check the Kernel Driver FAQ at

You are currently subscribed to ntdev as:
To unsubscribe send a blank email to

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.