-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b970b70
commit 192790b
Showing
22 changed files
with
208 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
53 changes: 53 additions & 0 deletions
53
Delete value from Registry - Example/Delete value from Registry - Example.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{E85AF823-164C-4F42-AD54-689E6B849D68}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Delete_value_from_Registry___Example</RootNamespace> | ||
<AssemblyName>Delete value from Registry - Example</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
25 changes: 25 additions & 0 deletions
25
Delete value from Registry - Example/Delete value from Registry - Example.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34601.278 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Delete value from Registry - Example", "Delete value from Registry - Example.csproj", "{E85AF823-164C-4F42-AD54-689E6B849D68}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E85AF823-164C-4F42-AD54-689E6B849D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E85AF823-164C-4F42-AD54-689E6B849D68}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E85AF823-164C-4F42-AD54-689E6B849D68}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E85AF823-164C-4F42-AD54-689E6B849D68}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {48C6FEF5-CC77-4264-ABB9-5333539DEFB1} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Microsoft.Win32; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Delete_value_from_Registry___Example | ||
{ | ||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
|
||
// Specify the registry key path and value name | ||
string keyPath = @"SOFTWARE\YourSoftware"; | ||
string valueName = "YourValueName"; | ||
|
||
|
||
try | ||
{ | ||
// Open the registry key in read/write mode with explicit registry view | ||
using (RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64)) | ||
{ | ||
using (RegistryKey key = baseKey.OpenSubKey(keyPath, true)) | ||
{ | ||
if (key != null) | ||
{ | ||
// Delete the specified value | ||
key.DeleteValue(valueName); | ||
|
||
|
||
Console.WriteLine($"Successfully deleted value '{valueName}' from registry key '{keyPath}'"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"Registry key '{keyPath}' not found"); | ||
} | ||
} | ||
} | ||
} | ||
catch (UnauthorizedAccessException) | ||
{ | ||
Console.WriteLine("UnauthorizedAccessException: Run the program with administrative privileges."); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"An error occurred: {ex.Message}"); | ||
} | ||
|
||
|
||
Console.ReadKey(); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Delete value from Registry - Example/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Delete value from Registry - Example")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Delete value from Registry - Example")] | ||
[assembly: AssemblyCopyright("Copyright © 2024")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("e85af823-164c-4f42-ad54-689e6b849d68")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file added
BIN
+6 KB
Delete value from Registry - Example/bin/Debug/Delete value from Registry - Example.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
...e value from Registry - Example/bin/Debug/Delete value from Registry - Example.exe.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
Binary file added
BIN
+21.5 KB
Delete value from Registry - Example/bin/Debug/Delete value from Registry - Example.pdb
Binary file not shown.
Binary file added
BIN
+3.98 KB
...y - Example/obj/Debug/Delete value from Registry - Example.csproj.AssemblyReference.cache
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...y - Example/obj/Debug/Delete value from Registry - Example.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5bb56c9ef8259863da41b9966ff000324a4ac45ce033dd510671b53b9ecdc07a |
7 changes: 7 additions & 0 deletions
7
...stry - Example/obj/Debug/Delete value from Registry - Example.csproj.FileListAbsolute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
D:\USED\Delete value from Registry - Example\bin\Debug\Delete value from Registry - Example.exe.config | ||
D:\USED\Delete value from Registry - Example\bin\Debug\Delete value from Registry - Example.exe | ||
D:\USED\Delete value from Registry - Example\bin\Debug\Delete value from Registry - Example.pdb | ||
D:\USED\Delete value from Registry - Example\obj\Debug\Delete value from Registry - Example.csproj.AssemblyReference.cache | ||
D:\USED\Delete value from Registry - Example\obj\Debug\Delete value from Registry - Example.csproj.CoreCompileInputs.cache | ||
D:\USED\Delete value from Registry - Example\obj\Debug\Delete value from Registry - Example.exe | ||
D:\USED\Delete value from Registry - Example\obj\Debug\Delete value from Registry - Example.pdb |
Binary file added
BIN
+6 KB
Delete value from Registry - Example/obj/Debug/Delete value from Registry - Example.exe
Binary file not shown.
Binary file added
BIN
+21.5 KB
Delete value from Registry - Example/obj/Debug/Delete value from Registry - Example.pdb
Binary file not shown.
Binary file added
BIN
+1.74 KB
...te value from Registry - Example/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="YourAppName" type="win32" /> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges> | ||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
</assembly> |
Binary file modified
BIN
+0 Bytes
(100%)
Permission to Write to Registry/bin/Debug/Permission to Write to Registry.exe
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
Permission to Write to Registry/bin/Debug/Permission to Write to Registry.pdb
Binary file not shown.
Binary file modified
BIN
+53 Bytes
(100%)
Permission to Write to Registry/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
Permission to Write to Registry/obj/Debug/Permission to Write to Registry.exe
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
Permission to Write to Registry/obj/Debug/Permission to Write to Registry.pdb
Binary file not shown.