/// <summary> /// Constructor /// </summary> /// <param name="relocDirectory">Reloc directory</param> /// <param name="machine">Machine</param> /// <param name="logError">Error logger</param> internal StartupStub(RelocDirectory relocDirectory, Machine machine, Action <string, object[]> logError) { this.relocDirectory = relocDirectory; this.machine = machine; this.logError = logError; CpuArch.TryGetCpuArch(machine, out cpuArch); }
/// <summary> /// Constructor /// </summary> /// <param name="relocDirectory">Reloc directory</param> /// <param name="machine">Machine</param> /// <param name="logError">Error logger</param> internal StartupStub(RelocDirectory relocDirectory, Machine machine, LogError logError) { this.relocDirectory = relocDirectory; this.machine = machine; this.logError = logError; CpuArch.TryGetCpuArch(machine, out cpuArch); }
public ManagedExportsWriter(string moduleName, Machine machine, RelocDirectory relocDirectory, MetaData metaData, PEHeaders peHeaders, LogError logError) { this.moduleName = moduleName; this.machine = machine; this.relocDirectory = relocDirectory; this.metaData = metaData; this.peHeaders = peHeaders; this.logError = logError; vtableFixups = new VtableFixupsChunk(this); stubsChunk = new StubsChunk(this); sdataChunk = new SdataChunk(this); exportDir = new ExportDir(this); vtables = new List <VTableInfo>(); allMethodInfos = new List <MethodInfo>(); sortedNameInfos = new List <MethodInfo>(); // The error is reported later when we know that there's at least one exported method CpuArch.TryGetCpuArch(machine, out cpuArch); }
public static CbsPackageInfo[] BuildNonBinaryPackages(string DeviceName, CpuArch OSArchitecture) { List <CbsPackageInfo> packages = new List <CbsPackageInfo>(); foreach (var partpath in Directory.EnumerateDirectories(nonBinDirectory)) { string partitionname = partpath.Split('\\').Last(); var cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = partitionname, OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"OneCore.{DeviceName}.{partitionname}", PackageName = $"Microsoft-OneCore-{DeviceName}-{partitionname}-Package", SubComponent = "", PublicKey = MicrosoftCBSPublicKey1 }; foreach (var file in Directory.EnumerateFiles(partpath, "*.*", SearchOption.AllDirectories)) { Console.WriteLine(file); cbsCabinet.AddFile(FileType.Regular, file, file.Replace(partpath, ""), cbsCabinet.PackageName); } cbsCabinet.Validate(); string DevicePlatformCabFileName = $"Microsoft-OneCore-{DeviceName}-{partitionname}-Package~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab"; cbsCabinet.SaveCab(Path.Combine(OEMOutputDir, DevicePlatformCabFileName)); packages.Add(new CbsPackageInfo(Path.Combine(OEMOutputDir, DevicePlatformCabFileName))); } return(packages.ToArray()); }
public static CbsPackageInfo[] BuildBinaryPackages(string DeviceName, CpuArch OSArchitecture) { List <CbsPackageInfo> packages = new List <CbsPackageInfo>(); foreach (var partpath in Directory.EnumerateFiles(binDirectory, "*.bin")) { string partitionname = Path.GetFileNameWithoutExtension(partpath); var cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = true, Owner = "Microsoft", Partition = partitionname, OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"OneCore.{DeviceName}.{partitionname}", PackageName = $"Microsoft-OneCore-{DeviceName}-{partitionname}-Package", SubComponent = "", PublicKey = MicrosoftCBSPublicKey1 }; cbsCabinet.AddFile(FileType.BinaryPartition, partpath, $"\\{partitionname}.bin", ""); cbsCabinet.Validate(); string DevicePlatformCabFileName = $"Microsoft-OneCore-{DeviceName}-{partitionname}-Package~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab"; cbsCabinet.SaveCab(Path.Combine(OEMOutputDir, DevicePlatformCabFileName)); packages.Add(new CbsPackageInfo(Path.Combine(OEMOutputDir, DevicePlatformCabFileName))); } return(packages.ToArray()); }
public static void BuildComponents( string DeviceName, string BuildVersion, string OutputPath, string DeviceFMPath, string OEMDevicePlatformPath, string DeviceLayoutPath, string DeviceLayoutLegacyPath, CpuArch OSArchitecture, string OSProductName, IEnumerable <IPackageInfo> SupplementalPackages) { string FeatureManifestId = $"{OSProductName.ToUpper()}{string.Join("", DeviceName.ToUpper().Take(3))}DEV"; //////////////////////// var cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = "mainos", OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"OneCore.{DeviceName}.DevicePlatform", PackageName = $"Microsoft-OneCore-{DeviceName}-DevicePlatform-Package", SubComponent = "", PublicKey = MicrosoftCBSPublicKey1 }; cbsCabinet.AddFile(FileType.Regular, OEMDevicePlatformPath, @"\Windows\ImageUpdate\OEMDevicePlatform.xml", cbsCabinet.PackageName); cbsCabinet.Validate(); string DevicePlatformCabFileName = $"Microsoft-OneCore-{DeviceName}-DevicePlatform-Package~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab"; cbsCabinet.SaveCab(Path.Combine(OutputPath, DevicePlatformCabFileName)); cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = "MainOS", OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"{OSProductName}.OEMDEVICEPLATFORM_TALKMAN.{FeatureManifestId}", PackageName = $"Microsoft.{OSProductName}.OEMDEVICEPLATFORM_TALKMAN.{FeatureManifestId}.FIP", SubComponent = "FIP", PublicKey = OEMCBSPublicKey2 }; List <IPackageInfo> lst = new List <IPackageInfo> { new CbsPackageInfo(Path.Combine(OutputPath, DevicePlatformCabFileName)) }; cbsCabinet.SetCBSFeatureInfo(FeatureManifestId, $"OEMDEVICEPLATFORM_TALKMAN", "OEM", lst); cbsCabinet.Validate(); cbsCabinet.SaveCab(Path.Combine(OutputPath, $"Microsoft.{OSProductName}.OEMDEVICEPLATFORM_TALKMAN.{FeatureManifestId}.FIP~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab")); //////////////////////// cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = "MAINOS", OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"OneCore.Cityman.SpaceDeviceLayout", PackageName = $"Microsoft-OneCore-Cityman-SpaceDeviceLayout-Package", SubComponent = "", PublicKey = MicrosoftCBSPublicKey1 }; cbsCabinet.AddFile(FileType.Regular, DeviceLayoutPath, @"\Windows\ImageUpdate\DeviceLayout.xml", cbsCabinet.PackageName); cbsCabinet.Validate(); string DeviceLayoutCabFileName = $"Microsoft-OneCore-Cityman-SpaceDeviceLayout-Package~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab"; cbsCabinet.SaveCab(Path.Combine(OutputPath, DeviceLayoutCabFileName)); cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = "MAINOS", OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"{OSProductName}.DEVICELAYOUT_CITYMAN_SPACES.{FeatureManifestId}", PackageName = $"Microsoft.{OSProductName}.DEVICELAYOUT_CITYMAN_SPACES.{FeatureManifestId}.FIP", SubComponent = "FIP", PublicKey = OEMCBSPublicKey2 }; lst = new List <IPackageInfo> { new CbsPackageInfo(Path.Combine(OutputPath, DeviceLayoutCabFileName)) }; cbsCabinet.SetCBSFeatureInfo(FeatureManifestId, $"DEVICELAYOUT_CITYMAN_SPACES", "OEM", lst); cbsCabinet.Validate(); cbsCabinet.SaveCab(Path.Combine(OutputPath, $"Microsoft.{OSProductName}.DEVICELAYOUT_CITYMAN_SPACES.{FeatureManifestId}.FIP~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab")); ///////////////// cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = "MAINOS", OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"OneCore.Cityman.LegacyDeviceLayout", PackageName = $"Microsoft-OneCore-Cityman-LegacyDeviceLayout-Package", SubComponent = "", PublicKey = MicrosoftCBSPublicKey1 }; cbsCabinet.AddFile(FileType.Regular, DeviceLayoutLegacyPath, @"\Windows\ImageUpdate\DeviceLayout.xml", cbsCabinet.PackageName); cbsCabinet.Validate(); DeviceLayoutCabFileName = $"Microsoft-OneCore-Cityman-LegacyDeviceLayout-Package~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab"; cbsCabinet.SaveCab(Path.Combine(OutputPath, DeviceLayoutCabFileName)); cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = "MAINOS", OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"{OSProductName}.DEVICELAYOUT_CITYMAN_LEGACY.{FeatureManifestId}", PackageName = $"Microsoft.{OSProductName}.DEVICELAYOUT_CITYMAN_LEGACY.{FeatureManifestId}.FIP", SubComponent = "FIP", PublicKey = OEMCBSPublicKey2 }; lst = new List <IPackageInfo> { new CbsPackageInfo(Path.Combine(OutputPath, DeviceLayoutCabFileName)) }; cbsCabinet.SetCBSFeatureInfo(FeatureManifestId, $"DEVICELAYOUT_CITYMAN_LEGACY", "OEM", lst); cbsCabinet.Validate(); cbsCabinet.SaveCab(Path.Combine(OutputPath, $"Microsoft.{OSProductName}.DEVICELAYOUT_CITYMAN_LEGACY.{FeatureManifestId}.FIP~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab")); ///////////////// cbsCabinet = new CbsPackage { BuildType = BuildType.Release, BinaryPartition = false, Owner = "Microsoft", Partition = "MainOS", OwnerType = PhoneOwnerType.OEM, PhoneReleaseType = PhoneReleaseType.Production, ReleaseType = "Feature Pack", HostArch = OSArchitecture, Version = new Version(BuildVersion), Component = $"{OSProductName}.{DeviceName}DeviceFM", PackageName = $"Microsoft.{OSProductName}.{DeviceName}DeviceFM", SubComponent = "", PublicKey = OEMCBSPublicKey2 }; cbsCabinet.AddFile(FileType.Regular, DeviceFMPath, $@"\Windows\ImageUpdate\FeatureManifest\OEM\{DeviceName}DeviceFM.xml", ""); cbsCabinet.SetCBSFeatureInfo(FeatureManifestId, "BASE", "OEM", SupplementalPackages.ToList()); cbsCabinet.Validate(); cbsCabinet.SaveCab(Path.Combine(OutputPath, $"Microsoft.{OSProductName}.{DeviceName}DeviceFM~{MicrosoftCBSPublicKey1}~{OSArchitecture.ToString().ToUpper()}~~.cab")); }