Skip to content

Commit

Permalink
Limiting capsule install to supported versions (#431)
Browse files Browse the repository at this point in the history
The syntax 'DIRID 13' was introduced in OS version 10.0.16299, but DDInstall sections utilizing the syntax will install on earlier OS versions. Those DDInstall sections should be restricted to only install on 10.0.16299 or higher using a TargetOSVersion decoration.
  • Loading branch information
bkarstens authored Oct 12, 2023
1 parent 3b79a78 commit 000f4c8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions edk2toollib/windows/capsule/inf_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class InfGenerator(object):
CatalogFile={Name}.cat
[Manufacturer]
%MfgName% = Firmware,NT{Arch}
%MfgName% = Firmware,NT{Arch}.10.0...16299
[Firmware.NT{Arch}]
[Firmware.NT{Arch}.10.0...16299]
%FirmwareDesc% = Firmware_Install,UEFI\RES_{{{EsrtGuid}}}
[Firmware_Install.NT]
Expand Down
4 changes: 2 additions & 2 deletions edk2toollib/windows/capsule/inf_generator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __str__(self) -> str:
CatalogFile={self.Name}.cat
[Manufacturer]
%MfgName% = Firmware,NT{self.Arch}
%MfgName% = Firmware,NT{self.Arch}.10.0...16299
""")

Expand Down Expand Up @@ -284,7 +284,7 @@ def __str__(self) -> str:
This includes any InfFirmware objects in it.
"""
firmwareStr = f"[Firmware.NT{self.Arch}]\n"
firmwareStr = f"[Firmware.NT{self.Arch}.10.0...16299]\n"
for InfFirmware in self.Sections.values():
firmwareStr += f"%{InfFirmware.Tag}Desc% = {InfFirmware.Tag}_Install,UEFI\\RES_{{{InfFirmware.EsrtGuid}}}\n"
firmwareStr += "\n"
Expand Down
4 changes: 2 additions & 2 deletions tests.unit/test_inf_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ def test_invalid_guid_format(self):
CatalogFile=TestName.cat
[Manufacturer]
%MfgName% = Firmware,NTamd64
%MfgName% = Firmware,NTamd64.10.0...16299
[Firmware.NTamd64]
[Firmware.NTamd64.10.0...16299]
%FirmwareDesc% = Firmware_Install,UEFI\\RES_{3cad7a0c-d35b-4b75-96b1-03a9fb07b7fc}
[Firmware_Install.NT]
Expand Down
18 changes: 9 additions & 9 deletions tests.unit/test_inf_generator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_header(self):
CatalogFile=InfTest.cat
[Manufacturer]
%MfgName% = Firmware,NTamd64
%MfgName% = Firmware,NTamd64.10.0...16299
""")
self.assertEqual(ExpectedStr, str(Header))
Expand Down Expand Up @@ -258,7 +258,7 @@ def test_one_section(self):
Sections.AddSection(Firmware)

ExpectedStr = textwrap.dedent("""\
[Firmware.NTamd64]
[Firmware.NTamd64.10.0...16299]
%tagDesc% = tag_Install,UEFI\\RES_{34e094e9-4079-44cd-9450-3f2cb7824c97}
[tag_Install.NT]
Expand Down Expand Up @@ -312,7 +312,7 @@ def test_two_sections(self):
Sections.AddSection(Firmware2)

ExpectedStr = textwrap.dedent("""\
[Firmware.NTamd64]
[Firmware.NTamd64.10.0...16299]
%tag1Desc% = tag1_Install,UEFI\\RES_{34e094e9-4079-44cd-9450-3f2cb7824c97}
%tag2Desc% = tag2_Install,UEFI\\RES_{bec9124f-9934-4ec0-a6ed-b8bc1c91d276}
Expand Down Expand Up @@ -480,9 +480,9 @@ def test_inf_file(self):
CatalogFile=CapsuleName.cat
[Manufacturer]
%MfgName% = Firmware,NTamd64
%MfgName% = Firmware,NTamd64.10.0...16299
[Firmware.NTamd64]
[Firmware.NTamd64.10.0...16299]
%tag1Desc% = tag1_Install,UEFI\\RES_{34e094e9-4079-44cd-9450-3f2cb7824c97}
%tag2Desc% = tag2_Install,UEFI\\RES_{bec9124f-9934-4ec0-a6ed-b8bc1c91d276}
Expand Down Expand Up @@ -574,9 +574,9 @@ def test_inf_file_rollback(self):
CatalogFile=CapsuleName.cat
[Manufacturer]
%MfgName% = Firmware,NTamd64
%MfgName% = Firmware,NTamd64.10.0...16299
[Firmware.NTamd64]
[Firmware.NTamd64.10.0...16299]
%tag1Desc% = tag1_Install,UEFI\\RES_{34e094e9-4079-44cd-9450-3f2cb7824c97}
%tag2Desc% = tag2_Install,UEFI\\RES_{bec9124f-9934-4ec0-a6ed-b8bc1c91d276}
Expand Down Expand Up @@ -678,9 +678,9 @@ def test_inf_file_rollback_integrity(self):
CatalogFile=CapsuleName.cat
[Manufacturer]
%MfgName% = Firmware,NTamd64
%MfgName% = Firmware,NTamd64.10.0...16299
[Firmware.NTamd64]
[Firmware.NTamd64.10.0...16299]
%tag1Desc% = tag1_Install,UEFI\\RES_{34e094e9-4079-44cd-9450-3f2cb7824c97}
%tag2Desc% = tag2_Install,UEFI\\RES_{bec9124f-9934-4ec0-a6ed-b8bc1c91d276}
Expand Down

0 comments on commit 000f4c8

Please sign in to comment.