Skip to content

Instantly share code, notes, and snippets.

@mattifestation
Created June 16, 2014 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattifestation/9975f46887ddcbbb13ae to your computer and use it in GitHub Desktop.
Save mattifestation/9975f46887ddcbbb13ae to your computer and use it in GitHub Desktop.
Module Initializer PoC - Run build.bat from current dir in Visual Studio Command Prompt
csc test.cs
ildasm /OUT=test.il test.exe
type moduleinititalizer.il >> test.il
ilasm /EXE /OUTPUT=test.exe test.il
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
.maxstack 8
IL_0000: nop
IL_0001: ldstr "Hello"
IL_0006: call void [mscorlib]System.Console::Write(string)
IL_000b: nop
IL_000c: ret
}
using System;
namespace testns
{
class test
{
public static void Main(String[] args)
{
Console.WriteLine(", World!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment