├── .gitignore
├── CefDetector.csproj
├── CefDetector.sln
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── LICENSE
├── Program.cs
├── Properties
├── Resources.Designer.cs
└── Resources.resx
├── README.md
└── screenshot.png
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.tlog
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
298 | *.vbp
299 |
300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
301 | *.dsw
302 | *.dsp
303 |
304 | # Visual Studio 6 technical files
305 | *.ncb
306 | *.aps
307 |
308 | # Visual Studio LightSwitch build output
309 | **/*.HTMLClient/GeneratedArtifacts
310 | **/*.DesktopClient/GeneratedArtifacts
311 | **/*.DesktopClient/ModelManifest.xml
312 | **/*.Server/GeneratedArtifacts
313 | **/*.Server/ModelManifest.xml
314 | _Pvt_Extensions
315 |
316 | # Paket dependency manager
317 | .paket/paket.exe
318 | paket-files/
319 |
320 | # FAKE - F# Make
321 | .fake/
322 |
323 | # CodeRush personal settings
324 | .cr/personal
325 |
326 | # Python Tools for Visual Studio (PTVS)
327 | __pycache__/
328 | *.pyc
329 |
330 | # Cake - Uncomment if you are using it
331 | # tools/**
332 | # !tools/packages.config
333 |
334 | # Tabs Studio
335 | *.tss
336 |
337 | # Telerik's JustMock configuration file
338 | *.jmconfig
339 |
340 | # BizTalk build output
341 | *.btp.cs
342 | *.btm.cs
343 | *.odx.cs
344 | *.xsd.cs
345 |
346 | # OpenCover UI analysis results
347 | OpenCover/
348 |
349 | # Azure Stream Analytics local run output
350 | ASALocalRun/
351 |
352 | # MSBuild Binary and Structured Log
353 | *.binlog
354 |
355 | # NVidia Nsight GPU debugger configuration file
356 | *.nvuser
357 |
358 | # MFractors (Xamarin productivity tool) working folder
359 | .mfractor/
360 |
361 | # Local History for Visual Studio
362 | .localhistory/
363 |
364 | # Visual Studio History (VSHistory) files
365 | .vshistory/
366 |
367 | # BeatPulse healthcheck temp database
368 | healthchecksdb
369 |
370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
371 | MigrationBackup/
372 |
373 | # Ionide (cross platform F# VS Code tools) working folder
374 | .ionide/
375 |
376 | # Fody - auto-generated XML schema
377 | FodyWeavers.xsd
378 |
379 | # VS Code files for those working on multiple tools
380 | .vscode/*
381 | !.vscode/settings.json
382 | !.vscode/tasks.json
383 | !.vscode/launch.json
384 | !.vscode/extensions.json
385 | *.code-workspace
386 |
387 | # Local History for Visual Studio Code
388 | .history/
389 |
390 | # Windows Installer files from build outputs
391 | *.cab
392 | *.msi
393 | *.msix
394 | *.msm
395 | *.msp
396 |
397 | # JetBrains Rider
398 | *.sln.iml
--------------------------------------------------------------------------------
/CefDetector.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.0
6 | enable
7 | true
8 | enable
9 |
10 |
11 |
12 |
13 | tlbimp
14 | 0
15 | 1
16 | 6bf52a50-394a-11d3-b153-00c04f79faa6
17 | 0
18 | false
19 | true
20 |
21 |
22 |
23 |
24 |
25 | True
26 | True
27 | Resources.resx
28 |
29 |
30 |
31 |
32 |
33 | ResXFileCodeGenerator
34 | Resources.Designer.cs
35 |
36 |
37 |
38 |
39 | 10.0
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/CefDetector.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.4.33110.190
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefDetector", "CefDetector.csproj", "{83E08B9E-2FEC-4AAA-AD02-D22B7E2B777E}"
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 | {83E08B9E-2FEC-4AAA-AD02-D22B7E2B777E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {83E08B9E-2FEC-4AAA-AD02-D22B7E2B777E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {83E08B9E-2FEC-4AAA-AD02-D22B7E2B777E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {83E08B9E-2FEC-4AAA-AD02-D22B7E2B777E}.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 = {2131B34A-C169-49D9-921A-0063D3AE30A0}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CefDetector
2 | {
3 | partial class Form1
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 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
33 | this.apps = new System.Windows.Forms.FlowLayoutPanel();
34 | this.label = new System.Windows.Forms.Label();
35 | this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
36 | this.SuspendLayout();
37 | //
38 | // apps
39 | //
40 | this.apps.BackColor = System.Drawing.Color.Transparent;
41 | this.apps.Dock = System.Windows.Forms.DockStyle.Fill;
42 | this.apps.Location = new System.Drawing.Point(150, 300);
43 | this.apps.Margin = new System.Windows.Forms.Padding(0);
44 | this.apps.Name = "apps";
45 | this.apps.Size = new System.Drawing.Size(834, 394);
46 | this.apps.TabIndex = 0;
47 | this.apps.HorizontalScroll.Maximum = 0;
48 | this.apps.AutoScroll = false;
49 | this.apps.VerticalScroll.Visible = false;
50 | this.apps.AutoScroll = true;
51 | //
52 | // label
53 | //
54 | this.label.AutoSize = true;
55 | this.label.BackColor = System.Drawing.Color.Transparent;
56 | this.label.Font = new System.Drawing.Font("Microsoft YaHei UI", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
57 | this.label.ForeColor = System.Drawing.Color.Black;
58 | this.label.Location = new System.Drawing.Point(90, 210);
59 | this.label.Name = "label";
60 | this.label.Size = new System.Drawing.Size(954, 58);
61 | this.label.TabIndex = 1;
62 | this.label.Text = "扫描中...";
63 | //
64 | // Form1
65 | //
66 | this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
67 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
68 | this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
69 | this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
70 | this.ClientSize = new System.Drawing.Size(1160, 800);
71 | this.Controls.Add(this.label);
72 | this.Controls.Add(this.apps);
73 | this.DoubleBuffered = true;
74 | this.Margin = new System.Windows.Forms.Padding(6);
75 | this.Name = "Form1";
76 | this.Padding = new System.Windows.Forms.Padding(130, 300, 130, 100);
77 | this.Text = "Cef Detector";
78 | this.Load += new System.EventHandler(this.Form1_Load);
79 | this.ResumeLayout(false);
80 | this.PerformLayout();
81 | }
82 |
83 | #endregion
84 |
85 | private FlowLayoutPanel apps;
86 | private Label label;
87 | private ToolTip toolTip1;
88 | }
89 | }
--------------------------------------------------------------------------------
/Form1.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using System.Runtime.InteropServices;
3 | using System.Diagnostics;
4 |
5 | namespace CefDetector
6 | {
7 | public partial class Form1 : Form
8 | {
9 | private const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001;
10 | private const int EVERYTHING_REQUEST_PATH = 0x00000002;
11 |
12 | [DllImport("Everything64.dll", CharSet = CharSet.Unicode)]
13 | private static extern UInt32 Everything_SetSearchW(string lpSearchString);
14 |
15 | [DllImport("Everything64.dll")]
16 | public static extern bool Everything_QueryW(bool bWait);
17 | [DllImport("Everything64.dll")]
18 | private static extern UInt32 Everything_GetNumResults();
19 | [DllImport("Everything64.dll", CharSet = CharSet.Unicode)]
20 | private static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount);
21 |
22 | [DllImport("Everything64.dll")]
23 | private static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags);
24 |
25 | private static readonly byte[] LIBCEF = Encoding.ASCII.GetBytes("cef_string_utf8_to_utf16"),
26 | ELECTRON = Encoding.ASCII.GetBytes("third_party/electron_node"),
27 | ELECTRON2 = Encoding.ASCII.GetBytes("register_atom_browser_web_contents"),
28 | CEF_SHARP = Encoding.ASCII.GetBytes("CefSharp.Internals"),
29 | NWJS = Encoding.ASCII.GetBytes("url-nwjs");
30 |
31 | private readonly HashSet processes = new();
32 | private int cnt = 0;
33 | private long totalSize = 0;
34 | private readonly string[] sizes = { "B", "KB", "MB", "GB", "TB" };
35 | private readonly HashSet cache = new();
36 |
37 | private static bool Contains(byte[] file, byte[] search)
38 | {
39 | return Parallel.For(0, file.Length - search.Length, (i, loopState) =>
40 | {
41 | if (file[i] == search[0])
42 | {
43 | byte[] localCache = new byte[search.Length];
44 | Array.Copy(file, i, localCache, 0, search.Length);
45 | if (Enumerable.SequenceEqual(localCache, search))
46 | loopState.Stop();
47 | }
48 | }).IsCompleted == false;
49 | }
50 |
51 | public Form1()
52 | {
53 | InitializeComponent();
54 | }
55 |
56 | protected override void OnResize(EventArgs e)
57 | {
58 | base.OnResize(e);
59 | CalcLabelPos();
60 | }
61 |
62 | private void CalcLabelPos()
63 | {
64 | int x = (int)(0.5 * (this.Width - label.Width));
65 | int y = label.Location.Y;
66 | label.Location = new Point(x, y);
67 | }
68 |
69 | private static Icon? GetIcon(string filePath)
70 | {
71 | try { return Icon.ExtractAssociatedIcon(filePath); } catch { return null; }
72 | }
73 |
74 | private void AddIcon(string fileName, string? type)
75 | {
76 | if (cache.Contains(fileName)) return;
77 | cache.Add(fileName);
78 | var name = (type ?? "Unknown: ") + Path.GetFileName(fileName);
79 | Debug.WriteLine(name);
80 | var button = new System.Windows.Forms.Button
81 | {
82 | Size = new Size(100, 100),
83 | TabIndex = 0,
84 | BackgroundImageLayout = ImageLayout.Stretch,
85 | Dock = DockStyle.Top,
86 | };
87 | if (type == null) button.Text = "Unknown";
88 | else button.BackgroundImage = GetIcon(fileName)?.ToBitmap();
89 | var label2 = new System.Windows.Forms.Label
90 | {
91 | Text = name,
92 | Dock = DockStyle.Bottom,
93 | Font = new Font(label.Font.FontFamily, 6),
94 | AutoEllipsis = true,
95 | };
96 | if (type != null && processes.Contains(fileName)) label2.ForeColor = System.Drawing.Color.Green;
97 | var panel = new Panel()
98 | {
99 | Controls = { button, label2 },
100 | BackColor = Color.Transparent,
101 | Size = new Size(100, 128)
102 | };
103 | button.MouseEnter += (object? sender, EventArgs e) => toolTip1.Show(fileName, (System.Windows.Forms.Button)sender!);
104 | button.MouseLeave += (object? sender, EventArgs e) => toolTip1.Hide((System.Windows.Forms.Button)sender!);
105 | button.Click += (object? sender, EventArgs e) => Process.Start("Explorer", "/select," + fileName);
106 |
107 | cnt++;
108 | FolderSize(Directory.GetParent(fileName)!);
109 |
110 | int order = 0;
111 | double len = totalSize;
112 | while (len >= 1024 && order < sizes.Length - 1)
113 | {
114 | order++;
115 | len /= 1024.0;
116 | }
117 | Invoke(new MethodInvoker(delegate
118 | {
119 | label.Text = $"这台电脑上总共有 {cnt} 个 Chromium 内核的应用 ({String.Format("{0:0.##}{1}", len, sizes[order])})";
120 | CalcLabelPos();
121 | apps.Controls.Add(panel);
122 | }));
123 | }
124 |
125 | private void FolderSize(DirectoryInfo folder, int deep = 0)
126 | {
127 | if (deep > 10) return;
128 | try
129 | {
130 | FileInfo[] allFiles = folder.GetFiles();
131 | foreach (FileInfo file in allFiles) try
132 | {
133 | totalSize += file.Length;
134 | }
135 | catch (Exception)
136 | {
137 | }
138 | foreach (DirectoryInfo dir in folder.GetDirectories()) FolderSize(dir, deep + 1);
139 | }
140 | catch (Exception)
141 | {
142 | return;
143 | }
144 | }
145 |
146 | private void SearchResult(string defaultType = "Unknown: ")
147 | {
148 | var buf = new StringBuilder(260);
149 | for (uint i = 0; i < Everything_GetNumResults(); i++)
150 | {
151 | buf.Clear();
152 | Everything_GetResultFullPathName(i, buf, 260);
153 |
154 | var path = Path.GetDirectoryName(buf.ToString())!;
155 | if (cache.Contains(path) || File.GetAttributes(buf.ToString()).HasFlag(FileAttributes.Directory) ||
156 | path.Contains("$RECYCLE.BIN") || path.Contains("OneDrive")) continue;
157 | cache.Add(path);
158 | bool flag = false;
159 | string? firstExe = null;
160 | var search = (string path) =>
161 | {
162 | try
163 | {
164 | var f = Path.Join(path, "msedge.exe");
165 | if (File.Exists(f))
166 | {
167 | flag = true;
168 | AddIcon(f, "Edge: ");
169 | return;
170 | }
171 | if (File.Exists(f = Path.Join(path, "chrome_pwa_launcher.exe")) && File.Exists(f = Path.Join(path, "../chrome.exe")))
172 | {
173 | flag = true;
174 | AddIcon(f, "Chrome: ");
175 | return;
176 | }
177 | foreach (var it in Directory.GetFiles(path, "*.exe"))
178 | {
179 | string type;
180 | var data = File.ReadAllBytes(it);
181 | var fileName = Path.GetFileName(it);
182 | if (Contains(data, ELECTRON) || Contains(data, ELECTRON2)) type = "Electron: ";
183 | else if (Contains(data, CEF_SHARP)) type = "CefSharp: ";
184 | else if (Contains(data, NWJS)) type = "NWJS: ";
185 | else if (Contains(data, LIBCEF)) type = "CEF: ";
186 | else if (firstExe == null && !fileName.Contains("uninst", StringComparison.OrdinalIgnoreCase) &&
187 | !fileName.Contains("setup", StringComparison.OrdinalIgnoreCase) &&
188 | !fileName.Contains("report", StringComparison.OrdinalIgnoreCase))
189 | {
190 | firstExe = it;
191 | continue;
192 | }
193 | else continue;
194 | flag = true;
195 | AddIcon(it, type);
196 | }
197 | }
198 | catch { }
199 | };
200 | search(path);
201 | if (!flag)
202 | {
203 | if (firstExe == null)
204 | {
205 | search(Path.GetDirectoryName(path)!);
206 | if (firstExe == null) AddIcon(path, null);
207 | else AddIcon(firstExe, defaultType);
208 | }
209 | else AddIcon(firstExe, defaultType);
210 | }
211 | }
212 | }
213 |
214 | private void Form1_Load(object sender, EventArgs e)
215 | {
216 | CalcLabelPos();
217 | new Thread(() =>
218 | {
219 | try
220 | {
221 |
222 | foreach (var it in Process.GetProcesses())
223 | {
224 | try
225 | {
226 | if (it.MainModule?.FileName != null) processes.Add(it.MainModule.FileName);
227 | }
228 | catch { }
229 | }
230 | Everything_SetSearchW("_percent.pak");
231 | Everything_SetRequestFlags(EVERYTHING_REQUEST_PATH | EVERYTHING_REQUEST_FILE_NAME);
232 | Everything_QueryW(true);
233 |
234 | Invoke(new MethodInvoker(delegate
235 | {
236 | label.Text = "这台电脑上总共有 0 个 Chromium 内核的应用";
237 | CalcLabelPos();
238 | }));
239 |
240 | SearchResult();
241 |
242 | Everything_SetSearchW("libcef");
243 | Everything_QueryW(true);
244 | SearchResult("CEF: ");
245 | } finally
246 | {
247 | Invoke(new MethodInvoker(delegate
248 | {
249 | label.ForeColor = Color.Green;
250 | if (cnt == 0) label.Text = "这台电脑上没有 Chromium 内核的应用 (也可能是你没装 Everything)";
251 | }));
252 | }
253 | }).Start();
254 | }
255 | }
256 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2022 Shirasawa
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace CefDetector
4 |
5 | {
6 | internal static class Program
7 | {
8 | [DllImport("Everything64.dll")]
9 | private static extern uint Everything_GetMajorVersion();
10 | [STAThread]
11 | static void Main()
12 | {
13 | try
14 | {
15 | _ = Everything_GetMajorVersion();
16 | }
17 | catch (Exception)
18 | {
19 | MessageBox.Show("Please install and run Everything first!", "Error:");
20 | return;
21 | }
22 |
23 | Application.SetHighDpiMode(HighDpiMode.SystemAware);
24 | Application.EnableVisualStyles();
25 | Application.SetCompatibleTextRenderingDefault(false);
26 | try
27 | {
28 | var wplayer = new WMPLib.WindowsMediaPlayer
29 | {
30 | URL = "bgm.mp3"
31 | };
32 | wplayer.controls.play();
33 | wplayer.settings.setMode("loop", true);
34 | wplayer.settings.setMode("shuffle", false);
35 | } catch { }
36 | Application.Run(new Form1());
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CefDetector.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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 | /// 返回此类使用的缓存的 ResourceManager 实例。
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("CefDetector.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 重写当前线程的 CurrentUICulture 属性,对
51 | /// 使用此强类型资源类的所有资源查找执行重写。
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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CEF Detector - 一眼CEF: 年轻人的第一款 Windows CEF检测器
2 |
3 | **【Electron版本已发布! 提供更多功能并增强稳定性: [CefDetectorX](https://github.com/ShirasawaSama/CefDetectorX)】**
4 |
5 | Check how many CEFs are on your Windows.
6 |
7 | 看看你电脑 **(Windows)** 上有多少个 [CEF (Chromium Embedded Framework)](https://bitbucket.org/chromiumembedded/cef/).
8 |
9 | > 你说的对,但是《LibCEF》是由谷歌自主研发的一款全新开放浏览器内核。第三方代码运行在在一个被称作「CEF」的浏览器沙盒,在这里,被前端程序员选中的代码将被授予「libcef.dll」,导引浏览器之力。你将扮演一位名为「电脑用户」的冤种角色,在各种软件的安装中下载类型各异、体积庞大的 CEF 们,被它们一起占用硬盘空间,吃光你的内存——同时,逐步发掘「CEF」的真相。
10 |
11 | ## 截屏
12 |
13 | 
14 |
15 | ## 使用
16 |
17 | **你首先需要安装 [Everything](https://www.voidtools.com/) 并完成全硬盘的扫描.**
18 |
19 | _不支持精简版Everything,因为它不允许 [IPC](https://www.voidtools.com/zh-cn/support/everything/sdk/ipc/) (Inter Process Communication)_
20 |
21 | 从 [Release](https://github.com/ShirasawaSama/CefDetector/releases) 页面下载最新的压缩包, 解压后运行 `CefDetector.exe` 即可.
22 |
23 | ## 特性
24 |
25 | - 检测 CEF 的类型: 如 [libcef](https://bitbucket.org/chromiumembedded/cef/src/master/)、[Electron](https://www.electronjs.org/)、[NWJS](https://nwjs.io/)、[CefSharp](http://cefsharp.github.io/)、[Edge](https://www.microsoft.com/en-us/edge) 和 [Chrome](https://www.google.com/chrome/)
26 | - 显示总空间占用
27 | - 显示当前所运行的进程 (绿色文件名)
28 | - 支持自定义背景音乐 (默认为: [The Magnificent Seven](https://soundcloud.com/7kruzes/the-magnificent-seven), 不想要的话删掉 bgm.mp3 即可)
29 |
30 | ## 作者
31 |
32 | Shirasawa
33 |
34 | 创意来自 @Lakr233 的 [SafariYYDS](https://github.com/Lakr233/SafariYYDS) 项目.
35 |
36 | ## 协议
37 |
38 | [MIT](./LICENSE)
39 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ShirasawaSama/CefDetector/317c75854cd57e704c950fde4c253e6b3ad2019e/screenshot.png
--------------------------------------------------------------------------------