Questions about KeWaitForMutexObject

Hi,

MSDN states that KeWaitForMutexObject’s last parameter (Timeout) is
optional.

My first question is:
if I use NULL for Timeout, is it the same thing as a timeout of 0 (which
must be used at Dispatch Level) ?

My second question is:
if KeWaitForMutexObject() returns STATUS_ALERTED, STATUS_USER_APC or
STATUS_TIMEOUT, should I call KeReleaseMutex() ?

“Nicolas Mugnier” wrote in message
news:xxxxx@mxsf05.cluster1.charter.net
> Hi,
>
> MSDN states that KeWaitForMutexObject’s last parameter (Timeout) is
> optional.
>
> My first question is:
> if I use NULL for Timeout, is it the same thing as a timeout of 0 (which
> must be used at Dispatch Level) ?

No, NULL indicates wait for ever, a pointer to an __int64 value of zero
indicates return immeditely.

> My second question is:
> if KeWaitForMutexObject() returns STATUS_ALERTED, STATUS_USER_APC or
> STATUS_TIMEOUT, should I call KeReleaseMutex() ?

Depends on what you are trying to do. This is an open ended question as
stated.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com

> if I use NULL for Timeout, is it the same thing as a timeout of 0 (which

must be used at Dispatch Level) ?

No. NULL is infinite, and 0 is 0.

if KeWaitForMutexObject() returns STATUS_ALERTED, STATUS_USER_APC or
STATUS_TIMEOUT, should I call KeReleaseMutex() ?

No.

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