Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

C28107

warning C28107: Resource must be held when calling function

A resource that the program must acquire before calling the function was not acquired when the function was called. As a result, the function call will fail. This warning is reported only when resources are acquired and released in the same function.

The following code example generates this warning:

ExAcquireResourceLite(resource, true);
ExReleaseResourceLite(resource);

The following code example avoids this warning:

KeEnterCriticalRegion();
ExAcquireResourceLite(resource, true);
ExReleaseResourceLite(resource);
KeLeaveCriticalRegion();
KeEnterCriticalRegion();
ExAcquireResourceLite(resource, true);
ExReleaseResourceLite(resource);
KeLeaveCriticalRegion();
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.