コード例 #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
        public static UninstallFileInfo Read(Stream fs)
        {
            UninstallFileInfo tempUFI = new UninstallFileInfo();

            //read in the fileinfo

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

            while (!ReadFiles.ReachedEndByte(fs, bType, 0x9A)) //if end byte is detected, bail out
            {
                switch (bType)
                {
                case 0x01:     //file path
                    tempUFI.Path = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x02:     //delete the file?
                    tempUFI.DeleteFile = ReadFiles.ReadBool(fs);
                    break;

                case 0x03:     //un-NGEN the file?
                    tempUFI.UnNGENFile = ReadFiles.ReadBool(fs);
                    break;

                case 0x04:
                    tempUFI.CPUVersion = (CPUVersion)ReadFiles.ReadInt(fs);
                    break;

                case 0x05:
                    tempUFI.FrameworkVersion = (FrameworkVersion)ReadFiles.ReadInt(fs);
                    break;

                case 0x06:
                    tempUFI.RegisterCOMDll = (COMRegistration)ReadFiles.ReadInt(fs);
                    break;

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

                bType = (byte)fs.ReadByte();
            }

            return(tempUFI);
        }
コード例 #3
0
        public static void ReadRollbackCOM(string fileName, List <UninstallFileInfo> rollbackList)
        {
            using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
            {
                // Read back the file identification data, if any
                if (!ReadFiles.IsHeaderValid(fs, "IURUCV1"))
                {
                    throw new Exception("Identifier incorrect");
                }

                UninstallFileInfo tempUpdateFile = new UninstallFileInfo();

                byte bType = (byte)fs.ReadByte();
                while (!ReadFiles.ReachedEndByte(fs, bType, 0xFF))
                {
                    switch (bType)
                    {
                    case 0x01:
                        tempUpdateFile.Path = ReadFiles.ReadString(fs);
                        break;

                    case 0x02:
                        tempUpdateFile.RegisterCOMDll = (COMRegistration)ReadFiles.ReadInt(fs);
                        break;

                    case 0x9B:    //end of file
                        rollbackList.Add(tempUpdateFile);
                        tempUpdateFile = new UninstallFileInfo();
                        break;

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

                    bType = (byte)fs.ReadByte();
                }
            }
        }
コード例 #4
0
ファイル: RollbackUpdate.cs プロジェクト: chances/Animatum
        public static UninstallFileInfo Read(Stream fs)
        {
            UninstallFileInfo tempUFI = new UninstallFileInfo();

            //read in the fileinfo

            byte bType = (byte)fs.ReadByte();
            while (!ReadFiles.ReachedEndByte(fs, bType, 0x9A)) //if end byte is detected, bail out
            {
                switch (bType)
                {
                    case 0x01: //file path
                        tempUFI.Path = ReadFiles.ReadDeprecatedString(fs);
                        break;
                    case 0x02: //delete the file?
                        tempUFI.DeleteFile = ReadFiles.ReadBool(fs);
                        break;
                    case 0x03: //un-NGEN the file?
                        tempUFI.UnNGENFile = ReadFiles.ReadBool(fs);
                        break;
                    case 0x04:
                        tempUFI.CPUVersion = (CPUVersion) ReadFiles.ReadInt(fs);
                        break;
                    case 0x05:
                        tempUFI.FrameworkVersion = (FrameworkVersion) ReadFiles.ReadInt(fs);
                        break;
                    case 0x06:
                        tempUFI.RegisterCOMDll = (COMRegistration) ReadFiles.ReadInt(fs);
                        break;
                    default:
                        ReadFiles.SkipField(fs, bType);
                        break;
                }

                bType = (byte)fs.ReadByte();
            }

            return tempUFI;
        }
コード例 #5
0
ファイル: RollbackUpdate.cs プロジェクト: chances/Animatum
        public static void ReadRollbackCOM(string fileName, List<UninstallFileInfo> rollbackList)
        {
            using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
            {
                // Read back the file identification data, if any
                if (!ReadFiles.IsHeaderValid(fs, "IURUCV1"))
                    throw new Exception("Identifier incorrect");

                UninstallFileInfo tempUpdateFile = new UninstallFileInfo();

                byte bType = (byte)fs.ReadByte();
                while (!ReadFiles.ReachedEndByte(fs, bType, 0xFF))
                {
                    switch (bType)
                    {
                        case 0x01:
                            tempUpdateFile.Path = ReadFiles.ReadString(fs);
                            break;
                        case 0x02:
                            tempUpdateFile.RegisterCOMDll = (COMRegistration)ReadFiles.ReadInt(fs);
                            break;
                        case 0x9B://end of file
                            rollbackList.Add(tempUpdateFile);
                            tempUpdateFile = new UninstallFileInfo();
                            break;
                        default:
                            ReadFiles.SkipField(fs, bType);
                            break;
                    }

                    bType = (byte)fs.ReadByte();
                }
            }
        }