Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

C28113

warning C28113: Accessing a local variable via an Interlocked function

The driver is using an Interlocked executive support routine, such as InterlockedDecrement, to access a local variable.

Although drivers are permitted to pass the address of a local variable to another function, and then use an interlocked function to operate on that variable, it's important to verify that the stack will not be swapped out to disk unexpectedly and that the variable has the correct life time across all threads that might use it.

Typically, the return value of an Interlocked executive support routine is used in subsequent computations, instead of the input arguments. Also, the Interlocked routines only protect the first (leftmost) argument. Using an Interlocked routine in the following way does not protect the value of global and often serves no purpose.

InterlockedExchange(&local, global)

The following form has the same effect on the data and safely accesses the global variable.

local = InterllockedExchange(&global, global) 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft