You can use the __drv_raisesIRQL for the AcquireSpinLock function. You also
might be able to use __drv_savesIRQLGlobal and __drv_restoresIRQLGlobal.
Bill Wandel
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Ray Trent
Sent: Friday, April 25, 2008 6:23 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Prefast annotations
I think your problem may only be solvable by using a pragma to suppress the
warning message in this case.
You’ve got a situation here where exactly one of two possible resources can
be acquired, and if I’m interpreting your code hints correctly, that
decision can never change, so it’s actually safe.
The problem is that Prefast is a static local analyzer, so there’s literally
no way for it to know that the resource freed by one of these functions is
the same one as is acquired in the other one, no matter how you annotate it.
xxxxx@dsl.pipex.com wrote:
Sometimes I can make prefast be quiet but sometimes I have not got a
clue. So here is a nice little puzzle for the weekend. How should I
annotate these
_inline void AcquireSpinLock(
__inout PKSPIN_LOCK SpinLock,
__out PKIRQL Irql,
__out PKLOCK_QUEUE_HANDLE hSpinLock)
{
if (PtrKeAcquireInStackQueuedSpinLock)
PtrKeAcquireInStackQueuedSpinLock(SpinLock, hSpinLock);
else
KeAcquireSpinLock(SpinLock, Irql);
}
_inline void ReleaseSpinLock(
__inout PKSPIN_LOCK SpinLock,
__in _KIRQL Irql,
__in PKLOCK_QUEUE_HANDLE hSpinLock)
{
if (PtrKeAcquireInStackQueuedSpinLock)
PtrKeReleaseInStackQueuedSpinLock(hSpinLock);
else
KeReleaseSpinLock(SpinLock, Irql);
}
–
Ray
(If you want to reply to me off list, please remove “spamblock.” from my
email address)
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer