This commit is contained in:
Vichingo455 2025-06-23 17:07:12 +02:00
parent a6b60d72bd
commit b71e8bd82f
6 changed files with 136 additions and 90 deletions

View File

@ -174,16 +174,16 @@ namespace patch_seb
} }
if (checkBox2.Checked) if (checkBox2.Checked)
{ {
File.WriteAllText(Path.GetTempPath() + @"\SEB.reg", Resources.cert); File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Temp\SEB.reg", Resources.cert);
ProcessStartInfo info = new ProcessStartInfo ProcessStartInfo info = new ProcessStartInfo
{ {
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\regedit.exe", FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\regedit.exe",
Arguments = $@"/s \""{Path.GetTempPath() + @"\SEB.reg"}\""", Arguments = $@"/s {Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Temp\SEB.reg"}",
CreateNoWindow = true, CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden WindowStyle = ProcessWindowStyle.Hidden
}; };
Process.Start(info).WaitForExit(); Process.Start(info).WaitForExit();
File.Delete(Path.GetTempPath() + @"\SEB.reg"); File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Temp\SEB.reg");
} }
AddLog("PATCHING DONE"); AddLog("PATCHING DONE");
button1.Text = "PATCH DONE"; button1.Text = "PATCH DONE";
@ -199,7 +199,11 @@ namespace patch_seb
if (something == 4) if (something == 4)
{ {
something = 0; something = 0;
#if DEBUG
MessageBox.Show("Safe Exam Browser Patch (Debug/Beta) v" + Application.ProductVersion + "\nFor Safe Exam Browser version " + Variables.SupportedSEB + "\nCreated with love by Vichingo455\n\nBecause Freedom is a right, respect it.", "Safe Exam Browser Patch", MessageBoxButtons.OK, MessageBoxIcon.Information);
#else
MessageBox.Show("Safe Exam Browser Patch v" + Application.ProductVersion + "\nFor Safe Exam Browser version " + Variables.SupportedSEB + "\nCreated with love by Vichingo455\n\nBecause Freedom is a right, respect it.", "Safe Exam Browser Patch", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Safe Exam Browser Patch v" + Application.ProductVersion + "\nFor Safe Exam Browser version " + Variables.SupportedSEB + "\nCreated with love by Vichingo455\n\nBecause Freedom is a right, respect it.", "Safe Exam Browser Patch", MessageBoxButtons.OK, MessageBoxIcon.Information);
#endif
} }
else else
{ {

View File

@ -31,17 +31,17 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OfflinePatcher)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OfflinePatcher));
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.partitionComboBox = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.partitionComboBox = new System.Windows.Forms.ComboBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.selectedinstallation = new System.Windows.Forms.Label();
this.autodetect = new System.Windows.Forms.RadioButton();
this.x64 = new System.Windows.Forms.RadioButton();
this.x86 = new System.Windows.Forms.RadioButton();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox(); this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.x86 = new System.Windows.Forms.RadioButton();
this.x64 = new System.Windows.Forms.RadioButton();
this.autodetect = new System.Windows.Forms.RadioButton();
this.selectedinstallation = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
@ -61,6 +61,7 @@
this.label1.Size = new System.Drawing.Size(324, 28); this.label1.Size = new System.Drawing.Size(324, 28);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "Safe Exam Browser Offline Patch"; this.label1.Text = "Safe Exam Browser Offline Patch";
this.label1.Click += new System.EventHandler(this.label1_Click);
// //
// groupBox1 // groupBox1
// //
@ -74,14 +75,15 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Safe Exam Browser installations"; this.groupBox1.Text = "Safe Exam Browser installations";
// //
// partitionComboBox // button1
// //
this.partitionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.button1.Location = new System.Drawing.Point(583, 44);
this.partitionComboBox.FormattingEnabled = true; this.button1.Name = "button1";
this.partitionComboBox.Location = new System.Drawing.Point(178, 44); this.button1.Size = new System.Drawing.Size(116, 29);
this.partitionComboBox.Name = "partitionComboBox"; this.button1.TabIndex = 2;
this.partitionComboBox.Size = new System.Drawing.Size(381, 29); this.button1.Text = "USE";
this.partitionComboBox.TabIndex = 0; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// label2 // label2
// //
@ -92,15 +94,14 @@
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
this.label2.Text = "Installation to patch:"; this.label2.Text = "Installation to patch:";
// //
// button1 // partitionComboBox
// //
this.button1.Location = new System.Drawing.Point(583, 44); this.partitionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.button1.Name = "button1"; this.partitionComboBox.FormattingEnabled = true;
this.button1.Size = new System.Drawing.Size(116, 29); this.partitionComboBox.Location = new System.Drawing.Point(178, 44);
this.button1.TabIndex = 2; this.partitionComboBox.Name = "partitionComboBox";
this.button1.Text = "USE"; this.partitionComboBox.Size = new System.Drawing.Size(381, 29);
this.button1.UseVisualStyleBackColor = true; this.partitionComboBox.TabIndex = 0;
this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// groupBox2 // groupBox2
// //
@ -119,23 +120,47 @@
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Patch settings"; this.groupBox2.Text = "Patch settings";
// //
// label3 // checkBox2
// //
this.label3.AutoSize = true; this.checkBox2.AutoSize = true;
this.label3.Location = new System.Drawing.Point(21, 73); this.checkBox2.Checked = true;
this.label3.Name = "label3"; this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.label3.Size = new System.Drawing.Size(233, 21); this.checkBox2.Location = new System.Drawing.Point(25, 152);
this.label3.TabIndex = 0; this.checkBox2.Name = "checkBox2";
this.label3.Text = "Safe Exam Browser Architecture:"; this.checkBox2.Size = new System.Drawing.Size(467, 25);
this.checkBox2.TabIndex = 6;
this.checkBox2.Text = "Install custom certificate on the offline system (recommended)";
this.checkBox2.UseVisualStyleBackColor = true;
// //
// selectedinstallation // checkBox1
// //
this.selectedinstallation.AutoSize = true; this.checkBox1.AutoSize = true;
this.selectedinstallation.Location = new System.Drawing.Point(21, 38); this.checkBox1.Location = new System.Drawing.Point(25, 110);
this.selectedinstallation.Name = "selectedinstallation"; this.checkBox1.Name = "checkBox1";
this.selectedinstallation.Size = new System.Drawing.Size(190, 21); this.checkBox1.Size = new System.Drawing.Size(86, 25);
this.selectedinstallation.TabIndex = 1; this.checkBox1.TabIndex = 5;
this.selectedinstallation.Text = "Selected Installation: none"; this.checkBox1.Text = "Backup";
this.checkBox1.UseVisualStyleBackColor = true;
//
// x86
//
this.x86.AutoSize = true;
this.x86.Location = new System.Drawing.Point(605, 73);
this.x86.Name = "x86";
this.x86.Size = new System.Drawing.Size(60, 25);
this.x86.TabIndex = 4;
this.x86.Text = "x86";
this.x86.UseVisualStyleBackColor = true;
//
// x64
//
this.x64.AutoSize = true;
this.x64.Location = new System.Drawing.Point(525, 73);
this.x64.Name = "x64";
this.x64.Size = new System.Drawing.Size(60, 25);
this.x64.TabIndex = 3;
this.x64.Text = "x64";
this.x64.UseVisualStyleBackColor = true;
// //
// autodetect // autodetect
// //
@ -149,47 +174,23 @@
this.autodetect.Text = "Auto-Detect (recommended)"; this.autodetect.Text = "Auto-Detect (recommended)";
this.autodetect.UseVisualStyleBackColor = true; this.autodetect.UseVisualStyleBackColor = true;
// //
// x64 // selectedinstallation
// //
this.x64.AutoSize = true; this.selectedinstallation.AutoSize = true;
this.x64.Location = new System.Drawing.Point(525, 73); this.selectedinstallation.Location = new System.Drawing.Point(21, 38);
this.x64.Name = "x64"; this.selectedinstallation.Name = "selectedinstallation";
this.x64.Size = new System.Drawing.Size(60, 25); this.selectedinstallation.Size = new System.Drawing.Size(190, 21);
this.x64.TabIndex = 3; this.selectedinstallation.TabIndex = 1;
this.x64.Text = "x64"; this.selectedinstallation.Text = "Selected Installation: none";
this.x64.UseVisualStyleBackColor = true;
// //
// x86 // label3
// //
this.x86.AutoSize = true; this.label3.AutoSize = true;
this.x86.Location = new System.Drawing.Point(605, 73); this.label3.Location = new System.Drawing.Point(21, 73);
this.x86.Name = "x86"; this.label3.Name = "label3";
this.x86.Size = new System.Drawing.Size(60, 25); this.label3.Size = new System.Drawing.Size(233, 21);
this.x86.TabIndex = 4; this.label3.TabIndex = 0;
this.x86.Text = "x86"; this.label3.Text = "Safe Exam Browser Architecture:";
this.x86.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(25, 110);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(86, 25);
this.checkBox1.TabIndex = 5;
this.checkBox1.Text = "Backup";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Checked = true;
this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2.Location = new System.Drawing.Point(25, 152);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(467, 25);
this.checkBox2.TabIndex = 6;
this.checkBox2.Text = "Install custom certificate on the offline system (recommended)";
this.checkBox2.UseVisualStyleBackColor = true;
// //
// button2 // button2
// //
@ -218,6 +219,7 @@
this.textBox1.Multiline = true; this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true; this.textBox1.ReadOnly = true;
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(707, 204); this.textBox1.Size = new System.Drawing.Size(707, 204);
this.textBox1.TabIndex = 0; this.textBox1.TabIndex = 0;
// //

View File

@ -22,6 +22,7 @@ namespace patch_seb
public static bool alreadyPatched = false; public static bool alreadyPatched = false;
public static bool is64bits = false; public static bool is64bits = false;
public static string SEBPath = ""; public static string SEBPath = "";
public static int something = 0;
public OfflinePatcher() public OfflinePatcher()
{ {
InitializeComponent(); InitializeComponent();
@ -118,7 +119,7 @@ namespace patch_seb
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
SEBPath = installation + @"Program Files\SafeExamBrowser\Application"; SEBPath = installation + @"Program Files\SafeExamBrowser\Application\";
if (alreadyPatched) if (alreadyPatched)
{ {
var dialog = MessageBox.Show("An already patched Safe Exam Browser has been found. Are you sure to continue?", "Safe Exam Browser Offline Patch", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); var dialog = MessageBox.Show("An already patched Safe Exam Browser has been found. Are you sure to continue?", "Safe Exam Browser Offline Patch", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
@ -185,6 +186,8 @@ namespace patch_seb
File.Delete(SEBPath + @"SafeExamBrowser.Monitoring.dll"); File.Delete(SEBPath + @"SafeExamBrowser.Monitoring.dll");
File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll"); File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll");
File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll"); File.Delete(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll");
if (autodetect.Checked) // Autodetect
{
if (is64bits) // 64 bits patch if (is64bits) // 64 bits patch
{ {
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.exe", Resources.SafeExamBrowser); File.WriteAllBytes(SEBPath + @"SafeExamBrowser.exe", Resources.SafeExamBrowser);
@ -203,32 +206,51 @@ namespace patch_seb
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", Resources.SafeExamBrowser_UserInterface_Desktop1); File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", Resources.SafeExamBrowser_UserInterface_Desktop1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", Resources.SafeExamBrowser_UserInterface_Mobile1); File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", Resources.SafeExamBrowser_UserInterface_Mobile1);
} }
}
else if (x64.Checked) // 64 bits patch
{
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.exe", Resources.SafeExamBrowser);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Client.exe", Resources.SafeExamBrowser_Client);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Configuration.dll", Resources.SafeExamBrowser_Configuration);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Monitoring.dll", Resources.SafeExamBrowser_Monitoring);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", Resources.SafeExamBrowser_UserInterface_Desktop);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", Resources.SafeExamBrowser_UserInterface_Mobile);
}
else // 32 bits patch
{
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.exe", Resources.SafeExamBrowser1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Client.exe", Resources.SafeExamBrowser_Client1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Configuration.dll", Resources.SafeExamBrowser_Configuration1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.Monitoring.dll", Resources.SafeExamBrowser_Monitoring1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Desktop.dll", Resources.SafeExamBrowser_UserInterface_Desktop1);
File.WriteAllBytes(SEBPath + @"SafeExamBrowser.UserInterface.Mobile.dll", Resources.SafeExamBrowser_UserInterface_Mobile1);
}
if (checkBox2.Checked) if (checkBox2.Checked)
{ {
// Load offline registry // Load offline registry
ProcessStartInfo load = new ProcessStartInfo ProcessStartInfo load = new ProcessStartInfo
{ {
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"System32\reg.exe", FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\reg.exe",
Arguments = $@"load HKLM\OFFSOFTWARE {installation}Windows\System32\config\software", Arguments = $@"load HKLM\OFFSOFTWARE {installation}Windows\System32\config\software",
CreateNoWindow = true, CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden WindowStyle = ProcessWindowStyle.Hidden
}; };
Process.Start(load).WaitForExit(); Process.Start(load).WaitForExit();
// Add certificate to offline registry // Add certificate to offline registry
File.WriteAllText(Path.GetTempPath() + @"\SEB.reg", Resources.cert_offline); File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Temp\SEB.reg", Resources.cert_offline);
ProcessStartInfo info = new ProcessStartInfo ProcessStartInfo info = new ProcessStartInfo
{ {
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\regedit.exe", FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\regedit.exe",
Arguments = $@"/s \""{Path.GetTempPath() + @"\SEB.reg"}\""", Arguments = $@"/s {Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Temp\SEB.reg"}",
CreateNoWindow = true, CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden WindowStyle = ProcessWindowStyle.Hidden
}; };
Process.Start(info).WaitForExit(); Process.Start(info).WaitForExit();
File.Delete(Path.GetTempPath() + @"\SEB.reg"); File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Temp\SEB.reg");
// Unload offline registry // Unload offline registry
ProcessStartInfo unload = new ProcessStartInfo ProcessStartInfo unload = new ProcessStartInfo
{ {
FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"System32\reg.exe", FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\reg.exe",
Arguments = $@"unload HKLM\OFFSOFTWARE", Arguments = $@"unload HKLM\OFFSOFTWARE",
CreateNoWindow = true, CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden WindowStyle = ProcessWindowStyle.Hidden
@ -243,5 +265,22 @@ namespace patch_seb
AddLog("[ERROR] " + ex.Message); AddLog("[ERROR] " + ex.Message);
} }
} }
private void label1_Click(object sender, EventArgs e)
{
if (something == 4)
{
something = 0;
#if DEBUG
MessageBox.Show("Safe Exam Browser Offline Patch (Debug/Beta) v" + Application.ProductVersion + "\nFor Safe Exam Browser version " + Variables.SupportedSEB + "\nCreated with love by Vichingo455\n\nBecause Freedom is a right, respect it.", "Safe Exam Browser Patch", MessageBoxButtons.OK, MessageBoxIcon.Information);
#else
MessageBox.Show("Safe Exam Browser Offline Patch v" + Application.ProductVersion + "\nFor Safe Exam Browser version " + Variables.SupportedSEB + "\nCreated with love by Vichingo455\n\nBecause Freedom is a right, respect it.", "Safe Exam Browser Patch", MessageBoxButtons.OK, MessageBoxIcon.Information);
#endif
}
else
{
something++;
}
}
} }
} }

View File

@ -28,7 +28,7 @@ namespace patch_seb
// Check if the user wants the offline patcher // Check if the user wants the offline patcher
if (args.Length == 1) if (args.Length == 1)
{ {
if (args[1] == "/offline" || args[1] == "/Offline") if (args[0] == "/offline" || args[0] == "/Offline")
{ {
Application.Run(new OfflinePatcher()); Application.Run(new OfflinePatcher());
} }

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Numero di build // Numero di build
// Revisione // Revisione
// //
[assembly: AssemblyVersion("1.5.2.0")] [assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.5.2.0")] [assembly: AssemblyFileVersion("1.6.0.0")]

View File

@ -23,6 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>