diff --git a/csharphelloworld.cs b/csharphelloworld.cs new file mode 100644 index 0000000..2db2b21 --- /dev/null +++ b/csharphelloworld.cs @@ -0,0 +1,18 @@ +// https://www.geeksforgeeks.org/how-to-compile-decompile-and-run-c-code-in-linux/ +// +// Use mcs compiler to create a windows executable csharphelloworld.exe from csharphelloworld.cs +// +// mcs -out:csharphelloworld.exe csharphelloworld.cs +// mono csharphelloworld.exe + +using System; + +public class GFG { + + static public void Main() + { + Console.WriteLine("Hello World!"); + Console.ReadKey(); + + } +} \ No newline at end of file diff --git a/csharphelloworld.decomp.cs b/csharphelloworld.decomp.cs new file mode 100644 index 0000000..f78f15f --- /dev/null +++ b/csharphelloworld.decomp.cs @@ -0,0 +1,50 @@ +.assembly extern mscorlib +{ + .ver 4:0:0:0 + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. +} +.assembly 'csharphelloworld' +{ + .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = ( + 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module csharphelloworld.exe // GUID = {D5E6E53D-50CA-452F-AED9-6A961E988718} + + + .class public auto ansi beforefieldinit GFG + extends [mscorlib]System.Object + { + + // method line 1 + .method public hidebysig specialname rtspecialname + instance default void '.ctor' () cil managed + { + // Method begins at RVA 0x2050 + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void object::'.ctor'() + IL_0006: ret + } // end of method GFG::.ctor + + // method line 2 + .method public static hidebysig + default void Main () cil managed + { + // Method begins at RVA 0x2058 + .entrypoint + // Code size 17 (0x11) + .maxstack 8 + IL_0000: ldstr "Hello World!" + IL_0005: call void class [mscorlib]System.Console::WriteLine(string) + IL_000a: call valuetype [mscorlib]System.ConsoleKeyInfo class [mscorlib]System.Console::ReadKey() + IL_000f: pop + IL_0010: ret + } // end of method GFG::Main + + } // end of class GFG + diff --git a/csharphelloworld.txt b/csharphelloworld.txt new file mode 100644 index 0000000..6153103 --- /dev/null +++ b/csharphelloworld.txt @@ -0,0 +1,10 @@ +https://www.geeksforgeeks.org/how-to-compile-decompile-and-run-c-code-in-linux/ + +Use mcs compiler to create a windows executable csharphelloworld.exe from csharphelloworld.cs + +mcs -out:csharphelloworld.exe csharphelloworld.cs +mono csharphelloworld.exe + +To decompile this executable file run the following command: + +monodis --output=csharphelloworld.decomp.cs csharphelloworld.exe \ No newline at end of file