RE: question on KeWaitForMultipleObjects and timeout valu e...

liTimeout.QuadPart = -400000;

You want relative time and that needs to be negative. And check your math on
those units, I think you are off by quite a bit.

=====================
Mark Roddy


From: Paul Benware [mailto:xxxxx@koolspan.com]
Sent: Wednesday, September 15, 2004 10: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

I use this:

#define MILLISECONDS(_ms) ((_ms)*-1000*10)

Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com

-----Original Message-----
From: xxxxx@tab.at [mailto:xxxxx@tab.at]
Sent: September 15, 2004 11:28 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] question on KeWaitForMultipleObjects and timeout
value…

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


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

AFAIC it was a day-one design error to have the absolute case be positive
and the relative case be negative.

=====================
Mark Roddy


From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Thursday, September 16, 2004 9:32 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] question on KeWaitForMultipleObjects and timeout
value…

i wasn’t trying to imply that absolute timers aren’t useful. However i
think absolute timeouts on other dispatcher objects (events, mutexes,
etc…) are of limited use to device drivers. Particularly considering how
often someone accidentally passes a positive value to them.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Asa Yeamans
Sent: Wednesday, September 15, 2004 9:42 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] question on KeWaitForMultipleObjects and timeout
value…

what mechanism does the expiration feature use to determine when to display
the ’ your system is shutting down in an hour box’. i’d think it uses
absolute
because when i would roll the system time back a year, it wouldnt come up
until ANOTHER year passed…
btw, when installing NT 4 always make disks from the CD, otherwise you might
get stuck with evaluation disks and a normal CD, yet
for some bizarre reason… it thinks all an eval…

asa

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Peter Wieland
Sent: Wednesday, September 15, 2004 10:32 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] question on KeWaitForMultipleObjects and timeout
value…

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


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


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
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