├── .gitattributes ├── .gitignore ├── README.md ├── build.bat ├── pictures ├── findwindow.png ├── mainwindow.png └── networkwindow.png └── src ├── Windows.RegistryEditor.sln └── Windows.RegistryEditor ├── App.config ├── Events ├── FindResultsArgs.cs ├── FindSingleResultArgs.cs ├── ProgressArgs.cs ├── ProgressChangedArgs.cs ├── ProgressFinishedArgs.cs └── ProgressStartedArgs.cs ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── RegistryEditor.csproj ├── Resources ├── app.ico └── loader_clock.gif ├── Utils ├── Native │ ├── NativeListViewItem.cs │ └── NativeMethods.cs ├── RegistryUtils.cs ├── Stopwatch.cs └── Utility.cs ├── Views ├── Controls │ ├── CheckBoxes.Designer.cs │ ├── CheckBoxes.cs │ ├── ListViewEx.cs │ ├── Loader.Designer.cs │ └── Loader.cs ├── FindWindow.Designer.cs ├── FindWindow.cs ├── MainWindow.Designer.cs ├── MainWindow.cs ├── NetworkWindow.Designer.cs └── NetworkWindow.cs └── app.manifest /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Registry Editor 2 | 3 | Registry Editor is a small utility that will help you finding specific registries with a specific search criteria.
4 | All the results will be showen in one place and you can then delete the selected registries or right click on one of the results will open 5 | the official Windows regedit in the location of the selected registry. NOTE: When deleting registries, a backup will automatically be 6 | created on your desktop. 7 | 8 | 9 | ## Motivation 10 | 11 | If you're here, I guess you already aware that the official build in registry editor(regedit) in Windows allows you to only `Find Next` 12 | and searching for `Keys`, `Values` and `Data`.
13 | That sometimes can be very time consuming when you look for specific registry, therefore writing a quick gui application to add all 14 | these results in one place wouldn't take much time so I can just let it scan through with more advanced filters and do with the results 15 | whatever comes in mind, i.e deleting found results, saving, jumping directly to the official registry location etc...
16 | I also have to give credit to my brother that asked for a simple script to scan through the registry on a specific criteria, which brought 17 | me to the idea of writing a gui application that will be much easier to maintain and extend if needed. 18 | 19 | Another useful situation is when you install a new software and you want to look for any registers that the software installed on your 20 | machine, which can be easily tracked down by scanning the whole registry and finding their existing locations. 21 | 22 | ## Pictures 23 | 24 | ![alt text][img_main] 25 | 26 | ![alt text][img_edit] 27 | 28 | ![alt text][img_network] 29 | 30 | [img_main]: pictures/mainwindow.png 31 | [img_edit]: pictures/findwindow.png 32 | [img_network]: pictures/networkwindow.png -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | 4 | set BUILD_TYPE=%1 5 | 6 | if not "%BUILD_TYPE%" == "Debug" ( 7 | echo Building in Release mode. 8 | set BUILD_TYPE=Release 9 | ) else ( 10 | echo Building in Debug mode. 11 | ) 12 | 13 | WHERE msbuild 14 | if %ERRORLEVEL% NEQ 0 ( 15 | echo ### ERROR: Run Developer Command Prompt for VS and try again. ### 16 | ) else ( 17 | cd /d %~dp0 18 | cd src 19 | msbuild /t:Rebuild /m /p:Configuration=%BUILD_TYPE% /p:BuildInParallel=true /p:Platform="Any CPU" 20 | cd .. 21 | ) -------------------------------------------------------------------------------- /pictures/findwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladreich/RegistryEditor/5ae7cc233366256cab629b42a42ba52c2ba7eebb/pictures/findwindow.png -------------------------------------------------------------------------------- /pictures/mainwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladreich/RegistryEditor/5ae7cc233366256cab629b42a42ba52c2ba7eebb/pictures/mainwindow.png -------------------------------------------------------------------------------- /pictures/networkwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladreich/RegistryEditor/5ae7cc233366256cab629b42a42ba52c2ba7eebb/pictures/networkwindow.png -------------------------------------------------------------------------------- /src/Windows.RegistryEditor.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.2047 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegistryEditor", "Windows.RegistryEditor\RegistryEditor.csproj", "{E76E123C-04A1-488F-AA28-A5FF6FE236E5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E76E123C-04A1-488F-AA28-A5FF6FE236E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {E76E123C-04A1-488F-AA28-A5FF6FE236E5}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {E76E123C-04A1-488F-AA28-A5FF6FE236E5}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {E76E123C-04A1-488F-AA28-A5FF6FE236E5}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {F377F101-355E-4E65-B5F2-8A0F71D97308} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Events/FindResultsArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Windows.RegistryEditor.Events 5 | { 6 | public class FindResultsArgs : EventArgs 7 | { 8 | public List Matches { get; set; } 9 | 10 | public FindResultsArgs(List matches) 11 | { 12 | Matches = matches; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Events/FindSingleResultArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Windows.RegistryEditor.Events 4 | { 5 | public class FindSingleResultArgs : EventArgs 6 | { 7 | public string Match { get; set; } 8 | 9 | public FindSingleResultArgs(string match) 10 | { 11 | Match = match; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Events/ProgressArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Windows.RegistryEditor.Events 4 | { 5 | public class ProgressArgs : EventArgs 6 | { 7 | public string Message { get; set; } 8 | 9 | public ProgressArgs(string message) 10 | { 11 | Message = message; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Events/ProgressChangedArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Events 2 | { 3 | public class ProgressChangedArgs : ProgressArgs 4 | { 5 | public string Hive { get; set; } 6 | public ProgressChangedArgs(string message, string hive) 7 | : base(message) 8 | { 9 | Hive = hive; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Events/ProgressFinishedArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Events 2 | { 3 | public class ProgressFinishedArgs : ProgressArgs 4 | { 5 | public ProgressFinishedArgs(string message) 6 | : base(message) 7 | { } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Events/ProgressStartedArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Events 2 | { 3 | public class ProgressStartedArgs : ProgressArgs 4 | { 5 | public string Hive { get; set; } 6 | public ProgressStartedArgs(string message, string hive) 7 | : base(message) 8 | { 9 | Hive = hive; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using Windows.RegistryEditor.Views; 4 | 5 | namespace Windows.RegistryEditor 6 | { 7 | static class Program 8 | { 9 | [STAThread] 10 | static void Main() 11 | { 12 | Application.EnableVisualStyles(); 13 | Application.SetCompatibleTextRenderingDefault(false); 14 | Application.Run(new MainWindow()); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Registry Editor")] 9 | [assembly: AssemblyDescription("Windows utility to help scanning and removing unwanted registries.")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Registry Editor")] 13 | [assembly: AssemblyCopyright("Copyright © 2018 Reich")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e76e123c-04a1-488f-aa28-a5ff6fe236e5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.1")] 36 | [assembly: AssemblyFileVersion("1.0.1")] 37 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Windows.RegistryEditor.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Windows.RegistryEditor.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 65 | /// 66 | internal static System.Drawing.Icon app { 67 | get { 68 | object obj = ResourceManager.GetObject("app", resourceCulture); 69 | return ((System.Drawing.Icon)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap loader_clock { 77 | get { 78 | object obj = ResourceManager.GetObject("loader_clock", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\loader_clock.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Windows.RegistryEditor.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/RegistryEditor.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E76E123C-04A1-488F-AA28-A5FF6FE236E5} 8 | WinExe 9 | Windows.RegistryEditor 10 | RegistryEditor-v1.0.1 11 | v4.7 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | app.manifest 36 | 37 | 38 | Resources/app.ico 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Form 65 | 66 | 67 | NetworkWindow.cs 68 | 69 | 70 | UserControl 71 | 72 | 73 | CheckBoxes.cs 74 | 75 | 76 | Component 77 | 78 | 79 | UserControl 80 | 81 | 82 | Loader.cs 83 | 84 | 85 | 86 | Form 87 | 88 | 89 | FindWindow.cs 90 | 91 | 92 | Form 93 | 94 | 95 | MainWindow.cs 96 | 97 | 98 | 99 | 100 | 101 | 102 | ResXFileCodeGenerator 103 | Resources.Designer.cs 104 | Designer 105 | 106 | 107 | True 108 | Resources.resx 109 | True 110 | 111 | 112 | 113 | SettingsSingleFileGenerator 114 | Settings.Designer.cs 115 | 116 | 117 | True 118 | Settings.settings 119 | True 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Resources/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladreich/RegistryEditor/5ae7cc233366256cab629b42a42ba52c2ba7eebb/src/Windows.RegistryEditor/Resources/app.ico -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Resources/loader_clock.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladreich/RegistryEditor/5ae7cc233366256cab629b42a42ba52c2ba7eebb/src/Windows.RegistryEditor/Resources/loader_clock.gif -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Utils/Native/NativeListViewItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Windows.RegistryEditor.Utils.Native 5 | { 6 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 7 | internal struct NativeListViewItem 8 | { 9 | public int mask; 10 | public int iItem; 11 | public int iSubItem; 12 | public int state; 13 | public int stateMask; 14 | [MarshalAs(UnmanagedType.LPTStr)] 15 | public string pszText; 16 | public int cchTextMax; 17 | public int iImage; 18 | public IntPtr lParam; 19 | public int iIndent; 20 | public int iGroupId; 21 | public int cColumns; 22 | public IntPtr puColumns; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Utils/Native/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Security; 4 | using System.Windows.Forms; 5 | 6 | namespace Windows.RegistryEditor.Utils.Native 7 | { 8 | [ComVisible(false), SuppressUnmanagedCodeSecurity] 9 | internal sealed class NativeMethods 10 | { 11 | 12 | #region --- ListView WinForms Control Stuff --- 13 | 14 | private const int LVM_FIRST = 0x1000; 15 | private const int LVM_SETITEMSTATE = LVM_FIRST + 43; 16 | 17 | [DllImport("user32.dll", CharSet = CharSet.Auto)] 18 | internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, ref NativeListViewItem lvi); 19 | 20 | internal static void SetItemState(ListView listView, int itemIndex, int mask, int value) 21 | { 22 | NativeListViewItem lvItem = new NativeListViewItem {stateMask = mask, state = value}; 23 | SendMessage(listView.Handle, LVM_SETITEMSTATE, itemIndex, ref lvItem); 24 | } 25 | 26 | #endregion #region --- ListView Functions --- 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Utils/RegistryUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | namespace Windows.RegistryEditor.Utils 7 | { 8 | public static class RegistryUtils 9 | { 10 | public const string HKCR = "HKEY_CLASSES_ROOT"; 11 | public const string HKCU = "HKEY_CURRENT_USER"; 12 | public const string HKLM = "HKEY_LOCAL_MACHINE"; 13 | public const string HKU = "HKEY_USERS"; 14 | public const string HKCC = "HKEY_CURRENT_CONFIG"; 15 | 16 | public const string SHKCR = "HKCR"; 17 | public const string SHKCU = "HKCU"; 18 | public const string SHKLM = "HKLM"; 19 | public const string SHKU = "HKU"; 20 | public const string SHKCC = "HKCC"; 21 | 22 | public const string REG_SZ = "REG_SZ"; 23 | public const string REG_EXPAND_SZ = "REG_EXPAND_SZ"; 24 | public const string REG_MULTI_SZ = "REG_MULTI_SZ"; 25 | public const string REG_DWORD = "REG_DWORD"; 26 | public const string REG_QWORD = "REG_QWORD"; 27 | public const string REG_DWORD_LITTLE_ENDIAN = "REG_DWORD_LITTLE_ENDIAN"; 28 | public const string REG_QWORD_LITTLE_ENDIAN = "REG_QWORD_LITTLE_ENDIAN"; 29 | public const string REG_DWORD_BIG_ENDIAN = "REG_DWORD_BIG_ENDIAN"; 30 | public const string REG_BINARY = "REG_BINARY"; 31 | public const string REG_NONE = "REG_NONE"; 32 | public const string REG_LINK = "REG_LINK"; 33 | public const string REG_RESOURCE_LIST = "REG_RESOURCE_LIST"; 34 | 35 | private const string HKEY_REGEDIT = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"; 36 | 37 | public static void OpenRegistryLocation(string path) 38 | { 39 | string args = $"{HKEY_REGEDIT} /v LastKey /t REG_SZ /d \"{path}\" /f"; 40 | ProcessStartInfo procInfo = new ProcessStartInfo 41 | { 42 | FileName = "REG", 43 | Arguments = $"ADD {args}", 44 | CreateNoWindow = true, 45 | UseShellExecute = false 46 | }; 47 | 48 | Process.Start(procInfo); 49 | 50 | Utility.KillProcess("regedit"); 51 | Process.Start("regedit.exe"); 52 | } 53 | 54 | public static void ExportHive(string hivePath, string dstDir) 55 | { 56 | if (!Directory.Exists(dstDir)) 57 | Directory.CreateDirectory(dstDir); 58 | 59 | string fileName = Utility.ValidateDirOrFileName(hivePath.Split('\\').Last()); 60 | string dstFile = Path.Combine(dstDir, fileName + ".reg"); 61 | ProcessStartInfo procInfo = new ProcessStartInfo() 62 | { 63 | FileName = "REG", 64 | Arguments = $"EXPORT \"{hivePath}\" \"{dstFile}\" /y", 65 | CreateNoWindow = true, 66 | UseShellExecute = false 67 | }; 68 | 69 | Process.Start(procInfo); 70 | } 71 | 72 | public static void DeleteHive(string hivePath) 73 | { 74 | ProcessStartInfo procInfo = new ProcessStartInfo() 75 | { 76 | FileName = "REG", 77 | Arguments = $"DELETE \"{hivePath}\" /f", 78 | CreateNoWindow = true, 79 | UseShellExecute = false 80 | }; 81 | 82 | Process.Start(procInfo); 83 | } 84 | 85 | public static string GetHiveShortcut(string hive) 86 | { 87 | switch (hive) 88 | { 89 | case HKCR: return SHKCR; 90 | case HKCU: return SHKCU; 91 | case HKLM: return SHKLM; 92 | case HKU: return SHKU; 93 | case HKCC: return SHKCC; 94 | 95 | default: 96 | throw new ArgumentException($"[GetHiveShortcut] - Invalid HKEY input -> {hive}"); 97 | } 98 | } 99 | 100 | public static string GetHiveFullName(string hive) 101 | { 102 | switch (hive) 103 | { 104 | case SHKCR: return HKCR; 105 | case SHKCU: return HKCU; 106 | case SHKLM: return HKLM; 107 | case SHKU: return HKU; 108 | case SHKCC: return HKCC; 109 | 110 | default: 111 | throw new ArgumentException($"[GetHiveFullName] - Invalid HKEY input -> {hive}"); 112 | } 113 | } 114 | 115 | public static string GetRemoteShortcut(string hive) 116 | { 117 | return GetHiveShortcut(hive.Split('\\').Last()); 118 | } 119 | 120 | public static string GetRemoteHiveFullName(string hive) 121 | { 122 | return GetHiveFullName(hive.Split('\\').Last()); 123 | } 124 | 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Utils/Stopwatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using SW = System.Diagnostics.Stopwatch; 4 | 5 | namespace Windows.RegistryEditor.Utils 6 | { 7 | public class Stopwatch 8 | { 9 | public event Action Started; 10 | public event Action Stopped; 11 | 12 | protected virtual void OnStarted() => Started?.Invoke(); 13 | protected virtual void OnStopped(TimeSpan e) => Stopped?.Invoke(e); 14 | 15 | 16 | private SW watch; 17 | 18 | public Stopwatch() 19 | { 20 | watch = new SW(); 21 | } 22 | 23 | public TimeSpan Elapsed => watch.Elapsed; 24 | 25 | public bool IsRunning => watch.IsRunning; 26 | 27 | public Stopwatch Start(bool reset = false) 28 | { 29 | if (reset) watch.Reset(); 30 | 31 | watch.Start(); 32 | OnStarted(); 33 | 34 | return this; 35 | } 36 | 37 | public TimeSpan Stop() 38 | { 39 | if (!watch.IsRunning) 40 | throw new InvalidOperationException("Stopwatch isn't running"); 41 | 42 | watch.Stop(); 43 | OnStopped(Elapsed); 44 | 45 | return Elapsed; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Utils/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Text.RegularExpressions; 6 | using System.Windows.Forms; 7 | using Windows.RegistryEditor.Utils.Native; 8 | 9 | namespace Windows.RegistryEditor.Utils 10 | { 11 | public static class Utility 12 | { 13 | 14 | public static void InvokeSafe(this ISynchronizeInvoke caller, Action method) 15 | { 16 | if (caller.InvokeRequired) 17 | caller.Invoke(method, null); 18 | else 19 | method.Invoke(); 20 | } 21 | 22 | public static T InvokeSafe(this ISynchronizeInvoke caller, Func method) 23 | { 24 | if (caller.InvokeRequired) 25 | return (T)caller.Invoke(method, null); 26 | 27 | return method.Invoke(); 28 | } 29 | 30 | public static void BeginInvokeSafe(this ISynchronizeInvoke caller, Action method) 31 | { 32 | if (caller.InvokeRequired) 33 | caller.BeginInvoke(method, null); 34 | else 35 | method.Invoke(); 36 | } 37 | 38 | public static bool KillProcess(string proc) 39 | { 40 | foreach (Process process in Process.GetProcesses()) 41 | { 42 | if (process.ProcessName.ToLower() != proc) continue; 43 | 44 | process.Kill(); 45 | return true; 46 | } 47 | 48 | return false; 49 | } 50 | 51 | /// 52 | /// Characters that are not allowed on windows: 53 | /// < > : " / \ | ? 54 | /// 55 | public static string ValidateDirOrFileName(string name) 56 | { 57 | return Regex.Replace(name, "<|>|:|\"|/|\\\\|\\||\\?|\\*", " "); 58 | } 59 | 60 | public static void SelectAllItems(this ListView listView) 61 | { 62 | NativeMethods.SetItemState(listView, -1, 2, 2); 63 | } 64 | 65 | public static void DeselectAllItems(this ListView listView) 66 | { 67 | NativeMethods.SetItemState(listView, -1, 2, 0); 68 | } 69 | 70 | public static void OpenFolderInExplorer(string path) 71 | { 72 | Process.Start("explorer.exe", path); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/Controls/CheckBoxes.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Views.Controls 2 | { 3 | partial class CheckBoxes 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.lbxAll = new System.Windows.Forms.CheckedListBox(); 32 | this.cbxAll = new System.Windows.Forms.CheckBox(); 33 | this.panelMain = new System.Windows.Forms.TableLayoutPanel(); 34 | this.panelMain.SuspendLayout(); 35 | this.SuspendLayout(); 36 | // 37 | // lbxAll 38 | // 39 | this.lbxAll.Dock = System.Windows.Forms.DockStyle.Fill; 40 | this.lbxAll.FormattingEnabled = true; 41 | this.lbxAll.Location = new System.Drawing.Point(0, 30); 42 | this.lbxAll.Margin = new System.Windows.Forms.Padding(0); 43 | this.lbxAll.Name = "lbxAll"; 44 | this.lbxAll.Size = new System.Drawing.Size(148, 90); 45 | this.lbxAll.TabIndex = 0; 46 | this.lbxAll.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.LbxAll_ItemCheck); 47 | // 48 | // cbxAll 49 | // 50 | this.cbxAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 51 | this.cbxAll.AutoSize = true; 52 | this.cbxAll.Location = new System.Drawing.Point(3, 10); 53 | this.cbxAll.Name = "cbxAll"; 54 | this.cbxAll.Size = new System.Drawing.Size(70, 17); 55 | this.cbxAll.TabIndex = 1; 56 | this.cbxAll.Text = "Select All"; 57 | this.cbxAll.UseVisualStyleBackColor = true; 58 | this.cbxAll.CheckedChanged += new System.EventHandler(this.CbxAll_CheckedChanged); 59 | // 60 | // panelMain 61 | // 62 | this.panelMain.ColumnCount = 1; 63 | this.panelMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 64 | this.panelMain.Controls.Add(this.cbxAll, 0, 0); 65 | this.panelMain.Controls.Add(this.lbxAll, 0, 1); 66 | this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill; 67 | this.panelMain.Location = new System.Drawing.Point(0, 0); 68 | this.panelMain.Name = "panelMain"; 69 | this.panelMain.RowCount = 2; 70 | this.panelMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); 71 | this.panelMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 72 | this.panelMain.Size = new System.Drawing.Size(148, 120); 73 | this.panelMain.TabIndex = 2; 74 | // 75 | // CheckBoxes 76 | // 77 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 78 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 79 | this.Controls.Add(this.panelMain); 80 | this.Name = "CheckBoxes"; 81 | this.Size = new System.Drawing.Size(148, 120); 82 | this.Load += new System.EventHandler(this.CheckBoxes_Load); 83 | this.panelMain.ResumeLayout(false); 84 | this.panelMain.PerformLayout(); 85 | this.ResumeLayout(false); 86 | 87 | } 88 | 89 | #endregion 90 | 91 | private System.Windows.Forms.CheckedListBox lbxAll; 92 | private System.Windows.Forms.CheckBox cbxAll; 93 | private System.Windows.Forms.TableLayoutPanel panelMain; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/Controls/CheckBoxes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Drawing; 4 | using System.Drawing.Design; 5 | using System.Management.Instrumentation; 6 | using System.Reflection; 7 | using System.Windows.Forms; 8 | 9 | namespace Windows.RegistryEditor.Views.Controls 10 | { 11 | public partial class CheckBoxes : UserControl 12 | { 13 | 14 | public event ItemCheckEventHandler ItemCheck; 15 | public event EventHandler SelectAllCheckedChanged; 16 | 17 | protected virtual void OnItemCheck(ItemCheckEventArgs e) => ItemCheck?.Invoke(this, e); 18 | protected virtual void OnSelectAllCheckedChanged() => SelectAllCheckedChanged?.Invoke(this, EventArgs.Empty); 19 | 20 | public CheckBoxes() 21 | { 22 | InitializeComponent(); 23 | CheckOnClick = true; 24 | lbxAll.Dock = DockStyle.Fill; 25 | 26 | foreach (Control control in panelMain.Controls) 27 | typeof(Control).InvokeMember("DoubleBuffered", 28 | BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, 29 | null, control, new object[] { true }); 30 | } 31 | 32 | private void CheckBoxes_Load(object sender, EventArgs e) 33 | { 34 | 35 | } 36 | 37 | private void CbxAll_CheckedChanged(object sender, EventArgs e) 38 | { 39 | for (int i = 0; i < lbxAll.Items.Count; i++) 40 | { 41 | lbxAll.SetItemChecked(i, cbxAll.Checked); 42 | } 43 | 44 | OnSelectAllCheckedChanged(); 45 | } 46 | 47 | private void LbxAll_ItemCheck(object sender, ItemCheckEventArgs e) 48 | { 49 | if (e.NewValue == CheckState.Unchecked) 50 | { 51 | cbxAll.CheckedChanged -= CbxAll_CheckedChanged; 52 | cbxAll.Checked = false; 53 | cbxAll.CheckedChanged += CbxAll_CheckedChanged; 54 | } 55 | else if (lbxAll.Items.Count == lbxAll.CheckedItems.Count + 1 56 | && e.NewValue == CheckState.Checked) 57 | { 58 | cbxAll.CheckedChanged -= CbxAll_CheckedChanged; 59 | cbxAll.Checked = true; 60 | cbxAll.CheckedChanged += CbxAll_CheckedChanged; 61 | } 62 | 63 | OnItemCheck(e); 64 | } 65 | 66 | [Browsable(false)] 67 | protected override CreateParams CreateParams 68 | { 69 | get 70 | { 71 | CreateParams cp = base.CreateParams; 72 | cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED 73 | return cp; 74 | } 75 | } 76 | 77 | [MergableProperty(false)] 78 | [Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] 79 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] 80 | [Localizable(true)] 81 | [Category("Data")] 82 | [Description("Gets the collection of items in this CheckedListBox.")] 83 | public CheckedListBox.ObjectCollection Items 84 | { 85 | get 86 | { 87 | CbxAll_CheckedChanged(null, null); // When new items are added through the designer, check the state of the cbxAll. 88 | return lbxAll.Items; 89 | } 90 | } 91 | 92 | [Browsable(false)] 93 | [EditorBrowsable(EditorBrowsableState.Never)] 94 | [Description("CheckedListBox DataSource.")] 95 | public object DataSource 96 | { 97 | get => lbxAll.DataSource; 98 | set => lbxAll.DataSource = value; 99 | } 100 | 101 | [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] 102 | [Obsolete("Deprecated", false)] 103 | public new Image BackgroundImage { get; set; } 104 | 105 | [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] 106 | public new ImageLayout BackgroundImageLayout { get; set; } 107 | 108 | public new Color BackColor 109 | { 110 | get => lbxAll.BackColor; 111 | set => UpdateControl(() => lbxAll.BackColor = value); 112 | } 113 | 114 | public new BorderStyle BorderStyle 115 | { 116 | get => lbxAll.BorderStyle; 117 | set => UpdateControl(() => lbxAll.BorderStyle = value); 118 | } 119 | 120 | public new Color ForeColor 121 | { 122 | get => lbxAll.ForeColor; 123 | set => UpdateControl(() => lbxAll.ForeColor = value); 124 | } 125 | 126 | [Category("Appearance")] 127 | [Description("Indicates if the CheckBoxes should show up as flat or 3D in appearance.")] 128 | public bool ThreeDCheckBoxes 129 | { 130 | get => lbxAll.ThreeDCheckBoxes; 131 | set => UpdateControl(() => lbxAll.ThreeDCheckBoxes = value); 132 | } 133 | 134 | [Category("Behavior")] 135 | [Description("Indicates if the check box should be toggled with the first click on an item.")] 136 | public bool CheckOnClick 137 | { 138 | get => lbxAll.CheckOnClick; 139 | set => lbxAll.CheckOnClick = value; 140 | } 141 | 142 | 143 | [Browsable(false)] 144 | [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 145 | [Description("Collection of checked items in this CheckedListBox.")] 146 | public CheckedListBox.CheckedItemCollection CheckedItems => lbxAll.CheckedItems; 147 | 148 | [Browsable(true)] 149 | [Description("Indicates if all check boxes are checked in the CheckedListBox.")] 150 | [Category("Appearance")] 151 | public bool SelectAllChecked 152 | { 153 | get => cbxAll.Checked; 154 | set => UpdateControl(() => cbxAll.Checked = value); 155 | } 156 | 157 | public void UpdateControl(Action action) 158 | { 159 | action.Invoke(); 160 | if (DesignMode) Invalidate(); 161 | } 162 | 163 | /// 164 | /// Sets the checked value of the given item. This value should be a boolean. 165 | /// 166 | public void SetItemChecked(int index, bool value) 167 | { 168 | lbxAll.SetItemChecked(index, value); 169 | } 170 | 171 | /// 172 | /// Sets the checked value of the given item. This value should be from 173 | /// the System.Windows.Forms.CheckState enumeration. 174 | /// 175 | public void SetItemCheckState(int index, CheckState value) 176 | { 177 | lbxAll.SetItemCheckState(index, value); 178 | } 179 | 180 | /// 181 | /// Indicates if the given item is, in any way, shape, or form, checked. 182 | /// This will return true if the item is fully or indeterminately checked. 183 | /// 184 | public bool GetItemChecked(int index) 185 | { 186 | return lbxAll.GetItemChecked(index); 187 | } 188 | 189 | /// 190 | /// Gets the check value of the current item. This value will be from the 191 | /// System.Windows.Forms.CheckState enumeration. 192 | /// 193 | public CheckState GetItemCheckState(int index) 194 | { 195 | return lbxAll.GetItemCheckState(index); 196 | } 197 | 198 | public void SetItemCheckedByName(string value, bool flag) 199 | { 200 | for (int i = 0; i < lbxAll.Items.Count; i++) 201 | { 202 | if (lbxAll.Items[i].ToString().Equals(value)) 203 | lbxAll.SetItemChecked(i, flag); 204 | } 205 | 206 | throw new InstanceNotFoundException($"[SetItemCheckedByName] - Couldn't find the specified value -> {value}."); 207 | } 208 | 209 | public bool GetItemCheckedByName(string value) 210 | { 211 | for (int i = 0; i < lbxAll.Items.Count; i++) 212 | { 213 | if (lbxAll.Items[i].ToString().Equals(value)) 214 | return lbxAll.GetItemChecked(i); 215 | } 216 | 217 | throw new InstanceNotFoundException($"[GetItemCheckedByName] - Couldn't find the specified value -> {value}."); 218 | } 219 | 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/Controls/ListViewEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | using Windows.RegistryEditor.Utils; 5 | 6 | namespace Windows.RegistryEditor.Views.Controls 7 | { 8 | public class ListViewEx : ListView 9 | { 10 | 11 | public ListViewEx() 12 | { 13 | CheckBoxes = true; 14 | FullRowSelect = true; 15 | GridLines = true; 16 | } 17 | 18 | public void SelectAllItems() => Utility.SelectAllItems(this); 19 | 20 | public void DeselectAllItems() => Utility.DeselectAllItems(this); 21 | 22 | public void CheckAllItems(bool value) 23 | { 24 | foreach (ListViewItem item in Items) 25 | item.Checked = value; 26 | } 27 | 28 | public string GetAllSelectedSubItemsText(int index) 29 | { 30 | string data = String.Empty; 31 | foreach (ListViewItem item in SelectedItems) 32 | data += item.SubItems[index].Text + Environment.NewLine; 33 | 34 | data = data.TrimEnd(); 35 | 36 | return data; 37 | } 38 | 39 | public List GetAllSelectedSubItemsTextList(int index) 40 | { 41 | List newList = new List(); 42 | foreach (ListViewItem item in SelectedItems) 43 | newList.Add(item.SubItems[index].Text); 44 | 45 | return newList; 46 | } 47 | 48 | public List GetAllCheckedSubItemsTextList(int index) 49 | { 50 | List newList = new List(); 51 | foreach (ListViewItem item in CheckedItems) 52 | newList.Add(item.SubItems[index].Text); 53 | 54 | return newList; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/Controls/Loader.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Views.Controls 2 | { 3 | partial class Loader 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.pbxGif = new System.Windows.Forms.PictureBox(); 32 | ((System.ComponentModel.ISupportInitialize)(this.pbxGif)).BeginInit(); 33 | this.SuspendLayout(); 34 | // 35 | // pbxGif 36 | // 37 | this.pbxGif.Dock = System.Windows.Forms.DockStyle.Fill; 38 | this.pbxGif.Image = global::Windows.RegistryEditor.Properties.Resources.loader_clock; 39 | this.pbxGif.Location = new System.Drawing.Point(0, 0); 40 | this.pbxGif.Name = "pbxGif"; 41 | this.pbxGif.Size = new System.Drawing.Size(100, 100); 42 | this.pbxGif.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 43 | this.pbxGif.TabIndex = 0; 44 | this.pbxGif.TabStop = false; 45 | // 46 | // Loader 47 | // 48 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 50 | this.BackColor = System.Drawing.Color.Transparent; 51 | this.Controls.Add(this.pbxGif); 52 | this.Name = "Loader"; 53 | this.Size = new System.Drawing.Size(100, 100); 54 | this.Load += new System.EventHandler(this.Spinner_Load); 55 | ((System.ComponentModel.ISupportInitialize)(this.pbxGif)).EndInit(); 56 | this.ResumeLayout(false); 57 | 58 | } 59 | 60 | #endregion 61 | 62 | private System.Windows.Forms.PictureBox pbxGif; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/Controls/Loader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Diagnostics; 4 | using System.Drawing; 5 | using System.Runtime.CompilerServices; 6 | using System.Windows.Forms; 7 | using Windows.RegistryEditor.Properties; 8 | 9 | namespace Windows.RegistryEditor.Views.Controls 10 | { 11 | public enum LoaderKind 12 | { 13 | Clock, 14 | Arrows, 15 | CircleBall, 16 | Loading, 17 | Snake, 18 | WheelThrobber 19 | } 20 | 21 | public partial class Loader : UserControl 22 | { 23 | #region --- Fields --- 24 | 25 | private LoaderKind loaderKind; 26 | 27 | #endregion --- Fields --- 28 | 29 | 30 | 31 | #region --- Properties --- 32 | 33 | [Description("Whether to disable all controls on form when loader is displayed.")] 34 | [Category("Behavior")] 35 | public bool DisableControlsOnWork { get; set; } 36 | 37 | [Description("The size of the control when it's spinning. The purpose of this property is " + 38 | "to allow you hidding your loader as a very small size in the corner, while " + 39 | "being able to specifying the expected size.")] 40 | [Category("Layout")] 41 | public Size SizeLoading { get; set; } 42 | 43 | [Description("Gets or sets the loader appearance to be displayed.")] 44 | [Category("Appearance")] 45 | public LoaderKind LoaderKind 46 | { 47 | get => loaderKind; 48 | set 49 | { 50 | if (value == loaderKind) return; 51 | 52 | loaderKind = value; 53 | pbxGif.Image = CreateLoaderImage(value); 54 | if (DesignMode) Invalidate(); 55 | } 56 | } 57 | 58 | protected override CreateParams CreateParams 59 | { 60 | get 61 | { 62 | CreateParams cp = base.CreateParams; 63 | cp.ExStyle |= 0x02000000; // Turns on WS_EX_COMPOSITED 64 | return cp; 65 | } 66 | } 67 | 68 | #endregion --- Properties --- 69 | 70 | 71 | public Loader() 72 | { 73 | SetStyle(ControlStyles.SupportsTransparentBackColor | 74 | ControlStyles.UserPaint | 75 | ControlStyles.ResizeRedraw | 76 | ControlStyles.Selectable, true); 77 | 78 | InitializeComponent(); 79 | 80 | DoubleBuffered = true; 81 | Visible = false; 82 | DisableControlsOnWork = true; 83 | SizeLoading = new Size(100, 100); 84 | LoaderKind = LoaderKind.Clock; 85 | } 86 | 87 | private void Spinner_Load(object sender, EventArgs e) 88 | { 89 | if (IsParentNull()) return; 90 | 91 | ParentForm.SizeChanged += delegate { PositionToParent(); }; 92 | } 93 | 94 | private void PositionToParent() 95 | { 96 | if (IsParentNull()) return; 97 | 98 | this.Invoke(new Action(() => Left = (ParentForm.ClientSize.Width - Width) / 2)); 99 | this.Invoke(new Action(() => Top = (ParentForm.ClientSize.Height - Height) / 2)); 100 | } 101 | 102 | public new void Show() 103 | { 104 | if (IsParentNull() || Visible) return; 105 | 106 | this.Invoke(new Action(() => Size = SizeLoading)); 107 | 108 | if (DisableControlsOnWork) 109 | EnableParentControls(false); 110 | 111 | PositionToParent(); 112 | 113 | this.Invoke(new Action(() => base.Show())); 114 | this.Invoke(new Action(() => BringToFront())); 115 | } 116 | 117 | public new void Hide() 118 | { 119 | if (IsParentNull() || !Visible) return; 120 | 121 | if (DisableControlsOnWork) 122 | EnableParentControls(true); 123 | 124 | this.Invoke(new Action(() => base.Hide())); 125 | this.Invoke(new Action(() => SendToBack())); 126 | } 127 | 128 | 129 | private bool IsParentNull([CallerMemberName] string callerMethod = "") 130 | { 131 | bool isNull = ParentForm == null; 132 | 133 | if (isNull) 134 | Debug.WriteLine($"[{callerMethod}] - Parent cannot be null."); 135 | 136 | return isNull; 137 | } 138 | private void EnableParentControls(bool enabled) 139 | { 140 | if (IsParentNull()) return; 141 | 142 | foreach (Control control in ParentForm.Controls) 143 | { 144 | if (control.GetType() == typeof(Loader)) continue; 145 | 146 | control.Invoke(new Action(() => control.Enabled = enabled)); 147 | } 148 | } 149 | 150 | protected override void OnPaint(PaintEventArgs e) 151 | { 152 | Transparent(this, e.Graphics); 153 | base.OnPaint(e); 154 | } 155 | 156 | public static void Transparent(Control control, Graphics graphics) 157 | { 158 | Control owner = control.Parent; 159 | if (owner == null) return; 160 | 161 | Rectangle controlBounds = control.Bounds; 162 | ControlCollection ownerControls = owner.Controls; 163 | int controlIndex = ownerControls.IndexOf(control); 164 | Bitmap bitmapBehind = null; 165 | for (int i = controlIndex + 1; i < ownerControls.Count; i++) 166 | { 167 | Control targetControl = ownerControls[i]; 168 | if (!targetControl.Bounds.IntersectsWith(controlBounds)) continue; 169 | 170 | if (bitmapBehind == null) 171 | bitmapBehind = new Bitmap(control.Parent.ClientSize.Width, control.Parent.ClientSize.Height); 172 | targetControl.DrawToBitmap(bitmapBehind, targetControl.Bounds); 173 | } 174 | 175 | if (bitmapBehind == null) return; 176 | 177 | graphics.DrawImage(bitmapBehind, control.ClientRectangle, controlBounds, GraphicsUnit.Pixel); 178 | bitmapBehind.Dispose(); 179 | } 180 | 181 | private Image CreateLoaderImage(LoaderKind value) 182 | { 183 | switch (value) 184 | { 185 | case LoaderKind.Clock: 186 | return Resources.loader_clock; 187 | 188 | //case LoaderKind.Arrows: 189 | // return Resources.loader_arrows; 190 | 191 | //case LoaderKind.CircleBall: 192 | // return Resources.loader_circleball; 193 | 194 | //case LoaderKind.Loading: 195 | // return Resources.loader_loading; 196 | 197 | //case LoaderKind.Snake: 198 | // return Resources.loader_snake; 199 | 200 | //case LoaderKind.WheelThrobber: 201 | // return Resources.loader_wheelthrobber; 202 | 203 | default: 204 | throw new ArgumentOutOfRangeException(nameof(value), value, null); 205 | } 206 | } 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/FindWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Views 2 | { 3 | partial class FindWindow 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.tbxSearch = new System.Windows.Forms.TextBox(); 33 | this.label1 = new System.Windows.Forms.Label(); 34 | this.gbxLookAt = new System.Windows.Forms.GroupBox(); 35 | this.cbxData = new System.Windows.Forms.CheckBox(); 36 | this.cbxValues = new System.Windows.Forms.CheckBox(); 37 | this.cbxKeys = new System.Windows.Forms.CheckBox(); 38 | this.cbxMatchString = new System.Windows.Forms.CheckBox(); 39 | this.btnFindNext = new System.Windows.Forms.Button(); 40 | this.btnFindAll = new System.Windows.Forms.Button(); 41 | this.btnCancel = new System.Windows.Forms.Button(); 42 | this.cbxCaseSensitive = new System.Windows.Forms.CheckBox(); 43 | this.cbxRegularEx = new System.Windows.Forms.CheckBox(); 44 | this.textBox1 = new System.Windows.Forms.TextBox(); 45 | this.gbxOptions = new System.Windows.Forms.GroupBox(); 46 | this.gbxHkeys = new System.Windows.Forms.GroupBox(); 47 | this.cbxsHkeys = new Windows.RegistryEditor.Views.Controls.CheckBoxes(); 48 | this.gbxDataTypes = new System.Windows.Forms.GroupBox(); 49 | this.cbxsDataTypes = new Windows.RegistryEditor.Views.Controls.CheckBoxes(); 50 | this.tbxRemoteComputer = new System.Windows.Forms.TextBox(); 51 | this.label2 = new System.Windows.Forms.Label(); 52 | this.cbxRemoteSearch = new System.Windows.Forms.CheckBox(); 53 | this.btnFindAvailableMachines = new System.Windows.Forms.Button(); 54 | this.toolTip = new System.Windows.Forms.ToolTip(this.components); 55 | this.loader = new Windows.RegistryEditor.Views.Controls.Loader(); 56 | this.gbxLookAt.SuspendLayout(); 57 | this.gbxOptions.SuspendLayout(); 58 | this.gbxHkeys.SuspendLayout(); 59 | this.gbxDataTypes.SuspendLayout(); 60 | this.SuspendLayout(); 61 | // 62 | // tbxSearch 63 | // 64 | this.tbxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 65 | | System.Windows.Forms.AnchorStyles.Right))); 66 | this.tbxSearch.Location = new System.Drawing.Point(110, 57); 67 | this.tbxSearch.Name = "tbxSearch"; 68 | this.tbxSearch.Size = new System.Drawing.Size(454, 20); 69 | this.tbxSearch.TabIndex = 0; 70 | // 71 | // label1 72 | // 73 | this.label1.AutoSize = true; 74 | this.label1.Location = new System.Drawing.Point(44, 60); 75 | this.label1.Name = "label1"; 76 | this.label1.Size = new System.Drawing.Size(60, 13); 77 | this.label1.TabIndex = 2; 78 | this.label1.Text = "Find String:"; 79 | // 80 | // gbxLookAt 81 | // 82 | this.gbxLookAt.Controls.Add(this.cbxData); 83 | this.gbxLookAt.Controls.Add(this.cbxValues); 84 | this.gbxLookAt.Controls.Add(this.cbxKeys); 85 | this.gbxLookAt.Location = new System.Drawing.Point(18, 83); 86 | this.gbxLookAt.Name = "gbxLookAt"; 87 | this.gbxLookAt.Size = new System.Drawing.Size(86, 120); 88 | this.gbxLookAt.TabIndex = 4; 89 | this.gbxLookAt.TabStop = false; 90 | this.gbxLookAt.Text = "Look at"; 91 | // 92 | // cbxData 93 | // 94 | this.cbxData.AutoSize = true; 95 | this.cbxData.Checked = true; 96 | this.cbxData.CheckState = System.Windows.Forms.CheckState.Checked; 97 | this.cbxData.Location = new System.Drawing.Point(7, 66); 98 | this.cbxData.Name = "cbxData"; 99 | this.cbxData.Size = new System.Drawing.Size(49, 17); 100 | this.cbxData.TabIndex = 2; 101 | this.cbxData.Text = "Data"; 102 | this.cbxData.UseVisualStyleBackColor = true; 103 | // 104 | // cbxValues 105 | // 106 | this.cbxValues.AutoSize = true; 107 | this.cbxValues.Checked = true; 108 | this.cbxValues.CheckState = System.Windows.Forms.CheckState.Checked; 109 | this.cbxValues.Location = new System.Drawing.Point(7, 43); 110 | this.cbxValues.Name = "cbxValues"; 111 | this.cbxValues.Size = new System.Drawing.Size(58, 17); 112 | this.cbxValues.TabIndex = 1; 113 | this.cbxValues.Text = "Values"; 114 | this.cbxValues.UseVisualStyleBackColor = true; 115 | // 116 | // cbxKeys 117 | // 118 | this.cbxKeys.AutoSize = true; 119 | this.cbxKeys.Checked = true; 120 | this.cbxKeys.CheckState = System.Windows.Forms.CheckState.Checked; 121 | this.cbxKeys.Location = new System.Drawing.Point(7, 20); 122 | this.cbxKeys.Name = "cbxKeys"; 123 | this.cbxKeys.Size = new System.Drawing.Size(49, 17); 124 | this.cbxKeys.TabIndex = 0; 125 | this.cbxKeys.Text = "Keys"; 126 | this.cbxKeys.UseVisualStyleBackColor = true; 127 | // 128 | // cbxMatchString 129 | // 130 | this.cbxMatchString.AutoSize = true; 131 | this.cbxMatchString.Location = new System.Drawing.Point(6, 43); 132 | this.cbxMatchString.Name = "cbxMatchString"; 133 | this.cbxMatchString.Size = new System.Drawing.Size(113, 17); 134 | this.cbxMatchString.TabIndex = 1; 135 | this.cbxMatchString.Text = "Match whole word"; 136 | this.cbxMatchString.UseVisualStyleBackColor = true; 137 | // 138 | // btnFindNext 139 | // 140 | this.btnFindNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 141 | this.btnFindNext.Enabled = false; 142 | this.btnFindNext.Location = new System.Drawing.Point(519, 272); 143 | this.btnFindNext.Name = "btnFindNext"; 144 | this.btnFindNext.Size = new System.Drawing.Size(75, 23); 145 | this.btnFindNext.TabIndex = 1; 146 | this.btnFindNext.Text = "Find Next"; 147 | this.btnFindNext.UseVisualStyleBackColor = true; 148 | this.btnFindNext.Click += new System.EventHandler(this.BtnFindSingle_Click); 149 | // 150 | // btnFindAll 151 | // 152 | this.btnFindAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 153 | this.btnFindAll.Location = new System.Drawing.Point(519, 301); 154 | this.btnFindAll.Name = "btnFindAll"; 155 | this.btnFindAll.Size = new System.Drawing.Size(75, 23); 156 | this.btnFindAll.TabIndex = 2; 157 | this.btnFindAll.Text = "Find All"; 158 | this.btnFindAll.UseVisualStyleBackColor = true; 159 | this.btnFindAll.Click += new System.EventHandler(this.BtnFindAll_Click); 160 | // 161 | // btnCancel 162 | // 163 | this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 164 | this.btnCancel.Enabled = false; 165 | this.btnCancel.Location = new System.Drawing.Point(519, 330); 166 | this.btnCancel.Name = "btnCancel"; 167 | this.btnCancel.Size = new System.Drawing.Size(75, 23); 168 | this.btnCancel.TabIndex = 3; 169 | this.btnCancel.Text = "Cancel"; 170 | this.btnCancel.UseVisualStyleBackColor = true; 171 | this.btnCancel.Click += new System.EventHandler(this.BtnCancel_Click); 172 | // 173 | // cbxCaseSensitive 174 | // 175 | this.cbxCaseSensitive.AutoSize = true; 176 | this.cbxCaseSensitive.Location = new System.Drawing.Point(6, 20); 177 | this.cbxCaseSensitive.Name = "cbxCaseSensitive"; 178 | this.cbxCaseSensitive.Size = new System.Drawing.Size(96, 17); 179 | this.cbxCaseSensitive.TabIndex = 0; 180 | this.cbxCaseSensitive.Text = "Case Sensitive"; 181 | this.cbxCaseSensitive.UseVisualStyleBackColor = true; 182 | // 183 | // cbxRegularEx 184 | // 185 | this.cbxRegularEx.AutoSize = true; 186 | this.cbxRegularEx.Enabled = false; 187 | this.cbxRegularEx.Location = new System.Drawing.Point(6, 66); 188 | this.cbxRegularEx.Name = "cbxRegularEx"; 189 | this.cbxRegularEx.Size = new System.Drawing.Size(117, 17); 190 | this.cbxRegularEx.TabIndex = 2; 191 | this.cbxRegularEx.Text = "Regular Expression"; 192 | this.cbxRegularEx.UseVisualStyleBackColor = true; 193 | // 194 | // textBox1 195 | // 196 | this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 197 | | System.Windows.Forms.AnchorStyles.Right))); 198 | this.textBox1.Enabled = false; 199 | this.textBox1.Location = new System.Drawing.Point(6, 90); 200 | this.textBox1.Name = "textBox1"; 201 | this.textBox1.Size = new System.Drawing.Size(478, 20); 202 | this.textBox1.TabIndex = 3; 203 | // 204 | // gbxOptions 205 | // 206 | this.gbxOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 207 | | System.Windows.Forms.AnchorStyles.Right))); 208 | this.gbxOptions.Controls.Add(this.cbxMatchString); 209 | this.gbxOptions.Controls.Add(this.textBox1); 210 | this.gbxOptions.Controls.Add(this.cbxRegularEx); 211 | this.gbxOptions.Controls.Add(this.cbxCaseSensitive); 212 | this.gbxOptions.Location = new System.Drawing.Point(110, 83); 213 | this.gbxOptions.Name = "gbxOptions"; 214 | this.gbxOptions.Size = new System.Drawing.Size(490, 120); 215 | this.gbxOptions.TabIndex = 5; 216 | this.gbxOptions.TabStop = false; 217 | this.gbxOptions.Text = "Search Options"; 218 | // 219 | // gbxHkeys 220 | // 221 | this.gbxHkeys.Controls.Add(this.cbxsHkeys); 222 | this.gbxHkeys.Location = new System.Drawing.Point(18, 210); 223 | this.gbxHkeys.Name = "gbxHkeys"; 224 | this.gbxHkeys.Size = new System.Drawing.Size(194, 147); 225 | this.gbxHkeys.TabIndex = 6; 226 | this.gbxHkeys.TabStop = false; 227 | this.gbxHkeys.Text = "HKEYS"; 228 | // 229 | // cbxsHkeys 230 | // 231 | this.cbxsHkeys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 232 | this.cbxsHkeys.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 233 | this.cbxsHkeys.CheckOnClick = true; 234 | this.cbxsHkeys.DataSource = null; 235 | this.cbxsHkeys.Items.AddRange(new object[] { 236 | "HKEY_CLASSES_ROOT", 237 | "HKEY_CURRENT_USER", 238 | "HKEY_LOCAL_MACHINE", 239 | "HKEY_USERS", 240 | "HKEY_CURRENT_CONFIG"}); 241 | this.cbxsHkeys.Location = new System.Drawing.Point(6, 16); 242 | this.cbxsHkeys.Name = "cbxsHkeys"; 243 | this.cbxsHkeys.SelectAllChecked = false; 244 | this.cbxsHkeys.Size = new System.Drawing.Size(182, 125); 245 | this.cbxsHkeys.TabIndex = 0; 246 | this.cbxsHkeys.ThreeDCheckBoxes = false; 247 | // 248 | // gbxDataTypes 249 | // 250 | this.gbxDataTypes.Controls.Add(this.cbxsDataTypes); 251 | this.gbxDataTypes.Location = new System.Drawing.Point(218, 210); 252 | this.gbxDataTypes.Name = "gbxDataTypes"; 253 | this.gbxDataTypes.Size = new System.Drawing.Size(269, 147); 254 | this.gbxDataTypes.TabIndex = 7; 255 | this.gbxDataTypes.TabStop = false; 256 | this.gbxDataTypes.Text = "Data Types"; 257 | // 258 | // cbxsDataTypes 259 | // 260 | this.cbxsDataTypes.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 261 | this.cbxsDataTypes.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 262 | this.cbxsDataTypes.CheckOnClick = true; 263 | this.cbxsDataTypes.DataSource = null; 264 | this.cbxsDataTypes.Items.AddRange(new object[] { 265 | "REG_SZ", 266 | "REG_EXPAND_SZ", 267 | "REG_MULTI_SZ", 268 | "REG_DWORD", 269 | "REG_QWORD", 270 | "REG_DWORD_LITTLE_ENDIAN", 271 | "REG_QWORD_LITTLE_ENDIAN", 272 | "REG_DWORD_BIG_ENDIAN", 273 | "REG_BINARY", 274 | "REG_NONE", 275 | "REG_LINK", 276 | "REG_RESOURCE_LIST"}); 277 | this.cbxsDataTypes.Location = new System.Drawing.Point(6, 16); 278 | this.cbxsDataTypes.Name = "cbxsDataTypes"; 279 | this.cbxsDataTypes.SelectAllChecked = true; 280 | this.cbxsDataTypes.Size = new System.Drawing.Size(257, 125); 281 | this.cbxsDataTypes.TabIndex = 0; 282 | this.cbxsDataTypes.ThreeDCheckBoxes = false; 283 | // 284 | // tbxRemoteComputer 285 | // 286 | this.tbxRemoteComputer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 287 | | System.Windows.Forms.AnchorStyles.Right))); 288 | this.tbxRemoteComputer.Enabled = false; 289 | this.tbxRemoteComputer.Location = new System.Drawing.Point(110, 31); 290 | this.tbxRemoteComputer.Name = "tbxRemoteComputer"; 291 | this.tbxRemoteComputer.Size = new System.Drawing.Size(454, 20); 292 | this.tbxRemoteComputer.TabIndex = 0; 293 | // 294 | // label2 295 | // 296 | this.label2.AutoSize = true; 297 | this.label2.Location = new System.Drawing.Point(18, 34); 298 | this.label2.Name = "label2"; 299 | this.label2.Size = new System.Drawing.Size(86, 13); 300 | this.label2.TabIndex = 2; 301 | this.label2.Text = "Computer Name:"; 302 | // 303 | // cbxRemoteSearch 304 | // 305 | this.cbxRemoteSearch.AutoSize = true; 306 | this.cbxRemoteSearch.Location = new System.Drawing.Point(18, 8); 307 | this.cbxRemoteSearch.Name = "cbxRemoteSearch"; 308 | this.cbxRemoteSearch.Size = new System.Drawing.Size(227, 17); 309 | this.cbxRemoteSearch.TabIndex = 4; 310 | this.cbxRemoteSearch.Text = "Search in remote computer on the network"; 311 | this.cbxRemoteSearch.UseVisualStyleBackColor = true; 312 | this.cbxRemoteSearch.CheckedChanged += new System.EventHandler(this.CbxSearchInRemote_CheckedChanged); 313 | // 314 | // btnFindAvailableMachines 315 | // 316 | this.btnFindAvailableMachines.Enabled = false; 317 | this.btnFindAvailableMachines.Location = new System.Drawing.Point(570, 30); 318 | this.btnFindAvailableMachines.Name = "btnFindAvailableMachines"; 319 | this.btnFindAvailableMachines.Size = new System.Drawing.Size(24, 21); 320 | this.btnFindAvailableMachines.TabIndex = 9; 321 | this.btnFindAvailableMachines.Text = "..."; 322 | this.toolTip.SetToolTip(this.btnFindAvailableMachines, "Find available machines on the network."); 323 | this.btnFindAvailableMachines.UseVisualStyleBackColor = true; 324 | this.btnFindAvailableMachines.Click += new System.EventHandler(this.BtnFindAvailableMachines_Click); 325 | // 326 | // loader 327 | // 328 | this.loader.BackColor = System.Drawing.Color.Transparent; 329 | this.loader.DisableControlsOnWork = false; 330 | this.loader.LoaderKind = Windows.RegistryEditor.Views.Controls.LoaderKind.Clock; 331 | this.loader.Location = new System.Drawing.Point(554, 226); 332 | this.loader.Name = "loader"; 333 | this.loader.Size = new System.Drawing.Size(40, 40); 334 | this.loader.SizeLoading = new System.Drawing.Size(100, 100); 335 | this.loader.TabIndex = 8; 336 | this.loader.Visible = false; 337 | // 338 | // FindWindow 339 | // 340 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 341 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 342 | this.ClientSize = new System.Drawing.Size(606, 365); 343 | this.Controls.Add(this.btnFindAvailableMachines); 344 | this.Controls.Add(this.cbxRemoteSearch); 345 | this.Controls.Add(this.loader); 346 | this.Controls.Add(this.gbxDataTypes); 347 | this.Controls.Add(this.gbxHkeys); 348 | this.Controls.Add(this.gbxOptions); 349 | this.Controls.Add(this.btnCancel); 350 | this.Controls.Add(this.btnFindAll); 351 | this.Controls.Add(this.btnFindNext); 352 | this.Controls.Add(this.gbxLookAt); 353 | this.Controls.Add(this.label2); 354 | this.Controls.Add(this.label1); 355 | this.Controls.Add(this.tbxRemoteComputer); 356 | this.Controls.Add(this.tbxSearch); 357 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 358 | this.KeyPreview = true; 359 | this.Name = "FindWindow"; 360 | this.ShowIcon = false; 361 | this.ShowInTaskbar = false; 362 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 363 | this.Text = "Find"; 364 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindWindow_FormClosing); 365 | this.Load += new System.EventHandler(this.FindWindow_Load); 366 | this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.FindWindow_KeyPress); 367 | this.gbxLookAt.ResumeLayout(false); 368 | this.gbxLookAt.PerformLayout(); 369 | this.gbxOptions.ResumeLayout(false); 370 | this.gbxOptions.PerformLayout(); 371 | this.gbxHkeys.ResumeLayout(false); 372 | this.gbxDataTypes.ResumeLayout(false); 373 | this.ResumeLayout(false); 374 | this.PerformLayout(); 375 | 376 | } 377 | 378 | #endregion 379 | private System.Windows.Forms.TextBox tbxSearch; 380 | private System.Windows.Forms.Label label1; 381 | private System.Windows.Forms.GroupBox gbxLookAt; 382 | private System.Windows.Forms.CheckBox cbxData; 383 | private System.Windows.Forms.CheckBox cbxValues; 384 | private System.Windows.Forms.CheckBox cbxKeys; 385 | private System.Windows.Forms.CheckBox cbxMatchString; 386 | private System.Windows.Forms.Button btnFindNext; 387 | private System.Windows.Forms.Button btnFindAll; 388 | private System.Windows.Forms.Button btnCancel; 389 | private System.Windows.Forms.CheckBox cbxCaseSensitive; 390 | private System.Windows.Forms.CheckBox cbxRegularEx; 391 | private System.Windows.Forms.TextBox textBox1; 392 | private System.Windows.Forms.GroupBox gbxOptions; 393 | private System.Windows.Forms.GroupBox gbxHkeys; 394 | private System.Windows.Forms.GroupBox gbxDataTypes; 395 | private Windows.RegistryEditor.Views.Controls.CheckBoxes cbxsDataTypes; 396 | private Windows.RegistryEditor.Views.Controls.CheckBoxes cbxsHkeys; 397 | private Windows.RegistryEditor.Views.Controls.Loader loader; 398 | private System.Windows.Forms.TextBox tbxRemoteComputer; 399 | private System.Windows.Forms.Label label2; 400 | private System.Windows.Forms.CheckBox cbxRemoteSearch; 401 | private System.Windows.Forms.Button btnFindAvailableMachines; 402 | private System.Windows.Forms.ToolTip toolTip; 403 | } 404 | } 405 | 406 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/FindWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Security.Principal; 6 | using System.Text.RegularExpressions; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Windows.RegistryEditor.Events; 11 | using Windows.RegistryEditor.Utils; 12 | using Stopwatch = Windows.RegistryEditor.Utils.Stopwatch; 13 | 14 | namespace Windows.RegistryEditor.Views 15 | { 16 | /// 17 | /// https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/reg-query 18 | /// 19 | public partial class FindWindow : Form 20 | { 21 | private NetworkWindow refNetworkWindow; 22 | public NetworkWindow NetworkInstance 23 | { 24 | get 25 | { 26 | if (refNetworkWindow != null && !refNetworkWindow.IsDisposed) 27 | { 28 | refNetworkWindow.Activate(); 29 | return refNetworkWindow; 30 | } 31 | refNetworkWindow = new NetworkWindow(); 32 | refNetworkWindow.MachineSelected += (e) => tbxRemoteComputer.Text = e; 33 | refNetworkWindow.FormClosing += delegate { tbxSearch.Focus(); }; 34 | return refNetworkWindow; 35 | } 36 | } 37 | 38 | 39 | private List procsList; 40 | private int procsExecuted; 41 | private bool searchInProgress; 42 | 43 | private AutoResetEvent procToken; 44 | private CancellationTokenSource cancelSrc; 45 | private CancellationToken cancelToken; 46 | 47 | public FindWindow() 48 | { 49 | InitializeComponent(); 50 | } 51 | 52 | private void FindWindow_Load(object sender, EventArgs e) 53 | { 54 | cbxsHkeys.SetItemChecked(1, true); 55 | } 56 | 57 | private void BtnFindAvailableMachines_Click(object sender, EventArgs e) 58 | { 59 | NetworkInstance.ShowDialog(this); 60 | } 61 | 62 | private void BtnFindSingle_Click(object sender, EventArgs e) { } 63 | 64 | private async void BtnFindAll_Click(object sender, EventArgs e) 65 | { 66 | if (String.IsNullOrEmpty(tbxSearch.Text)) return; 67 | 68 | if (cbxRemoteSearch.Checked) 69 | { 70 | DialogResult answer = MessageBox.Show( 71 | "Scanning registries through the network may take a while depending on the" + 72 | "chosen filter. Are you sure you want to continue?", "INFO", 73 | MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); 74 | 75 | if (answer != DialogResult.Yes) return; 76 | } 77 | 78 | Started(); 79 | List hives = GetHkeysFilters(); 80 | procsList = GenerateRegQueryProcs(hives); 81 | 82 | Stopwatch stopwatch = new Stopwatch(); 83 | stopwatch.Start(); 84 | OnProgressStarted(this, new ProgressStartedArgs("Starting to search for registries...", hives.First())); 85 | 86 | searchInProgress = true; 87 | await ExecuteProcs(procsList); 88 | searchInProgress = false; 89 | procToken.Set(); 90 | 91 | stopwatch.Stop(); 92 | OnProgressFinished(this, new ProgressFinishedArgs("Finished searching for registries.")); 93 | Stopped(); 94 | 95 | Activate(); 96 | MessageBox.Show("Finished searching. Time Taken:\n" + stopwatch.Elapsed.ToString("g"), 97 | "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information); 98 | } 99 | 100 | private void Started() 101 | { 102 | btnFindAll.Enabled = false; 103 | btnCancel.Enabled = true; 104 | loader.Show(); 105 | 106 | procsExecuted = 0; 107 | procToken = new AutoResetEvent(false); 108 | cancelSrc = new CancellationTokenSource(); 109 | cancelToken = cancelSrc.Token; 110 | } 111 | 112 | private void Stopped() 113 | { 114 | Text = "Find"; 115 | btnFindAll.Enabled = true; 116 | btnCancel.Enabled = false; 117 | loader.Hide(); 118 | } 119 | 120 | /// 121 | /// BIG NOTE: When we search through the registry remotely, we can't really access HKCR, HKCU, HKCC but at the same time 122 | /// we don't really need to, as they can be found under HKLM and HKU. In other words, they're just symbolic links. i.e: 123 | /// ### HKEY_CLASSES_ROOT links to: ### 124 | /// HKEY_CURRENT_USER\Software\Classes 125 | /// HKEY_LOCAL_MACHINE\SOFTWARE\Classes 126 | /// HKEY_USERS\{UserSID}\Software\Classes 127 | /// HKEY_USERS\{UserSID}_Classes 128 | /// 129 | /// ### HKEY_CURRENT_USER links to: ### 130 | /// HKEY_USERS\{UserSID} 131 | /// 132 | /// ### HKEY_CURRENT_CONFIG links to: ### 133 | /// HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Hardware Profiles\0001 134 | /// HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Hardware Profiles\Current 135 | /// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\0001 136 | /// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current 137 | /// 138 | /// Getting user SID: 139 | /// WindowsIdentity.GetCurrent().User 140 | /// whoami /user 141 | /// 142 | private List GetHkeysFilters() 143 | { 144 | List hives = new List(); 145 | if (cbxRemoteSearch.Checked) 146 | { 147 | hives.Add(RegistryUtils.HKLM); 148 | hives.Add(RegistryUtils.HKU); 149 | #region experimental 150 | //string userSID = WindowsIdentity.GetCurrent().User?.Value; 151 | //Debug.Assert(userSID != null, "userSID != null"); 152 | //foreach (string hive in cbxsHkeys.CheckedItems) 153 | //{ 154 | // if (hive.Equals(RegistryUtils.HKCR)) 155 | // hives.Add($@"HKU\{userSID}\Software\Classes"); 156 | // else if (hive.Equals(RegistryUtils.HKCU)) 157 | // hives.Add($@"HKU\{userSID}"); 158 | // else if (hive.Equals(RegistryUtils.HKLM)) 159 | // hives.Add($@"HKLM"); 160 | // else if (hive.Equals(RegistryUtils.HKU)) 161 | // hives.Add($@"HKU"); 162 | // else if (hive.Equals(RegistryUtils.HKCC)) 163 | // hives.Add($@"HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current"); 164 | //} 165 | #endregion experimental 166 | } 167 | else 168 | { 169 | foreach (string hive in cbxsHkeys.CheckedItems) 170 | hives.Add(hive); 171 | } 172 | 173 | return hives; 174 | } 175 | 176 | private List GenerateRegQueryProcs(List hives) 177 | { 178 | List procs = new List(); 179 | foreach (string hive in hives) 180 | { 181 | string searchQuery = BuildSearchQuery(RegistryUtils.GetHiveShortcut(hive)); 182 | Process proc = CreateRegQueryProc(searchQuery); 183 | procs.Add(proc); 184 | Console.WriteLine($"{proc.StartInfo.FileName} {proc.StartInfo.Arguments}"); 185 | } 186 | 187 | return procs; 188 | } 189 | 190 | private string BuildSearchQuery(string hive) 191 | { 192 | string query = String.Empty; 193 | 194 | if (cbxRemoteSearch.Checked) 195 | query = $"\"\\\\{tbxRemoteComputer.Text}\\{hive}\" /f \"{tbxSearch.Text}\" /s"; 196 | else 197 | query = $"\"{hive}\" /f \"{tbxSearch.Text}\" /s"; 198 | 199 | if (cbxKeys.Checked) query += " /k"; 200 | if (cbxValues.Checked) query += " /v"; 201 | if (cbxData.Checked) query += " /d"; 202 | if (cbxCaseSensitive.Checked) query += " /c"; 203 | if (cbxMatchString.Checked) query += " /e"; 204 | if (cbxsDataTypes.GetItemCheckedByName("REG_MULTI_SZ")) query += " /se +"; 205 | 206 | if (cbxsDataTypes.CheckedItems.Count <= 0 || cbxsDataTypes.SelectAllChecked) 207 | return query; 208 | 209 | // ------------------------ Adding Data types filters ------------------------ 210 | query += " /t \""; 211 | foreach (string checkedItem in cbxsDataTypes.CheckedItems) 212 | query += checkedItem + ","; 213 | 214 | query = query.TrimEnd(','); 215 | query += "\""; 216 | 217 | // https://msdn.microsoft.com/en-us/library/windows/desktop/bb773476(v=vs.85).aspx 218 | // Unfortunately these are not supported by reg query when filtering... 219 | query = Regex.Replace(query, ",?REG_QWORD_LITTLE_ENDIAN", String.Empty); 220 | query = Regex.Replace(query, ",?REG_LINK", String.Empty); 221 | query = Regex.Replace(query, ",?REG_RESOURCE_LIST", String.Empty); 222 | 223 | return query; 224 | } 225 | 226 | private Process CreateRegQueryProc(string searchQuery) 227 | { 228 | ProcessStartInfo procInfo = new ProcessStartInfo 229 | { 230 | FileName = "REG", 231 | Arguments = $"QUERY {searchQuery}", 232 | RedirectStandardError = true, 233 | RedirectStandardInput = true, 234 | RedirectStandardOutput = true, 235 | CreateNoWindow = true, 236 | UseShellExecute = false 237 | }; 238 | 239 | Process proc = new Process 240 | { 241 | StartInfo = procInfo, 242 | EnableRaisingEvents = true 243 | }; 244 | 245 | proc.ErrorDataReceived += OnErrorDataReceived; 246 | proc.OutputDataReceived += OnOutputDataReceived; 247 | proc.Exited += OnFindEnd; 248 | 249 | return proc; 250 | } 251 | 252 | private async Task ExecuteProcs(IEnumerable procs) 253 | { 254 | foreach (Process proc in procs) 255 | { 256 | procsExecuted++; 257 | 258 | string hiveShort = proc.StartInfo.Arguments.Split('"')[1]; 259 | string hive = cbxRemoteSearch.Checked 260 | ? RegistryUtils.GetRemoteHiveFullName(hiveShort) 261 | : RegistryUtils.GetHiveFullName(hiveShort); 262 | string message = $"Searching in {hive}...Patient :)"; 263 | Text = $"Find | {message}"; 264 | 265 | OnProgressChanged(this, new ProgressChangedArgs(message, hive)); 266 | await Task.Run(() => ExecuteProc(proc)); 267 | 268 | if (cancelToken.IsCancellationRequested) 269 | break; 270 | } 271 | } 272 | 273 | private void ExecuteProc(Process proc) 274 | { 275 | proc.Start(); 276 | proc.BeginErrorReadLine(); 277 | proc.BeginOutputReadLine(); 278 | 279 | Console.WriteLine("[Process::ExecuteProc] - Waiting for exit..."); 280 | proc.WaitForExit(); 281 | Console.WriteLine("[Process::ExecuteProc] - Executed Finished."); 282 | } 283 | 284 | private void OnOutputDataReceived(object sender, DataReceivedEventArgs e) 285 | { 286 | if (e?.Data == null) return; 287 | 288 | string hive = e.Data.TrimStart().StartsWith("HKEY_") ? e.Data : String.Empty; 289 | if (String.IsNullOrEmpty(hive)) return; 290 | 291 | if (cbxRemoteSearch.Checked) 292 | hive = $"{tbxRemoteComputer.Text}\\{hive}"; 293 | 294 | OnFoundSingleResult(this, new FindSingleResultArgs(hive)); 295 | } 296 | 297 | private void OnErrorDataReceived(object sender, DataReceivedEventArgs e) 298 | { 299 | if (e?.Data == null) return; 300 | if (!e.Data.StartsWith("ERROR")) return; 301 | 302 | if (e.Data.Trim().StartsWith("ERROR: The network path was not found.")) 303 | { 304 | MessageBox.Show($"{e.Data}\n" + 305 | "Make sure that the target machine has \"Remote Registry\" service running.", 306 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); 307 | 308 | cancelSrc.Cancel(); 309 | } 310 | else 311 | { 312 | MessageBox.Show("Error occured. Please contact author of this app with this message.\n" + 313 | $"{e.Data}", 314 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); 315 | } 316 | } 317 | 318 | 319 | private async void OnFindEnd(object sender, EventArgs e) 320 | { 321 | if (procsList.Count != procsExecuted || procsExecuted == 0) return; 322 | 323 | await Task.Run(() => Thread.Sleep(1000)); 324 | Console.WriteLine("[Process::OnFindEnd] - Waiting for other thread to finished."); 325 | procToken.WaitOne(); 326 | Console.WriteLine("[Process::OnFindEnd] - Clearing up."); 327 | for (int i = 0; i < procsList.Count; i++) 328 | { 329 | procsList[i].Dispose(); 330 | procsList[i] = null; 331 | } 332 | 333 | searchInProgress = false; 334 | loader.Hide(); 335 | } 336 | 337 | private void BtnCancel_Click(object sender, EventArgs e) 338 | { 339 | if (!searchInProgress) return; 340 | 341 | cancelSrc.Cancel(); 342 | for (int i = 0; i < procsExecuted; i++) 343 | { 344 | procsList[i].CancelErrorRead(); 345 | procsList[i].CancelOutputRead(); 346 | if (!procsList[i].HasExited) 347 | procsList[i].Kill(); 348 | } 349 | 350 | procToken.Set(); 351 | } 352 | 353 | private void CbxSearchInRemote_CheckedChanged(object sender, EventArgs e) 354 | { 355 | tbxRemoteComputer.Enabled = cbxRemoteSearch.Checked; 356 | btnFindAvailableMachines.Enabled = cbxRemoteSearch.Checked; 357 | gbxHkeys.Enabled = !cbxRemoteSearch.Checked; 358 | if (cbxRemoteSearch.Checked) 359 | tbxRemoteComputer.Focus(); 360 | else 361 | tbxSearch.Focus(); 362 | } 363 | 364 | private void FindWindow_KeyPress(object sender, KeyPressEventArgs e) 365 | { 366 | Keys key = (Keys) e.KeyChar; 367 | switch (key) 368 | { 369 | case Keys.Escape: 370 | Close(); 371 | break; 372 | 373 | case Keys.Return: 374 | btnFindAll.PerformClick(); 375 | break; 376 | } 377 | } 378 | 379 | private async void FindWindow_FormClosing(object sender, FormClosingEventArgs e) 380 | { 381 | if (searchInProgress) 382 | { 383 | e.Cancel = true; 384 | btnCancel.PerformClick(); 385 | await Task.Run(() => Thread.Sleep(500)); 386 | Close(); 387 | } 388 | } 389 | 390 | 391 | #region --- Events --- 392 | 393 | public event Action FoundResults; 394 | public event Action FoundSingleResult; 395 | public event Action ProgressStarted; 396 | public event Action ProgressChanged; 397 | public event Action ProgressFinished; 398 | 399 | protected virtual void OnFoundResults(object sender, FindResultsArgs e) => FoundResults?.Invoke(sender, e); 400 | 401 | protected virtual void OnFoundSingleResult(object sender, FindSingleResultArgs e) => FoundSingleResult?.Invoke(sender, e); 402 | 403 | protected virtual void OnProgressStarted(object sender, ProgressStartedArgs e) => ProgressStarted?.Invoke(sender, e); 404 | 405 | protected virtual void OnProgressChanged(object sender, ProgressChangedArgs e) => ProgressChanged?.Invoke(sender, e); 406 | 407 | protected virtual void OnProgressFinished(object sender, ProgressFinishedArgs e) => ProgressFinished?.Invoke(sender, e); 408 | 409 | #endregion --- Events --- 410 | 411 | #region Slow As Hell 412 | 413 | //using LogQuery = Interop.MSUtil.LogQueryClass; 414 | //using RegistryInputFormat = Interop.MSUtil.COMRegistryInputContextClass; 415 | //using RegRecordSet = Interop.MSUtil.ILogRecordset; 416 | 417 | //private void BtnFindSingle_Click(object sender, EventArgs e) 418 | //{ 419 | // matches = new List(); 420 | // RegRecordSet rs = null; 421 | // try 422 | // { 423 | // LogQuery qry = new LogQuery(); 424 | // RegistryInputFormat registryFormat = new RegistryInputFormat(); 425 | // string query = $@"SELECT Path FROM HKLM WHERE Value='{tbxSearch.Text}'"; 426 | // rs = qry.Execute(query, registryFormat); 427 | // for (; !rs.atEnd(); rs.moveNext()) 428 | // { 429 | // matches.Add(rs.getRecord().toNativeString("")); 430 | // } 431 | // } 432 | // finally 433 | // { 434 | // rs.close(); 435 | // } 436 | 437 | // ((MainWindow)Owner).OnFoundResults(this, new FindResultsArgs(matches)); 438 | // Close(); 439 | //} 440 | 441 | #endregion Slow As Hell 442 | } 443 | } 444 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/MainWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Views 2 | { 3 | partial class MainWindow 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Computer"); 32 | this.menuStrip1 = new System.Windows.Forms.MenuStrip(); 33 | this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 34 | this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 35 | this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 36 | this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); 37 | this.loadHideToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 38 | this.unloadHiveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 39 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 40 | this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 41 | this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 42 | this.modifyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 43 | this.modifyBinaryDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 44 | this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); 45 | this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 46 | this.keyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 47 | this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); 48 | this.stringValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 49 | this.binaryValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 | this.dWORD32BitValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 | this.dWORD64bitValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 | this.multiStringValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 | this.expandableStringValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 | this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); 55 | this.permissionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 56 | this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); 57 | this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 58 | this.renameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 59 | this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); 60 | this.copyKeyNameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 61 | this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); 62 | this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 63 | this.findNextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 64 | this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 65 | this.favoritesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 66 | this.addToFavoritesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 67 | this.removeFavoritesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 68 | this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 69 | this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 70 | this.treeView = new System.Windows.Forms.TreeView(); 71 | this.splitContainer = new System.Windows.Forms.SplitContainer(); 72 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 73 | this.cbxScrollToCaret = new System.Windows.Forms.CheckBox(); 74 | this.label3 = new System.Windows.Forms.Label(); 75 | this.label2 = new System.Windows.Forms.Label(); 76 | this.cbxSelectAll = new System.Windows.Forms.CheckBox(); 77 | this.btnDelete = new System.Windows.Forms.Button(); 78 | this.lblResultsCount = new System.Windows.Forms.Label(); 79 | this.lvwResults = new Windows.RegistryEditor.Views.Controls.ListViewEx(); 80 | this.columnCbx = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 81 | this.columnHkey = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 82 | this.cbx = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 83 | this.HKEY = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 84 | this.menuStrip1.SuspendLayout(); 85 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 86 | this.splitContainer.Panel1.SuspendLayout(); 87 | this.splitContainer.Panel2.SuspendLayout(); 88 | this.splitContainer.SuspendLayout(); 89 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 90 | this.splitContainer1.Panel1.SuspendLayout(); 91 | this.splitContainer1.Panel2.SuspendLayout(); 92 | this.splitContainer1.SuspendLayout(); 93 | this.SuspendLayout(); 94 | // 95 | // menuStrip1 96 | // 97 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 98 | this.fileToolStripMenuItem, 99 | this.editToolStripMenuItem, 100 | this.viewToolStripMenuItem, 101 | this.favoritesToolStripMenuItem, 102 | this.helpToolStripMenuItem}); 103 | this.menuStrip1.Location = new System.Drawing.Point(0, 0); 104 | this.menuStrip1.Name = "menuStrip1"; 105 | this.menuStrip1.Size = new System.Drawing.Size(956, 24); 106 | this.menuStrip1.TabIndex = 0; 107 | this.menuStrip1.Text = "menuStrip1"; 108 | // 109 | // fileToolStripMenuItem 110 | // 111 | this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 112 | this.importToolStripMenuItem, 113 | this.exportToolStripMenuItem, 114 | this.toolStripSeparator2, 115 | this.loadHideToolStripMenuItem, 116 | this.unloadHiveToolStripMenuItem, 117 | this.toolStripSeparator1, 118 | this.exitToolStripMenuItem}); 119 | this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; 120 | this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); 121 | this.fileToolStripMenuItem.Text = "File"; 122 | // 123 | // importToolStripMenuItem 124 | // 125 | this.importToolStripMenuItem.Name = "importToolStripMenuItem"; 126 | this.importToolStripMenuItem.Size = new System.Drawing.Size(148, 22); 127 | this.importToolStripMenuItem.Text = "Import..."; 128 | // 129 | // exportToolStripMenuItem 130 | // 131 | this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; 132 | this.exportToolStripMenuItem.Size = new System.Drawing.Size(148, 22); 133 | this.exportToolStripMenuItem.Text = "Export..."; 134 | // 135 | // toolStripSeparator2 136 | // 137 | this.toolStripSeparator2.Name = "toolStripSeparator2"; 138 | this.toolStripSeparator2.Size = new System.Drawing.Size(145, 6); 139 | // 140 | // loadHideToolStripMenuItem 141 | // 142 | this.loadHideToolStripMenuItem.Name = "loadHideToolStripMenuItem"; 143 | this.loadHideToolStripMenuItem.Size = new System.Drawing.Size(148, 22); 144 | this.loadHideToolStripMenuItem.Text = "Load Hive..."; 145 | // 146 | // unloadHiveToolStripMenuItem 147 | // 148 | this.unloadHiveToolStripMenuItem.Name = "unloadHiveToolStripMenuItem"; 149 | this.unloadHiveToolStripMenuItem.Size = new System.Drawing.Size(148, 22); 150 | this.unloadHiveToolStripMenuItem.Text = "Unload Hive..."; 151 | // 152 | // toolStripSeparator1 153 | // 154 | this.toolStripSeparator1.Name = "toolStripSeparator1"; 155 | this.toolStripSeparator1.Size = new System.Drawing.Size(145, 6); 156 | // 157 | // exitToolStripMenuItem 158 | // 159 | this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; 160 | this.exitToolStripMenuItem.Size = new System.Drawing.Size(148, 22); 161 | this.exitToolStripMenuItem.Text = "Exit"; 162 | // 163 | // editToolStripMenuItem 164 | // 165 | this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 166 | this.modifyToolStripMenuItem, 167 | this.modifyBinaryDataToolStripMenuItem, 168 | this.toolStripSeparator3, 169 | this.newToolStripMenuItem, 170 | this.toolStripSeparator5, 171 | this.permissionsToolStripMenuItem, 172 | this.toolStripSeparator6, 173 | this.deleteToolStripMenuItem, 174 | this.renameToolStripMenuItem, 175 | this.toolStripSeparator7, 176 | this.copyKeyNameToolStripMenuItem, 177 | this.toolStripSeparator8, 178 | this.findToolStripMenuItem, 179 | this.findNextToolStripMenuItem}); 180 | this.editToolStripMenuItem.Name = "editToolStripMenuItem"; 181 | this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); 182 | this.editToolStripMenuItem.Text = "Edit"; 183 | // 184 | // modifyToolStripMenuItem 185 | // 186 | this.modifyToolStripMenuItem.Name = "modifyToolStripMenuItem"; 187 | this.modifyToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 188 | this.modifyToolStripMenuItem.Text = "Modify..."; 189 | // 190 | // modifyBinaryDataToolStripMenuItem 191 | // 192 | this.modifyBinaryDataToolStripMenuItem.Name = "modifyBinaryDataToolStripMenuItem"; 193 | this.modifyBinaryDataToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 194 | this.modifyBinaryDataToolStripMenuItem.Text = "Modify Binary Data..."; 195 | // 196 | // toolStripSeparator3 197 | // 198 | this.toolStripSeparator3.Name = "toolStripSeparator3"; 199 | this.toolStripSeparator3.Size = new System.Drawing.Size(181, 6); 200 | // 201 | // newToolStripMenuItem 202 | // 203 | this.newToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 204 | this.keyToolStripMenuItem, 205 | this.toolStripSeparator4, 206 | this.stringValueToolStripMenuItem, 207 | this.binaryValueToolStripMenuItem, 208 | this.dWORD32BitValueToolStripMenuItem, 209 | this.dWORD64bitValueToolStripMenuItem, 210 | this.multiStringValueToolStripMenuItem, 211 | this.expandableStringValueToolStripMenuItem}); 212 | this.newToolStripMenuItem.Name = "newToolStripMenuItem"; 213 | this.newToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 214 | this.newToolStripMenuItem.Text = "New"; 215 | // 216 | // keyToolStripMenuItem 217 | // 218 | this.keyToolStripMenuItem.Name = "keyToolStripMenuItem"; 219 | this.keyToolStripMenuItem.Size = new System.Drawing.Size(199, 22); 220 | this.keyToolStripMenuItem.Text = "Key"; 221 | // 222 | // toolStripSeparator4 223 | // 224 | this.toolStripSeparator4.Name = "toolStripSeparator4"; 225 | this.toolStripSeparator4.Size = new System.Drawing.Size(196, 6); 226 | // 227 | // stringValueToolStripMenuItem 228 | // 229 | this.stringValueToolStripMenuItem.Name = "stringValueToolStripMenuItem"; 230 | this.stringValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); 231 | this.stringValueToolStripMenuItem.Text = "String Value"; 232 | // 233 | // binaryValueToolStripMenuItem 234 | // 235 | this.binaryValueToolStripMenuItem.Name = "binaryValueToolStripMenuItem"; 236 | this.binaryValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); 237 | this.binaryValueToolStripMenuItem.Text = "Binary Value"; 238 | // 239 | // dWORD32BitValueToolStripMenuItem 240 | // 241 | this.dWORD32BitValueToolStripMenuItem.Name = "dWORD32BitValueToolStripMenuItem"; 242 | this.dWORD32BitValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); 243 | this.dWORD32BitValueToolStripMenuItem.Text = "DWORD (32-bit) Value"; 244 | // 245 | // dWORD64bitValueToolStripMenuItem 246 | // 247 | this.dWORD64bitValueToolStripMenuItem.Name = "dWORD64bitValueToolStripMenuItem"; 248 | this.dWORD64bitValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); 249 | this.dWORD64bitValueToolStripMenuItem.Text = "QWORD (64-bit) Value"; 250 | // 251 | // multiStringValueToolStripMenuItem 252 | // 253 | this.multiStringValueToolStripMenuItem.Name = "multiStringValueToolStripMenuItem"; 254 | this.multiStringValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); 255 | this.multiStringValueToolStripMenuItem.Text = "Multi-String Value"; 256 | // 257 | // expandableStringValueToolStripMenuItem 258 | // 259 | this.expandableStringValueToolStripMenuItem.Name = "expandableStringValueToolStripMenuItem"; 260 | this.expandableStringValueToolStripMenuItem.Size = new System.Drawing.Size(199, 22); 261 | this.expandableStringValueToolStripMenuItem.Text = "Expandable String Value"; 262 | // 263 | // toolStripSeparator5 264 | // 265 | this.toolStripSeparator5.Name = "toolStripSeparator5"; 266 | this.toolStripSeparator5.Size = new System.Drawing.Size(181, 6); 267 | // 268 | // permissionsToolStripMenuItem 269 | // 270 | this.permissionsToolStripMenuItem.Name = "permissionsToolStripMenuItem"; 271 | this.permissionsToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 272 | this.permissionsToolStripMenuItem.Text = "Permissions..."; 273 | // 274 | // toolStripSeparator6 275 | // 276 | this.toolStripSeparator6.Name = "toolStripSeparator6"; 277 | this.toolStripSeparator6.Size = new System.Drawing.Size(181, 6); 278 | // 279 | // deleteToolStripMenuItem 280 | // 281 | this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; 282 | this.deleteToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 283 | this.deleteToolStripMenuItem.Text = "Delete"; 284 | // 285 | // renameToolStripMenuItem 286 | // 287 | this.renameToolStripMenuItem.Name = "renameToolStripMenuItem"; 288 | this.renameToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 289 | this.renameToolStripMenuItem.Text = "Rename"; 290 | // 291 | // toolStripSeparator7 292 | // 293 | this.toolStripSeparator7.Name = "toolStripSeparator7"; 294 | this.toolStripSeparator7.Size = new System.Drawing.Size(181, 6); 295 | // 296 | // copyKeyNameToolStripMenuItem 297 | // 298 | this.copyKeyNameToolStripMenuItem.Name = "copyKeyNameToolStripMenuItem"; 299 | this.copyKeyNameToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 300 | this.copyKeyNameToolStripMenuItem.Text = "Copy Key Name"; 301 | // 302 | // toolStripSeparator8 303 | // 304 | this.toolStripSeparator8.Name = "toolStripSeparator8"; 305 | this.toolStripSeparator8.Size = new System.Drawing.Size(181, 6); 306 | // 307 | // findToolStripMenuItem 308 | // 309 | this.findToolStripMenuItem.Name = "findToolStripMenuItem"; 310 | this.findToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 311 | this.findToolStripMenuItem.Text = "Find..."; 312 | this.findToolStripMenuItem.Click += new System.EventHandler(this.FindToolStripMenuItem_Click); 313 | // 314 | // findNextToolStripMenuItem 315 | // 316 | this.findNextToolStripMenuItem.Name = "findNextToolStripMenuItem"; 317 | this.findNextToolStripMenuItem.Size = new System.Drawing.Size(184, 22); 318 | this.findNextToolStripMenuItem.Text = "Find Next"; 319 | // 320 | // viewToolStripMenuItem 321 | // 322 | this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; 323 | this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); 324 | this.viewToolStripMenuItem.Text = "View"; 325 | // 326 | // favoritesToolStripMenuItem 327 | // 328 | this.favoritesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 329 | this.addToFavoritesToolStripMenuItem, 330 | this.removeFavoritesToolStripMenuItem}); 331 | this.favoritesToolStripMenuItem.Name = "favoritesToolStripMenuItem"; 332 | this.favoritesToolStripMenuItem.Size = new System.Drawing.Size(66, 20); 333 | this.favoritesToolStripMenuItem.Text = "Favorites"; 334 | // 335 | // addToFavoritesToolStripMenuItem 336 | // 337 | this.addToFavoritesToolStripMenuItem.Name = "addToFavoritesToolStripMenuItem"; 338 | this.addToFavoritesToolStripMenuItem.Size = new System.Drawing.Size(176, 22); 339 | this.addToFavoritesToolStripMenuItem.Text = "Add to Favorites..."; 340 | // 341 | // removeFavoritesToolStripMenuItem 342 | // 343 | this.removeFavoritesToolStripMenuItem.Name = "removeFavoritesToolStripMenuItem"; 344 | this.removeFavoritesToolStripMenuItem.Size = new System.Drawing.Size(176, 22); 345 | this.removeFavoritesToolStripMenuItem.Text = "Remove Favorites..."; 346 | // 347 | // helpToolStripMenuItem 348 | // 349 | this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 350 | this.aboutToolStripMenuItem}); 351 | this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; 352 | this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); 353 | this.helpToolStripMenuItem.Text = "Help"; 354 | // 355 | // aboutToolStripMenuItem 356 | // 357 | this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; 358 | this.aboutToolStripMenuItem.Size = new System.Drawing.Size(195, 22); 359 | this.aboutToolStripMenuItem.Text = "About Registry Editor..."; 360 | // 361 | // treeView 362 | // 363 | this.treeView.Dock = System.Windows.Forms.DockStyle.Fill; 364 | this.treeView.Location = new System.Drawing.Point(0, 0); 365 | this.treeView.Name = "treeView"; 366 | treeNode1.Name = "Computer"; 367 | treeNode1.Text = "Computer"; 368 | this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { 369 | treeNode1}); 370 | this.treeView.Size = new System.Drawing.Size(202, 536); 371 | this.treeView.TabIndex = 0; 372 | // 373 | // splitContainer 374 | // 375 | this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 376 | this.splitContainer.Location = new System.Drawing.Point(0, 24); 377 | this.splitContainer.Name = "splitContainer"; 378 | // 379 | // splitContainer.Panel1 380 | // 381 | this.splitContainer.Panel1.Controls.Add(this.treeView); 382 | // 383 | // splitContainer.Panel2 384 | // 385 | this.splitContainer.Panel2.Controls.Add(this.splitContainer1); 386 | this.splitContainer.Size = new System.Drawing.Size(956, 536); 387 | this.splitContainer.SplitterDistance = 202; 388 | this.splitContainer.TabIndex = 2; 389 | // 390 | // splitContainer1 391 | // 392 | this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 393 | this.splitContainer1.Location = new System.Drawing.Point(0, 0); 394 | this.splitContainer1.Name = "splitContainer1"; 395 | this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; 396 | // 397 | // splitContainer1.Panel1 398 | // 399 | this.splitContainer1.Panel1.Controls.Add(this.cbxScrollToCaret); 400 | this.splitContainer1.Panel1.Controls.Add(this.label3); 401 | this.splitContainer1.Panel1.Controls.Add(this.label2); 402 | this.splitContainer1.Panel1.Controls.Add(this.cbxSelectAll); 403 | this.splitContainer1.Panel1.Controls.Add(this.btnDelete); 404 | this.splitContainer1.Panel1.Controls.Add(this.lblResultsCount); 405 | // 406 | // splitContainer1.Panel2 407 | // 408 | this.splitContainer1.Panel2.Controls.Add(this.lvwResults); 409 | this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; 410 | this.splitContainer1.Size = new System.Drawing.Size(750, 536); 411 | this.splitContainer1.SplitterDistance = 47; 412 | this.splitContainer1.TabIndex = 0; 413 | // 414 | // cbxScrollToCaret 415 | // 416 | this.cbxScrollToCaret.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 417 | this.cbxScrollToCaret.AutoSize = true; 418 | this.cbxScrollToCaret.Checked = true; 419 | this.cbxScrollToCaret.CheckState = System.Windows.Forms.CheckState.Checked; 420 | this.cbxScrollToCaret.Location = new System.Drawing.Point(585, 30); 421 | this.cbxScrollToCaret.Name = "cbxScrollToCaret"; 422 | this.cbxScrollToCaret.Size = new System.Drawing.Size(147, 17); 423 | this.cbxScrollToCaret.TabIndex = 5; 424 | this.cbxScrollToCaret.Text = "Automatically scroll down."; 425 | this.cbxScrollToCaret.UseVisualStyleBackColor = true; 426 | // 427 | // label3 428 | // 429 | this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top; 430 | this.label3.AutoSize = true; 431 | this.label3.Location = new System.Drawing.Point(219, 23); 432 | this.label3.Name = "label3"; 433 | this.label3.Size = new System.Drawing.Size(275, 13); 434 | this.label3.TabIndex = 4; 435 | this.label3.Text = "Right Click on one of the results lines to see some magic."; 436 | // 437 | // label2 438 | // 439 | this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top; 440 | this.label2.AutoSize = true; 441 | this.label2.Location = new System.Drawing.Point(219, 5); 442 | this.label2.Name = "label2"; 443 | this.label2.Size = new System.Drawing.Size(162, 13); 444 | this.label2.TabIndex = 4; 445 | this.label2.Text = "CTRL + F to search for registries."; 446 | // 447 | // cbxSelectAll 448 | // 449 | this.cbxSelectAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 450 | this.cbxSelectAll.AutoSize = true; 451 | this.cbxSelectAll.Checked = true; 452 | this.cbxSelectAll.CheckState = System.Windows.Forms.CheckState.Checked; 453 | this.cbxSelectAll.Location = new System.Drawing.Point(7, 29); 454 | this.cbxSelectAll.Name = "cbxSelectAll"; 455 | this.cbxSelectAll.Size = new System.Drawing.Size(70, 17); 456 | this.cbxSelectAll.TabIndex = 1; 457 | this.cbxSelectAll.Text = "Select All"; 458 | this.cbxSelectAll.UseVisualStyleBackColor = true; 459 | this.cbxSelectAll.CheckedChanged += new System.EventHandler(this.CbxSelectAll_CheckedChanged); 460 | // 461 | // btnDelete 462 | // 463 | this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 464 | this.btnDelete.Location = new System.Drawing.Point(583, 5); 465 | this.btnDelete.Name = "btnDelete"; 466 | this.btnDelete.Size = new System.Drawing.Size(164, 23); 467 | this.btnDelete.TabIndex = 2; 468 | this.btnDelete.Text = "Delete All Selected Registries"; 469 | this.btnDelete.UseVisualStyleBackColor = true; 470 | this.btnDelete.Click += new System.EventHandler(this.BtnDelete_Click); 471 | // 472 | // lblResultsCount 473 | // 474 | this.lblResultsCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 475 | this.lblResultsCount.AutoSize = true; 476 | this.lblResultsCount.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 477 | this.lblResultsCount.Location = new System.Drawing.Point(5, 8); 478 | this.lblResultsCount.Name = "lblResultsCount"; 479 | this.lblResultsCount.Size = new System.Drawing.Size(128, 17); 480 | this.lblResultsCount.TabIndex = 1; 481 | this.lblResultsCount.Text = "Results Count: 0"; 482 | // 483 | // lvwResults 484 | // 485 | this.lvwResults.CheckBoxes = true; 486 | this.lvwResults.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 487 | this.columnCbx, 488 | this.columnHkey}); 489 | this.lvwResults.Dock = System.Windows.Forms.DockStyle.Fill; 490 | this.lvwResults.FullRowSelect = true; 491 | this.lvwResults.GridLines = true; 492 | this.lvwResults.Location = new System.Drawing.Point(0, 0); 493 | this.lvwResults.Name = "lvwResults"; 494 | this.lvwResults.Size = new System.Drawing.Size(750, 485); 495 | this.lvwResults.TabIndex = 0; 496 | this.lvwResults.UseCompatibleStateImageBehavior = false; 497 | this.lvwResults.View = System.Windows.Forms.View.Details; 498 | this.lvwResults.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LvwResults_MouseClick); 499 | // 500 | // columnCbx 501 | // 502 | this.columnCbx.Text = ""; 503 | this.columnCbx.Width = 24; 504 | // 505 | // columnHkey 506 | // 507 | this.columnHkey.Text = "HKEY"; 508 | this.columnHkey.Width = 1980; 509 | // 510 | // MainWindow 511 | // 512 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 513 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 514 | this.ClientSize = new System.Drawing.Size(956, 560); 515 | this.Controls.Add(this.splitContainer); 516 | this.Controls.Add(this.menuStrip1); 517 | this.DoubleBuffered = true; 518 | this.Icon = global::Windows.RegistryEditor.Properties.Resources.app; 519 | this.KeyPreview = true; 520 | this.MainMenuStrip = this.menuStrip1; 521 | this.Name = "MainWindow"; 522 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 523 | this.Text = "Registry Editor"; 524 | this.Load += new System.EventHandler(this.MainWindow_Load); 525 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MainWindow_KeyDown); 526 | this.menuStrip1.ResumeLayout(false); 527 | this.menuStrip1.PerformLayout(); 528 | this.splitContainer.Panel1.ResumeLayout(false); 529 | this.splitContainer.Panel2.ResumeLayout(false); 530 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 531 | this.splitContainer.ResumeLayout(false); 532 | this.splitContainer1.Panel1.ResumeLayout(false); 533 | this.splitContainer1.Panel1.PerformLayout(); 534 | this.splitContainer1.Panel2.ResumeLayout(false); 535 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 536 | this.splitContainer1.ResumeLayout(false); 537 | this.ResumeLayout(false); 538 | this.PerformLayout(); 539 | 540 | } 541 | 542 | private void InitializeRegistryTree() 543 | { 544 | treeView.TopNode.Nodes.Add(Microsoft.Win32.Registry.ClassesRoot.Name, Microsoft.Win32.Registry.ClassesRoot.Name); 545 | treeView.TopNode.Nodes.Add(Microsoft.Win32.Registry.CurrentUser.Name, Microsoft.Win32.Registry.CurrentUser.Name); 546 | treeView.TopNode.Nodes.Add(Microsoft.Win32.Registry.LocalMachine.Name, Microsoft.Win32.Registry.LocalMachine.Name); 547 | treeView.TopNode.Nodes.Add(Microsoft.Win32.Registry.Users.Name, Microsoft.Win32.Registry.Users.Name); 548 | treeView.TopNode.Nodes.Add(Microsoft.Win32.Registry.CurrentConfig.Name, Microsoft.Win32.Registry.CurrentConfig.Name); 549 | 550 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.ClassesRoot.Name].Nodes.Add(System.String.Empty); 551 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.CurrentUser.Name].Nodes.Add(System.String.Empty); 552 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.LocalMachine.Name].Nodes.Add(System.String.Empty); 553 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.Users.Name].Nodes.Add(System.String.Empty); 554 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.CurrentConfig.Name].Nodes.Add(System.String.Empty); 555 | 556 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.ClassesRoot.Name].Tag = Microsoft.Win32.Registry.ClassesRoot; 557 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.CurrentUser.Name].Tag = Microsoft.Win32.Registry.CurrentUser; 558 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.LocalMachine.Name].Tag = Microsoft.Win32.Registry.LocalMachine; 559 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.Users.Name].Tag = Microsoft.Win32.Registry.Users; 560 | treeView.TopNode.Nodes[Microsoft.Win32.Registry.CurrentConfig.Name].Tag = Microsoft.Win32.Registry.CurrentConfig; 561 | 562 | treeView.TopNode.Expand(); 563 | 564 | treeView.BeforeExpand += TreeViewBeforeExpand; 565 | } 566 | 567 | #endregion 568 | 569 | private System.Windows.Forms.MenuStrip menuStrip1; 570 | private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; 571 | private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem; 572 | private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem; 573 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; 574 | private System.Windows.Forms.ToolStripMenuItem loadHideToolStripMenuItem; 575 | private System.Windows.Forms.ToolStripMenuItem unloadHiveToolStripMenuItem; 576 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 577 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; 578 | private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; 579 | private System.Windows.Forms.ToolStripMenuItem modifyToolStripMenuItem; 580 | private System.Windows.Forms.ToolStripMenuItem modifyBinaryDataToolStripMenuItem; 581 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; 582 | private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; 583 | private System.Windows.Forms.ToolStripMenuItem keyToolStripMenuItem; 584 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; 585 | private System.Windows.Forms.ToolStripMenuItem stringValueToolStripMenuItem; 586 | private System.Windows.Forms.ToolStripMenuItem binaryValueToolStripMenuItem; 587 | private System.Windows.Forms.ToolStripMenuItem dWORD32BitValueToolStripMenuItem; 588 | private System.Windows.Forms.ToolStripMenuItem dWORD64bitValueToolStripMenuItem; 589 | private System.Windows.Forms.ToolStripMenuItem multiStringValueToolStripMenuItem; 590 | private System.Windows.Forms.ToolStripMenuItem expandableStringValueToolStripMenuItem; 591 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; 592 | private System.Windows.Forms.ToolStripMenuItem permissionsToolStripMenuItem; 593 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; 594 | private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; 595 | private System.Windows.Forms.ToolStripMenuItem renameToolStripMenuItem; 596 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; 597 | private System.Windows.Forms.ToolStripMenuItem copyKeyNameToolStripMenuItem; 598 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; 599 | private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem; 600 | private System.Windows.Forms.ToolStripMenuItem findNextToolStripMenuItem; 601 | private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; 602 | private System.Windows.Forms.ToolStripMenuItem favoritesToolStripMenuItem; 603 | private System.Windows.Forms.ToolStripMenuItem addToFavoritesToolStripMenuItem; 604 | private System.Windows.Forms.ToolStripMenuItem removeFavoritesToolStripMenuItem; 605 | private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; 606 | private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; 607 | private System.Windows.Forms.TreeView treeView; 608 | private System.Windows.Forms.SplitContainer splitContainer; 609 | private System.Windows.Forms.Label lblResultsCount; 610 | private System.Windows.Forms.SplitContainer splitContainer1; 611 | private System.Windows.Forms.ColumnHeader cbx; 612 | private System.Windows.Forms.ColumnHeader HKEY; 613 | private System.Windows.Forms.Button btnDelete; 614 | private System.Windows.Forms.CheckBox cbxSelectAll; 615 | private Windows.RegistryEditor.Views.Controls.ListViewEx lvwResults; 616 | private System.Windows.Forms.ColumnHeader columnCbx; 617 | private System.Windows.Forms.ColumnHeader columnHkey; 618 | private System.Windows.Forms.Label label2; 619 | private System.Windows.Forms.Label label3; 620 | private System.Windows.Forms.CheckBox cbxScrollToCaret; 621 | } 622 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/MainWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | using Windows.RegistryEditor.Events; 9 | using Windows.RegistryEditor.Utils; 10 | using Microsoft.Win32; 11 | 12 | using static System.Environment; 13 | 14 | namespace Windows.RegistryEditor.Views 15 | { 16 | public partial class MainWindow : Form 17 | { 18 | 19 | private FindWindow refFindWindow; 20 | public FindWindow FindInstance 21 | { 22 | get 23 | { 24 | if (refFindWindow != null && !refFindWindow.IsDisposed) 25 | { 26 | refFindWindow.Activate();; 27 | return refFindWindow; 28 | } 29 | refFindWindow = new FindWindow(); 30 | refFindWindow.FoundSingleResult += SingleResultFound; 31 | refFindWindow.ProgressStarted += ProgressStarted; 32 | refFindWindow.ProgressChanged += ProgressChanged; 33 | refFindWindow.ProgressFinished += ProgressFinished; 34 | refFindWindow.FormClosed += delegate { this.Activate(); }; 35 | return refFindWindow; 36 | } 37 | } 38 | 39 | private void ProgressStarted(object sender, ProgressStartedArgs e) 40 | { 41 | lvwResults.Items.Clear(); 42 | lblResultsCount.Text = "Results Count: 0"; 43 | Console.WriteLine(e.Message); 44 | } 45 | 46 | private void ProgressChanged(object sender, ProgressChangedArgs e) 47 | { 48 | Text = $"Registry Editor | Collecting Data from {e.Hive}"; 49 | Console.WriteLine(e.Message); 50 | } 51 | 52 | private void ProgressFinished(object sender, ProgressFinishedArgs e) 53 | { 54 | Text = "Registry Editor"; 55 | Console.WriteLine(e.Message); 56 | } 57 | 58 | 59 | public MainWindow() 60 | { 61 | InitializeComponent(); 62 | } 63 | 64 | private void MainWindow_Load(object sender, EventArgs e) 65 | { 66 | InitializeRegistryTree(); 67 | } 68 | 69 | private void TreeViewBeforeExpand(object sender, TreeViewCancelEventArgs e) 70 | { 71 | if (e.Node.Nodes.Count != 1 || e.Node.Nodes[0].Text != String.Empty) return; 72 | 73 | e.Node.Nodes.Clear(); 74 | if (!(e.Node.Tag is RegistryKey key)) return; 75 | 76 | foreach (string name in key.GetSubKeyNames()) 77 | { 78 | e.Node.Nodes.Add(name, name); 79 | if (name == "SECURITY" || name == "SAM") continue; 80 | 81 | RegistryKey subKey = key.OpenSubKey(name); 82 | e.Node.Nodes[name].Tag = subKey; 83 | if (subKey.SubKeyCount > 0) 84 | e.Node.Nodes[name].Nodes.Add(String.Empty); 85 | } 86 | } 87 | 88 | private async void SingleResultFound(object sender, FindSingleResultArgs e) 89 | { 90 | await Task.Run(() => 91 | lvwResults.InvokeSafe(() => 92 | AddItem(e.Match, true, cbxScrollToCaret.Checked) 93 | )); 94 | } 95 | 96 | private void AddItem(string text, bool isChecked, bool isVisible) 97 | { 98 | ListViewItem item = new ListViewItem(); 99 | item.SubItems.Add(text); 100 | item.Checked = isChecked; 101 | 102 | lvwResults.Items.Add(item); 103 | int count = lvwResults.Items.Count; 104 | lblResultsCount.Text = $"Results Count: {count}"; 105 | if (isVisible) 106 | lvwResults.EnsureVisible(count - 1); 107 | //lvwResults.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); 108 | } 109 | 110 | private void MainWindow_KeyDown(object sender, KeyEventArgs e) 111 | { 112 | if (e.Control && e.KeyCode == Keys.F) 113 | { 114 | if (!FindInstance.Visible) 115 | FindInstance.Show(this); 116 | } 117 | else if (lvwResults.Focused && e.Control && e.KeyCode == Keys.C) 118 | { 119 | Clipboard.SetData(DataFormats.StringFormat, lvwResults.GetAllSelectedSubItemsText(1)); 120 | } 121 | else if (lvwResults.Focused && e.Control && e.KeyCode == Keys.A) 122 | { 123 | lvwResults.SelectAllItems(); 124 | } 125 | } 126 | 127 | private void LvwResults_MouseClick(object sender, MouseEventArgs e) 128 | { 129 | if (e.Button == MouseButtons.Right) 130 | RegistryUtils.OpenRegistryLocation(lvwResults.FocusedItem.SubItems[1].Text); 131 | } 132 | 133 | private void CbxSelectAll_CheckedChanged(object sender, EventArgs e) 134 | { 135 | lvwResults.CheckAllItems(cbxSelectAll.Checked); 136 | } 137 | 138 | private void BtnDelete_Click(object sender, EventArgs e) 139 | { 140 | List hives = lvwResults.GetAllCheckedSubItemsTextList(1); 141 | if (hives.Count < 1) return; 142 | 143 | if (!hives.First().StartsWith("HKEY_")) 144 | { 145 | MessageBox.Show("Deleting or Exporting registry keys on remote machines not implemented.", 146 | "NOT IMPLEMENTED", MessageBoxButtons.OK, MessageBoxIcon.Information); 147 | return; 148 | } 149 | 150 | DialogResult result = MessageBox.Show( 151 | "All registries that are checked will be removed from registry including sub keys.\n" + 152 | "Are you sure you want to continue?", "WARNING", 153 | MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); 154 | 155 | if (result != DialogResult.Yes) return; 156 | 157 | string dstDir = Path.Combine(GetFolderPath(SpecialFolder.Desktop), "Registry_Backup", $"{DateTime.Now:yy-MM-dd_hh-mm}"); 158 | foreach (string hive in hives) 159 | { 160 | RegistryUtils.ExportHive(hive, dstDir); 161 | RegistryUtils.DeleteHive(hive); 162 | Console.WriteLine($"Registry Deleted: {hive}"); 163 | } 164 | 165 | MessageBox.Show("Successfully removed checked registries.\n" + 166 | "Created emergency backup of the removed registries on your desktop.", 167 | "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information); 168 | 169 | Utility.OpenFolderInExplorer(dstDir); 170 | } 171 | 172 | private void FindToolStripMenuItem_Click(object sender, EventArgs e) 173 | { 174 | if (!FindInstance.Visible) 175 | FindInstance.Show(this); 176 | } 177 | 178 | protected override CreateParams CreateParams 179 | { 180 | get 181 | { 182 | CreateParams cp = base.CreateParams; 183 | cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED 184 | return cp; 185 | } 186 | } 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/NetworkWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Windows.RegistryEditor.Views 2 | { 3 | partial class NetworkWindow 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.lbxMachines = new System.Windows.Forms.ListBox(); 32 | this.btnSelect = new System.Windows.Forms.Button(); 33 | this.loader = new Windows.RegistryEditor.Views.Controls.Loader(); 34 | this.SuspendLayout(); 35 | // 36 | // lbxMachines 37 | // 38 | this.lbxMachines.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 39 | | System.Windows.Forms.AnchorStyles.Right))); 40 | this.lbxMachines.FormattingEnabled = true; 41 | this.lbxMachines.Location = new System.Drawing.Point(12, 19); 42 | this.lbxMachines.Name = "lbxMachines"; 43 | this.lbxMachines.Size = new System.Drawing.Size(179, 95); 44 | this.lbxMachines.TabIndex = 0; 45 | // 46 | // btnSelect 47 | // 48 | this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 49 | this.btnSelect.Location = new System.Drawing.Point(103, 120); 50 | this.btnSelect.Name = "btnSelect"; 51 | this.btnSelect.Size = new System.Drawing.Size(88, 23); 52 | this.btnSelect.TabIndex = 2; 53 | this.btnSelect.Text = "Select"; 54 | this.btnSelect.UseVisualStyleBackColor = true; 55 | this.btnSelect.Click += new System.EventHandler(this.BtnSelect_Click); 56 | // 57 | // loader 58 | // 59 | this.loader.BackColor = System.Drawing.Color.Transparent; 60 | this.loader.DisableControlsOnWork = true; 61 | this.loader.LoaderKind = Windows.RegistryEditor.Views.Controls.LoaderKind.Clock; 62 | this.loader.Location = new System.Drawing.Point(12, 123); 63 | this.loader.Name = "loader"; 64 | this.loader.Size = new System.Drawing.Size(20, 20); 65 | this.loader.SizeLoading = new System.Drawing.Size(60, 60); 66 | this.loader.TabIndex = 3; 67 | this.loader.Visible = false; 68 | // 69 | // NetworkWindow 70 | // 71 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 72 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 73 | this.ClientSize = new System.Drawing.Size(203, 155); 74 | this.Controls.Add(this.loader); 75 | this.Controls.Add(this.btnSelect); 76 | this.Controls.Add(this.lbxMachines); 77 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 78 | this.Name = "NetworkWindow"; 79 | this.ShowInTaskbar = false; 80 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 81 | this.Text = "Machines on the Network"; 82 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.NetworkWindow_FormClosing); 83 | this.Load += new System.EventHandler(this.NetworkWindow_Load); 84 | this.ResumeLayout(false); 85 | 86 | } 87 | 88 | #endregion 89 | 90 | private System.Windows.Forms.ListBox lbxMachines; 91 | private System.Windows.Forms.Button btnSelect; 92 | private Controls.Loader loader; 93 | } 94 | } -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/Views/NetworkWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | using Windows.RegistryEditor.Utils; 7 | 8 | namespace Windows.RegistryEditor.Views 9 | { 10 | public partial class NetworkWindow : Form 11 | { 12 | private Process proc; 13 | 14 | public NetworkWindow() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private async void NetworkWindow_Load(object sender, EventArgs e) 20 | { 21 | lbxMachines.Items.Clear(); 22 | 23 | loader.Show(); 24 | ProcessStartInfo procInfo = new ProcessStartInfo 25 | { 26 | FileName = "NET", 27 | Arguments = "VIEW", 28 | RedirectStandardError = true, 29 | RedirectStandardInput = true, 30 | RedirectStandardOutput = true, 31 | CreateNoWindow = true, 32 | UseShellExecute = false 33 | }; 34 | 35 | proc = new Process 36 | { 37 | StartInfo = procInfo, 38 | EnableRaisingEvents = true 39 | }; 40 | 41 | proc.ErrorDataReceived += OnErrorDataReceived; 42 | proc.OutputDataReceived += OnOutputDataReceived; 43 | proc.Exited += OnFindEnd; 44 | 45 | await Task.Run(() => Execute(proc)); 46 | } 47 | 48 | private void Execute(Process proc) 49 | { 50 | proc.Start(); 51 | proc.BeginErrorReadLine(); 52 | proc.BeginOutputReadLine(); 53 | proc.WaitForExit(); 54 | } 55 | 56 | private void OnOutputDataReceived(object sender, DataReceivedEventArgs e) 57 | { 58 | if (e.Data == null) return; 59 | if (!e.Data.StartsWith(@"\\")) return; 60 | 61 | lbxMachines.InvokeSafe(() => lbxMachines.Items.Add(e.Data.Trim())); 62 | } 63 | 64 | private void OnErrorDataReceived(object sender, DataReceivedEventArgs e) 65 | { 66 | Console.WriteLine("ERROR occured while searching for network devices -> " + e.Data); 67 | loader.Hide(); 68 | } 69 | 70 | private void OnFindEnd(object sender, EventArgs e) 71 | { 72 | Console.WriteLine("Finished searching for network devices."); 73 | loader.Hide(); 74 | 75 | proc = null; 76 | } 77 | 78 | private void BtnSelect_Click(object sender, EventArgs e) 79 | { 80 | string machineName = lbxMachines.SelectedItem.ToString(); 81 | OnMachineSelected(machineName.Replace(@"\\", String.Empty)); 82 | Close(); 83 | } 84 | 85 | private async void NetworkWindow_FormClosing(object sender, FormClosingEventArgs e) 86 | { 87 | if (proc != null) 88 | { 89 | e.Cancel = true; 90 | proc.CancelErrorRead(); 91 | proc.CancelOutputRead(); 92 | await Task.Run(() => Thread.Sleep(100)); 93 | proc.Kill(); 94 | proc.Dispose(); 95 | proc = null; 96 | await Task.Run(() => Thread.Sleep(500)); 97 | 98 | Close(); 99 | } 100 | } 101 | 102 | public event Action MachineSelected; 103 | 104 | protected virtual void OnMachineSelected(string e) => MachineSelected?.Invoke(e); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/Windows.RegistryEditor/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 59 | 60 | 61 | 75 | 76 | 77 | --------------------------------------------------------------------------------