Skip to content

Commit

Permalink
inf_generator: Add [Install.NT.Services] section
Browse files Browse the repository at this point in the history
Adds the [<tag>_Install.NT.Services] section with the default value
of `AddService=,2` to be compliant, and pass, the infverif.exe tool.
  • Loading branch information
Javagedes committed Dec 6, 2023
1 parent cdf6d13 commit b4d8e95
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
3 changes: 3 additions & 0 deletions edk2toollib/windows/capsule/inf_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class InfGenerator(object):
{Rollback}
{FirmwareCopyFilesSection}
[Firmware_Install.NT.Services]
AddService=,2
[Firmware_Install.NT.Hw]
AddReg = Firmware_AddReg
Expand Down
6 changes: 5 additions & 1 deletion edk2toollib/windows/capsule/inf_generator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ def __str__(self) -> str:
[{self.Tag}_CopyFiles]
{self.FirmwareFile}
""")
outstr += IntegrityFile
outstr += IntegrityFile + "\n"
outstr += textwrap.dedent(f"""\
[{self.Tag}_Install.NT.Services]
AddService=,2
""")
outstr += textwrap.dedent(f"""
[{self.Tag}_Install.NT.Hw]
AddReg = {self.Tag}_AddReg
Expand Down
10 changes: 7 additions & 3 deletions tests.unit/test_inf_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

import unittest
import tempfile
import os
import datetime
import os
import tempfile
import unittest

from edk2toollib.windows.capsule.inf_generator import InfGenerator, InfSection


Expand Down Expand Up @@ -162,6 +163,9 @@ def test_invalid_guid_format(self):
[Firmware_CopyFiles]
TestFirmwareRom.bin
[Firmware_Install.NT.Services]
AddService=,2
[Firmware_Install.NT.Hw]
AddReg = Firmware_AddReg
Expand Down
50 changes: 47 additions & 3 deletions tests.unit/test_inf_generator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

import unittest
import textwrap
from edk2toollib.windows.capsule.inf_generator2 import InfHeader, InfStrings, InfSourceFiles, InfFirmware
from edk2toollib.windows.capsule.inf_generator2 import InfFirmwareSections, InfFile
import unittest

from edk2toollib.windows.capsule.inf_generator2 import (
InfFile,
InfFirmware,
InfFirmwareSections,
InfHeader,
InfSourceFiles,
InfStrings,
)


class InfHeaderTest(unittest.TestCase):
Expand Down Expand Up @@ -85,6 +92,9 @@ def test_firmware(self):
[tag_CopyFiles]
test.bin
[tag_Install.NT.Services]
AddService=,2
[tag_Install.NT.Hw]
AddReg = tag_AddReg
Expand Down Expand Up @@ -126,6 +136,9 @@ def test_rollback_firmware(self):
[tag_CopyFiles]
test.bin
[tag_Install.NT.Services]
AddService=,2
[tag_Install.NT.Hw]
AddReg = tag_AddReg
Expand Down Expand Up @@ -169,6 +182,9 @@ def test_rollback_firmware_integrity(self):
test.bin
test2.bin
[tag_Install.NT.Services]
AddService=,2
[tag_Install.NT.Hw]
AddReg = tag_AddReg
Expand Down Expand Up @@ -267,6 +283,9 @@ def test_one_section(self):
[tag_CopyFiles]
test.bin
[tag_Install.NT.Services]
AddService=,2
[tag_Install.NT.Hw]
AddReg = tag_AddReg
Expand All @@ -286,6 +305,7 @@ def test_one_section(self):
self.assertEqual("0x00010001", Strings.NonLocalizableStrings['REG_DWORD'])

def test_two_sections(self):
self.maxDiff = None
Strings = InfStrings()
SourceFiles = InfSourceFiles("diskname", Strings)

Expand Down Expand Up @@ -322,6 +342,9 @@ def test_two_sections(self):
[tag1_CopyFiles]
test1.bin
[tag1_Install.NT.Services]
AddService=,2
[tag1_Install.NT.Hw]
AddReg = tag1_AddReg
Expand All @@ -336,6 +359,9 @@ def test_two_sections(self):
[tag2_CopyFiles]
test2.bin
[tag2_Install.NT.Services]
AddService=,2
[tag2_Install.NT.Hw]
AddReg = tag2_AddReg
Expand Down Expand Up @@ -492,6 +518,9 @@ def test_inf_file(self):
[tag1_CopyFiles]
test1.bin
[tag1_Install.NT.Services]
AddService=,2
[tag1_Install.NT.Hw]
AddReg = tag1_AddReg
Expand All @@ -506,6 +535,9 @@ def test_inf_file(self):
[tag2_CopyFiles]
test2.bin
[tag2_Install.NT.Services]
AddService=,2
[tag2_Install.NT.Hw]
AddReg = tag2_AddReg
Expand Down Expand Up @@ -590,6 +622,9 @@ def test_inf_file_rollback(self):
[tag1_CopyFiles]
test1.bin
[tag1_Install.NT.Services]
AddService=,2
[tag1_Install.NT.Hw]
AddReg = tag1_AddReg
Expand All @@ -608,6 +643,9 @@ def test_inf_file_rollback(self):
[tag2_CopyFiles]
test2.bin
[tag2_Install.NT.Services]
AddService=,2
[tag2_Install.NT.Hw]
AddReg = tag2_AddReg
Expand Down Expand Up @@ -695,6 +733,9 @@ def test_inf_file_rollback_integrity(self):
test1.bin
integrity1.bin
[tag1_Install.NT.Services]
AddService=,2
[tag1_Install.NT.Hw]
AddReg = tag1_AddReg
Expand All @@ -715,6 +756,9 @@ def test_inf_file_rollback_integrity(self):
test2.bin
integrity2.bin
[tag2_Install.NT.Services]
AddService=,2
[tag2_Install.NT.Hw]
AddReg = tag2_AddReg
Expand Down

0 comments on commit b4d8e95

Please sign in to comment.