public static void IntegrateTextModeDrivers(List <TextModeDriverDirectory> textModeDriverDirectories, WindowsInstallation installation)
 {
     foreach (TextModeDriverDirectory textModeDriverDirectory in textModeDriverDirectories)
     {
         string deviceID = TextModeDriverIntegrator.UISelectDeviceID(textModeDriverDirectory);
         if (deviceID == String.Empty)
         {
             // No device has been selected, exit.
             // UISelectDeviceID has already printed an error message
             Program.Exit();
         }
         TextModeDriverIntegrator integrator = new TextModeDriverIntegrator(textModeDriverDirectory, installation, deviceID);
         integrator.IntegrateDriver();
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            args = CommandLineParser.GetCommandLineArgsIgnoreEscape();
            WindowsInstallation            installation;
            List <TextModeDriverDirectory> textModeDriverDirectories;
            List <PNPDriverDirectory>      pnpDriverDirectories;
            bool   useLocalHardwareConfig;
            string enumExportPath;
            bool   preconfigure;
            bool   staticIP;
            bool   usbBoot;

            bool parseSuccess = ParseCommandLineSwitches(args, out installation, out textModeDriverDirectories, out pnpDriverDirectories, out useLocalHardwareConfig, out enumExportPath, out preconfigure, out staticIP, out usbBoot);

            if (!parseSuccess)
            {
                // parser was already supposed to print an error meesage;
                return;
            }

            // Make sure Windows temporary folder exist (the user may have deleted it)
            if (!FileSystemUtils.IsDirectoryExist(Path.GetTempPath()))
            {
                FileSystemUtils.CreateDirectory(Path.GetTempPath());
            }
            installation.SetupRegistryHive.LoadHiveFromDirectory(installation.SetupDirectory);
            TextModeDriverIntegrator.IntegrateTextModeDrivers(textModeDriverDirectories, installation);
            List <DeviceService>        deviceServices    = PNPDriverIntegratorUtils.IntegratePNPDrivers(pnpDriverDirectories, installation, useLocalHardwareConfig, enumExportPath, preconfigure);
            List <NetworkDeviceService> netDeviceServices = DeviceServiceUtils.FilterNetworkDeviceServices(deviceServices);

            if (netDeviceServices.Count > 0)
            {
                if (!preconfigure && !DeviceServiceUtils.ContainsService(deviceServices, "nicbtcfg"))
                {
                    Console.WriteLine();
                    Console.Write("********************************************************************************");
                    Console.Write("*You have supplied a device driver for a network adapter, which requires       *");
                    Console.Write("*special registry configuration to support boot start, but you have not        *");
                    Console.Write("*used the /preconf switch. IntegrateDrv will assume you're using NICBootConf   *");
                    Console.Write("*to configure your network adapter during boot. (recommended)                  *");
                    Console.Write("********************************************************************************");
                }
            }

            if (usbBoot && !DeviceServiceUtils.ContainsService(deviceServices, "wait4ufd"))
            {
                Console.WriteLine();
                Console.Write("********************************************************************************");
                Console.Write("*When booting from a USB storage device, most systems will require that you    *");
                Console.Write("*will use a special driver (such as Wait4UFD) that will wait for the UFD boot  *");
                Console.Write("*storage device to be initialized before proceeding with the boot process.     *");
                Console.Write("********************************************************************************");
            }

            if (DeviceServiceUtils.ContainsService(deviceServices, "sanbootconf"))
            {
                Console.WriteLine();
                Console.WriteLine("sanbootconf detected, GUI boot (Windows logo) has been enabled.");

                installation.TextSetupInf.EnableGUIBoot();
            }

            if (netDeviceServices.Count > 0)
            {
                KernelAndHalIntegrator kernelAndHalIntegrator = new KernelAndHalIntegrator(installation);
                kernelAndHalIntegrator.UseUniprocessorKernel();

                Console.WriteLine();
                Console.WriteLine("Network adapter has been added, adding TCP/IP:");
                TCPIPIntegrator integrator = new TCPIPIntegrator(installation, netDeviceServices);
                integrator.SetTCPIPBoot();
                integrator.AssignIPAddressToNetDeviceServices(staticIP);
            }

            if (usbBoot)
            {
                USBBootIntegrator integrator = new USBBootIntegrator(installation);
                Console.WriteLine();
                Console.WriteLine("Integrating USB 2.0 Host Controller and Hub drivers.");
                integrator.IntegrateUSB20HostControllerAndHubDrivers();
                Console.WriteLine("Integrating USB Mass Storage Class Driver.");
                integrator.IntegrateUSBStorageDriver();
            }

            // no need to keep migration information (current drive letter assignments)
            installation.DeleteMigrationInformation();

            Console.WriteLine("Committing changes.");
            installation.SaveModifiedINIFiles();
            installation.SaveRegistryChanges();
            Console.WriteLine("Driver integration completed.");
        }