When you need to understand what an unfamiliar .NET assembly actually does — not to its own data, but to the machine — the native interop is where the answer lives. Managed code that stays inside the CLR is sandboxed by it; the moment it calls into native code via P/Invoke, it can do anything the process can. Fortunately, P/Invoke declarations are among the most faithfully recoverable things in a decompiled assembly, because the information a decompiler needs is sitting in a dedicated metadata table. Reading it well turns "this assembly calls some native stuff" into a precise inventory.
How P/Invoke is stored
A [DllImport] method does not carry a method body — it is an extern declaration. In the assembly it becomes a method flagged pinvokeimpl , with an entry in the ImplMap metadata table that records four things: the module (the native DLL), the entry-point name , the calling convention , and the character set / name-mangling rules.…