How to Open Exe Source Code Image

How to Open Exe Source Code

Exe Source Code is a File Extension that currently is not properly associated with any program in our database. If you try to open an EXE file and you get a “Open With” window, or if you cannot find the application you are looking for, this could be the reason why. Every file type has a unique extension, which is sometimes referred to as its “file type”. This particular file type, such as EXE, usually denotes “Executable program”. Unfortunately, our team has not yet added an association for EXE files yet. It can cause problems when files are automatically opened by your computer after downloading and installing them from a web page without your permission because there may be an infection on your machine. One way to solve this problem is through freeware management software downloads. All of the best ones will provide an option to scan a computer for unnecessary programs and possible infections that cause excess load on the computer’s resources, including Internet surfing and opening more video sources.

Opening exe files can be frustrating sometimes – but here’s how to open such files easily. Easy to read and short, this e-book gives simple instructions on how to open exe files in seconds. Filled with screenshots and easy instructions for anyone – for both PC and Mac computer users alike. This book is approximately 2,500 words which is approximately 10 pages long, with a valid font size of 12 points or larger.

A .exe is a binary code, unless its instrumented with source code for debugging its close to impossible to get the source code. In general the application .exes are optimized that you get. .exe files are executables which take help (get linked) with .dll files to execute certain functions its meant to perform. However one can argue that .exe is converted from source code itself, but the reverse translation isn’t possible always. You might get bunch of assembly translation out of .exe but that would be hardly readable for the purpose you want, not at least same as the source code.

Viewing source code using JetBrains dotPeek

JetBrains dotPeek decompiles an executable file or DLL/.exe file written using .Net to their equivalent C# code.

Installing dotPeek

  • Download JetBrains dotPeek from JetBrains
  • Run the setup and install free .Net decompiler and assembly tools.

Decompiling the code

  1. Open dotPeek
  2. File -> Open -> navigate to your project -> select your .DLL/.exe file
  3. Your project will be listed in the projects on our dotPeek under Assembly Explorer
  4. Click your project and find the classes to view the source code

My file is called MyCalculator.dll and bellow is the source code

Obfuscating the source code

For more obfuscating tools both open source and paid versions check this NuGet obfuscator article

In this article, I’m using one from the article, and its called Eazfuscator.NET to hide source code for a C# application. I will be using a simple C# calculator.

Debugging

Just as with a normal project you can start debugging with F5, which will launch the EXE and attach the debugger. If you want to debug startup you can launch with F11, which will launch the EXE and stop on the first line of user code. Both of these options are available on the context menu for the EXE project in Solution Explorer window as illustrated below:

Starting debugging from the solution node

For debugging will need to have symbols (PDB files) for the EXE and any DLLs you need to debug. Visual Studio will follow the same process to try to obtain symbols as it does when debugging a normal project. Since it’s not likely that the PDB files were distributed alongside the EXE you might want to locate them from a build drop or, better yet, from a symbol server. More information and best practices for symbols can be found in this blog.

To effectively debug you’ll also need the source code that was used to build the EXE, even for just a few files that you care about. You’ll need to locate those files and open them in Visual Studio. If the source code isn’t the exact same as the source code that was built the EXE Visual Studio will warn you when you try to insert a breakpoint and the breakpoint won’t bind. That behavior can be overridden from the Breakpoint Settings peek window. In the settings peek window click on the Must match source link text and then check the box to allow mismatched source, as illustrated below. Of course, with mismatched source you never really know what’s going to happen, so use at your peril.

If the EXE was built with SourceLink enabled then information about the source will be included in the PDBs and Visual Studio will try to download the source automatically. This is a really good reason to use SourceLink with your projects. Even if you have a local enlistment you might not have the same version that was used to build the binary. SourceLink is your sure-fire way to make sure that the right source is linked with the right binary.

If you can’t obtain any source code you still have a couple of options:

  1. Use a tool to decompile the assemblies back into C#, which you can then recompile into a new assemble to patch the old one.
    1. ILSpy is a great choice for this, but there’s plenty of other good paid and free tools out there.
    2. [Note: Several comments have also pointed out dnSpy https://github.com/0xd4d/dnSpy as a great solution for this – thanks!]
  2. Use the Disassembly tool window in Visual Studio.
    1. The Source Not Found document has a link to view disassembly. Be warned, if you’re used to debugging C# code the disassembly view is a tool of last resort.

Lastly, if you need to pass in any arguments to the EXE that’s being debugged you can configure them along with other options in the Project Properties page (Right Click->Properties on the project node in solution explorer).

Project properties page for the exe project.

Steps for hiding the source code

  1. Open your application in Visual Studio
  2. Change your project from debug mode to Release modeAlt Text
  3. Open Eazfuscator.NET then drag and drop your project from solution explorer to protect itAlt Text
  4. Rebuild your project and click reload all

Profiling

You can also use the profiling tools with the EXE by launching them from the Debug -> Performance Profiling. From the launch page of the profiling tools you can select what tools to use against the EXE.

Conclusion

If you ever have the misfortune of getting a virus or malware, the easiest way to find out what it does is to open the exe in a hex editor — a piece of software that shows you the raw code that makes up the program.

Similar Posts

0 Comments

No Comment.