我正在使用 Enterprise Architect,在 C/C++ 中进行逆向工程时遇到了一些问题
Posted
技术标签:
【中文标题】我正在使用 Enterprise Architect,在 C/C++ 中进行逆向工程时遇到了一些问题【英文标题】:I'm using the Enterprise Architect, and I have some problems for reverse engineering in C/C++ 【发布时间】:2013-07-22 01:42:06 【问题描述】:我一直在使用 Enterprise Architect 工具执行与逆向工程相关的项目。但是,当我用 C/C++ 语言执行逆向工程时,会出现未知错误。错误日志如下:
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.
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Nsis\NsisDecode.h on line 41. Unexpected symbol: *
You may need to define a language macro.
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Nsis\NsisHandler.h on line 19. Unexpected symbol: public
You may need to define a language macro.
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Nsis\NsisIn.h on line 136. Unexpected symbol: *
You may need to define a language macro.
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Rar\RarHandler.h on line 19. Unexpected symbol: public
You may need to define a language macro.
There was an error parsing C:\Users\soo\Desktop\7z920\7zip\Archive\Rar\RarVolumeInStream.h on line 26. Unexpected symbol: void
You may need to define a language macro.
查看错误日志,我认为大部分错误是由预处理器处理的代码产生的,例如“#define
”、“#ifdef
”等。
我该如何解决这个问题? Enterprise Architect 能否逆向代码被预处理器处理?
我还有一个问题。
当文件在反转过程中在某行产生错误时,我发现 Enterprise Architect 在该文件中的该错误行之后不处理。
是否有一个函数可以连续处理该文件并跳过该错误行?
【问题讨论】:
现在有一个特定的 RE 站点。试试reverseengineering.stackexchange.com 【参考方案1】:首先,C 和 C++ 是两种完全不同的语言,EA 也是这样对待它们的。您似乎正在尝试导入 C++ 源代码,因此请确保您没有在“导入源目录”对话框中选择 C 作为源类型。
其次,语言宏在设置 - 预处理器宏中定义。同样,请确保选择正确的语言。
定义的预处理器宏在解析期间被 EA 跳过,而不是扩展(您只能指定宏名称,而不是右侧)。因此,如果您的代码包含许多聪明的宏,它们将不会包含在模型中。如果这是不可接受的,请通过预处理器运行代码,然后导入结果,这将是无宏的。
相关帮助页面是软件工程-开发工具-其他设置-语言宏。
最后不,你不能告诉 EA 继续解析它遇到问题的文件。它跳出并移动到下一个。
【讨论】:
而且它不能很好地解析现代 C++ 特性。见sparxsystems.com/forums/smf/index.php?topic=37752.0以上是关于我正在使用 Enterprise Architect,在 C/C++ 中进行逆向工程时遇到了一些问题的主要内容,如果未能解决你的问题,请参考以下文章
使用API 获取Github Enterprise Stats
从 Alfresco Enterprise 降级到 Alfresco Community
红帽 6.4 上的 Datastax Enterprise 5.0.0
Gradle Enterprise Gradle 插件 (com.gradle.enterprise) 在尝试构建我的项目时在 jenkins 中未发现错误