I want to detect exe file that created with zip tools? like 7z or WinRAR or ..., I mean SFX (self-extracting executable) files
So I have to find a way to distinguish between normal exe files and SFX files in C#?
Are there any ways to detect them in C#?
You can just make the
.exeformat into.rarformat and double-click to open(NOT extract) it up to view the contents, most likely it would be a self-extracting file if yourWinRARor7zmanages to open it up for you. But if you get an error while trying to view the contents in the.rarfile, then most likely it would be be a normal.exefile.I believe there are other methods but this is the one that I commonly use since its quite simple.
With that being said, what you need to let the C# do is this :
.rartry-catchblock, give an error message if fails to open , otherwise, give a positive message if opening is successful.If you need help with changing the file format , you can look up on this : Change File Extension Using C#
If you need help with opening the file : How do I launch files in C#