Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ProbeForRead

104 views
Skip to first unread message

veeman

unread,
Jan 29, 2007, 10:50:27 AM1/29/07
to
The following code is always throwing an exception, but if I comment it, my
driver works just fine.
So, any help is appreciated!

InputBuffer is char* allocated on stack in used mode. InputBufferLength is
buffer size.
Am I doing something wrong here??

if(ExGetPreviousMode() != KernelMode){
try{
ProbeForRead(InputBuffer, InputBufferLength, 1);
}except(EXCEPTION_EXECUTE_HANDLER){
KdPrint(("Exception!\n"));
IoStatus->Status = STATUS_INVALID_PARAMETER;
return FALSE;
}
}

thank you!


Arkady Frenkel

unread,
Jan 30, 2007, 2:20:05 AM1/30/07
to
Seems that InputBufferLength in driver have more length than buffer in user
mode you try to send. Check that with debugger. Just a hint
Arkady


"veeman" <yadaya...@yebi.se> wrote in message
news:eXm1z07Q...@TK2MSFTNGP06.phx.gbl...

Skywing [MVP]

unread,
Jan 30, 2007, 10:35:57 AM1/30/07
to
It could also be that InputBuffer is a kernel mode address (which might even
be the right thing here, such as if this is an ioctl handler with
METHOD_BUFFERED...).

--
Ken Johnson (Skywing)
Windows SDK MVP
http://www.nynaeve.net
"Arkady Frenkel" <ark...@hotmailxdotx.com> wrote in message
news:erUMS8DR...@TK2MSFTNGP05.phx.gbl...

duff_man

unread,
Jan 30, 2007, 1:54:57 PM1/30/07
to

"Skywing [MVP]" <skywing_...@valhallalegends.com> wrote in message
news:O$8JXRIR...@TK2MSFTNGP06.phx.gbl...

> It could also be that InputBuffer is a kernel mode address (which might
> even be the right thing here, such as if this is an ioctl handler with
> METHOD_BUFFERED...).
>
> --
> Ken Johnson (Skywing)

Ken, thanks for this comment. I'll check my code, but I think you are
right!!!


Anton Bassov

unread,
Jan 30, 2007, 10:07:03 PM1/30/07
to

> ProbeForRead(InputBuffer, InputBufferLength, 1);

> Am I doing something wrong here??

I would say that the excerpt below provides an answer to your question....

[begin quote]

If the specified range of memory is not within the user-mode address range,
ProbeForRead raises the STATUS_ACCESS_VIOLATION exception. If the beginning
of the address range is not aligned on the byte boundary that is specified
by Alignment, ProbeForRead raises the STATUS_DATATYPE_MISALIGNMENT exception.

[end quote]


Anton Bassov

0 new messages