FWIW, I have noticed that many interlocked operations in the Win2k headers
do not reference the pertinent argument as volatile in the Win2k headers,
unlike the WinXP headers(I don’t compile for server 2003 that often to
remember its case). The docs of course have pertinent arguments referenced
as volatile. Unless I cast away the volatile (very bad) in Win2k
environment, I cannot get many Win2k interlocked operations to compile. An
alternate (ugly) solution would be to edit the headers for Win2k and include
the volatile keyword.
e.g.
volatile LONG lCount = 0;
InterlockedIncrement(&lCount); // will not compile under Win2k
InterlockedIncrement((PLONG)&lCount); // compiles under Win2k, but not
desirable.
I’m using server 2003 DDK, build 1289. Is there something that I’m missing?
Philip Lukidis
-----Original Message-----
From: Don Ward [mailto:xxxxx@careful.co.uk]
Sent: Tuesday, January 25, 2005 11:58 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Problem with InterlockedOr using XP build environment
in W2003 DDK
Hello all,
I can’t believe I’m the first to notice this, (but I looked in the archives
for “InterlockedOr” and didn’t come up with anything pertinent).
I recently came across a problem where my driver (which compiles and works
fine using either the
W2K build environments or the W2003 environments) failed to compile when
using the XP environment.
Actually I got a warning, but I have it set to fail if warnings are
generated.
The problem appears to be caused by the different definitions of
_InterlockedOr.
WINDDK/3790/inc/ddk/wxp/ntddk.h says
LONG
_InterlockedOr (
IN OUT PLONG Target,
IN LONG Set
);
WINDDK/3790/inc/ddk/wnet/ntddk.h says
LONG
_InterlockedOr (
IN OUT LONG volatile *Target,
IN LONG Set
);
which, incidently, agrees with the documentation.
I “fixed” my XP problem by overriding the definition in one of my own
headers
#if (_WIN32_WINNT==0x0501)
LONG
_InterlockedOr (
IN OUT LONG volatile *Target,
IN LONG Set
);
#pragma intrinsic (_InterlockedOr)
#endif
Note the XP version of _InterlockedXor is differently broken (it has a “*”
missing)
Is this a “known error” in the DDK?
Don
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@guillemot.com
To unsubscribe send a blank email to xxxxx@lists.osr.com