Hi, why is this not waiting at all, there is no delay:

LARGE_INTEGER x;
NTSTATUS y;
x.QuadPart = 100000000I64; // wait 10 seconds
y = KeDelayExecutionThread( KernelMode, FALSE, &x);

Here, y == STATUS_SUCCESS meaning the wait was completed, but it was not,
and IRQL == PASSIVE_LEVEL.

Re: KeDelayExecutionThread not waiting by Don

Don
Thu Oct 11 13:15:10 PDT 2007

Because you specified 10 seconds after midnite in 1601 or any time there
after for the thread to run again. The value has to be negative for a 10
second relative delay. A lot of people use macros to simplify this, see
http://www.osronline.com/article.cfm?article=261


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
news:489979A2-D937-4E3F-936A-91192BB85403@microsoft.com...
> Hi, why is this not waiting at all, there is no delay:
>
> LARGE_INTEGER x;
> NTSTATUS y;
> x.QuadPart = 100000000I64; // wait 10 seconds
> y = KeDelayExecutionThread( KernelMode, FALSE, &x);
>
> Here, y == STATUS_SUCCESS meaning the wait was completed, but it was not,
> and IRQL == PASSIVE_LEVEL.



Re: KeDelayExecutionThread not waiting by Eliyas

Eliyas
Thu Oct 11 13:57:56 PDT 2007

Check out the following macros in the WDF header files:

WDF_REL_TIMEOUT_IN_MS
WDF_REL_TIMEOUT_IN_SEC
WDF_REL_TIMEOUT_IN_US

We also have absolute versions of these macros.

-Eliyas

"Don Burn" <burn@stopspam.windrvr.com> wrote in message
news:%23vsdoNEDIHA.1208@TK2MSFTNGP03.phx.gbl...
> Because you specified 10 seconds after midnite in 1601 or any time there
> after for the thread to run again. The value has to be negative for a 10
> second relative delay. A lot of people use macros to simplify this, see
> http://www.osronline.com/article.cfm?article=261
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
>
> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in
> message news:489979A2-D937-4E3F-936A-91192BB85403@microsoft.com...
>> Hi, why is this not waiting at all, there is no delay:
>>
>> LARGE_INTEGER x;
>> NTSTATUS y;
>> x.QuadPart = 100000000I64; // wait 10 seconds
>> y = KeDelayExecutionThread( KernelMode, FALSE, &x);
>>
>> Here, y == STATUS_SUCCESS meaning the wait was completed, but it was not,
>> and IRQL == PASSIVE_LEVEL.
>
>


Re: KeDelayExecutionThread not waiting by MichaelHarvey

MichaelHarvey
Thu Oct 11 15:26:00 PDT 2007

Thanks, What I am really trying to do is slow down my driver enough so my
user mode process can get all the notifications from KeSetEvent. Maybe a
reasonable timer value will do most of the time, but I would prefer a
guaranteed method.

"Don Burn" wrote:

> Because you specified 10 seconds after midnite in 1601 or any time there
> after for the thread to run again. The value has to be negative for a 10
> second relative delay. A lot of people use macros to simplify this, see
> http://www.osronline.com/article.cfm?article=261
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
>
> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
> news:489979A2-D937-4E3F-936A-91192BB85403@microsoft.com...
> > Hi, why is this not waiting at all, there is no delay:
> >
> > LARGE_INTEGER x;
> > NTSTATUS y;
> > x.QuadPart = 100000000I64; // wait 10 seconds
> > y = KeDelayExecutionThread( KernelMode, FALSE, &x);
> >
> > Here, y == STATUS_SUCCESS meaning the wait was completed, but it was not,
> > and IRQL == PASSIVE_LEVEL.
>
>
>

Re: KeDelayExecutionThread not waiting by Don

Don
Thu Oct 11 15:39:23 PDT 2007

