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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:54:31+00:00 2026-06-07T21:54:31+00:00

I’m working on a means of installing a driver. Because of the multiple platforms

  • 0

I’m working on a means of installing a driver. Because of the multiple platforms on which this must work, I’m shelling-out to both devcon and dpinst to do the work of driver install/update/removal when needed. While testing, I’m having problems with the shelling out to devcon. To isolate, I wrote a small app to do what devcon does in update see here, using the devcon source from the WinDDK for reference. I’m having some problems with UpdateDriverForPlugAndPlayDevices() from Setup API (actually part of Newdev.dll) see here. The source code is here:

#include <iostream>
#include <Windows.h>
#include <newdev.h>

int main(int argc, char** argv) {
    // Go through the same steps as does dev con for this update crap
    char infFile[MAX_PATH];

    if(3 > argc) {
        std::cerr << "an INF and HW ID must be specified" << std::endl;
        return 1;
    }

    DWORD result(GetFullPathName(argv[1], MAX_PATH, infFile, NULL));
    if((result >= MAX_PATH) || (0 == result)) {
        std::cerr << "path is too long for buffer" << std::endl;
        return 1;
    }

    if(GetFileAttributes(infFile) == -1) {
        std::cerr << "file doesn't exist" << std::endl;
        return 1;
}

    BOOL reboot(FALSE);
    if(!UpdateDriverForPlugAndPlayDevices(NULL, argv[2], infFile, INSTALLFLAG_FORCE, &reboot)) {
        std::cerr << "Failed to install the driver.  Code: "
                  << GetLastError()
                  << std::endl;
        return 2;
}

    if(reboot) {
        std::cout << "A reboot is needed to complete driver install"
                  << std::endl;
    }

    return 0;
}

The program fails when UpdateDriverForPlugAndPlayDevices() returns false. This then prints the error code, returned by GetLastError(), so I’d know what went wrong. The error code returned: 259. According to this resource says this is ERROR_NO_MORE_ITEMS. According to the link for UpdateDriverForPlugAndPlayDevices(), this function returns this error code when, “The function found a match for the HardwareId value, but the specified driver was not a better match than the current driver and the caller did not specify the INSTALLFLAG_FORCE flag.” You’ll notice from my code that I did specify this flag.

I do not know where to go from here. Can someone please identify from this code what it is I’m missing? This just has the “feel” of something simple, but I’m totally missing it.

Thank you,
Andy

  • 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-07T21:54:32+00:00Added an answer on June 7, 2026 at 9:54 pm

    The problem appeared to be not with the code but with the INF file. Interesting that the documentation for the function said that using that flag will force the install but didn’t when the INF file didn’t "list" any device classes in the models section. This is how I was able to install eventually. I added the correct device class to the models section in the INF.


    EDIT Sep. 17, 2020
    It was requested by someone just today (of the edit) to add an example from the INF. It’s been 8 years since I had this issue and I no longer work for this team. However, as best as I can recall, and drawing heavily upon the docs for INF Models Section and INF Manufacturers Section, I hope this helps.

    Essentially, the class is specified by the Models Section and the model is specified by the Manufacturer Section.

    [Manufacturer]
    %MfgName%=Standard,NTamd64
    
    [Standard.NTamd64]
    %DeviceString%=<class path or GUID>\<device>
    
    [Strings]
    MfgName=ACME
    DeviceString="Device Type"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I would like to run a str_replace or preg_replace which looks for certain words

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.