Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9115617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:28:30+00:00 2026-06-17T04:28:30+00:00

I am using PREFast to check some driver code build for Windows7. The following

  • 0

I am using PREFast to check some driver code build for Windows7. The following line of code

stackDeviceObject = IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject);

Gives the warning:

warning 28107: The Memory 'deviceObject' must be held when calling 'IoAttachDeviceToDeviceStack'.

deviceObject is obtained with an earlier call to IoCreateDevice. Does anyone know what this warning means and how to get rid of it?

The PREfast help says “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.”

The example that the help page provides surrounds a pair of calls to ExAcquireResourceLite and ExReleaseResourceLite (which gives this warning) between calls to KaEnterCriticalRegion and KaLeaveCriticalRegion, which then supposedly gets rid of the warning, but I don’t know how to apply this info to my call to IoAttachDeviceToDeviceStack.

Any advice would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:28:31+00:00Added an answer on June 17, 2026 at 4:28 am

    I believe I have an answer to my own question. The call to IoCreateDevice was in a separate function which was called from this one. I think this was stopping PREfast from seeing that this function was being called and deviceObject was being correctly initialised before the call to IoAttachDeviceToDeviceStack was called.

    I have moved the IoCreateDevice call into the same function as IoAttachDeviceToDeviceStack and the warning went away.

    Thanks to anyone that spent time reading this and trying to find an answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using MongoDB C# Driver (official form 10gen), I'm doing the following code: using (database.RequestStart())
Using this code, the following execution yields strange results: C 100 R W The
Using the DateTime class, if I try to run the following code: $mydate =
Using Visual Studio / C#, I've been debugging some nunit tests recently, and am
using this code: Java Server side: ... out = new PrintWriter(this.client.getOutputStream(), true); ... public
Using Android NDK is it possible (from native C-code) to get a list of
Using the Excel 2010 OleDb driver and an OleDbConnection I can query and manipulate
Using CMake I want to check if a particular function (cv::getGaborKernel) from OpenCV library
Using batch script, I want to get a first token of a line delimited
Using the new mvc4 now gives us access to use facebook oauth otb. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.