That is one of the reasons I would never use a shared event, you cannot
guarantee this no matter what. If you want a sure method convert this to an
inverted call.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
news:A87673E6-C799-4C90-8905-2EE2A04615F5@microsoft.com...
> Thanks, What I am really trying to do is slow down my driver enough so my
> user mode process can get all the notifications from KeSetEvent. Maybe a
> reasonable timer value will do most of the time, but I would prefer a
> guaranteed method.
>
> "Don Burn" wrote:
>
>> Because you specified 10 seconds after midnite in 1601 or any time there
>> after for the thread to run again. The value has to be negative for a 10
>> second relative delay. A lot of people use macros to simplify this, see
>> http://www.osronline.com/article.cfm?article=261
>>
>>
>> --
>> Don Burn (MVP, Windows DDK)
>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/WinDrvr
>> Remove StopSpam to reply
>>
>>
>> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in
>> message
>> news:489979A2-D937-4E3F-936A-91192BB85403@microsoft.com...
>> > Hi, why is this not waiting at all, there is no delay:
>> >
>> > LARGE_INTEGER x;
>> > NTSTATUS y;
>> > x.QuadPart = 100000000I64; // wait 10 seconds
>> > y = KeDelayExecutionThread( KernelMode, FALSE, &x);
>> >
>> > Here, y == STATUS_SUCCESS meaning the wait was completed, but it was
>> > not,
>> > and IRQL == PASSIVE_LEVEL.
>>
>>
>>



Re: KeDelayExecutionThread not waiting by Tim

Tim
Thu Oct 11 19:29:28 PDT 2007

Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
>
>Thanks, What I am really trying to do is slow down my driver enough so my
>user mode process can get all the notifications from KeSetEvent.

So they can "get" all the notifications? What do you mean by that?
KeSetEvent takes blocked processes and makes them ready to run. And they
will run, as soon as they can. The event is not going to expire.

If your driver has to wait for some action by the user-mode process, then
you need to have the user-mode process send an ioctl.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: KeDelayExecutionThread not waiting by Doron

Doron
Thu Oct 11 19:49:57 PDT 2007

instead of a shared event, have the application pend mulitple requests at
the same time. this way you have a one to one relationship between an
"event" occurring in the driver and notifying the application.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
news:A87673E6-C799-4C90-8905-2EE2A04615F5@microsoft.com...
> Thanks, What I am really trying to do is slow down my driver enough so my
> user mode process can get all the notifications from KeSetEvent. Maybe a
> reasonable timer value will do most of the time, but I would prefer a
> guaranteed method.
>
> "Don Burn" wrote:
>
>> Because you specified 10 seconds after midnite in 1601 or any time there
>> after for the thread to run again. The value has to be negative for a 10
>> second relative delay. A lot of people use macros to simplify this, see
>> http://www.osronline.com/article.cfm?article=261
>>
>>
>> --
>> Don Burn (MVP, Windows DDK)
>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/WinDrvr
>> Remove StopSpam to reply
>>
>>
>> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in
>> message
>> news:489979A2-D937-4E3F-936A-91192BB85403@microsoft.com...
>> > Hi, why is this not waiting at all, there is no delay:
>> >
>> > LARGE_INTEGER x;
>> > NTSTATUS y;
>> > x.QuadPart = 100000000I64; // wait 10 seconds
>> > y = KeDelayExecutionThread( KernelMode, FALSE, &x);
>> >
>> > Here, y == STATUS_SUCCESS meaning the wait was completed, but it was
>> > not,
>> > and IRQL == PASSIVE_LEVEL.
>>
>>
>>


Re: KeDelayExecutionThread not waiting by MichaelHarvey

MichaelHarvey
Fri Oct 12 13:14:01 PDT 2007



"Tim Roberts" wrote:

> Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
> >
> >Thanks, What I am really trying to do is slow down my driver enough so my
> >user mode process can get all the notifications from KeSetEvent.
>
> So they can "get" all the notifications? What do you mean by that?
> KeSetEvent takes blocked processes and makes them ready to run. And they
> will run, as soon as they can. The event is not going to expire.
>
> If your driver has to wait for some action by the user-mode process, then
> you need to have the user-mode process send an ioctl.
> --
> Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>
The user-mode process is calling DeviceIoControl followed by
GetOverlappedResult. The driver is calling KeSetEvent with no wait. Is it
possible to wait until the user-mode process has all of the result?

Re: KeDelayExecutionThread not waiting by Don

Don
Fri Oct 12 13:22:51 PDT 2007

