tsudakageyu / iconextractor Goto Github PK
View Code? Open in Web Editor NEWIcon Extractor Library for .NET
License: Other
Icon Extractor Library for .NET
License: Other
In an application of mine, I need to enumerate other applications' icons.
The Windows Defender executable on Windows 10 (C:\Program Files\Windows Defender\MSASCuiL.exe
) makes IconUtil choke and throw an exception.
Check this out:
// Gets the biggest icon of an .exe file
public static Bitmap GetEXEIconBitmap(string path) {
IconExtractor ie = new IconExtractor(path);
if (ie.Count > 0) {
Icon bigIcon = IconUtil.Split(ie.GetIcon(0)).OrderByDescending(i => IconUtil.ToBitmap(i).PhysicalDimension.Width).First();
return IconUtil.ToBitmap(bigIcon);
} else {
Debug.WriteLine("ExtractAssociatedIcon");
return Icon.ExtractAssociatedIcon(path).ToBitmap();
}
}
That crazy long LINQ query sorts all icons by size and returns the largest one it can find.
When I do this with the abovementioned executable's path, IconUtil throws an ArgumentException:
At this point, I'm stumped. Even more so because it works maybe one in a hundred times, but crashes all the other times. Is Windows protecting Windows Defender by disallowing all access to it or does its executable really contain corrupt icon data?
When using this project with .NET Core, you have to use the new package from microsoft for System.Drawing (this one: System.Drawing.Common) in which they apparently changed the field name of "iconData" to "_iconData", hence the static IconUtil()
method is currently throwing a System.ArgumentNullException
for gen.Emit(OpCodes.Ldfld, fi);
since the variable fi
is null.
I tried with "_iconData" and everything seems to be fine now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.