示例#1
0
        static void LoadUninstallData(Stream ms, List <UninstallFileInfo> uninstallFiles, List <string> uninstallFolders, List <RegChange> uninstallRegistry, List <UninstallFileInfo> comDllsToUnreg, List <string> servicesToStop)
        {
            ms.Position = 0;

            // Read back the file identification data, if any
            if (!ReadFiles.IsHeaderValid(ms, "IUUFRV1"))
            {
                //free up the file so it can be deleted
                ms.Close();

                throw new Exception("The uninstall file does not have the correct identifier - this is usually caused by file corruption.");
            }

            byte bType = (byte)ms.ReadByte();

            while (!ReadFiles.ReachedEndByte(ms, bType, 0xFF))
            {
                switch (bType)
                {
                case 0x8A:    //file to delete
                    uninstallFiles.Add(UninstallFileInfo.Read(ms));
                    break;

                case 0x8B:     // files to unreg COM
                    comDllsToUnreg.Add(UninstallFileInfo.Read(ms));
                    break;

                case 0x10:    //folder to delete
                    uninstallFolders.Add(ReadFiles.ReadDeprecatedString(ms));
                    break;

                case 0x11:     //service to stop
                    servicesToStop.Add(ReadFiles.ReadString(ms));
                    break;

                case 0x8E:    //regChanges to execute
                    uninstallRegistry.Add(RegChange.ReadFromStream(ms));
                    break;

                default:
                    ReadFiles.SkipField(ms, bType);
                    break;
                }

                bType = (byte)ms.ReadByte();
            }
        }
示例#2
0
        private static void LoadUninstallData(Stream ms, List <UninstallFileInfo> uninstallFiles, List <string> uninstallFolders, List <RegChange> uninstallRegistry, List <UninstallFileInfo> comDllsToUnreg, List <string> servicesToStop)
        {
            ms.Position = 0L;
            if (!ReadFiles.IsHeaderValid(ms, "IUUFRV1"))
            {
                ms.Close();
                throw new Exception("The uninstall file does not have the correct identifier - this is usually caused by file corruption.");
            }
            byte b = (byte)ms.ReadByte();

            while (!ReadFiles.ReachedEndByte(ms, b, byte.MaxValue))
            {
                switch (b)
                {
                case 138:
                    uninstallFiles.Add(UninstallFileInfo.Read(ms));
                    break;

                case 139:
                    comDllsToUnreg.Add(UninstallFileInfo.Read(ms));
                    break;

                case 16:
                    uninstallFolders.Add(ReadFiles.ReadDeprecatedString(ms));
                    break;

                case 17:
                    servicesToStop.Add(ReadFiles.ReadString(ms));
                    break;

                case 142:
                    uninstallRegistry.Add(RegChange.ReadFromStream(ms));
                    break;

                default:
                    ReadFiles.SkipField(ms, b);
                    break;
                }
                b = (byte)ms.ReadByte();
            }
        }