Hi,
I have a question relating to getting the timeout parameter for
KeWaitForMultipleObjects working reasonably for me. The DDK help says this
is a PLARGE_INTEGER value and it is specified in 100 nanosecond units. It
also talks about relative vs. absolute values. So, I just want it to wait
for a few seconds and wake up. This code is executing on a system thread
that I have created in my driver, but the timeout seems to me much shorter
than I want it to be. Here’s my code block. Maybe I’m just being stupid,
but I’ve been staring at it too long to see what if anything I’m doing
wrong. Thanks for any help.
LARGE_INTEGER liTimeout;
KIRQL irqlCurrent;
DBGPRINT((“==>WorkThread: entry\n”));
// loop until we are signaled to terminate
while (!bKill)
{
liTimeout.LowPart = 400000;
liTimeout.HighPart = 0;
// wait to be signaled with timeout
status = KeWaitForMultipleObjects(iEventCount,
evList,
WaitAny,
Executive,
KernelMode,
FALSE,
&liTimeout,
NULL);
}
----------------------------
Paul Benware
Director of Client Development
KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD 20852
TELE: 1-301-468-9434
DIRECT: 1-585-582-3296
CELL: 1-585-739-0441
www.koolspan.com
You need a negative value for this, take a look at the following article for
a simple way to handle the time values.
http://www.osronline.com/article.cfm?article=261
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
“Paul Benware” wrote in message news:xxxxx@ntdev…
Hi,
I have a question relating to getting the timeout parameter for
KeWaitForMultipleObjects working reasonably for me. The DDK help says this
is a PLARGE_INTEGER value and it is specified in 100 nanosecond units. It
also talks about relative vs. absolute values. So, I just want it to wait
for a few seconds and wake up. This code is executing on a system thread
that I have created in my driver, but the timeout seems to me much shorter
than I want it to be. Here’s my code block. Maybe I’m just being stupid,
but I’ve been staring at it too long to see what if anything I’m doing
wrong. Thanks for any help.
LARGE_INTEGER liTimeout;
KIRQL irqlCurrent;
DBGPRINT((“==>WorkThread: entry\n”));
// loop until we are signaled to terminate
while (!bKill)
{
liTimeout.LowPart = 400000;
liTimeout.HighPart = 0;
// wait to be signaled with timeout
status = KeWaitForMultipleObjects(iEventCount,
evList,
WaitAny,
Executive,
KernelMode,
FALSE,
&liTimeout,
NULL);
}
----------------------------
Paul Benware
Director of Client Development
KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD 20852
TELE: 1-301-468-9434
DIRECT: 1-585-582-3296
CELL: 1-585-739-0441
www.koolspan.com
Your waittime is probably 40 ms ?
100 nanosec = 0.1 us = 0.0001 ms = 0.0000001 sec
----- Original Message -----
From: Paul Benware
To: Windows System Software Devs Interest List
Sent: Wednesday, September 15, 2004 4:41 PM
Subject: [ntdev] question on KeWaitForMultipleObjects and timeout value…
Hi,
I have a question relating to getting the timeout parameter for KeWaitForMultipleObjects working reasonably for me. The DDK help says this is a PLARGE_INTEGER value and it is specified in 100 nanosecond units. It also talks about relative vs. absolute values. So, I just want it to wait for a few seconds and wake up. This code is executing on a system thread that I have created in my driver, but the timeout seems to me much shorter than I want it to be. Here’s my code block. Maybe I’m just being stupid, but I’ve been staring at it too long to see what if anything I’m doing wrong. Thanks for any help.
LARGE_INTEGER liTimeout;
KIRQL irqlCurrent;
DBGPRINT((“==>WorkThread: entry\n”));
// loop until we are signaled to terminate
while (!bKill)
{
liTimeout.LowPart = 400000;
liTimeout.HighPart = 0;
// wait to be signaled with timeout
status = KeWaitForMultipleObjects(iEventCount,
evList,
WaitAny,
Executive,
KernelMode,
FALSE,
&liTimeout,
NULL);
}
----------------------------
Paul Benware
Director of Client Development
KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD 20852
TELE: 1-301-468-9434
DIRECT: 1-585-582-3296
CELL: 1-585-739-0441
www.koolspan.com
—
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
And what is the status returned by KeWaitForMultipleObjects?
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Paul Benware
To: Windows System Software Devs Interest List
Sent: Wednesday, September 15, 2004 6:41 PM
Subject: [ntdev] question on KeWaitForMultipleObjects and timeout value…
Hi,
I have a question relating to getting the timeout parameter for KeWaitForMultipleObjects working reasonably for me. The DDK help says this is a PLARGE_INTEGER value and it is specified in 100 nanosecond units. It also talks about relative vs. absolute values. So, I just want it to wait for a few seconds and wake up. This code is executing on a system thread that I have created in my driver, but the timeout seems to me much shorter than I want it to be. Here’s my code block. Maybe I’m just being stupid, but I’ve been staring at it too long to see what if anything I’m doing wrong. Thanks for any help.
LARGE_INTEGER liTimeout;
KIRQL irqlCurrent;
DBGPRINT((“==>WorkThread: entry\n”));
// loop until we are signaled to terminate
while (!bKill)
{
liTimeout.LowPart = 400000;
liTimeout.HighPart = 0;
// wait to be signaled with timeout
status = KeWaitForMultipleObjects(iEventCount,
evList,
WaitAny,
Executive,
KernelMode,
FALSE,
&liTimeout,
NULL);
}
----------------------------
Paul Benware
Director of Client Development
KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD 20852
TELE: 1-301-468-9434
DIRECT: 1-585-582-3296
CELL: 1-585-739-0441
www.koolspan.com
—
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
DQoNCg0KDQoNClBhdWwsDQoNClJlbGF0aXZlIHRpbWUgaXMgYSBuZWdhdGl2ZSBudW1iZXIsIHNv
IHRvIHdhaXQgNDAwMDAwICogMTAwbnMsIHlvdSBuZWVkIHRvDQpkbyB0aGlzOg0KICAgICAgICAg
ICAgICAgICAgICAgICAgIGxpVGltZW91dC5Mb3dQYXJ0ID0gLTQwMDAwMDsNCiAgICAgICAgICAg
ICAgICAgICAgICAgICBsaVRpbWVvdXQuSGlnaFBhcnQgPSAtMTsNCg0KT3RoZXJ3aXNlLCB5b3Un
bGwgd2FpdCBmb3IgdGhlIG9iamVjdCwgb3IgdGhlIGFic29sdXRlIHRpbWUgKHNpbmNlDQo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0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCj4gUGF1bCBCZW53YXJlDQo+IERpcmVjdG9yIG9m
IENsaWVudCBEZXZlbG9wbWVudA0KPg0KPiBLb29sU3BhbiBJbmMuDQo+IDExMTM0IFN0ZXBoYWxl
ZSBMYW5lDQo+IE5vcnRoIEJldGhlc2RhLCBNRCAyMDg1Mg0KPiBURUxFOiAxLTMwMS00NjgtOTQz
NA0KPiBESVJFQ1Q6IDEtNTg1LTU4Mi0zMjk2DQo+IENFTEw6IDEtNTg1LTczOS0wNDQxDQo+IHd3
dy5rb29sc3Bhbi5jb20NCj4NCj4gLS0tDQo+IFF1ZXN0aW9ucz8gRmlyc3QgY2hlY2sgdGhlIEtl
cm5lbCBEcml2ZXIgRkFRIGF0IGh0dHA6Ly93d3cuDQo+IG9zcm9ubGluZS5jb20vYXJ0aWNsZS5j
Zm0/aWQ9MjU2DQo+DQo+IFlvdSBhcmUgY3VycmVudGx5IHN1YnNjcmliZWQgdG8gbnRkZXYgYXM6
IHVua25vd24gbG1zdWJzdCB0YWcgYXJndW1lbnQ6DQonJw0KPiBUbyB1bnN1YnNjcmliZSBzZW5k
IGEgYmxhbmsgZW1haWwgdG8gbGVhdmUtbnRkZXYtMTQwNzlDQGxpc3RzLm9zci5jb20NCj4gRm9y
d2FyZFNvdXJjZUlEOk5UMDAwMDM4NUE=
1, milli, micro, nano, …
100 nano … *10 ->
1 micro … *1000->
1 milli … *1000->
1
so you need 10*1000*1000 for 1 sec.; 400000 should give you a 40ms delay.
if you want 4s try “4*1000*1000*10”. Works perfectly well for me. Of
course you need a negative value since positive values are absolute. Try
setting LARGE_INTEGER::QuadPart to the desired value (negative, 64 bit).
But it’s all perfectly well documented in the DDK.
Regards,
Paul Groke
“Paul Benware”
Gesendet von: xxxxx@lists.osr.com
15.09.2004 16:41
Bitte antworten an “Windows System Software Devs Interest List”
An: “Windows System Software Devs Interest List”
Kopie:
Thema: [ntdev] question on KeWaitForMultipleObjects and timeout
value…
Hi,
I have a question relating to getting the timeout parameter for
KeWaitForMultipleObjects working reasonably for me. The DDK help says
this is a PLARGE_INTEGER value and it is specified in 100 nanosecond
units. It also talks about relative vs. absolute values. So, I just want
it to wait for a few seconds and wake up. This code is executing on a
system thread that I have created in my driver, but the timeout seems to
me much shorter than I want it to be. Here?s my code block. Maybe I?m
just being stupid, but I?ve been staring at it too long to see what if
anything I?m doing wrong. Thanks for any help.
LARGE_INTEGER liTimeout;
KIRQL irqlCurrent;
DBGPRINT((“==>WorkThread: entry\n”));
// loop until we are signaled to terminate
while (!bKill)
{
liTimeout.LowPart = 400000;
liTimeout.HighPart = 0;
// wait to be signaled with timeout
status = KeWaitForMultipleObjects(iEventCount,
evList,
WaitAny,
Executive,
KernelMode,
FALSE,
&liTimeout,
NULL);
}
----------------------------
Paul Benware
Director of Client Development
KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD20852
TELE: 1-301-468-9434
DIRECT: 1-585-582-3296
CELL: 1-585-739-0441
www.koolspan.com
—
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
Please visit us: www.tab.at www.championsnet.net
www.silverball.com
you want a relative timeout (4 seconds from now) so you want to specify
a negative timeout value.
has anyone ever used an event wait with an absolute timeout in their
driver? Just curious.
-p
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Paul Benware
Sent: Wednesday, September 15, 2004 7:42 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] question on KeWaitForMultipleObjects and
timeout value…
Hi,
I have a question relating to getting the timeout parameter for
KeWaitForMultipleObjects working reasonably for me. The DDK help says
this is a PLARGE_INTEGER value and it is specified in 100 nanosecond
units. It also talks about relative vs. absolute values. So, I just
want it to wait for a few seconds and wake up. This code is executing
on a system thread that I have created in my driver, but the timeout
seems to me much shorter than I want it to be. Here’s my code block.
Maybe I’m just being stupid, but I’ve been staring at it too long to see
what if anything I’m doing wrong. Thanks for any help.
LARGE_INTEGER liTimeout;
KIRQL irqlCurrent;
DBGPRINT((“==>WorkThread: entry\n”));
// loop until we are signaled to terminate
while (!bKill)
{
liTimeout.LowPart = 400000;
liTimeout.HighPart = 0;
// wait to be signaled with timeout
status =
KeWaitForMultipleObjects(iEventCount,
evList,
WaitAny,
Executive,
KernelMode,
FALSE,
&liTimeout,
NULL);
}
----------------------------
Paul Benware
Director of Client Development
KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD 20852
TELE: 1-301-468-9434
DIRECT: 1-585-582-3296
CELL: 1-585-739-0441
www.koolspan.com
—
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
Peter,
I’ve seen a few in shipping drivers, in all cases they were bugs!
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
“Peter Wieland” wrote in message
news:xxxxx@ntdev…
you want a relative timeout (4 seconds from now) so you want to specify a
negative timeout value.
has anyone ever used an event wait with an absolute timeout in their driver?
Just curious.
-p
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Paul Benware
Sent: Wednesday, September 15, 2004 7:42 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] question on KeWaitForMultipleObjects and timeout value…
Hi,
I have a question relating to getting the timeout parameter for
KeWaitForMultipleObjects working reasonably for me. The DDK help says this
is a PLARGE_INTEGER value and it is specified in 100 nanosecond units. It
also talks about relative vs. absolute values. So, I just want it to wait
for a few seconds and wake up. This code is executing on a system thread
that I have created in my driver, but the timeout seems to me much shorter
than I want it to be. Here’s my code block. Maybe I’m just being stupid,
but I’ve been staring at it too long to see what if anything I’m doing
wrong. Thanks for any help.
LARGE_INTEGER liTimeout;
KIRQL irqlCurrent;
DBGPRINT((“==>WorkThread: entry\n”));
// loop until we are signaled to terminate
while (!bKill)
{
liTimeout.LowPart = 400000;
liTimeout.HighPart = 0;
// wait to be signaled with timeout
status = KeWaitForMultipleObjects(iEventCount,
evList,
WaitAny,
Executive,
KernelMode,
FALSE,
&liTimeout,
NULL);
}
----------------------------
Paul Benware
Director of Client Development
KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD 20852
TELE: 1-301-468-9434
DIRECT: 1-585-582-3296
CELL: 1-585-739-0441
www.koolspan.com
—
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