public void IntegrateDriver()
        {
            UpdateTextSetupInformationFileAndCopyFiles(m_deviceID);
            string destinationWinntDirectory = m_installation.GetDriverDestinationWinntDirectory(m_deviceID);

            // hivesft.inf
            m_installation.HiveSoftwareInf.RegisterDriverDirectory(destinationWinntDirectory);

            if (m_installation.Is64Bit)
            {
                // hivsft32.inf
                m_installation.HiveSoftware32Inf.RegisterDriverDirectory(destinationWinntDirectory);
            }
        }
Пример #2
0
        public void CopyDriverToSetupDriverDirectoryAndRegisterIt(PNPDriverINFFile pnpDriverInf)
        {
            Console.WriteLine();
            Console.WriteLine("Making the driver available to GUI mode setup.");

            // build list of source files:
            List <string> driverFiles = new List <string>();

            foreach (FileToCopy fileToCopy in this.DriverFilesToCopy)
            {
                DisableInBoxDeviceDriverFile(m_installation.SetupDirectory, fileToCopy.DestinationFileName);

                driverFiles.Add(fileToCopy.RelativeSourceFilePath);
            }

            // make sure the .inf file will be copied too
            driverFiles.Add(pnpDriverInf.FileName);

            if (pnpDriverInf.CatalogFile != String.Empty)
            {
                if (File.Exists(this.DriverDirectory.Path + pnpDriverInf.CatalogFile))
                {
                    // add the catalog file too (to suppress unsigned driver warning message if the .inf has not been modified)
                    // the catalog file is in the same location as the INF file ( http://msdn.microsoft.com/en-us/library/windows/hardware/ff547502%28v=vs.85%29.aspx )
                    driverFiles.Add(pnpDriverInf.CatalogFile);
                }
            }

            // Note that we may perform some operations on the same directory more than once,
            // the allocate / register methods are supposed to return the previously allocated IDs on subsequent calls,
            // and skip registration of previously registered directories
            foreach (string relativeFilePath in driverFiles)
            {
                string fileName = FileSystemUtils.GetNameFromPath(relativeFilePath);
                string relativeDirectoryPath = relativeFilePath.Substring(0, relativeFilePath.Length - fileName.Length);

                // we need to copy the files to the proper sub-directories
                m_installation.CopyFileToSetupDriverDirectory(this.DriverDirectory.Path + relativeDirectoryPath + fileName, this.HardwareID + @"\" + relativeDirectoryPath, fileName);

                string sourceDirectoryInMediaRootForm = m_installation.GetSourceDriverDirectoryInMediaRootForm(this.HardwareID + @"\" + relativeDirectoryPath); // note that we may violate ISO9660 - & is not allowed
                int    sourceDiskID = m_installation.TextSetupInf.AllocateSourceDiskID(m_installation.ArchitectureIdentifier, sourceDirectoryInMediaRootForm);

                string destinationWinntDirectory   = m_installation.GetDriverDestinationWinntDirectory(this.HardwareID + @"\" + relativeDirectoryPath);
                int    destinationWinntDirectoryID = m_installation.TextSetupInf.AllocateWinntDirectoryID(destinationWinntDirectory);

                m_installation.TextSetupInf.SetSourceDisksFileEntry(m_installation.ArchitectureIdentifier, sourceDiskID, destinationWinntDirectoryID, fileName, FileCopyDisposition.AlwaysCopy);

                // dosnet.inf: we add the file to the list of files to be copied to local source directory
                if (!m_installation.IsTargetContainsTemporaryInstallation)
                {
                    m_installation.DosNetInf.InstructSetupToCopyFileFromSetupDirectoryToLocalSourceDriverDirectory(sourceDirectoryInMediaRootForm, fileName);
                }

                m_installation.HiveSoftwareInf.RegisterDriverDirectory(destinationWinntDirectory);
                if (m_installation.Is64Bit)
                {
                    // hivsft32.inf
                    m_installation.HiveSoftware32Inf.RegisterDriverDirectory(destinationWinntDirectory);
                }
            }

            // set inf to boot start:
            string setupDriverDirectoryPath = m_installation.GetSetupDriverDirectoryPath(this.HardwareID + @"\"); // note that we may violate ISO9660 - & character is not allowed
            string installSectionName       = pnpDriverInf.GetDeviceInstallSectionName(this.HardwareID, m_installation.ArchitectureIdentifier, m_installation.MinorOSVersion, m_installation.ProductType);

            pnpDriverInf.SetServiceToBootStart(installSectionName, m_installation.ArchitectureIdentifier, m_installation.MinorOSVersion);
            pnpDriverInf.SaveToDirectory(setupDriverDirectoryPath);
            // finished setting inf to boot start
        }