Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

WDM driver can't be installed in window server 2019 with error 0x80070002

Descartes123Descartes123 Member Posts: 4

Our product has a WDM driver for several years, it works well for all previous window version, but recently we need to upgrade to window 2019 which already opened the test mode, the setup API always failed with error message "A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider."

We mainly used below cmd to sign the driver:
makecert.exe -a sha256 -r -pe -n CN=$(DDKCertName) -sv $(DDKTestCertPath).pvk $(DDKTestCertPath).cer
inf2cat.exe /driver:$(DDKOutputDir) /os:ServerRS5_$(DDKInf2CatArch) /USELOCALTIME"
SignTool.exe sign /f $(DDKTestCertPath) /p $(DDKOutputDir)$(Name).$(Ext)"

We installed the generated cert to root cert store and trust publisher store, and then call setup API to install driver to window.
We found it eventually copied the inf file to C:\Windows\System32\DriverStore folder and the driver binary to C:\Windows\System32\drivers folder after calling SetupCopyOEMInf(), but when call the INetCfgClassSetup->install method, the driver service was not created, it just return 0x80070002, however,we can create the service manually by sc create binPath="C:\Windows\System32\drivers.sys" type=kernel,and it could start well.

We also have other two NDIS filter drivers which used the same way to sign, but they didn't meet the issue.
Our environment is window server 2019, build 17763 which is running on a VM.
Not sure why this happened, no log or event trace could be watched, do you have any idea?

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,493

    (A post by Mr. Roddy in reply to this topic was accidentally deleted when the question got snagged by the spam filters. I apologize to Mr. Roddy for the error.)

    IIRC, the gist of Mr. Roddy’s post was that error 0x80070002 is STATUS_WAIT_2 and thus your problem is unlikely related to signing.

    I’d add that you should check setupapi.dev.log — also that 0x80070002 can have many different meaning, depending on the facility returning the error. It can, for example, also mean “file not found.”

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,970

    At the risk of correcting Mr Roddy, STATUS_WAIT_2 is just 0x00000002. According to the venerable and ancient "err" tool, 80070002 is always some form of "object not found".

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,493

    (well, tp be clear: That was MY report of what I recalled of Mr. Roddy's post... which very well may be in error.)

    Peter Viscarola
    OSR
    @OSRDrivers

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,436

    Nah my old eyes probably read an 8 where only a 0 existed.

  • Descartes123Descartes123 Member Posts: 4

    @Peter_Viscarola_(OSR) said:
    (A post by Mr. Roddy in reply to this topic was accidentally deleted when the question got snagged by the spam filters. I apologize to Mr. Roddy for the error.)

    IIRC, the gist of Mr. Roddy’s post was that error 0x80070002 is STATUS_WAIT_2 and thus your problem is unlikely related to signing.

    I’d add that you should check setupapi.dev.log — also that 0x80070002 can have many different meaning, depending on the facility returning the error. It can, for example, also mean “file not found.”

    Peter

    I watched the setupapi.dev.log, here is the error message:
    dvi: Selected driver:
    dvi: INF path C:\Windows\INF\oem4.inf
    dvi: INF section Install
    dvi: INF version 16.1.56.921
    sig: {_VERIFY_FILE_SIGNATURE} 03:12:36.262
    sig: Key = dserverdriver.sys
    sig: FilePath = C:\Windows\system32\DRIVERS\dserverdriver.sys
    sig: Catalog = C:\Windows\System32\DriverStore\FileRepository\iodriver.inf_amd64_63835d84e79a19cb\iodriver.cat
    ! sig: Verifying file against catalog 'iodriver.cat' failed.
    ! sig: Error 2: The system cannot find the file specified.
    sig: {_VERIFY_FILE_SIGNATURE exit(0x00000002)} 03:12:36.262

    it said can't find the file, but I checked that both the .sys and .cat files were well in place, so I wonder why prompt this message?

    Do you have any experience on it?
    Thanks

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,493

    It’s looking for a file with a .c file extension?? Not a .sys file?

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,436

    the 'at' pat of the cat file are wrapping over to the next line.

    I'd start looking inside the cat file. It seems to not be cataloging the right stuff.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,970

    If the cat file exists at the exact path in the log, then the "cannot find the file" message means one of the files mentioned in the cat was not pre-installed in the driver store. Are you mentioning any DLLs or other files in your INF?

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Descartes123Descartes123 Member Posts: 4

    @Tim_Roberts said:
    If the cat file exists at the exact path in the log, then the "cannot find the file" message means one of the files mentioned in the cat was not pre-installed in the driver store. Are you mentioning any DLLs or other files in your INF?

    Our inf file only includes the .sys file and the cat files only mentioned two files: the .sys and .inf, I could see the .sys, inf and cat files were located in C:\Windows\System32\DriverStore\FileRepository\iodriver.inf_amd64_63835d84e79a19cb.
    So I still confused what file is missing.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,970

    And you didn't change the .SYS file or the .INF after creating the CAT? Are you willing to put the driver package somewhere we could look at it?

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Descartes123Descartes123 Member Posts: 4

    @Tim_Roberts said:
    And you didn't change the .SYS file or the .INF after creating the CAT? Are you willing to put the driver package somewhere we could look at it?

    They were all generated by one build batch and no manually change at all, I'd like to share you the package, but it seems no attachment option in the forum, could you give me an email adress for sending it to you?
    Thank in advance.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Developing Minifilters 24 May 2021 Live, Online
Writing WDF Drivers 14 June 2021 Live, Online
Internals & Software Drivers 27 September 2021 Live, Online
Kernel Debugging 15 November 2021 Live, Online