1

I have an old VB.net project (with some custom C++ dlls in it as well) that was only recently obfuscated using ConfuserEx.

The obfuscation led to a series of bugs, which were fixed by adding namespaces to the appropriate code sections and excluding these namespaces from the obfuscation. These exclusions were done by including rules in the .crproj file, such as the following:

  <rule preset="none" pattern="namespace('Namespace1')">
    <protection id="rename" action="remove" />
  </rule>

where 'Namespace1' is the name of my namespace.

The problem is that this solution does not seem to work for the class that contains the "Export to Excel" features. The methods behind these features use the Microsoft.Office.Interop library to:

  1. open a pre-existing template Excel file
  2. write some data on specific cells
  3. save the file
    excelApp = New Microsoft.Office.Interop.Excel.Application()
    excelApp.DisplayAlerts = False
    workBook = excelApp.Workbooks.Open('templateFile.xls')
    workBook.Activate()
    workSheet = workBook.Worksheets(1)

    m_paramList.SaveToExcelTemplate(workSheet) 'writes some data to the appropriate cells

    workBook.SaveAs('newFile.xls')

The class that contains this method inherits from a class contained in a non-obfuscated library.

When the code is not obfuscated, everything works perfectly. When the code is obfuscated all of the methods work fine except for the methods that use the Microsoft.Office.Interop library (it's like they are not even called when the UI button is clicked). There are other methods that handle exporting to different files and these work just fine with the obfuscation.

I really have no idea of why these features are not working even after excluding the class from obfuscation. Maybe I didn't exclude the namespace properly or something (I'm really inexperienced when it comes to obfuscation and I couldn't find anything very useful regarding how to do it properly on my searches). Any help would be greatly appreciated!

Thank you in advance,

Pedro

  • Take dotPeek to explore what was obfuscated and what was not, or try another obfuscator, here a good list: https://stackoverflow.com/a/60054/1480104 – Artem Razin Jul 14 '20 at 08:13

0 Answers0