What do you mean, the application is using a device I/O control request by
your description, and the driver is using an event somehow signaling the
event must complete the request.

Tell us more about what you are doing at the moment you have not described
you design.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
news:5443A30D-503F-42BB-955C-DB64417246B2@microsoft.com...
>
>
> "Tim Roberts" wrote:
>
>> Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
>> >
>> >Thanks, What I am really trying to do is slow down my driver enough so
>> >my
>> >user mode process can get all the notifications from KeSetEvent.
>>
>> So they can "get" all the notifications? What do you mean by that?
>> KeSetEvent takes blocked processes and makes them ready to run. And they
>> will run, as soon as they can. The event is not going to expire.
>>
>> If your driver has to wait for some action by the user-mode process, then
>> you need to have the user-mode process send an ioctl.
>> --
>> Tim Roberts, timr@probo.com
>> Providenza & Boekelheide, Inc.
>>
> The user-mode process is calling DeviceIoControl followed by
> GetOverlappedResult. The driver is calling KeSetEvent with no wait. Is it
> possible to wait until the user-mode process has all of the result?



Re: KeDelayExecutionThread not waiting by Tim

Tim
Sat Oct 13 19:52:09 PDT 2007

Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
>"Tim Roberts" wrote:
>
>> Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
>> >
>> >Thanks, What I am really trying to do is slow down my driver enough so my
>> >user mode process can get all the notifications from KeSetEvent.
>>
>> So they can "get" all the notifications? What do you mean by that?
>> KeSetEvent takes blocked processes and makes them ready to run. And they
>> will run, as soon as they can. The event is not going to expire.
>>
>> If your driver has to wait for some action by the user-mode process, then
>> you need to have the user-mode process send an ioctl.
>
>The user-mode process is calling DeviceIoControl followed by
>GetOverlappedResult. The driver is calling KeSetEvent with no wait. Is it
>possible to wait until the user-mode process has all of the result?

This is a most confusing description. If your user-mode process is blocked
in GetOverlappedResult, then it isn't going to move forward until your
driver completes the request. It doesn't matter how many KeSetEvents you
do.

Are you saying you have other threads waiting on the events, and those
threads must process the events before the GetOverlappedResult returns?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: KeDelayExecutionThread not waiting by MichaelHarvey

MichaelHarvey
Tue Oct 16 08:14:01 PDT 2007

The driver device object type is FILE_DEVICE_UNKNOWN.

When there is a notification to send, this is placed in the device extension
and a notification event in the extension is set. All of the information is
included in the extension, so there is no need for GetOverlappedResult in the
user-mode process.

There is one dispatch routine. It transfers the information from the
extension to the IRP Stack Location, for transfer to the user-mode process.

What is the mechanism here? Does setting the notification event signal the
user-mode process and it requests the info from the driver through the
dispatch routine?

"Don Burn" wrote:

> What do you mean, the application is using a device I/O control request by
> your description, and the driver is using an event somehow signaling the
> event must complete the request.
>
> Tell us more about what you are doing at the moment you have not described
> you design.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
>
> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
> news:5443A30D-503F-42BB-955C-DB64417246B2@microsoft.com...
> >
> >
> > "Tim Roberts" wrote:
> >
> >> Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
> >> >
> >> >Thanks, What I am really trying to do is slow down my driver enough so
> >> >my
> >> >user mode process can get all the notifications from KeSetEvent.
> >>
> >> So they can "get" all the notifications? What do you mean by that?
> >> KeSetEvent takes blocked processes and makes them ready to run. And they
> >> will run, as soon as they can. The event is not going to expire.
> >>
> >> If your driver has to wait for some action by the user-mode process, then
> >> you need to have the user-mode process send an ioctl.
> >> --
> >> Tim Roberts, timr@probo.com
> >> Providenza & Boekelheide, Inc.
> >>
> > The user-mode process is calling DeviceIoControl followed by
> > GetOverlappedResult. The driver is calling KeSetEvent with no wait. Is it
> > possible to wait until the user-mode process has all of the result?
>
>
>

Re: KeDelayExecutionThread not waiting by MichaelHarvey

