Book a Demo

Author Topic: I have problems for reverse engineering in C/C++  (Read 6125 times)

kkakkung11

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
I have problems for reverse engineering in C/C++
« on: July 23, 2013, 05:03:05 pm »
I've been performing a project related with reverse engineering using Enterprise Architect tool. But, it occurs unknown errors when I perform reverse engineering in C/C++ language. the error logs are followed:
=========================================
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\7z\7zDecode.cpp  on line 91.  Unexpected symbol: *  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\7z\7zEncode.h  on line 36.  Unexpected symbol: *
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\7z\7zHandler.h  on line 46.  Unexpected symbol: public  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\7z\7zIn.h  on line 210.  Unexpected symbol: baseOffset  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\7z\7zOut.h  on line 103.  Unexpected symbol: &  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\7z\7zUpdate.h  on line 74.  Unexpected symbol: *
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Cab\CabBlockInStream.h  on line 37.  Unexpected symbol: void
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Cab\CabHandler.h  on line 22.  Unexpected symbol: private    
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Chm\ChmHandler.h  on line 22.  Unexpected symbol: private    
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Chm\ChmHeader.cpp  on line 14.  Unexpected symbol: {
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Chm\ChmIn.h  on line 208.  Unexpected symbol: PURE  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Com\ComHandler.h  on line 23.  Unexpected symbol: STDMETHOD  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\CoderMixer2MT.h  on line 59.  Unexpected symbol: ISequentialInStream  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\CoderMixer2ST.h  on line 43.  Unexpected symbol: GetInStream  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\CoderMixerMT.h  on line 50.  Unexpected symbol: ISequentialInStream  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\CrossThreadProgress.h  on line 34.  Unexpected symbol: const  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\DummyOutStream.h  on line 20.  Unexpected symbol: const  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\InStreamWithCRC.h  on line 19.  Unexpected symbol: void  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\OutStreamWithCRC.h  on line 22.  Unexpected symbol: const
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Common\OutStreamWithSha1.h  on line 22.  Unexpected symbol: const    
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Hfs\HfsHandler.h  on line 22.  Unexpected symbol: }  
You may need to define a language macro.    
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Iso\IsoHandler.h  on line 25.  Unexpected symbol: STDMETHOD  
You may need to define a language macro.    
.....
.....
========================================
Checking error logs, I think most of error was generated by codes to be processed by preprocessor, for example, "#define", "#ifdef" and so on.

How can I solve this problems ? can the Enterprise Architect reverse codes to be processed by preprocessor ?

I have one more question.

when a file generated an error in a certain line during reversing, I found that Enterprise Architect don't process after that error line in that file.

is there a function that can process continuously that file with skipping that error line ?

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: I have problems for reverse engineering in C/C
« Reply #1 on: July 23, 2013, 06:07:16 pm »
Hi
If your code contains macros you can tell EA to ignore these.
For EA V10 the dialog you need is under Settings->Language Macros.

Without seeing your code it is hard to see what is causing your errors.

HTH
Using V12

kkakkung11

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: I have problems for reverse engineering in C/C
« Reply #2 on: July 23, 2013, 06:12:59 pm »
as you told, I can configurate in Settings->Language Macros. but,
for example,
if I define as
#define MACRO(a,b) function(c,d)
the error is not generated in that line. BUT,
the files that MACRO(a,b) is used occur error....

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: I have problems for reverse engineering in C/C
« Reply #3 on: July 23, 2013, 07:00:53 pm »
Hi
How did you add the macro definition in EA -
For your example you need to add it as MACRO()
Using V12

kkakkung11

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: I have problems for reverse engineering in C/C
« Reply #4 on: July 23, 2013, 07:25:29 pm »
Hi, thank you for your reply. your solution is good. but..

I'm measuring the opensource.
in them, there are so many macros, so, I can't add them all.. right?

is there any other solution ?....

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: I have problems for reverse engineering in C/C
« Reply #5 on: July 23, 2013, 07:44:57 pm »
I guess you could add them all, but it may be a little time consuming.
I am using Qt framework and to reverse engineer the files that I wanted to use, I made local copies and commented out the lines containing the macros. However, this wont work if you want to regenerate the source files.

Sorry not be be more help
Using V12

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: I have problems for reverse engineering in C/C
« Reply #6 on: July 24, 2013, 06:09:50 am »
Quote
Hi, thank you for your reply. your solution is good. but..

I'm measuring the opensource.
in them, there are so many macros, so, I can't add them all.. right?

is there any other solution ?....

If you want to reverse engineer the source without any errors, you'll need to set them up.
Another option might be preprocessing the code first, and reverse engineer the preprocessed C++ code.

HTH
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/