Exemple #1
0
        /// <param name="subdir">Presumably in the following form: '\x86'</param>
        public static string GeSourceFileDiskID(PNPDriverINFFile pnpDriverInf, string sourceFileName, string architectureIdentifier, out string subdir)
        {
            // During installation, SetupAPI functions look for architecture-specific SourceDisksFiles sections before using the generic section
            string        platformSpecificSectionName = "SourceDisksFiles." + architectureIdentifier;
            List <string> values = pnpDriverInf.GetValuesOfKeyInSection(platformSpecificSectionName, sourceFileName);

            if (values.Count == 0)
            {
                values = pnpDriverInf.GetValuesOfKeyInSection("SourceDisksFiles", sourceFileName);
            }
            // filename=diskid[,[ subdir][,size]]
            string diskID = INIFile.TryGetValue(values, 0);

            subdir = INIFile.TryGetValue(values, 1);
            return(diskID);
        }
Exemple #2
0
        /// <returns>
        /// Null if the diskID entry was not found,
        /// otherwise, the path is supposed to be in the following form: '\WinNT'
        /// </returns>
        public static string GeSourceDiskPath(PNPDriverINFFile pnpDriverInf, string diskID, string architectureIdentifier)
        {
            List <string> values = pnpDriverInf.GetValuesOfKeyInSection("SourceDisksNames." + architectureIdentifier, diskID);

            if (values.Count == 0)
            {
                values = pnpDriverInf.GetValuesOfKeyInSection("SourceDisksNames", diskID);
            }

            if (values.Count > 0)
            {
                // diskid = disk-description[,[tag-or-cab-file],[unused],[path],[flags][,tag-file]]
                string path = INIFile.TryGetValue(values, 3);
                // Quoted path is allowed (example: SiS 900-Based PCI Fast Ethernet Adapter driver, version 2.0.1039.1190)
                return(QuotedStringUtils.Unquote(path));
            }
            else
            {
                return(null);
            }
        }