Almost every assembly produced by Microsoft VisualC++.NET is a mixed image, which contains both managed and unmanaged code. Our obfuscator supports such mixed images very well.
Microsoft .NET Framework shipped a sample utility, called metainfo, that dumps metadata info of any .NET assemblies. Originally, this sample was configured to emit only native image with Visual C++. Here we reconfigure it to compile into three different kinds of images: managed, mixed, and native. Our obfuscator is then used to obfuscate those images that contain managed code. Results are shown below.
Typically, metainfo is located in the following directory,
c:\Program Files:\Microsoft.NET\FrameworkSDK\Tool Developers Guide\Samples\metainfo
Copy the following three .bat files into the metainfo folder, change the setting accordingly, you will be able to generate three different images.
| Image Type | Batch File |
| managed | build_managed.bat |
| mixed | build_mixed.bat |
| native | build_native.bat |
Here are the images before and after obfuscation, the file size reduction is the most for managed image. Notice the mixed image happens to have the same size after obfuscation in this particular sample, this is not typical. Most situations result in size reduction for mixed images as well. If you download and run the programs, five images will always produce exactly same outputs, which shows the correctness of our obfuscator and the robustness of Visual C++.NET compiler. You may also want to examine with ILDASM to see how obfuscation renames symbols.
| Image Type | Before | Size (bytes) | After | Size (bytes) |
| managed | metainfo_managed.exe | 155,648 | metainfo_managed_ob.exe | 122,880 |
| mixed | metainfo_mixed.exe | 110,592 | metainfo_mixed_ob.exe | 110,592 |
| native | metainfo_native.exe | 98,304 | No obfuscation | NA |