This repository has been archived on 2025-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
Settings/Vichingo455 Settings/Form1.cs

67 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static Vichingo455_Settings.Utilities.RegistryWorker;
namespace Vichingo455_Settings
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
var dialog = new About();
dialog.ShowDialog();
}
private void runToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\explorer.exe", "shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}");
}
private void fileExplorerToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\explorer.exe");
}
private void registryEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\regedit.exe");
}
private void commandPromptToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\cmd.exe");
}
private void registry_CheckedChanged(object sender, EventArgs e)
{
if (registry.Checked)
{
if (SetRegistryValueCurrentUserA(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System","DisableRegistryTools","0",Microsoft.Win32.RegistryValueKind.DWord) != 0)
{
MessageBox.Show("Error occured while applying Registry Editor changes. SetRegistryValueCurrentUserA returned non-zero value.","Vichingo455 Settings",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
else
{
if (SetRegistryValueCurrentUserA(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "1", Microsoft.Win32.RegistryValueKind.DWord) != 0)
{
MessageBox.Show("Error occured while applying Registry Editor changes. SetRegistryValueCurrentUserA returned non-zero value.", "Vichingo455 Settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}