public static void ReadRollbackRegistry(string fileName, List <RegChange> rollbackRegistry) { using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { // Read back the file identification data, if any if (!ReadFiles.IsHeaderValid(fs, "IURURV1")) { throw new Exception("Identifier incorrect"); } byte bType = (byte)fs.ReadByte(); while (!ReadFiles.ReachedEndByte(fs, bType, 0xFF)) { switch (bType) { case 0x01: //num of registry changes rollbackRegistry.Capacity = ReadFiles.ReadInt(fs); break; case 0x8E: //add RegChange rollbackRegistry.Add(RegChange.ReadFromStream(fs)); break; default: ReadFiles.SkipField(fs, bType); break; } bType = (byte)fs.ReadByte(); } } }
public static void ReadRollbackRegistry(string fileName, List <RegChange> rollbackRegistry) { using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { if (!ReadFiles.IsHeaderValid(fileStream, "IURURV1")) { throw new Exception("Identifier incorrect"); } byte b = (byte)fileStream.ReadByte(); while (!ReadFiles.ReachedEndByte(fileStream, b, byte.MaxValue)) { switch (b) { case 1: rollbackRegistry.Capacity = ReadFiles.ReadInt(fileStream); break; case 142: rollbackRegistry.Add(RegChange.ReadFromStream(fileStream)); break; default: ReadFiles.SkipField(fileStream, b); break; } b = (byte)fileStream.ReadByte(); } } }
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(); } }
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(); } }