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

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

inf2cat 22.9.10: the tool does not expand a variable

Eugene_MuzychenkoEugene_Muzychenko Member Posts: 12
Many years ago, I had built an INF file template for an audio KS driver that can be customized by changing the [Strings] section only. Resulting INF files are successfully installed in all Windows versions from XP to latest Win10. inf2cat from WDK 7600.16385.1 reports no errors in such files.

But if I try to use inf2cat from latest WDKs (including WDK 10.0.15063), it fails:

22.9.10: %driverfile% in [devinst.drivermodules] is missing from [SourceDisksFiles] section in myproject\mydriver.inf; driver may not sign correctly until this is resolved.

The same inf2cat behavior is observed on SysDev portal on driver signing submission.

Related sections in the INF file:

=================
[SourceDisksFiles.x86]
%DriverFile% = 222, \x86

[SourceDisksFiles.amd64]
%DriverFile% = 222, \x64

[DevInst.DriverModules]
%DriverFile%
=================

If I replace %DriverFile% with actual driver file name, new inf2cat show no errors.

Obviously, new inf2cat does not expand string variables while checking source file sections.

Where to report this inf2cat bug?

Comments

  • Nathan_KiddNathan_Kidd Member - All Emails Posts: 13
    On 05/12/17 11:47 AM, xxxxx@muzychenko.net wrote:
    > Many years ago, I had built an INF file template for an audio KS driver that can be customized by changing the [Strings] section only. Resulting INF files are successfully installed in all Windows versions from XP to latest Win10. inf2cat from WDK 7600.16385.1 reports no errors in such files.
    >
    > But if I try to use inf2cat from latest WDKs (including WDK 10.0.15063), it fails:

    Since it worked with the older inf2cat this seems unlikely, but you
    might double-check that all your line endings are consistently CRLF.

    Earlier this year I had trouble getting stampinf to expand macros and
    finally realized it doesn't grok LF. It squashed all lines to be part
    of the first line which was a comment, and macros are not replaced in
    comments.

    -Nathan
  • Eugene_MuzychenkoEugene_Muzychenko Member Posts: 12
    >you might double-check that all your line endings are consistently CRLF.

    Thank you for the suggestion but all line endings in the file are really CR/LF (just checked to be sure). Moreover, there are empty lines before and after each of lines in my example. Even more, I had cross-tested it, replacing %DriverFile% with actual file name, running inf2cat, replacing file name with %DriverFile% back, and running inf2cat again.
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 12,663
    xxxxx@muzychenko.net wrote:
    >> you might double-check that all your line endings are consistently CRLF.
    > Thank you for the suggestion but all line endings in the file are really CR/LF (just checked to be sure). Moreover, there are empty lines before and after each of lines in my example. Even more, I had cross-tested it, replacing %DriverFile% with actual file name, running inf2cat, replacing file name with %DriverFile% back, and running inf2cat again.

    No, there's no need to check anything else.  Remember, the complete
    source code for ChkInf is included in the WDK.  I just checked, and
    indeed it does not expand strings within a CopyFiles section.

    From the beginning of time ;), perhaps the biggest flaw in the INF world
    is that there has never been a definitive syntax description.  It's all
    just crap that has accreted over the decades without any consistency or
    centralized control.  The sections do not all follow the same rules, and
    there is no place that definitively states where %strings% are allowed
    and where they are not.  It's clearly not a general purpose macro
    language, so without rules, we just have to guess.

    Thus, the authors of ChkInf could argue that they are following the
    documentation, because the documentation does not state whether this is
    supposed to work or not.  The fact that the operating system DOES seem
    to expand strings suggests that ChkInf ought to do so as well.

    --
    Tim Roberts, xxxxx@probo.com
    Providenza & Boekelheide, Inc.

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

  • Zac_LockardZac_Lockard Member - All Emails Posts: 23
    This is part of the reason ChkInf was deprecated a few years ago ???? It is probably the least reliable source of INF truth that MS released.

    However, InfVerif can be used as the de facto source of INF truth. It internally uses the OS INF parser, so it has no divergence at all. InfVerif will point out if there are any %string% tokens in the file that do not get replaced (and FYI, they will be replaced anywhere in the file as long as there is a match in [strings]).

    Also interesting, we re-wrote the INF parser in Win8, and it is *way* more consistent and coherent than it was before that point. You won't find the same sort of differences between how various things get handled any more. Unfortunately, inf2cat was implemented before the new parser, and works much more closely to how ChkInf works. We're working on switching inf2cat over.

    -----Original Message-----
    From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@probo.com
    Sent: Wednesday, December 6, 2017 10:00 AM
    To: Windows System Software Devs Interest List <xxxxx@lists.osr.com>
    Subject: Re: [ntdev] inf2cat 22.9.10: the tool does not expand a variable

    xxxxx@muzychenko.net wrote:
    >> you might double-check that all your line endings are consistently CRLF.
    > Thank you for the suggestion but all line endings in the file are really CR/LF (just checked to be sure). Moreover, there are empty lines before and after each of lines in my example. Even more, I had cross-tested it, replacing %DriverFile% with actual file name, running inf2cat, replacing file name with %DriverFile% back, and running inf2cat again.

    No, there's no need to check anything else.  Remember, the complete source code for ChkInf is included in the WDK.  I just checked, and indeed it does not expand strings within a CopyFiles section.

    From the beginning of time ;), perhaps the biggest flaw in the INF world is that there has never been a definitive syntax description.  It's all just crap that has accreted over the decades without any consistency or centralized control.  The sections do not all follow the same rules, and there is no place that definitively states where %strings% are allowed and where they are not.  It's clearly not a general purpose macro language, so without rules, we just have to guess.

    Thus, the authors of ChkInf could argue that they are following the documentation, because the documentation does not state whether this is supposed to work or not.  The fact that the operating system DOES seem to expand strings suggests that ChkInf ought to do so as well.

    --
    Tim Roberts, xxxxx@probo.com
    Providenza & Boekelheide, Inc.


    ---
    NTDEV is sponsored by OSR

    Visit the list online at: <https://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/showlists.cfm?list=ntdev&amp;data=02|01|[email protected]|148f981a7371474268c808d53cd3411a|72f988bf86f141af91ab2d7cd011db47|1|0|636481800386130199&amp;sdata=IJ3il+SMQqfzGvA8Gd8lF6/+3md8zoly1bUs6wJDJjc=&amp;reserved=0&gt;

    MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
    Details at <https://na01.safelinks.protection.outlook.com/?url=http://www.osr.com/seminars&amp;data=02|01|[email protected]|148f981a7371474268c808d53cd3411a|72f988bf86f141af91ab2d7cd011db47|1|0|636481800386130199&amp;sdata=Gd0GbT73O56zxVSUMlYosFncZx86JxxhwiAVhqU92+M=&amp;reserved=0&gt;

    To unsubscribe, visit the List Server section of OSR Online at <https://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/page.cfm?name=ListServer&amp;data=02|01|[email protected]|148f981a7371474268c808d53cd3411a|72f988bf86f141af91ab2d7cd011db47|1|0|636481800386130199&amp;sdata=FnhleoFV4kpKEGycfUNj9r8Q+eNG4u9Xq7upJlOFYkA=&amp;reserved=0&gt;
  • Eugene_MuzychenkoEugene_Muzychenko Member Posts: 12
    The most significant problem for me is that latest inf2cat versions are used to check INF files on SysDev driver signing submission. It marks INF file that is fully compatible with all Windows versions from Win2000 to Win10 as invalid, so there is no way to get MS signature for a driver with such INF file.
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 12,663
    On Dec 6, 2017, at 6:33 PM, xxxxx@muzychenko.net <xxxxx@lists.osr.com> wrote:
    >
    > The most significant problem for me is that latest inf2cat versions are used to check INF files on SysDev driver signing submission. It marks INF file that is fully compatible with all Windows versions from Win2000 to Win10 as invalid, so there is no way to get MS signature for a driver with such INF file.

    Yes, we know, but it's easy to work around. A simple script to do the macro substitution, and off you go.

    Tim Roberts, xxxxx@probo.com
    Providenza & Boekelheide, Inc.

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

  • Eugene_MuzychenkoEugene_Muzychenko Member Posts: 12
    Of course, workaround is easy, but the aftertaste... :) Not only that MS forced me to submit each driver release to SysDev for signing, but cannot even process a valid INF file. :)
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!