MichaelHarvey
Tue Oct 16 09:23:01 PDT 2007

That could work if I filter the notifications at the driver so only the
important ones get sent, there won't be too many of them. Just have to figure
out how to do it. I think it requires storing the notification on the stack
and not in the driver extension, and figure out how to make the dispatch
routine get it from the right place on the stack.

"Doron Holan [MSFT]" wrote:

> instead of a shared event, have the application pend mulitple requests at
> the same time. this way you have a one to one relationship between an
> "event" occurring in the driver and notifying the application.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
> news:A87673E6-C799-4C90-8905-2EE2A04615F5@microsoft.com...
> > Thanks, What I am really trying to do is slow down my driver enough so my
> > user mode process can get all the notifications from KeSetEvent. Maybe a
> > reasonable timer value will do most of the time, but I would prefer a
> > guaranteed method.
> >
> > "Don Burn" wrote:
> >
> >> Because you specified 10 seconds after midnite in 1601 or any time there
> >> after for the thread to run again. The value has to be negative for a 10
> >> second relative delay. A lot of people use macros to simplify this, see
> >> http://www.osronline.com/article.cfm?article=261
> >>
> >>
> >> --
> >> Don Burn (MVP, Windows DDK)
> >> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >> Website: http://www.windrvr.com
> >> Blog: http://msmvps.com/blogs/WinDrvr
> >> Remove StopSpam to reply
> >>
> >>
> >> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in
> >> message
> >> news:489979A2-D937-4E3F-936A-91192BB85403@microsoft.com...
> >> > Hi, why is this not waiting at all, there is no delay:
> >> >
> >> > LARGE_INTEGER x;
> >> > NTSTATUS y;
> >> > x.QuadPart = 100000000I64; // wait 10 seconds
> >> > y = KeDelayExecutionThread( KernelMode, FALSE, &x);
> >> >
> >> > Here, y == STATUS_SUCCESS meaning the wait was completed, but it was
> >> > not,
> >> > and IRQL == PASSIVE_LEVEL.
> >>
> >>
> >>
>
>

Re: KeDelayExecutionThread not waiting by Don

Don
Tue Oct 16 09:32:20 PDT 2007

No, you don't store it on the stack. You take a bunch of IRP's and queue
them with a cancel safe queue, then when there is something to report you
complete the IRP with the data to report in the buffer associated with the
IRP. This is a very standard model for Windows drivers.

If you need to not loose an event, you may need to have a secondary queue
that can store event data if there is no IRP to satisfy the event when it
happens. But start with the above, an article on this model is at
http://www.osronline.com/article.cfm?id=94



--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
news:0EA25500-C4C6-45E1-9D88-D86330D08771@microsoft.com...
> That could work if I filter the notifications at the driver so only the
> important ones get sent, there won't be too many of them. Just have to
> figure
> out how to do it. I think it requires storing the notification on the
> stack
> and not in the driver extension, and figure out how to make the dispatch
> routine get it from the right place on the stack.
>
> "Doron Holan [MSFT]" wrote:
>
>> instead of a shared event, have the application pend mulitple requests at
>> the same time. this way you have a one to one relationship between an
>> "event" occurring in the driver and notifying the application.
>>
>> d
>>
>> --
>> Please do not send e-mail directly to this alias. this alias is for
>> newsgroup purposes only.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in
>> message
>> news:A87673E6-C799-4C90-8905-2EE2A04615F5@microsoft.com...
>> > Thanks, What I am really trying to do is slow down my driver enough so
>> > my
>> > user mode process can get all the notifications from KeSetEvent. Maybe
>> > a
>> > reasonable timer value will do most of the time, but I would prefer a
>> > guaranteed method.
>> >
>> > "Don Burn" wrote:
>> >
>> >> Because you specified 10 seconds after midnite in 1601 or any time
>> >> there
>> >> after for the thread to run again. The value has to be negative for a
>> >> 10
>> >> second relative delay. A lot of people use macros to simplify this,
>> >> see
>> >> http://www.osronline.com/article.cfm?article=261
>> >>
>> >>
>> >> --
>> >> Don Burn (MVP, Windows DDK)
>> >> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> >> Website: http://www.windrvr.com
>> >> Blog: http://msmvps.com/blogs/WinDrvr
>> >> Remove StopSpam to reply
>> >>
>> >>
>> >> "Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in
>> >> message
>> >> news:489979A2-D937-4E3F-936A-91192BB85403@microsoft.com...
>> >> > Hi, why is this not waiting at all, there is no delay:
>> >> >
>> >> > LARGE_INTEGER x;
>> >> > NTSTATUS y;
>> >> > x.QuadPart = 100000000I64; // wait 10 seconds
>> >> > y = KeDelayExecutionThread( KernelMode, FALSE, &x);
>> >> >
>> >> > Here, y == STATUS_SUCCESS meaning the wait was completed, but it was
>> >> > not,
>> >> > and IRQL == PASSIVE_LEVEL.
>> >>
>> >>
>> >>
>>
>>



