Start Writing code, Work in Progress
This commit is contained in:
parent
7a7ef12add
commit
72ecd2bf6c
|
@ -41,6 +41,9 @@
|
|||
this.registryEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.commandPromptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.commandPromptToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.checkBox4 = new System.Windows.Forms.CheckBox();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -67,6 +70,9 @@
|
|||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.checkBox4);
|
||||
this.groupBox1.Controls.Add(this.checkBox3);
|
||||
this.groupBox1.Controls.Add(this.checkBox2);
|
||||
this.groupBox1.Controls.Add(this.checkBox1);
|
||||
this.groupBox1.Controls.Add(this.registry);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 27);
|
||||
|
@ -85,6 +91,7 @@
|
|||
this.registry.TabIndex = 0;
|
||||
this.registry.Text = "Enable Registry Editor";
|
||||
this.registry.UseVisualStyleBackColor = true;
|
||||
this.registry.CheckedChanged += new System.EventHandler(this.registry_CheckedChanged);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
|
@ -149,6 +156,7 @@
|
|||
this.commandPromptToolStripMenuItem.Name = "commandPromptToolStripMenuItem";
|
||||
this.commandPromptToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.commandPromptToolStripMenuItem.Text = "Command Prompt";
|
||||
this.commandPromptToolStripMenuItem.Click += new System.EventHandler(this.commandPromptToolStripMenuItem_Click);
|
||||
//
|
||||
// commandPromptToolStripMenuItem1
|
||||
//
|
||||
|
@ -156,6 +164,36 @@
|
|||
this.commandPromptToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
this.commandPromptToolStripMenuItem1.Text = "Command Prompt";
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
this.checkBox2.AutoSize = true;
|
||||
this.checkBox2.Location = new System.Drawing.Point(6, 65);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(82, 17);
|
||||
this.checkBox2.TabIndex = 2;
|
||||
this.checkBox2.Text = "Enable Run";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
this.checkBox3.AutoSize = true;
|
||||
this.checkBox3.Location = new System.Drawing.Point(6, 88);
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.Size = new System.Drawing.Size(125, 17);
|
||||
this.checkBox3.TabIndex = 2;
|
||||
this.checkBox3.Text = "Enable Control Panel";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
this.checkBox4.AutoSize = true;
|
||||
this.checkBox4.Location = new System.Drawing.Point(6, 111);
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.Size = new System.Drawing.Size(131, 17);
|
||||
this.checkBox4.TabIndex = 2;
|
||||
this.checkBox4.Text = "Enable Task Manager";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -192,6 +230,9 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem registryEditorToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem commandPromptToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem commandPromptToolStripMenuItem1;
|
||||
private System.Windows.Forms.CheckBox checkBox4;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static Vichingo455_Settings.Utilities.RegistryWorker;
|
||||
|
||||
namespace Vichingo455_Settings
|
||||
{
|
||||
|
@ -38,5 +39,28 @@ namespace Vichingo455_Settings
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Vichingo455_Settings.Utilities
|
||||
{
|
||||
internal class RegistryWorker
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets a registry value on the local machine
|
||||
/// </summary>
|
||||
/// <param name="RegistryKey">Registry Key</param>
|
||||
/// <param name="RegistryValueName">Registry Value Name</param>
|
||||
/// <param name="RegistryValueData">Registry Value Data</param>
|
||||
/// <param name="RegistryValueType">Registry Value Type</param>
|
||||
/// <returns></returns>
|
||||
public static int SetRegistryValueLocalMachineA(string RegistryKey,string RegistryValueName, string RegistryValueData, RegistryValueKind RegistryValueType)
|
||||
{
|
||||
try
|
||||
{
|
||||
RegistryKey rk = Registry.LocalMachine.CreateSubKey(RegistryKey);
|
||||
rk.SetValue(RegistryValueName,RegistryValueData,RegistryValueType);
|
||||
return 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public static int SetRegistryValueCurrentUserA(string RegistryKey, string RegistryValueName, string RegistryValueData, RegistryValueKind RegistryValueType)
|
||||
{
|
||||
try
|
||||
{
|
||||
RegistryKey rk = Registry.CurrentUser.CreateSubKey(RegistryKey);
|
||||
rk.SetValue(RegistryValueName, RegistryValueData, RegistryValueType);
|
||||
return 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
|
@ -95,6 +95,7 @@
|
|||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utilities\RegistryWorker.cs" />
|
||||
<EmbeddedResource Include="About.resx">
|
||||
<DependentUpon>About.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -123,5 +124,14 @@
|
|||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="Utilities\PsExec.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Utilities\PsExec64.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Reference in New Issue