I’m working on a C# obfuscation program, and I’m wondering if there are method names that are “hardwired” into the framework and should therefore not be modified. The ones that spring to mind are .ctor, .cctor and Dispose. Are there any others I should avoid modifying?
Edit:
To elaborate, and inspired by Paul Alexander (thanks for your answer), I’m doing this by modifying the IL source code. Here are some typical(?) .method statements:
.method family hidebysig virtual instance void
Dispose(bool disposing) cil managed
.method private hidebysig instance void
InitializeComponent() cil managed
.method public hidebysig specialname rtspecialname
instance void .ctor(class [mscorlib]System.Collections.Generic.List`1<string> twoLetterWords) cil managed
.method private hidebysig static string[]
CreateStringArray() cil managed
I can see that the constructor (.ctor) has a “rtspecialname” option, and Dispose has a “family” option. Is this the sort of thing I should be looking out for?
The meta data for a given method contains a “special name” flag on methods that cannot be renamed which you can use as a basic heuristic. However to accurately determine the eligibility of a method you have to walk the entire inheritance tree, accounting base classes, interfaces, methods/properties referenced by attribute strings, etc.