Re: KeDelayExecutionThread not waiting by MichaelHarvey

MichaelHarvey
Fri Nov 09 09:45:02 PST 2007

Thanks, I appreciate the inverted call example, and it seems to have some of
what I need but not completely.

If I could write this toy driver, I would have the mechanism I need. The
driver will be a ticking clock with a thread that loops every few
milliseconds and records the current time. Each recorded time is a data that
needs to be received by a user mode process that opens the driver and
constantly reads. If the driver thread runs faster than the user mode
process, it will run out of storage and begin to throw away data.

The real driver might have data a little larger than the time, but it would
not need to store more than 10 pieces of data. Those are practical
limitations that may determine the mechanism for storing the data. I expect
it would be stored in IRP's but I don't know how to create and transfer IRP's
from the driver thread to the dispatch routine.

Is there an example anywhere that would speed me on my way?

"Don Burn" wrote:

> No, you don't store it on the stack. You take a bunch of IRP's and queue
> them with a cancel safe queue, then when there is something to report you
> complete the IRP with the data to report in the buffer associated with the
> IRP. This is a very standard model for Windows drivers.
>
> If you need to not loose an event, you may need to have a secondary queue
> that can store event data if there is no IRP to satisfy the event when it
> happens. But start with the above, an article on this model is at
> http://www.osronline.com/article.cfm?id=94


Re: KeDelayExecutionThread not waiting by Tim

Tim
Fri Nov 09 20:22:52 PST 2007

Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:

>Thanks, I appreciate the inverted call example, and it seems to have some of
>what I need but not completely.
>
>If I could write this toy driver, I would have the mechanism I need. The
>driver will be a ticking clock with a thread that loops every few
>milliseconds and records the current time. Each recorded time is a data that
>needs to be received by a user mode process that opens the driver and
>constantly reads. If the driver thread runs faster than the user mode
>process, it will run out of storage and begin to throw away data.
>
>The real driver might have data a little larger than the time, but it would
>not need to store more than 10 pieces of data. Those are practical
>limitations that may determine the mechanism for storing the data. I expect
>it would be stored in IRP's but I don't know how to create and transfer IRP's
>from the driver thread to the dispatch routine.

Why do you think this is not the inverted call model? You have your user
mode application queue up a bunch of IRPs (10, 20, however many you need),
and when data is ready, the driver completes one of them. The app does
what it needs to do and resubmits it. We're pumping 45 megabytes/second
through a USB endpoint doing exactly this.

Note, however, that you cannot rely on a user mode application being
scheduled on a millisecond basis. You will still be subject to scheduling
quanta, and that means there may be dozens of milliseconds when your user
mode app doesn't run.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: KeDelayExecutionThread not waiting by MichaelHarvey

MichaelHarvey
Thu Nov 15 07:53:04 PST 2007



"Tim Roberts" wrote:

> Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
>
> >Thanks, I appreciate the inverted call example, and it seems to have some of
> >what I need but not completely.
> >
> >If I could write this toy driver, I would have the mechanism I need. The
> >driver will be a ticking clock with a thread that loops every few
> >milliseconds and records the current time. Each recorded time is a data that
> >needs to be received by a user mode process that opens the driver and
> >constantly reads. If the driver thread runs faster than the user mode
> >process, it will run out of storage and begin to throw away data.
> >
> >The real driver might have data a little larger than the time, but it would
> >not need to store more than 10 pieces of data. Those are practical
> >limitations that may determine the mechanism for storing the data. I expect
> >it would be stored in IRP's but I don't know how to create and transfer IRP's
> >from the driver thread to the dispatch routine.
>
> Why do you think this is not the inverted call model? You have your user
> mode application queue up a bunch of IRPs (10, 20, however many you need),
> and when data is ready, the driver completes one of them. The app does
> what it needs to do and resubmits it. We're pumping 45 megabytes/second
> through a USB endpoint doing exactly this.
>
> Note, however, that you cannot rely on a user mode application being
> scheduled on a millisecond basis. You will still be subject to scheduling
> quanta, and that means there may be dozens of milliseconds when your user
> mode app doesn't run.
> --
> Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>
This example doesn't show more than one IRP being used at any one time,
although it has the capabilility to queue the IRP's. I'm not sure how to use
that capability. In my case there is no application, only a service and
driver. So I'm not sure how to queue up more than one request from the
service into the driver. I am only guessing I might create 10 or 20 threads
and open the driver with each one.


Re: KeDelayExecutionThread not waiting by Don

Don
Thu Nov 15 07:58:53 PST 2007

From the service just open the driver with OVERLAPPED and then you can send
as many requests as you want to the driver. Each request can be associated
with an event so you can wait for multiple and get the correct request
number back.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Michael Harvey" <MichaelHarvey@discussions.microsoft.com> wrote in message
news:3C0B518D-94F0-404B-AF2C-70AD8FFCEF32@microsoft.com...
>
>
> "Tim Roberts" wrote:
>
>> Michael Harvey <MichaelHarvey@discussions.microsoft.com> wrote:
>>
>> >Thanks, I appreciate the inverted call example, and it seems to have
>> >some of
>> >what I need but not completely.
>> >
>> >If I could write this toy driver, I would have the mechanism I need. The
>> >driver will be a ticking clock with a thread that loops every few
>> >milliseconds and records the current time. Each recorded time is a data
>> >that
>> >needs to be received by a user mode process that opens the driver and
>> >constantly reads. If the driver thread runs faster than the user mode
>> >process, it will run out of storage and begin to throw away data.
>> >
>> >The real driver might have data a little larger than the time, but it
>> >would
>> >not need to store more than 10 pieces of data. Those are practical
>> >limitations that may determine the mechanism for storing the data. I
>> >expect
>> >it would be stored in IRP's but I don't know how to create and transfer
>> >IRP's
>> >from the driver thread to the dispatch routine.
>>
>> Why do you think this is not the inverted call model? You have your user
>> mode application queue up a bunch of IRPs (10, 20, however many you
>> need),
>> and when data is ready, the driver completes one of them. The app does
>> what it needs to do and resubmits it. We're pumping 45 megabytes/second
>> through a USB endpoint doing exactly this.
>>
>> Note, however, that you cannot rely on a user mode application being
>> scheduled on a millisecond basis. You will still be subject to
>> scheduling
>> quanta, and that means there may be dozens of milliseconds when your user
>> mode app doesn't run.
>> --
>> Tim Roberts, timr@probo.com
>> Providenza & Boekelheide, Inc.
>>
> This example doesn't show more than one IRP being used at any one time,
> although it has the capabilility to queue the IRP's. I'm not sure how to
> use
> that capability. In my case there is no application, only a service and
> driver. So I'm not sure how to queue up more than one request from the
> service into the driver. I am only guessing I might create 10 or 20
> threads
> and open the driver with each one.
>



Re: KeDelayExecutionThread not waiting by Maxim

Maxim
Thu Nov 15 09:44:45 PST 2007

> that capability. In my case there is no application, only a service and
> driver.

Then the service is the "application". In this context, "application" means
"user mode code".

>So I'm not sure how to queue up more than one request from the
> service into the driver. I am only guessing I might create 10 or 20 threads
> and open the driver with each one.

CreateFile with FILE_FLAG_OVERLAPPED, then call DeviceIoControl 10 or 20 times.
Use one of the 3 Win32 mechanisms to detect the completion of the IOCTL IRPs
you have sent.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com