├── .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