IoCallDriver() Access Violation

Hi,

This is my first driver project, it is an serial upper filter driver.

I want to create an IRP_MJ_CLOSE irp to pass down to the lower device object
on top of which I am attached.

I do the following in a private IOCTL (less error checks):

KEVENT event;
IO_STATUS_BLOCK iosb;

KeInitializeEvent(&event,NotificationEvent,FALSE);
PIRP OwnIrp = IoBuildSynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS,
DevExt->LowerDevice, NULL, 0, 0, &event, &iosb);

PIO_STACK_LOCATION MyStack = IoGetNextIrpStackLocation(OwnIrp);
MyStack->MajorFunction = IRP_MJ_CLOSE;
IoCallDriver(DevExt->LowerDevice,OwnIrp);

At this point I get an access violation from a lower device at a point
“Modem!UniCloseStarter+0x19”

Any ideas?

Thanks

Alasdair

NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.

since you’re trying to tell the lower driver that a file object is being
destroyed (that’s what close does) you might consider including a file
object in the IRP.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alasdair Tompson
(external)
Sent: Tuesday, October 05, 2004 9:33 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoCallDriver() Access Violation

Hi,

This is my first driver project, it is an serial upper filter
driver.

I want to create an IRP_MJ_CLOSE irp to pass down to the lower
device object on top of which I am attached.

I do the following in a private IOCTL (less error checks):

KEVENT event;
IO_STATUS_BLOCK iosb;

KeInitializeEvent(&event,NotificationEvent,FALSE);
PIRP OwnIrp = IoBuildSynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS,
DevExt->LowerDevice, NULL, 0, 0, &event, &iosb);

PIO_STACK_LOCATION MyStack = IoGetNextIrpStackLocation(OwnIrp);
MyStack->MajorFunction = IRP_MJ_CLOSE;
IoCallDriver(DevExt->LowerDevice,OwnIrp);

At this point I get an access violation from a lower device at a
point “Modem!UniCloseStarter+0x19”

Any ideas?

Thanks

Alasdair


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to
xxxxx@lists.osr.com

NOTICE AND DISCLAIMER:

This email (including attachments) is confidential. If you have
received this email in error please notify the sender immediately and
delete this email from your system without copying or disseminating it
or placing any reliance upon its contents. We cannot accept liability
for any breaches of confidence arising through use of email. Any
opinions expressed in this email (including attachments) are those of
the author and do not necessarily reflect our opinions. We will not
accept responsibility for any commitments made by our employees outside
the scope of our business. We do not warrant the accuracy or
completeness of such information.

Hi Peter,

Thanks for this, I set the FileObject in “MyStack” and now it works!

The odd thing is that Walt Oney’s sample code does not do this and neither
does some other sample code I received (both of which presumably work) so
why I needed to do this I really don’t know… but then I am just a
beginner…

Thanks - I can now proceed to my next bug.

Alasdair

-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: 05 October 2004 17:42
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoCallDriver() Access Violation

since you’re trying to tell the lower driver that a file object is being
destroyed (that’s what close does) you might consider including a file
object in the IRP.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alasdair Tompson
(external)
Sent: Tuesday, October 05, 2004 9:33 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoCallDriver() Access Violation

Hi,

This is my first driver project, it is an serial upper filter driver.

I want to create an IRP_MJ_CLOSE irp to pass down to the lower device object
on top of which I am attached.

I do the following in a private IOCTL (less error checks):

KEVENT event;
IO_STATUS_BLOCK iosb;

KeInitializeEvent(&event,NotificationEvent,FALSE);
PIRP OwnIrp = IoBuildSynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS,
DevExt->LowerDevice, NULL, 0, 0, &event, &iosb);

PIO_STACK_LOCATION MyStack = IoGetNextIrpStackLocation(OwnIrp);
MyStack->MajorFunction = IRP_MJ_CLOSE;
IoCallDriver(DevExt->LowerDevice,OwnIrp);

At this point I get an access violation from a lower device at a point
“Modem!UniCloseStarter+0x19”

Any ideas?

Thanks

Alasdair


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

NOTICE AND DISCLAIMER:

This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.