def PackageWindowsCapsuleFiles(OutputFolder, ProductName, ProductFmpGuid, CapsuleVersion_DotString,
    CapsuleVersion_HexString, ProductFwProvider, ProductFwMfgName, ProductFwDesc, CapsuleFileName, PfxFile=None, PfxPass=None,
    Rollback=False, Arch='amd64', OperatingSystem_String='Win10'):

      logging.debug("CapsulePackage: Create Windows Capsule Files")

      #Make INF
      InfFilePath = os.path.join(OutputFolder, ProductName + ".inf")
      InfTool = InfGenerator(ProductName, ProductFwProvider, ProductFmpGuid, Arch, ProductFwDesc, CapsuleVersion_DotString, CapsuleVersion_HexString)
      InfTool.Manufacturer = ProductFwMfgName  #optional
      ret = InfTool.MakeInf(InfFilePath, CapsuleFileName, Rollback)
      if(ret != 0):
          raise Exception("CreateWindowsInf Failed with errorcode %d" % ret)

      #Make CAT
      CatFilePath = os.path.realpath(os.path.join(OutputFolder, ProductName + ".cat"))
      CatTool = CatGenerator(Arch, OperatingSystem_String)
      ret = CatTool.MakeCat(CatFilePath)

      if(ret != 0):
          raise Exception("Creating Cat file Failed with errorcode %d" % ret)

      if(PfxFile is not None):
          #Find Signtool
          SignToolPath = FindToolInWinSdk("signtool.exe")
          if not os.path.exists(SignToolPath):
              raise Exception("Can't find signtool on this machine.")
          #dev sign the cat file
          ret = CatalogSignWithSignTool(SignToolPath, CatFilePath, PfxFile, PfxPass)
          if(ret != 0):
              raise Exception("Signing Cat file Failed with errorcode %d" % ret)

      return ret
Exemple #2
0
 def test_invalid_pathtotool(self):
     o = CatGenerator("amd64", "10")
     with self.assertRaises(Exception) as cm:
         o.MakeCat("garbage",
                   os.path.join("c:", "test", "badpath", "inf2cat.exe"))
     self.assertTrue(
         str(cm.exception).startswith(
             "Can't find Inf2Cat on this machine."))
Exemple #3
0
 def test_invalid_arch(self):
     with self.assertRaises(ValueError):
         CatGenerator("Invalid Arch", "win10")
Exemple #4
0
 def test_arm_arch(self):
     o = CatGenerator("arm", "win10")
     self.assertEqual(o.Arch, "ARM")
Exemple #5
0
 def test_aarch64_arch(self):
     o = CatGenerator("aarch64", "win10")
     self.assertEqual(o.Arch, "ARM64")
Exemple #6
0
 def test_amd64_arch(self):
     o = CatGenerator("amd64", "win10")
     self.assertEqual(o.Arch, "X64")
Exemple #7
0
 def test_invalid_OS(self):
     with self.assertRaises(ValueError):
         CatGenerator("x64", "Invalid Junk")
Exemple #8
0
 def test_ServerRS4_OS(self):
     o = CatGenerator("x64", "ServerRS4")
     self.assertEqual(o.OperatingSystem, "ServerRS4")
Exemple #9
0
 def test_win10Server_OS(self):
     o = CatGenerator("x64", "Server10")
     self.assertEqual(o.OperatingSystem, "Server10")
Exemple #10
0
 def test_10_RS3_OS(self):
     o = CatGenerator("x64", "10_RS3")
     self.assertEqual(o.OperatingSystem, "10_RS3")