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 7406927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:37:53+00:00 2026-05-29T05:37:53+00:00

I’m not sure what I’m missing but it’s time to ask from more knowledgeable

  • 0

I’m not sure what I’m missing but it’s time to ask from more knowledgeable people than I. I’m using the HDC GUID that I found here. I’m trying to open with this in my C++ code:

// note: devGuid is pointer of type struct GUID in the class this ctor belongs to
DeviceHelper::DeviceManager::DeviceManager(GUID devClassGuid) : devGuid(new GUID(devClassGuid)) {
    hDevices = SetupDiGetClassDevs(&devClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
    if(INVALID_HANDLE_VALUE == hDevices) {
        throw std::exception("Failure to get a handle to a list of device classes");
    }
}

This call passes and hDevices holds a valid reference. However, when I call SetupDiEnumDeviceInterfaces() it iterates over nothing:

// hDevices is assigned in the c-tor as is devGuid which is a pointer
DWORD index(0);
SP_DEVICE_INTERFACE_DATA devInterfaceData = {sizeof(SP_DEVICE_INTERFACE_DATA)};
while(SetupDiEnumDeviceInterfaces(hDevices, NULL, devGuid, index, &devInterfaceData)) {
    // look for the HBA I want from parameters passed to the class function
    // FindHba()
}

SetupDiEnumDeviceInterfaces() sets the system error code to 249 which is “no more items” but nothing has been iterated. Apparently, the handle points to an empty list. What is it I’m getting wrong on the call to SetupDiGetClassDevs()? I thought that it might be the GUID isn’t an “interface” GUID (i.e. the word “interface” isn’t in the name). So, I tried taking off the bitwise-or with DIGCF_DEVICEINTERFACE, but this didn’t help.

My knowledge of how to make use of this API is quite limited and I’m doing nothing now but spinning my wheels.

Thanks for any help.

  • 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-05-29T05:37:54+00:00Added an answer on May 29, 2026 at 5:37 am

    I’m apparently ignorant of what an interface means in this context. The answer seems to have been with calling SetupDiEnumDeviceInfo() instead of using SetupDiEnumDeviceInterfaces(). Apparently, I was on the right track when I’d asked the question. Indeed, it would seem, that the problem had to do with trying to iterate over interfaces of which I had none.

    At any rate, I’m now able to enable/disable my ATA devices through this code (which is what I was after). For reference, I went off of this past article to Stack Overflow: Win32 API function to programatically enable/disable device

    That code was adapted for C++.

    To anyone quite familiar with the SetupApi, I’d sure appreciate some education about what these things are.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
In my XML file chapters tag has more chapter tag.i need to display chapters
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build

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.