Detect whether an executable is .NET or native, detect subsystem (console,gui), and whether it's 32-bit or 64-bit (PEPLUS)
![[Image: Syr3DlV.png]](https://i.imgur.com/Syr3DlV.png)
|
C#
Detecting PE architecture/type/subsystem (64/32/gui/console/net/native) |
|
Mar 28, 2018 06:38 AM
(This post was last modified: Mar 28, 2018 06:44 AM by Ninja.)
Call me a nitpicker, and I know it doesn't matter, but the empty line on line 24 bothers me.
Also, in my opinion, though this is purely preference, I prefer an if statement without brackets if there is only a single line of code that needs to be in it. And the if statement starting from line 89 can be shortened using a ternary operator, though that is also preference as well. The only comments I have on this is that you should use an ArgumentException instead of a normal Exception for when Streams are not seekable, and that there is no exception handling. I don't know what kind of exceptions get thrown by for example the BitConverter class but I can imagine that developers using this will not always immediately understand what is wrong. Catching and then throwing your own, more detailed exception is something you can do. (Mar 28, 2018 11:25 AM)gigajew Wrote: Thanks for the input Ninja No problem broski. Thanks for the great release! :^) |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| by daarioJun 9, 2024 04:14 PM | 10 | 301 |
Jun 9, 2024 04:14 PM Last Post: Tyr |
| [C] by maryousJul 24, 2022 03:35 PM | 0 | 160 |
Jul 24, 2022 03:35 PM Last Post: maryous |
| [C] by lo0srMar 23, 2022 10:40 PM | 14 | 761 |
Mar 23, 2022 10:40 PM Last Post: rathvncgod |