PROJECT: AStyle
This commit is contained in:
parent
d365b5a590
commit
9d692efbdf
|
|
@ -62,7 +62,7 @@ build-wrapper --out-dir bw-output build.bat %2
|
|||
if not defined APPVEYOR_PULL_REQUEST_NUMBER (
|
||||
sonar-scanner -Dsonar.projectKey=x64dbg -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=mrexodia-github -Dsonar.login=%SONARQUBE_TOKEN% -Dsonar.exclusions=src/capstone_wrapper/**,src/dbg/btparser/**,src/gui_build/**,src/zydis_wrapper/zydis/**
|
||||
) else (
|
||||
sonar-scanner -Dsonar.projectKey=x64dbg -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=mrexodia-github -Dsonar.login=%SONARQUBE_TOKEN% -Dsonar.exclusions=src/capstone_wrapper/**,src/dbg/btparser/**,src/gui_build/**,src/zydis_wrapper/zydis/** -Dsonar.analysis.mode=preview -Dsonar.github.pullRequest=%APPVEYOR_PULL_REQUEST_NUMBER% -Dsonar.github.repository=https://github.com/x64dbg/x64dbg -Dsonar.github.oauth=%GITHUB_TOKEN%
|
||||
sonar-scanner -Dsonar.projectKey=x64dbg -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=mrexodia-github -Dsonar.login=%SONARQUBE_TOKEN% -Dsonar.exclusions=src/capstone_wrapper/**,src/dbg/btparser/**,src/gui_build/**,src/zydis_wrapper/zydis/** -Dsonar.analysis.mode=preview -Dsonar.github.pullRequest=%APPVEYOR_PULL_REQUEST_NUMBER% -Dsonar.github.repository=x64dbg/x64dbg -Dsonar.github.oauth=%GITHUB_TOKEN%
|
||||
)
|
||||
goto :restorepath
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,536 @@
|
|||
src/bridge/Utf8Ini.h
|
||||
src/bridge/_global.cpp
|
||||
src/bridge/_global.h
|
||||
src/bridge/bridgegraph.h
|
||||
src/bridge/bridgelist.h
|
||||
src/bridge/bridgemain.cpp
|
||||
src/bridge/bridgemain.h
|
||||
src/dbg/DeviceNameResolver/DeviceNameResolver.h
|
||||
src/dbg/GetPeArch.h
|
||||
src/dbg/TitanEngine/TitanEngine.h
|
||||
src/dbg/TraceRecord.cpp
|
||||
src/dbg/TraceRecord.h
|
||||
src/dbg/XEDParse/XEDParse.h
|
||||
src/dbg/_dbgfunctions.cpp
|
||||
src/dbg/_dbgfunctions.h
|
||||
src/dbg/_exports.cpp
|
||||
src/dbg/_exports.h
|
||||
src/dbg/_global.cpp
|
||||
src/dbg/_global.h
|
||||
src/dbg/_plugin_types.h
|
||||
src/dbg/_plugins.cpp
|
||||
src/dbg/_plugins.h
|
||||
src/dbg/_scriptapi.h
|
||||
src/dbg/_scriptapi_argument.cpp
|
||||
src/dbg/_scriptapi_argument.h
|
||||
src/dbg/_scriptapi_assembler.cpp
|
||||
src/dbg/_scriptapi_assembler.h
|
||||
src/dbg/_scriptapi_bookmark.cpp
|
||||
src/dbg/_scriptapi_bookmark.h
|
||||
src/dbg/_scriptapi_comment.cpp
|
||||
src/dbg/_scriptapi_comment.h
|
||||
src/dbg/_scriptapi_debug.cpp
|
||||
src/dbg/_scriptapi_debug.h
|
||||
src/dbg/_scriptapi_flag.cpp
|
||||
src/dbg/_scriptapi_flag.h
|
||||
src/dbg/_scriptapi_function.cpp
|
||||
src/dbg/_scriptapi_function.h
|
||||
src/dbg/_scriptapi_gui.cpp
|
||||
src/dbg/_scriptapi_gui.h
|
||||
src/dbg/_scriptapi_label.cpp
|
||||
src/dbg/_scriptapi_label.h
|
||||
src/dbg/_scriptapi_memory.cpp
|
||||
src/dbg/_scriptapi_memory.h
|
||||
src/dbg/_scriptapi_misc.cpp
|
||||
src/dbg/_scriptapi_misc.h
|
||||
src/dbg/_scriptapi_module.cpp
|
||||
src/dbg/_scriptapi_module.h
|
||||
src/dbg/_scriptapi_pattern.cpp
|
||||
src/dbg/_scriptapi_pattern.h
|
||||
src/dbg/_scriptapi_register.cpp
|
||||
src/dbg/_scriptapi_register.h
|
||||
src/dbg/_scriptapi_stack.cpp
|
||||
src/dbg/_scriptapi_stack.h
|
||||
src/dbg/_scriptapi_symbol.cpp
|
||||
src/dbg/_scriptapi_symbol.h
|
||||
src/dbg/addrinfo.cpp
|
||||
src/dbg/addrinfo.h
|
||||
src/dbg/analysis/AnalysisPass.cpp
|
||||
src/dbg/analysis/AnalysisPass.h
|
||||
src/dbg/analysis/BasicBlock.h
|
||||
src/dbg/analysis/CodeFollowPass.cpp
|
||||
src/dbg/analysis/CodeFollowPass.h
|
||||
src/dbg/analysis/FunctionPass.cpp
|
||||
src/dbg/analysis/FunctionPass.h
|
||||
src/dbg/analysis/LinearPass.cpp
|
||||
src/dbg/analysis/LinearPass.h
|
||||
src/dbg/analysis/advancedanalysis.cpp
|
||||
src/dbg/analysis/advancedanalysis.h
|
||||
src/dbg/analysis/analysis.cpp
|
||||
src/dbg/analysis/analysis.h
|
||||
src/dbg/analysis/analysis_nukem.cpp
|
||||
src/dbg/analysis/analysis_nukem.h
|
||||
src/dbg/analysis/controlflowanalysis.cpp
|
||||
src/dbg/analysis/controlflowanalysis.h
|
||||
src/dbg/analysis/exceptiondirectoryanalysis.cpp
|
||||
src/dbg/analysis/exceptiondirectoryanalysis.h
|
||||
src/dbg/analysis/linearanalysis.cpp
|
||||
src/dbg/analysis/linearanalysis.h
|
||||
src/dbg/analysis/recursiveanalysis.cpp
|
||||
src/dbg/analysis/recursiveanalysis.h
|
||||
src/dbg/analysis/xrefsanalysis.cpp
|
||||
src/dbg/analysis/xrefsanalysis.h
|
||||
src/dbg/animate.cpp
|
||||
src/dbg/animate.h
|
||||
src/dbg/argument.cpp
|
||||
src/dbg/argument.h
|
||||
src/dbg/assemble.cpp
|
||||
src/dbg/assemble.h
|
||||
src/dbg/bookmark.cpp
|
||||
src/dbg/bookmark.h
|
||||
src/dbg/breakpoint.cpp
|
||||
src/dbg/breakpoint.h
|
||||
src/dbg/command.cpp
|
||||
src/dbg/command.h
|
||||
src/dbg/commandline.cpp
|
||||
src/dbg/commandline.h
|
||||
src/dbg/commandparser.cpp
|
||||
src/dbg/commandparser.h
|
||||
src/dbg/commands/cmd-all.h
|
||||
src/dbg/commands/cmd-analysis.cpp
|
||||
src/dbg/commands/cmd-analysis.h
|
||||
src/dbg/commands/cmd-breakpoint-control.cpp
|
||||
src/dbg/commands/cmd-breakpoint-control.h
|
||||
src/dbg/commands/cmd-conditional-breakpoint-control.cpp
|
||||
src/dbg/commands/cmd-conditional-breakpoint-control.h
|
||||
src/dbg/commands/cmd-debug-control.cpp
|
||||
src/dbg/commands/cmd-debug-control.h
|
||||
src/dbg/commands/cmd-general-purpose.cpp
|
||||
src/dbg/commands/cmd-general-purpose.h
|
||||
src/dbg/commands/cmd-gui.cpp
|
||||
src/dbg/commands/cmd-gui.h
|
||||
src/dbg/commands/cmd-memory-operations.cpp
|
||||
src/dbg/commands/cmd-memory-operations.h
|
||||
src/dbg/commands/cmd-misc.cpp
|
||||
src/dbg/commands/cmd-misc.h
|
||||
src/dbg/commands/cmd-operating-system-control.cpp
|
||||
src/dbg/commands/cmd-operating-system-control.h
|
||||
src/dbg/commands/cmd-plugins.cpp
|
||||
src/dbg/commands/cmd-plugins.h
|
||||
src/dbg/commands/cmd-script.cpp
|
||||
src/dbg/commands/cmd-script.h
|
||||
src/dbg/commands/cmd-searching.cpp
|
||||
src/dbg/commands/cmd-searching.h
|
||||
src/dbg/commands/cmd-thread-control.cpp
|
||||
src/dbg/commands/cmd-thread-control.h
|
||||
src/dbg/commands/cmd-tracing.cpp
|
||||
src/dbg/commands/cmd-tracing.h
|
||||
src/dbg/commands/cmd-types.cpp
|
||||
src/dbg/commands/cmd-types.h
|
||||
src/dbg/commands/cmd-undocumented.cpp
|
||||
src/dbg/commands/cmd-undocumented.h
|
||||
src/dbg/commands/cmd-user-database.cpp
|
||||
src/dbg/commands/cmd-user-database.h
|
||||
src/dbg/commands/cmd-variables.cpp
|
||||
src/dbg/commands/cmd-variables.h
|
||||
src/dbg/commands/cmd-watch-control.cpp
|
||||
src/dbg/commands/cmd-watch-control.h
|
||||
src/dbg/comment.cpp
|
||||
src/dbg/comment.h
|
||||
src/dbg/console.cpp
|
||||
src/dbg/console.h
|
||||
src/dbg/database.cpp
|
||||
src/dbg/database.h
|
||||
src/dbg/datainst_helper.cpp
|
||||
src/dbg/datainst_helper.h
|
||||
src/dbg/dbghelp/dbghelp.h
|
||||
src/dbg/dbghelp_safe.cpp
|
||||
src/dbg/dbghelp_safe.h
|
||||
src/dbg/debugger.cpp
|
||||
src/dbg/debugger.h
|
||||
src/dbg/debugger_cookie.h
|
||||
src/dbg/debugger_tracing.h
|
||||
src/dbg/disasm_fast.cpp
|
||||
src/dbg/disasm_fast.h
|
||||
src/dbg/disasm_helper.cpp
|
||||
src/dbg/disasm_helper.h
|
||||
src/dbg/dynamicmem.h
|
||||
src/dbg/encodemap.cpp
|
||||
src/dbg/encodemap.h
|
||||
src/dbg/exception.cpp
|
||||
src/dbg/exception.h
|
||||
src/dbg/exhandlerinfo.cpp
|
||||
src/dbg/exhandlerinfo.h
|
||||
src/dbg/expressionfunctions.cpp
|
||||
src/dbg/expressionfunctions.h
|
||||
src/dbg/expressionparser.cpp
|
||||
src/dbg/expressionparser.h
|
||||
src/dbg/exprfunc.cpp
|
||||
src/dbg/exprfunc.h
|
||||
src/dbg/filehelper.cpp
|
||||
src/dbg/filehelper.h
|
||||
src/dbg/filemap.h
|
||||
src/dbg/formatfunctions.cpp
|
||||
src/dbg/formatfunctions.h
|
||||
src/dbg/function.cpp
|
||||
src/dbg/function.h
|
||||
src/dbg/handle.h
|
||||
src/dbg/handles.cpp
|
||||
src/dbg/handles.h
|
||||
src/dbg/historycontext.cpp
|
||||
src/dbg/historycontext.h
|
||||
src/dbg/jansson/jansson.h
|
||||
src/dbg/jansson/jansson_config.h
|
||||
src/dbg/jansson/jansson_x64dbg.h
|
||||
src/dbg/jit.cpp
|
||||
src/dbg/jit.h
|
||||
src/dbg/keystone/arm.h
|
||||
src/dbg/keystone/arm64.h
|
||||
src/dbg/keystone/hexagon.h
|
||||
src/dbg/keystone/keystone.h
|
||||
src/dbg/keystone/mips.h
|
||||
src/dbg/keystone/ppc.h
|
||||
src/dbg/keystone/sparc.h
|
||||
src/dbg/keystone/systemz.h
|
||||
src/dbg/keystone/x86.h
|
||||
src/dbg/label.cpp
|
||||
src/dbg/label.h
|
||||
src/dbg/log.cpp
|
||||
src/dbg/loop.cpp
|
||||
src/dbg/loop.h
|
||||
src/dbg/lz4/lz4.h
|
||||
src/dbg/lz4/lz4file.h
|
||||
src/dbg/lz4/lz4hc.h
|
||||
src/dbg/main.cpp
|
||||
src/dbg/memory.cpp
|
||||
src/dbg/memory.h
|
||||
src/dbg/mnemonichelp.cpp
|
||||
src/dbg/mnemonichelp.h
|
||||
src/dbg/module.cpp
|
||||
src/dbg/module.h
|
||||
src/dbg/msgqueue.cpp
|
||||
src/dbg/msgqueue.h
|
||||
src/dbg/murmurhash.cpp
|
||||
src/dbg/murmurhash.h
|
||||
src/dbg/ntdll/ntdll.h
|
||||
src/dbg/patches.cpp
|
||||
src/dbg/patches.h
|
||||
src/dbg/patternfind.cpp
|
||||
src/dbg/patternfind.h
|
||||
src/dbg/plugin_loader.cpp
|
||||
src/dbg/plugin_loader.h
|
||||
src/dbg/reference.cpp
|
||||
src/dbg/reference.h
|
||||
src/dbg/serializablemap.h
|
||||
src/dbg/simplescript.cpp
|
||||
src/dbg/simplescript.h
|
||||
src/dbg/stackinfo.cpp
|
||||
src/dbg/stackinfo.h
|
||||
src/dbg/stringformat.cpp
|
||||
src/dbg/stringformat.h
|
||||
src/dbg/stringutils.cpp
|
||||
src/dbg/stringutils.h
|
||||
src/dbg/symbolinfo.cpp
|
||||
src/dbg/symbolinfo.h
|
||||
src/dbg/symcache.cpp
|
||||
src/dbg/symcache.h
|
||||
src/dbg/taskthread.h
|
||||
src/dbg/tcpconnections.cpp
|
||||
src/dbg/tcpconnections.h
|
||||
src/dbg/test/general/dll/main.cpp
|
||||
src/dbg/test/general/dll/main.h
|
||||
src/dbg/test/general/exe/main.cpp
|
||||
src/dbg/test/guard_page/main.cpp
|
||||
src/dbg/thread.cpp
|
||||
src/dbg/thread.h
|
||||
src/dbg/threading.cpp
|
||||
src/dbg/threading.h
|
||||
src/dbg/types.cpp
|
||||
src/dbg/types.h
|
||||
src/dbg/typesparser.cpp
|
||||
src/dbg/value.cpp
|
||||
src/dbg/value.h
|
||||
src/dbg/variable.cpp
|
||||
src/dbg/variable.h
|
||||
src/dbg/watch.cpp
|
||||
src/dbg/watch.h
|
||||
src/dbg/x64dbg.cpp
|
||||
src/dbg/x64dbg.h
|
||||
src/dbg/xrefs.cpp
|
||||
src/dbg/xrefs.h
|
||||
src/dbg/yara/yara.h
|
||||
src/dbg/yara/yara/ahocorasick.h
|
||||
src/dbg/yara/yara/arena.h
|
||||
src/dbg/yara/yara/atoms.h
|
||||
src/dbg/yara/yara/compiler.h
|
||||
src/dbg/yara/yara/dotnet.h
|
||||
src/dbg/yara/yara/elf.h
|
||||
src/dbg/yara/yara/endian.h
|
||||
src/dbg/yara/yara/error.h
|
||||
src/dbg/yara/yara/exec.h
|
||||
src/dbg/yara/yara/exefiles.h
|
||||
src/dbg/yara/yara/filemap.h
|
||||
src/dbg/yara/yara/globals.h
|
||||
src/dbg/yara/yara/hash.h
|
||||
src/dbg/yara/yara/hex_lexer.h
|
||||
src/dbg/yara/yara/integers.h
|
||||
src/dbg/yara/yara/lexer.h
|
||||
src/dbg/yara/yara/libyara.h
|
||||
src/dbg/yara/yara/limits.h
|
||||
src/dbg/yara/yara/mem.h
|
||||
src/dbg/yara/yara/modules.h
|
||||
src/dbg/yara/yara/object.h
|
||||
src/dbg/yara/yara/parser.h
|
||||
src/dbg/yara/yara/pe.h
|
||||
src/dbg/yara/yara/pe_utils.h
|
||||
src/dbg/yara/yara/proc.h
|
||||
src/dbg/yara/yara/re.h
|
||||
src/dbg/yara/yara/re_lexer.h
|
||||
src/dbg/yara/yara/rules.h
|
||||
src/dbg/yara/yara/scan.h
|
||||
src/dbg/yara/yara/sizedstr.h
|
||||
src/dbg/yara/yara/stream.h
|
||||
src/dbg/yara/yara/strutils.h
|
||||
src/dbg/yara/yara/threading.h
|
||||
src/dbg/yara/yara/types.h
|
||||
src/dbg/yara/yara/utils.h
|
||||
src/dbg_assert.h
|
||||
src/dbg_types.h
|
||||
src/exe/LoadResourceString.h
|
||||
src/exe/crashdump.cpp
|
||||
src/exe/crashdump.h
|
||||
src/exe/icon.h
|
||||
src/exe/resource.h
|
||||
src/exe/strings.h
|
||||
src/exe/x64dbg_exe.cpp
|
||||
src/gui/Src/BasicView/AbstractTableView.cpp
|
||||
src/gui/Src/BasicView/AbstractTableView.h
|
||||
src/gui/Src/BasicView/Disassembly.cpp
|
||||
src/gui/Src/BasicView/Disassembly.h
|
||||
src/gui/Src/BasicView/HeaderButton.h
|
||||
src/gui/Src/BasicView/HexDump.cpp
|
||||
src/gui/Src/BasicView/HexDump.h
|
||||
src/gui/Src/BasicView/HistoryLineEdit.cpp
|
||||
src/gui/Src/BasicView/HistoryLineEdit.h
|
||||
src/gui/Src/BasicView/LabeledSplitter.cpp
|
||||
src/gui/Src/BasicView/LabeledSplitter.h
|
||||
src/gui/Src/BasicView/LabeledSplitterDetachedWindow.cpp
|
||||
src/gui/Src/BasicView/LabeledSplitterDetachedWindow.h
|
||||
src/gui/Src/BasicView/ReferenceView.cpp
|
||||
src/gui/Src/BasicView/ReferenceView.h
|
||||
src/gui/Src/BasicView/SearchListView.cpp
|
||||
src/gui/Src/BasicView/SearchListView.h
|
||||
src/gui/Src/BasicView/SearchListViewTable.cpp
|
||||
src/gui/Src/BasicView/SearchListViewTable.h
|
||||
src/gui/Src/BasicView/ShortcutEdit.cpp
|
||||
src/gui/Src/BasicView/ShortcutEdit.h
|
||||
src/gui/Src/BasicView/StdTable.cpp
|
||||
src/gui/Src/BasicView/StdTable.h
|
||||
src/gui/Src/Bridge/Bridge.cpp
|
||||
src/gui/Src/Bridge/Bridge.h
|
||||
src/gui/Src/Bridge/BridgeResult.cpp
|
||||
src/gui/Src/Bridge/BridgeResult.h
|
||||
src/gui/Src/Disassembler/CsQBeaEngine.cpp
|
||||
src/gui/Src/Disassembler/CsQBeaEngine.h
|
||||
src/gui/Src/Disassembler/QBeaEngine.cpp
|
||||
src/gui/Src/Disassembler/QBeaEngine.h
|
||||
src/gui/Src/Disassembler/capstone_gui.cpp
|
||||
src/gui/Src/Disassembler/capstone_gui.h
|
||||
src/gui/Src/Disassembler/cs_capstone_gui.cpp
|
||||
src/gui/Src/Disassembler/cs_capstone_gui.h
|
||||
src/gui/Src/Exports.h
|
||||
src/gui/Src/Gui/AboutDialog.cpp
|
||||
src/gui/Src/Gui/AboutDialog.h
|
||||
src/gui/Src/Gui/AppearanceDialog.cpp
|
||||
src/gui/Src/Gui/AppearanceDialog.h
|
||||
src/gui/Src/Gui/AssembleDialog.cpp
|
||||
src/gui/Src/Gui/AssembleDialog.h
|
||||
src/gui/Src/Gui/AttachDialog.cpp
|
||||
src/gui/Src/Gui/AttachDialog.h
|
||||
src/gui/Src/Gui/BreakpointMenu.cpp
|
||||
src/gui/Src/Gui/BreakpointMenu.h
|
||||
src/gui/Src/Gui/BreakpointsView.cpp
|
||||
src/gui/Src/Gui/BreakpointsView.h
|
||||
src/gui/Src/Gui/BrowseDialog.cpp
|
||||
src/gui/Src/Gui/BrowseDialog.h
|
||||
src/gui/Src/Gui/CPUArgumentWidget.cpp
|
||||
src/gui/Src/Gui/CPUArgumentWidget.h
|
||||
src/gui/Src/Gui/CPUDisassembly.cpp
|
||||
src/gui/Src/Gui/CPUDisassembly.h
|
||||
src/gui/Src/Gui/CPUDump.cpp
|
||||
src/gui/Src/Gui/CPUDump.h
|
||||
src/gui/Src/Gui/CPUInfoBox.cpp
|
||||
src/gui/Src/Gui/CPUInfoBox.h
|
||||
src/gui/Src/Gui/CPUMultiDump.cpp
|
||||
src/gui/Src/Gui/CPUMultiDump.h
|
||||
src/gui/Src/Gui/CPUSideBar.cpp
|
||||
src/gui/Src/Gui/CPUSideBar.h
|
||||
src/gui/Src/Gui/CPUStack.cpp
|
||||
src/gui/Src/Gui/CPUStack.h
|
||||
src/gui/Src/Gui/CPUWidget.cpp
|
||||
src/gui/Src/Gui/CPUWidget.h
|
||||
src/gui/Src/Gui/CalculatorDialog.cpp
|
||||
src/gui/Src/Gui/CalculatorDialog.h
|
||||
src/gui/Src/Gui/CallStackView.cpp
|
||||
src/gui/Src/Gui/CallStackView.h
|
||||
src/gui/Src/Gui/CloseDialog.cpp
|
||||
src/gui/Src/Gui/CloseDialog.h
|
||||
src/gui/Src/Gui/CodepageSelectionDialog.cpp
|
||||
src/gui/Src/Gui/CodepageSelectionDialog.h
|
||||
src/gui/Src/Gui/ColumnReorderDialog.cpp
|
||||
src/gui/Src/Gui/ColumnReorderDialog.h
|
||||
src/gui/Src/Gui/ComboBoxDialog.cpp
|
||||
src/gui/Src/Gui/ComboBoxDialog.h
|
||||
src/gui/Src/Gui/CommandHelpView.cpp
|
||||
src/gui/Src/Gui/CommandHelpView.h
|
||||
src/gui/Src/Gui/CommandLineEdit.cpp
|
||||
src/gui/Src/Gui/CommandLineEdit.h
|
||||
src/gui/Src/Gui/CustomizeMenuDialog.cpp
|
||||
src/gui/Src/Gui/CustomizeMenuDialog.h
|
||||
src/gui/Src/Gui/DataCopyDialog.cpp
|
||||
src/gui/Src/Gui/DataCopyDialog.h
|
||||
src/gui/Src/Gui/DebugStatusLabel.cpp
|
||||
src/gui/Src/Gui/DebugStatusLabel.h
|
||||
src/gui/Src/Gui/DisassemblerGraphView.cpp
|
||||
src/gui/Src/Gui/DisassemblerGraphView.h
|
||||
src/gui/Src/Gui/DisassemblyPopup.cpp
|
||||
src/gui/Src/Gui/DisassemblyPopup.h
|
||||
src/gui/Src/Gui/EditBreakpointDialog.cpp
|
||||
src/gui/Src/Gui/EditBreakpointDialog.h
|
||||
src/gui/Src/Gui/EditFloatRegister.cpp
|
||||
src/gui/Src/Gui/EditFloatRegister.h
|
||||
src/gui/Src/Gui/EntropyDialog.cpp
|
||||
src/gui/Src/Gui/EntropyDialog.h
|
||||
src/gui/Src/Gui/ExceptionRangeDialog.cpp
|
||||
src/gui/Src/Gui/ExceptionRangeDialog.h
|
||||
src/gui/Src/Gui/FavouriteTools.cpp
|
||||
src/gui/Src/Gui/FavouriteTools.h
|
||||
src/gui/Src/Gui/GotoDialog.cpp
|
||||
src/gui/Src/Gui/GotoDialog.h
|
||||
src/gui/Src/Gui/HandlesView.cpp
|
||||
src/gui/Src/Gui/HandlesView.h
|
||||
src/gui/Src/Gui/HexEditDialog.cpp
|
||||
src/gui/Src/Gui/HexEditDialog.h
|
||||
src/gui/Src/Gui/HexLineEdit.cpp
|
||||
src/gui/Src/Gui/HexLineEdit.h
|
||||
src/gui/Src/Gui/LineEditDialog.cpp
|
||||
src/gui/Src/Gui/LineEditDialog.h
|
||||
src/gui/Src/Gui/LocalVarsView.cpp
|
||||
src/gui/Src/Gui/LocalVarsView.h
|
||||
src/gui/Src/Gui/LogStatusLabel.cpp
|
||||
src/gui/Src/Gui/LogStatusLabel.h
|
||||
src/gui/Src/Gui/LogView.cpp
|
||||
src/gui/Src/Gui/LogView.h
|
||||
src/gui/Src/Gui/MainWindow.cpp
|
||||
src/gui/Src/Gui/MainWindow.h
|
||||
src/gui/Src/Gui/MemoryMapView.cpp
|
||||
src/gui/Src/Gui/MemoryMapView.h
|
||||
src/gui/Src/Gui/MessagesBreakpoints.cpp
|
||||
src/gui/Src/Gui/MessagesBreakpoints.h
|
||||
src/gui/Src/Gui/NotepadView.cpp
|
||||
src/gui/Src/Gui/NotepadView.h
|
||||
src/gui/Src/Gui/NotesManager.cpp
|
||||
src/gui/Src/Gui/NotesManager.h
|
||||
src/gui/Src/Gui/PageMemoryRights.cpp
|
||||
src/gui/Src/Gui/PageMemoryRights.h
|
||||
src/gui/Src/Gui/PatchDialog.cpp
|
||||
src/gui/Src/Gui/PatchDialog.h
|
||||
src/gui/Src/Gui/PatchDialogGroupSelector.cpp
|
||||
src/gui/Src/Gui/PatchDialogGroupSelector.h
|
||||
src/gui/Src/Gui/ReferenceManager.cpp
|
||||
src/gui/Src/Gui/ReferenceManager.h
|
||||
src/gui/Src/Gui/RegistersView.cpp
|
||||
src/gui/Src/Gui/RegistersView.h
|
||||
src/gui/Src/Gui/SEHChainView.cpp
|
||||
src/gui/Src/Gui/SEHChainView.h
|
||||
src/gui/Src/Gui/ScriptView.cpp
|
||||
src/gui/Src/Gui/ScriptView.h
|
||||
src/gui/Src/Gui/SelectFields.cpp
|
||||
src/gui/Src/Gui/SelectFields.h
|
||||
src/gui/Src/Gui/SettingsDialog.cpp
|
||||
src/gui/Src/Gui/SettingsDialog.h
|
||||
src/gui/Src/Gui/ShortcutsDialog.cpp
|
||||
src/gui/Src/Gui/ShortcutsDialog.h
|
||||
src/gui/Src/Gui/SimpleTraceDialog.cpp
|
||||
src/gui/Src/Gui/SimpleTraceDialog.h
|
||||
src/gui/Src/Gui/SourceView.cpp
|
||||
src/gui/Src/Gui/SourceView.h
|
||||
src/gui/Src/Gui/SourceViewerManager.cpp
|
||||
src/gui/Src/Gui/SourceViewerManager.h
|
||||
src/gui/Src/Gui/StructWidget.cpp
|
||||
src/gui/Src/Gui/StructWidget.h
|
||||
src/gui/Src/Gui/SymbolView.cpp
|
||||
src/gui/Src/Gui/SymbolView.h
|
||||
src/gui/Src/Gui/TabBar.cpp
|
||||
src/gui/Src/Gui/TabBar.h
|
||||
src/gui/Src/Gui/TabWidget.cpp
|
||||
src/gui/Src/Gui/TabWidget.h
|
||||
src/gui/Src/Gui/ThreadView.cpp
|
||||
src/gui/Src/Gui/ThreadView.h
|
||||
src/gui/Src/Gui/TimeWastedCounter.cpp
|
||||
src/gui/Src/Gui/TimeWastedCounter.h
|
||||
src/gui/Src/Gui/VirtualModDialog.cpp
|
||||
src/gui/Src/Gui/VirtualModDialog.h
|
||||
src/gui/Src/Gui/WatchView.cpp
|
||||
src/gui/Src/Gui/WatchView.h
|
||||
src/gui/Src/Gui/WordEditDialog.cpp
|
||||
src/gui/Src/Gui/WordEditDialog.h
|
||||
src/gui/Src/Gui/XrefBrowseDialog.cpp
|
||||
src/gui/Src/Gui/XrefBrowseDialog.h
|
||||
src/gui/Src/Gui/YaraRuleSelectionDialog.cpp
|
||||
src/gui/Src/Gui/YaraRuleSelectionDialog.h
|
||||
src/gui/Src/Imports.h
|
||||
src/gui/Src/Memory/MemoryPage.cpp
|
||||
src/gui/Src/Memory/MemoryPage.h
|
||||
src/gui/Src/QEntropyView/Entropy.h
|
||||
src/gui/Src/QEntropyView/QEntropyView.cpp
|
||||
src/gui/Src/QEntropyView/QEntropyView.h
|
||||
src/gui/Src/QHexEdit/ArrayCommand.cpp
|
||||
src/gui/Src/QHexEdit/ArrayCommand.h
|
||||
src/gui/Src/QHexEdit/QHexEdit.cpp
|
||||
src/gui/Src/QHexEdit/QHexEdit.h
|
||||
src/gui/Src/QHexEdit/QHexEditPrivate.cpp
|
||||
src/gui/Src/QHexEdit/QHexEditPrivate.h
|
||||
src/gui/Src/QHexEdit/XByteArray.cpp
|
||||
src/gui/Src/QHexEdit/XByteArray.h
|
||||
src/gui/Src/ThirdPartyLibs/ldconvert/ldconvert.h
|
||||
src/gui/Src/ThirdPartyLibs/snowman/SnowmanView.h
|
||||
src/gui/Src/Utils/ActionHelpers.h
|
||||
src/gui/Src/Utils/Breakpoints.cpp
|
||||
src/gui/Src/Utils/Breakpoints.h
|
||||
src/gui/Src/Utils/CachedFontMetrics.h
|
||||
src/gui/Src/Utils/CodeFolding.cpp
|
||||
src/gui/Src/Utils/CodeFolding.h
|
||||
src/gui/Src/Utils/Configuration.cpp
|
||||
src/gui/Src/Utils/Configuration.h
|
||||
src/gui/Src/Utils/EncodeMap.cpp
|
||||
src/gui/Src/Utils/EncodeMap.h
|
||||
src/gui/Src/Utils/FlickerThread.cpp
|
||||
src/gui/Src/Utils/FlickerThread.h
|
||||
src/gui/Src/Utils/HexValidator.cpp
|
||||
src/gui/Src/Utils/HexValidator.h
|
||||
src/gui/Src/Utils/LongLongValidator.cpp
|
||||
src/gui/Src/Utils/LongLongValidator.h
|
||||
src/gui/Src/Utils/MRUList.cpp
|
||||
src/gui/Src/Utils/MRUList.h
|
||||
src/gui/Src/Utils/MainWindowCloseThread.cpp
|
||||
src/gui/Src/Utils/MainWindowCloseThread.h
|
||||
src/gui/Src/Utils/MenuBuilder.cpp
|
||||
src/gui/Src/Utils/MenuBuilder.h
|
||||
src/gui/Src/Utils/MiscUtil.cpp
|
||||
src/gui/Src/Utils/MiscUtil.h
|
||||
src/gui/Src/Utils/RichTextPainter.cpp
|
||||
src/gui/Src/Utils/RichTextPainter.h
|
||||
src/gui/Src/Utils/StringUtil.cpp
|
||||
src/gui/Src/Utils/StringUtil.h
|
||||
src/gui/Src/Utils/UpdateChecker.cpp
|
||||
src/gui/Src/Utils/UpdateChecker.h
|
||||
src/gui/Src/Utils/VaHistory.h
|
||||
src/gui/Src/Utils/ValidateExpressionThread.cpp
|
||||
src/gui/Src/Utils/ValidateExpressionThread.h
|
||||
src/gui/Src/main.cpp
|
||||
src/gui/Src/main.h
|
||||
src/launcher/x64dbg_launcher.cpp
|
||||
src/zydis_wrapper/ZydisExportConfig.h
|
||||
src/zydis_wrapper/zydis_wrapper.cpp
|
||||
src/zydis_wrapper/zydis_wrapper.h
|
||||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
# hooks
|
||||
|
||||
This contains two binaries `AStyleWhore.exe` and `AStyle.dll` to format any code before you commit. They are signed with the serial number `37 ba b6 0f 84 53 0e 5e e5 76 ba d2 6d 45 4b 58`.
|
||||
This contains two binaries `AStyleWhore.exe` and `AStyle.dll` to format any code before you commit.
|
||||
|
||||
If you are unsure about the integrity of the files, don't hesitate to contact me (mrexodia). The source code is available at [BitBucket](https://bitbucket.org/mrexodia/astylewhore). The version of `AStyle.dll` is compiled from `AStyle_2.06_windows.zip` which came from [Sourceforge](https://sourceforge.net/projects/astyle/files/astyle/astyle%202.06/AStyle_2.06_windows.zip/download).
|
||||
|
|
@ -1,329 +1,329 @@
|
|||
#include "CsQBeaEngine.h"
|
||||
#include "StringUtil.h"
|
||||
#include "EncodeMap.h"
|
||||
#include "CodeFolding.h"
|
||||
|
||||
CsQBeaEngine::CsQBeaEngine(int maxModuleSize)
|
||||
: _tokenizer(maxModuleSize), mCodeFoldingManager(nullptr), _bLongDataInst(false)
|
||||
{
|
||||
CsCapstoneTokenizer::UpdateColors();
|
||||
UpdateDataInstructionMap();
|
||||
this->mEncodeMap = new EncodeMap();
|
||||
}
|
||||
|
||||
CsQBeaEngine::~CsQBeaEngine()
|
||||
{
|
||||
delete this->mEncodeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the address of the nth instruction before the instruction pointed by ip. @n
|
||||
* This function has been grabbed from OllyDbg ("Disassembleback" in asmserv.c)
|
||||
*
|
||||
* @param[in] data Address of the data to disassemble
|
||||
* @param[in] base Original base address of the memory page (Required to disassemble destination addresses)
|
||||
* @param[in] size Size of the data block pointed by data
|
||||
* @param[in] ip RVA of the current instruction (Relative to data pointer)
|
||||
* @param[in] n Number of instruction back
|
||||
*
|
||||
* @return Return the RVA (Relative to the data pointer) of the nth instruction before the instruction pointed by ip
|
||||
*/
|
||||
ulong CsQBeaEngine::DisassembleBack(byte_t* data, duint base, duint size, duint ip, int n)
|
||||
{
|
||||
int i;
|
||||
uint abuf[128], addr, back, cmdsize;
|
||||
unsigned char* pdata;
|
||||
|
||||
// Reset Disasm Structure
|
||||
Capstone cp;
|
||||
|
||||
// Check if the pointer is not null
|
||||
if(data == NULL)
|
||||
return 0;
|
||||
|
||||
// Round the number of back instructions to 127
|
||||
if(n < 0)
|
||||
n = 0;
|
||||
else if(n > 127)
|
||||
n = 127;
|
||||
|
||||
// Check if the instruction pointer ip is not outside the memory range
|
||||
if(ip >= size)
|
||||
ip = size - 1;
|
||||
|
||||
// Obvious answer
|
||||
if(n == 0)
|
||||
return ip;
|
||||
|
||||
if(ip < (uint)n)
|
||||
return ip;
|
||||
|
||||
//TODO: buffer overflow due to unchecked "back" value
|
||||
back = MAX_DISASM_BUFFER * (n + 3); // Instruction length limited to 16
|
||||
|
||||
if(ip < back)
|
||||
back = ip;
|
||||
|
||||
addr = ip - back;
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(addr + base))
|
||||
{
|
||||
duint newback = mCodeFoldingManager->getFoldBegin(addr + base);
|
||||
if(newback >= base && newback < size + base)
|
||||
addr = newback - base;
|
||||
}
|
||||
|
||||
pdata = data + addr;
|
||||
|
||||
for(i = 0; addr < ip; i++)
|
||||
{
|
||||
abuf[i % 128] = addr;
|
||||
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(addr + base))
|
||||
{
|
||||
duint newaddr = mCodeFoldingManager->getFoldBegin(addr + base);
|
||||
if(newaddr >= base)
|
||||
{
|
||||
addr = newaddr - base;
|
||||
}
|
||||
cmdsize = mCodeFoldingManager->getFoldEnd(addr + base) - (addr + base) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!cp.DisassembleSafe(addr + base, pdata, (int)size))
|
||||
cmdsize = 2; //heuristic for better output (FF FE or FE FF are usually part of an instruction)
|
||||
else
|
||||
cmdsize = cp.Size();
|
||||
|
||||
cmdsize = mEncodeMap->getDataSize(base + addr, cmdsize);
|
||||
|
||||
}
|
||||
|
||||
|
||||
pdata += cmdsize;
|
||||
addr += cmdsize;
|
||||
back -= cmdsize;
|
||||
size -= cmdsize;
|
||||
}
|
||||
|
||||
if(i < n)
|
||||
return abuf[0];
|
||||
else
|
||||
return abuf[(i - n + 128) % 128];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the address of the nth instruction after the instruction pointed by ip. @n
|
||||
* This function has been grabbed from OllyDbg ("Disassembleforward" in asmserv.c)
|
||||
*
|
||||
* @param[in] data Address of the data to disassemble
|
||||
* @param[in] base Original base address of the memory page (Required to disassemble destination addresses)
|
||||
* @param[in] size Size of the data block pointed by data
|
||||
* @param[in] ip RVA of the current instruction (Relative to data pointer)
|
||||
* @param[in] n Number of instruction next
|
||||
*
|
||||
* @return Return the RVA (Relative to the data pointer) of the nth instruction after the instruction pointed by ip
|
||||
*/
|
||||
ulong CsQBeaEngine::DisassembleNext(byte_t* data, duint base, duint size, duint ip, int n)
|
||||
{
|
||||
int i;
|
||||
uint cmdsize;
|
||||
unsigned char* pdata;
|
||||
|
||||
// Reset Disasm Structure
|
||||
Capstone cp;
|
||||
|
||||
if(data == NULL)
|
||||
return 0;
|
||||
|
||||
if(ip >= size)
|
||||
ip = size - 1;
|
||||
|
||||
if(n <= 0)
|
||||
return ip;
|
||||
|
||||
|
||||
pdata = data + ip;
|
||||
size -= ip;
|
||||
|
||||
for(i = 0; i < n && size > 0; i++)
|
||||
{
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(ip + base))
|
||||
{
|
||||
cmdsize = mCodeFoldingManager->getFoldEnd(ip + base) - (ip + base) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!cp.DisassembleSafe(ip + base, pdata, (int)size))
|
||||
cmdsize = 1;
|
||||
else
|
||||
cmdsize = cp.Size();
|
||||
|
||||
cmdsize = mEncodeMap->getDataSize(base + ip, cmdsize);
|
||||
|
||||
}
|
||||
|
||||
pdata += cmdsize;
|
||||
ip += cmdsize;
|
||||
size -= cmdsize;
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disassemble the instruction at the given ip RVA.
|
||||
*
|
||||
* @param[in] data Pointer to memory data (Can be either a buffer or the original data memory)
|
||||
* @param[in] size Size of the memory pointed by data (Can be the memory page size if data points to the original memory page base address)
|
||||
* @param[in] origBase Original base address of the memory page (Required to disassemble destination addresses)
|
||||
* @param[in] origInstRVA Original Instruction RVA of the instruction to disassemble
|
||||
*
|
||||
* @return Return the disassembled instruction
|
||||
*/
|
||||
Instruction_t CsQBeaEngine::DisassembleAt(byte_t* data, duint size, duint origBase, duint origInstRVA, bool datainstr)
|
||||
{
|
||||
if(datainstr)
|
||||
{
|
||||
ENCODETYPE type = mEncodeMap->getDataType(origBase + origInstRVA);
|
||||
if(!mEncodeMap->isCode(type))
|
||||
return DecodeDataAt(data, size, origBase, origInstRVA, type);
|
||||
}
|
||||
//tokenize
|
||||
CapstoneTokenizer::InstructionToken cap;
|
||||
_tokenizer.Tokenize(origBase + origInstRVA, data, size, cap);
|
||||
int len = _tokenizer.Size();
|
||||
|
||||
const auto & cp = _tokenizer.GetCapstone();
|
||||
bool success = cp.Success();
|
||||
|
||||
|
||||
auto branchType = Instruction_t::None;
|
||||
Instruction_t wInst;
|
||||
if(success && (cp.InGroup(CS_GRP_JUMP) || cp.IsLoop() || cp.InGroup(CS_GRP_CALL) || cp.InGroup(CS_GRP_RET)))
|
||||
{
|
||||
wInst.branchDestination = DbgGetBranchDestination(origBase + origInstRVA);
|
||||
switch(cp.GetId())
|
||||
{
|
||||
case X86_INS_JMP:
|
||||
case X86_INS_LJMP:
|
||||
branchType = Instruction_t::Unconditional;
|
||||
break;
|
||||
case X86_INS_CALL:
|
||||
case X86_INS_LCALL:
|
||||
branchType = Instruction_t::Call;
|
||||
break;
|
||||
default:
|
||||
branchType = cp.InGroup(CS_GRP_RET) ? Instruction_t::None : Instruction_t::Conditional;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
wInst.branchDestination = 0;
|
||||
|
||||
wInst.instStr = QString(cp.InstructionText().c_str());
|
||||
wInst.dump = QByteArray((const char*)data, len);
|
||||
wInst.rva = origInstRVA;
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(origInstRVA))
|
||||
wInst.length = mCodeFoldingManager->getFoldEnd(origInstRVA + origBase) - (origInstRVA + origBase) + 1;
|
||||
else
|
||||
wInst.length = len;
|
||||
wInst.branchType = branchType;
|
||||
wInst.tokens = cap;
|
||||
|
||||
if(success)
|
||||
{
|
||||
cp.RegInfo(reginfo);
|
||||
cp.FlagInfo(flaginfo);
|
||||
|
||||
auto flaginfo2reginfo = [](uint8_t info)
|
||||
{
|
||||
auto result = 0;
|
||||
#define checkFlag(test, reg) result |= (info & test) == test ? reg : 0
|
||||
checkFlag(Capstone::Modify, Capstone::Write);
|
||||
checkFlag(Capstone::Prior, Capstone::None);
|
||||
checkFlag(Capstone::Reset, Capstone::Write);
|
||||
checkFlag(Capstone::Set, Capstone::Write);
|
||||
checkFlag(Capstone::Test, Capstone::Read);
|
||||
checkFlag(Capstone::Undefined, Capstone::None);
|
||||
#undef checkFlag
|
||||
return result;
|
||||
};
|
||||
|
||||
for(uint8_t i = Capstone::FLAG_INVALID; i < Capstone::FLAG_ENDING; i++)
|
||||
if(flaginfo[i])
|
||||
{
|
||||
reginfo[X86_REG_EFLAGS] = Capstone::None;
|
||||
wInst.regsReferenced.push_back({cp.FlagName(Capstone::Flag(i)), flaginfo2reginfo(flaginfo[i])});
|
||||
}
|
||||
|
||||
reginfo[ArchValue(X86_REG_EIP, X86_REG_RIP)] = Capstone::None;
|
||||
for(uint8_t i = X86_REG_INVALID; i < X86_REG_ENDING; i++)
|
||||
if(reginfo[i])
|
||||
wInst.regsReferenced.push_back({cp.RegName(x86_reg(i)), reginfo[i]});
|
||||
}
|
||||
|
||||
return wInst;
|
||||
}
|
||||
|
||||
Instruction_t CsQBeaEngine::DecodeDataAt(byte_t* data, duint size, duint origBase, duint origInstRVA, ENCODETYPE type)
|
||||
{
|
||||
//tokenize
|
||||
CapstoneTokenizer::InstructionToken cap;
|
||||
|
||||
auto & infoIter = dataInstMap.find(type);
|
||||
if(infoIter == dataInstMap.end())
|
||||
infoIter = dataInstMap.find(enc_byte);
|
||||
|
||||
int len = mEncodeMap->getDataSize(origBase + origInstRVA, 1);
|
||||
|
||||
QString mnemonic = _bLongDataInst ? infoIter.value().longName : infoIter.value().shortName;
|
||||
|
||||
len = std::min(len, (int)size);
|
||||
|
||||
QString datastr = GetDataTypeString(data, len, type);
|
||||
|
||||
_tokenizer.TokenizeData(mnemonic, datastr, cap);
|
||||
|
||||
Instruction_t wInst;
|
||||
wInst.instStr = mnemonic + " " + datastr;
|
||||
wInst.dump = QByteArray((const char*)data, len);
|
||||
wInst.rva = origInstRVA;
|
||||
wInst.length = len;
|
||||
wInst.branchType = Instruction_t::None;
|
||||
wInst.branchDestination = 0;
|
||||
wInst.tokens = cap;
|
||||
|
||||
return wInst;
|
||||
}
|
||||
|
||||
void CsQBeaEngine::UpdateDataInstructionMap()
|
||||
{
|
||||
dataInstMap.clear();
|
||||
dataInstMap.insert(enc_byte, {"db", "byte", "int8"});
|
||||
dataInstMap.insert(enc_word, {"dw", "word", "short"});
|
||||
dataInstMap.insert(enc_dword, {"dd", "dword", "int"});
|
||||
dataInstMap.insert(enc_fword, {"df", "fword", "fword"});
|
||||
dataInstMap.insert(enc_qword, {"dq", "qword", "long"});
|
||||
dataInstMap.insert(enc_tbyte, {"tbyte", "tbyte", "tbyte"});
|
||||
dataInstMap.insert(enc_oword, {"oword", "oword", "oword"});
|
||||
dataInstMap.insert(enc_mmword, {"mmword", "mmword", "long long"});
|
||||
dataInstMap.insert(enc_xmmword, {"xmmword", "xmmword", "_m128"});
|
||||
dataInstMap.insert(enc_ymmword, {"ymmword", "ymmword", "_m256"});
|
||||
dataInstMap.insert(enc_real4, {"real4", "real4", "float"});
|
||||
dataInstMap.insert(enc_real8, {"real8", "real8", "double"});
|
||||
dataInstMap.insert(enc_real10, {"real10", "real10", "long double"});
|
||||
dataInstMap.insert(enc_ascii, {"ascii", "ascii", "string"});
|
||||
dataInstMap.insert(enc_unicode, {"unicode", "unicode", "wstring"});
|
||||
}
|
||||
|
||||
void CsQBeaEngine::setCodeFoldingManager(CodeFoldingHelper* CodeFoldingManager)
|
||||
{
|
||||
mCodeFoldingManager = CodeFoldingManager;
|
||||
}
|
||||
|
||||
void CsQBeaEngine::UpdateConfig()
|
||||
{
|
||||
_bLongDataInst = ConfigBool("Disassembler", "LongDataInstruction");
|
||||
_tokenizer.UpdateConfig();
|
||||
}
|
||||
#include "CsQBeaEngine.h"
|
||||
#include "StringUtil.h"
|
||||
#include "EncodeMap.h"
|
||||
#include "CodeFolding.h"
|
||||
|
||||
CsQBeaEngine::CsQBeaEngine(int maxModuleSize)
|
||||
: _tokenizer(maxModuleSize), mCodeFoldingManager(nullptr), _bLongDataInst(false)
|
||||
{
|
||||
CsCapstoneTokenizer::UpdateColors();
|
||||
UpdateDataInstructionMap();
|
||||
this->mEncodeMap = new EncodeMap();
|
||||
}
|
||||
|
||||
CsQBeaEngine::~CsQBeaEngine()
|
||||
{
|
||||
delete this->mEncodeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the address of the nth instruction before the instruction pointed by ip. @n
|
||||
* This function has been grabbed from OllyDbg ("Disassembleback" in asmserv.c)
|
||||
*
|
||||
* @param[in] data Address of the data to disassemble
|
||||
* @param[in] base Original base address of the memory page (Required to disassemble destination addresses)
|
||||
* @param[in] size Size of the data block pointed by data
|
||||
* @param[in] ip RVA of the current instruction (Relative to data pointer)
|
||||
* @param[in] n Number of instruction back
|
||||
*
|
||||
* @return Return the RVA (Relative to the data pointer) of the nth instruction before the instruction pointed by ip
|
||||
*/
|
||||
ulong CsQBeaEngine::DisassembleBack(byte_t* data, duint base, duint size, duint ip, int n)
|
||||
{
|
||||
int i;
|
||||
uint abuf[128], addr, back, cmdsize;
|
||||
unsigned char* pdata;
|
||||
|
||||
// Reset Disasm Structure
|
||||
Capstone cp;
|
||||
|
||||
// Check if the pointer is not null
|
||||
if(data == NULL)
|
||||
return 0;
|
||||
|
||||
// Round the number of back instructions to 127
|
||||
if(n < 0)
|
||||
n = 0;
|
||||
else if(n > 127)
|
||||
n = 127;
|
||||
|
||||
// Check if the instruction pointer ip is not outside the memory range
|
||||
if(ip >= size)
|
||||
ip = size - 1;
|
||||
|
||||
// Obvious answer
|
||||
if(n == 0)
|
||||
return ip;
|
||||
|
||||
if(ip < (uint)n)
|
||||
return ip;
|
||||
|
||||
//TODO: buffer overflow due to unchecked "back" value
|
||||
back = MAX_DISASM_BUFFER * (n + 3); // Instruction length limited to 16
|
||||
|
||||
if(ip < back)
|
||||
back = ip;
|
||||
|
||||
addr = ip - back;
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(addr + base))
|
||||
{
|
||||
duint newback = mCodeFoldingManager->getFoldBegin(addr + base);
|
||||
if(newback >= base && newback < size + base)
|
||||
addr = newback - base;
|
||||
}
|
||||
|
||||
pdata = data + addr;
|
||||
|
||||
for(i = 0; addr < ip; i++)
|
||||
{
|
||||
abuf[i % 128] = addr;
|
||||
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(addr + base))
|
||||
{
|
||||
duint newaddr = mCodeFoldingManager->getFoldBegin(addr + base);
|
||||
if(newaddr >= base)
|
||||
{
|
||||
addr = newaddr - base;
|
||||
}
|
||||
cmdsize = mCodeFoldingManager->getFoldEnd(addr + base) - (addr + base) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!cp.DisassembleSafe(addr + base, pdata, (int)size))
|
||||
cmdsize = 2; //heuristic for better output (FF FE or FE FF are usually part of an instruction)
|
||||
else
|
||||
cmdsize = cp.Size();
|
||||
|
||||
cmdsize = mEncodeMap->getDataSize(base + addr, cmdsize);
|
||||
|
||||
}
|
||||
|
||||
|
||||
pdata += cmdsize;
|
||||
addr += cmdsize;
|
||||
back -= cmdsize;
|
||||
size -= cmdsize;
|
||||
}
|
||||
|
||||
if(i < n)
|
||||
return abuf[0];
|
||||
else
|
||||
return abuf[(i - n + 128) % 128];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the address of the nth instruction after the instruction pointed by ip. @n
|
||||
* This function has been grabbed from OllyDbg ("Disassembleforward" in asmserv.c)
|
||||
*
|
||||
* @param[in] data Address of the data to disassemble
|
||||
* @param[in] base Original base address of the memory page (Required to disassemble destination addresses)
|
||||
* @param[in] size Size of the data block pointed by data
|
||||
* @param[in] ip RVA of the current instruction (Relative to data pointer)
|
||||
* @param[in] n Number of instruction next
|
||||
*
|
||||
* @return Return the RVA (Relative to the data pointer) of the nth instruction after the instruction pointed by ip
|
||||
*/
|
||||
ulong CsQBeaEngine::DisassembleNext(byte_t* data, duint base, duint size, duint ip, int n)
|
||||
{
|
||||
int i;
|
||||
uint cmdsize;
|
||||
unsigned char* pdata;
|
||||
|
||||
// Reset Disasm Structure
|
||||
Capstone cp;
|
||||
|
||||
if(data == NULL)
|
||||
return 0;
|
||||
|
||||
if(ip >= size)
|
||||
ip = size - 1;
|
||||
|
||||
if(n <= 0)
|
||||
return ip;
|
||||
|
||||
|
||||
pdata = data + ip;
|
||||
size -= ip;
|
||||
|
||||
for(i = 0; i < n && size > 0; i++)
|
||||
{
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(ip + base))
|
||||
{
|
||||
cmdsize = mCodeFoldingManager->getFoldEnd(ip + base) - (ip + base) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!cp.DisassembleSafe(ip + base, pdata, (int)size))
|
||||
cmdsize = 1;
|
||||
else
|
||||
cmdsize = cp.Size();
|
||||
|
||||
cmdsize = mEncodeMap->getDataSize(base + ip, cmdsize);
|
||||
|
||||
}
|
||||
|
||||
pdata += cmdsize;
|
||||
ip += cmdsize;
|
||||
size -= cmdsize;
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disassemble the instruction at the given ip RVA.
|
||||
*
|
||||
* @param[in] data Pointer to memory data (Can be either a buffer or the original data memory)
|
||||
* @param[in] size Size of the memory pointed by data (Can be the memory page size if data points to the original memory page base address)
|
||||
* @param[in] origBase Original base address of the memory page (Required to disassemble destination addresses)
|
||||
* @param[in] origInstRVA Original Instruction RVA of the instruction to disassemble
|
||||
*
|
||||
* @return Return the disassembled instruction
|
||||
*/
|
||||
Instruction_t CsQBeaEngine::DisassembleAt(byte_t* data, duint size, duint origBase, duint origInstRVA, bool datainstr)
|
||||
{
|
||||
if(datainstr)
|
||||
{
|
||||
ENCODETYPE type = mEncodeMap->getDataType(origBase + origInstRVA);
|
||||
if(!mEncodeMap->isCode(type))
|
||||
return DecodeDataAt(data, size, origBase, origInstRVA, type);
|
||||
}
|
||||
//tokenize
|
||||
CapstoneTokenizer::InstructionToken cap;
|
||||
_tokenizer.Tokenize(origBase + origInstRVA, data, size, cap);
|
||||
int len = _tokenizer.Size();
|
||||
|
||||
const auto & cp = _tokenizer.GetCapstone();
|
||||
bool success = cp.Success();
|
||||
|
||||
|
||||
auto branchType = Instruction_t::None;
|
||||
Instruction_t wInst;
|
||||
if(success && (cp.InGroup(CS_GRP_JUMP) || cp.IsLoop() || cp.InGroup(CS_GRP_CALL) || cp.InGroup(CS_GRP_RET)))
|
||||
{
|
||||
wInst.branchDestination = DbgGetBranchDestination(origBase + origInstRVA);
|
||||
switch(cp.GetId())
|
||||
{
|
||||
case X86_INS_JMP:
|
||||
case X86_INS_LJMP:
|
||||
branchType = Instruction_t::Unconditional;
|
||||
break;
|
||||
case X86_INS_CALL:
|
||||
case X86_INS_LCALL:
|
||||
branchType = Instruction_t::Call;
|
||||
break;
|
||||
default:
|
||||
branchType = cp.InGroup(CS_GRP_RET) ? Instruction_t::None : Instruction_t::Conditional;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
wInst.branchDestination = 0;
|
||||
|
||||
wInst.instStr = QString(cp.InstructionText().c_str());
|
||||
wInst.dump = QByteArray((const char*)data, len);
|
||||
wInst.rva = origInstRVA;
|
||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(origInstRVA))
|
||||
wInst.length = mCodeFoldingManager->getFoldEnd(origInstRVA + origBase) - (origInstRVA + origBase) + 1;
|
||||
else
|
||||
wInst.length = len;
|
||||
wInst.branchType = branchType;
|
||||
wInst.tokens = cap;
|
||||
|
||||
if(success)
|
||||
{
|
||||
cp.RegInfo(reginfo);
|
||||
cp.FlagInfo(flaginfo);
|
||||
|
||||
auto flaginfo2reginfo = [](uint8_t info)
|
||||
{
|
||||
auto result = 0;
|
||||
#define checkFlag(test, reg) result |= (info & test) == test ? reg : 0
|
||||
checkFlag(Capstone::Modify, Capstone::Write);
|
||||
checkFlag(Capstone::Prior, Capstone::None);
|
||||
checkFlag(Capstone::Reset, Capstone::Write);
|
||||
checkFlag(Capstone::Set, Capstone::Write);
|
||||
checkFlag(Capstone::Test, Capstone::Read);
|
||||
checkFlag(Capstone::Undefined, Capstone::None);
|
||||
#undef checkFlag
|
||||
return result;
|
||||
};
|
||||
|
||||
for(uint8_t i = Capstone::FLAG_INVALID; i < Capstone::FLAG_ENDING; i++)
|
||||
if(flaginfo[i])
|
||||
{
|
||||
reginfo[X86_REG_EFLAGS] = Capstone::None;
|
||||
wInst.regsReferenced.push_back({cp.FlagName(Capstone::Flag(i)), flaginfo2reginfo(flaginfo[i])});
|
||||
}
|
||||
|
||||
reginfo[ArchValue(X86_REG_EIP, X86_REG_RIP)] = Capstone::None;
|
||||
for(uint8_t i = X86_REG_INVALID; i < X86_REG_ENDING; i++)
|
||||
if(reginfo[i])
|
||||
wInst.regsReferenced.push_back({cp.RegName(x86_reg(i)), reginfo[i]});
|
||||
}
|
||||
|
||||
return wInst;
|
||||
}
|
||||
|
||||
Instruction_t CsQBeaEngine::DecodeDataAt(byte_t* data, duint size, duint origBase, duint origInstRVA, ENCODETYPE type)
|
||||
{
|
||||
//tokenize
|
||||
CapstoneTokenizer::InstructionToken cap;
|
||||
|
||||
auto & infoIter = dataInstMap.find(type);
|
||||
if(infoIter == dataInstMap.end())
|
||||
infoIter = dataInstMap.find(enc_byte);
|
||||
|
||||
int len = mEncodeMap->getDataSize(origBase + origInstRVA, 1);
|
||||
|
||||
QString mnemonic = _bLongDataInst ? infoIter.value().longName : infoIter.value().shortName;
|
||||
|
||||
len = std::min(len, (int)size);
|
||||
|
||||
QString datastr = GetDataTypeString(data, len, type);
|
||||
|
||||
_tokenizer.TokenizeData(mnemonic, datastr, cap);
|
||||
|
||||
Instruction_t wInst;
|
||||
wInst.instStr = mnemonic + " " + datastr;
|
||||
wInst.dump = QByteArray((const char*)data, len);
|
||||
wInst.rva = origInstRVA;
|
||||
wInst.length = len;
|
||||
wInst.branchType = Instruction_t::None;
|
||||
wInst.branchDestination = 0;
|
||||
wInst.tokens = cap;
|
||||
|
||||
return wInst;
|
||||
}
|
||||
|
||||
void CsQBeaEngine::UpdateDataInstructionMap()
|
||||
{
|
||||
dataInstMap.clear();
|
||||
dataInstMap.insert(enc_byte, {"db", "byte", "int8"});
|
||||
dataInstMap.insert(enc_word, {"dw", "word", "short"});
|
||||
dataInstMap.insert(enc_dword, {"dd", "dword", "int"});
|
||||
dataInstMap.insert(enc_fword, {"df", "fword", "fword"});
|
||||
dataInstMap.insert(enc_qword, {"dq", "qword", "long"});
|
||||
dataInstMap.insert(enc_tbyte, {"tbyte", "tbyte", "tbyte"});
|
||||
dataInstMap.insert(enc_oword, {"oword", "oword", "oword"});
|
||||
dataInstMap.insert(enc_mmword, {"mmword", "mmword", "long long"});
|
||||
dataInstMap.insert(enc_xmmword, {"xmmword", "xmmword", "_m128"});
|
||||
dataInstMap.insert(enc_ymmword, {"ymmword", "ymmword", "_m256"});
|
||||
dataInstMap.insert(enc_real4, {"real4", "real4", "float"});
|
||||
dataInstMap.insert(enc_real8, {"real8", "real8", "double"});
|
||||
dataInstMap.insert(enc_real10, {"real10", "real10", "long double"});
|
||||
dataInstMap.insert(enc_ascii, {"ascii", "ascii", "string"});
|
||||
dataInstMap.insert(enc_unicode, {"unicode", "unicode", "wstring"});
|
||||
}
|
||||
|
||||
void CsQBeaEngine::setCodeFoldingManager(CodeFoldingHelper* CodeFoldingManager)
|
||||
{
|
||||
mCodeFoldingManager = CodeFoldingManager;
|
||||
}
|
||||
|
||||
void CsQBeaEngine::UpdateConfig()
|
||||
{
|
||||
_bLongDataInst = ConfigBool("Disassembler", "LongDataInstruction");
|
||||
_tokenizer.UpdateConfig();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,47 @@
|
|||
#ifndef CSQBEAENGINE_H
|
||||
#define CSQBEAENGINE_H
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
#include "cs_capstone_gui.h"
|
||||
#include "QBeaEngine.h" // for instruction_t
|
||||
|
||||
class EncodeMap;
|
||||
class CodeFoldingHelper;
|
||||
|
||||
class CsQBeaEngine
|
||||
{
|
||||
public:
|
||||
explicit CsQBeaEngine(int maxModuleSize);
|
||||
~CsQBeaEngine();
|
||||
ulong DisassembleBack(byte_t* data, duint base, duint size, duint ip, int n);
|
||||
ulong DisassembleNext(byte_t* data, duint base, duint size, duint ip, int n);
|
||||
Instruction_t DisassembleAt(byte_t* data, duint size, duint origBase, duint origInstRVA, bool datainstr = true);
|
||||
Instruction_t DecodeDataAt(byte_t* data, duint size, duint origBase, duint origInstRVA, ENCODETYPE type);
|
||||
void setCodeFoldingManager(CodeFoldingHelper* CodeFoldingManager);
|
||||
void UpdateConfig();
|
||||
|
||||
EncodeMap* getEncodeMap()
|
||||
{
|
||||
return mEncodeMap;
|
||||
}
|
||||
|
||||
private:
|
||||
struct DataInstructionInfo
|
||||
{
|
||||
QString shortName;
|
||||
QString longName;
|
||||
QString cName;
|
||||
};
|
||||
|
||||
void UpdateDataInstructionMap();
|
||||
CsCapstoneTokenizer _tokenizer;
|
||||
QHash<ENCODETYPE, DataInstructionInfo> dataInstMap;
|
||||
bool _bLongDataInst;
|
||||
EncodeMap* mEncodeMap;
|
||||
CodeFoldingHelper* mCodeFoldingManager;
|
||||
uint8_t reginfo[X86_REG_ENDING];
|
||||
uint8_t flaginfo[Capstone::FLAG_ENDING];
|
||||
};
|
||||
|
||||
#endif // CSQBEAENGINE_H
|
||||
#ifndef CSQBEAENGINE_H
|
||||
#define CSQBEAENGINE_H
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
#include "cs_capstone_gui.h"
|
||||
#include "QBeaEngine.h" // for instruction_t
|
||||
|
||||
class EncodeMap;
|
||||
class CodeFoldingHelper;
|
||||
|
||||
class CsQBeaEngine
|
||||
{
|
||||
public:
|
||||
explicit CsQBeaEngine(int maxModuleSize);
|
||||
~CsQBeaEngine();
|
||||
ulong DisassembleBack(byte_t* data, duint base, duint size, duint ip, int n);
|
||||
ulong DisassembleNext(byte_t* data, duint base, duint size, duint ip, int n);
|
||||
Instruction_t DisassembleAt(byte_t* data, duint size, duint origBase, duint origInstRVA, bool datainstr = true);
|
||||
Instruction_t DecodeDataAt(byte_t* data, duint size, duint origBase, duint origInstRVA, ENCODETYPE type);
|
||||
void setCodeFoldingManager(CodeFoldingHelper* CodeFoldingManager);
|
||||
void UpdateConfig();
|
||||
|
||||
EncodeMap* getEncodeMap()
|
||||
{
|
||||
return mEncodeMap;
|
||||
}
|
||||
|
||||
private:
|
||||
struct DataInstructionInfo
|
||||
{
|
||||
QString shortName;
|
||||
QString longName;
|
||||
QString cName;
|
||||
};
|
||||
|
||||
void UpdateDataInstructionMap();
|
||||
CsCapstoneTokenizer _tokenizer;
|
||||
QHash<ENCODETYPE, DataInstructionInfo> dataInstMap;
|
||||
bool _bLongDataInst;
|
||||
EncodeMap* mEncodeMap;
|
||||
CodeFoldingHelper* mCodeFoldingManager;
|
||||
uint8_t reginfo[X86_REG_ENDING];
|
||||
uint8_t flaginfo[Capstone::FLAG_ENDING];
|
||||
};
|
||||
|
||||
#endif // CSQBEAENGINE_H
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,67 +1,67 @@
|
|||
#ifndef CS_CAPSTONE_GUI_H
|
||||
#define CS_CAPSTONE_GUI_H
|
||||
|
||||
#include <capstone_wrapper.h>
|
||||
#include "RichTextPainter.h"
|
||||
#include "Configuration.h"
|
||||
#include <map>
|
||||
#include <QHash>
|
||||
#include <QtCore>
|
||||
|
||||
#include "capstone_gui.h"
|
||||
|
||||
class CsCapstoneTokenizer
|
||||
{
|
||||
public:
|
||||
CsCapstoneTokenizer(int maxModuleLength);
|
||||
bool Tokenize(duint addr, const unsigned char* data, int datasize, CapstoneTokenizer::InstructionToken & instruction);
|
||||
bool TokenizeData(const QString & datatype, const QString & data, CapstoneTokenizer::InstructionToken & instruction);
|
||||
void UpdateConfig();
|
||||
void SetConfig(bool bUppercase, bool bTabbedMnemonic, bool bArgumentSpaces, bool bMemorySpaces, bool bNoHighlightOperands, bool bNoCurrentModuleText, bool b0xPrefixValues);
|
||||
int Size() const;
|
||||
const Capstone & GetCapstone() const;
|
||||
|
||||
static void UpdateColors();
|
||||
static void UpdateStringPool();
|
||||
static void TokenToRichText(const CapstoneTokenizer::InstructionToken & instr, RichTextPainter::List & richTextList, const CapstoneTokenizer::SingleToken* highlightToken);
|
||||
static bool TokenFromX(const CapstoneTokenizer::InstructionToken & instr, CapstoneTokenizer::SingleToken & token, int x, CachedFontMetrics* fontMetrics);
|
||||
static bool IsHighlightableToken(const CapstoneTokenizer::SingleToken & token);
|
||||
static bool TokenEquals(const CapstoneTokenizer::SingleToken* a, const CapstoneTokenizer::SingleToken* b, bool ignoreSize = true);
|
||||
static void addColorName(CapstoneTokenizer::TokenType type, QString color, QString backgroundColor);
|
||||
static void addStringsToPool(const QString & regs);
|
||||
static bool tokenTextPoolEquals(const QString & a, const QString & b);
|
||||
|
||||
private:
|
||||
Capstone _cp;
|
||||
bool isNop;
|
||||
CapstoneTokenizer::InstructionToken _inst;
|
||||
bool _success;
|
||||
int _maxModuleLength;
|
||||
bool _bUppercase;
|
||||
bool _bTabbedMnemonic;
|
||||
bool _bArgumentSpaces;
|
||||
bool _bMemorySpaces;
|
||||
bool _bNoHighlightOperands;
|
||||
bool _bNoCurrentModuleText;
|
||||
bool _b0xPrefixValues;
|
||||
CapstoneTokenizer::TokenType _mnemonicType;
|
||||
|
||||
void addToken(CapstoneTokenizer::TokenType type, QString text, const CapstoneTokenizer::TokenValue & value);
|
||||
void addToken(CapstoneTokenizer::TokenType type, const QString & text);
|
||||
void addMemoryOperator(char operatorText);
|
||||
QString printValue(const CapstoneTokenizer::TokenValue & value, bool expandModule, int maxModuleLength) const;
|
||||
|
||||
static QHash<QString, int> stringPoolMap;
|
||||
static int poolId;
|
||||
|
||||
bool tokenizePrefix();
|
||||
bool tokenizeMnemonic();
|
||||
bool tokenizeMnemonic(CapstoneTokenizer::TokenType type, const QString & mnemonic);
|
||||
bool tokenizeOperand(const cs_x86_op & op);
|
||||
bool tokenizeRegOperand(const cs_x86_op & op);
|
||||
bool tokenizeImmOperand(const cs_x86_op & op);
|
||||
bool tokenizeMemOperand(const cs_x86_op & op);
|
||||
bool tokenizeInvalidOperand(const cs_x86_op & op);
|
||||
};
|
||||
|
||||
#endif //CS_CAPSTONE_GUI_H
|
||||
#ifndef CS_CAPSTONE_GUI_H
|
||||
#define CS_CAPSTONE_GUI_H
|
||||
|
||||
#include <capstone_wrapper.h>
|
||||
#include "RichTextPainter.h"
|
||||
#include "Configuration.h"
|
||||
#include <map>
|
||||
#include <QHash>
|
||||
#include <QtCore>
|
||||
|
||||
#include "capstone_gui.h"
|
||||
|
||||
class CsCapstoneTokenizer
|
||||
{
|
||||
public:
|
||||
CsCapstoneTokenizer(int maxModuleLength);
|
||||
bool Tokenize(duint addr, const unsigned char* data, int datasize, CapstoneTokenizer::InstructionToken & instruction);
|
||||
bool TokenizeData(const QString & datatype, const QString & data, CapstoneTokenizer::InstructionToken & instruction);
|
||||
void UpdateConfig();
|
||||
void SetConfig(bool bUppercase, bool bTabbedMnemonic, bool bArgumentSpaces, bool bMemorySpaces, bool bNoHighlightOperands, bool bNoCurrentModuleText, bool b0xPrefixValues);
|
||||
int Size() const;
|
||||
const Capstone & GetCapstone() const;
|
||||
|
||||
static void UpdateColors();
|
||||
static void UpdateStringPool();
|
||||
static void TokenToRichText(const CapstoneTokenizer::InstructionToken & instr, RichTextPainter::List & richTextList, const CapstoneTokenizer::SingleToken* highlightToken);
|
||||
static bool TokenFromX(const CapstoneTokenizer::InstructionToken & instr, CapstoneTokenizer::SingleToken & token, int x, CachedFontMetrics* fontMetrics);
|
||||
static bool IsHighlightableToken(const CapstoneTokenizer::SingleToken & token);
|
||||
static bool TokenEquals(const CapstoneTokenizer::SingleToken* a, const CapstoneTokenizer::SingleToken* b, bool ignoreSize = true);
|
||||
static void addColorName(CapstoneTokenizer::TokenType type, QString color, QString backgroundColor);
|
||||
static void addStringsToPool(const QString & regs);
|
||||
static bool tokenTextPoolEquals(const QString & a, const QString & b);
|
||||
|
||||
private:
|
||||
Capstone _cp;
|
||||
bool isNop;
|
||||
CapstoneTokenizer::InstructionToken _inst;
|
||||
bool _success;
|
||||
int _maxModuleLength;
|
||||
bool _bUppercase;
|
||||
bool _bTabbedMnemonic;
|
||||
bool _bArgumentSpaces;
|
||||
bool _bMemorySpaces;
|
||||
bool _bNoHighlightOperands;
|
||||
bool _bNoCurrentModuleText;
|
||||
bool _b0xPrefixValues;
|
||||
CapstoneTokenizer::TokenType _mnemonicType;
|
||||
|
||||
void addToken(CapstoneTokenizer::TokenType type, QString text, const CapstoneTokenizer::TokenValue & value);
|
||||
void addToken(CapstoneTokenizer::TokenType type, const QString & text);
|
||||
void addMemoryOperator(char operatorText);
|
||||
QString printValue(const CapstoneTokenizer::TokenValue & value, bool expandModule, int maxModuleLength) const;
|
||||
|
||||
static QHash<QString, int> stringPoolMap;
|
||||
static int poolId;
|
||||
|
||||
bool tokenizePrefix();
|
||||
bool tokenizeMnemonic();
|
||||
bool tokenizeMnemonic(CapstoneTokenizer::TokenType type, const QString & mnemonic);
|
||||
bool tokenizeOperand(const cs_x86_op & op);
|
||||
bool tokenizeRegOperand(const cs_x86_op & op);
|
||||
bool tokenizeImmOperand(const cs_x86_op & op);
|
||||
bool tokenizeMemOperand(const cs_x86_op & op);
|
||||
bool tokenizeInvalidOperand(const cs_x86_op & op);
|
||||
};
|
||||
|
||||
#endif //CS_CAPSTONE_GUI_H
|
||||
|
|
|
|||
|
|
@ -1,41 +1,41 @@
|
|||
|
||||
#ifndef ZYDIS_EXPORT_H
|
||||
#define ZYDIS_EXPORT_H
|
||||
|
||||
#ifdef ZYDIS_STATIC_DEFINE
|
||||
# define ZYDIS_EXPORT
|
||||
# define ZYDIS_NO_EXPORT
|
||||
#else
|
||||
# ifndef ZYDIS_EXPORT
|
||||
# ifdef Zydis_EXPORTS
|
||||
/* We are building this library */
|
||||
# define ZYDIS_EXPORT
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define ZYDIS_EXPORT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef ZYDIS_NO_EXPORT
|
||||
# define ZYDIS_NO_EXPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZYDIS_DEPRECATED
|
||||
# define ZYDIS_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifndef ZYDIS_DEPRECATED_EXPORT
|
||||
# define ZYDIS_DEPRECATED_EXPORT ZYDIS_EXPORT ZYDIS_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef ZYDIS_DEPRECATED_NO_EXPORT
|
||||
# define ZYDIS_DEPRECATED_NO_EXPORT ZYDIS_NO_EXPORT ZYDIS_DEPRECATED
|
||||
#endif
|
||||
|
||||
#define DEFINE_NO_DEPRECATED 0
|
||||
#if DEFINE_NO_DEPRECATED
|
||||
# define ZYDIS_NO_DEPRECATED
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef ZYDIS_EXPORT_H
|
||||
#define ZYDIS_EXPORT_H
|
||||
|
||||
#ifdef ZYDIS_STATIC_DEFINE
|
||||
# define ZYDIS_EXPORT
|
||||
# define ZYDIS_NO_EXPORT
|
||||
#else
|
||||
# ifndef ZYDIS_EXPORT
|
||||
# ifdef Zydis_EXPORTS
|
||||
/* We are building this library */
|
||||
# define ZYDIS_EXPORT
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define ZYDIS_EXPORT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef ZYDIS_NO_EXPORT
|
||||
# define ZYDIS_NO_EXPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZYDIS_DEPRECATED
|
||||
# define ZYDIS_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifndef ZYDIS_DEPRECATED_EXPORT
|
||||
# define ZYDIS_DEPRECATED_EXPORT ZYDIS_EXPORT ZYDIS_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef ZYDIS_DEPRECATED_NO_EXPORT
|
||||
# define ZYDIS_DEPRECATED_NO_EXPORT ZYDIS_NO_EXPORT ZYDIS_DEPRECATED
|
||||
#endif
|
||||
|
||||
#define DEFINE_NO_DEPRECATED 0
|
||||
#if DEFINE_NO_DEPRECATED
|
||||
# define ZYDIS_NO_DEPRECATED
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,109 +1,109 @@
|
|||
#ifndef ZYDIS_WRAPPER_H
|
||||
#define ZYDIS_WRAPPER_H
|
||||
|
||||
#include "Zydis/Zydis.h"
|
||||
#include <functional>
|
||||
|
||||
#define MAX_DISASM_BUFFER 16
|
||||
|
||||
class Zydis
|
||||
{
|
||||
public:
|
||||
static void GlobalInitialize();
|
||||
static void GlobalFinalize();
|
||||
Zydis();
|
||||
Zydis(const Zydis & capstone) = delete;
|
||||
~Zydis();
|
||||
bool Disassemble(size_t addr, const unsigned char data[MAX_DISASM_BUFFER]);
|
||||
bool Disassemble(size_t addr, const unsigned char* data, int size);
|
||||
bool DisassembleSafe(size_t addr, const unsigned char* data, int size);
|
||||
const ZydisDecodedInstruction* GetInstr() const;
|
||||
bool Success() const;
|
||||
const char* RegName(ZydisRegister reg) const;
|
||||
std::string OperandText(int opindex) const;
|
||||
int Size() const;
|
||||
size_t Address() const;
|
||||
bool IsFilling() const;
|
||||
bool IsUnusual() const;
|
||||
bool IsNop() const;
|
||||
bool IsPushPop() const;
|
||||
ZydisMnemonic GetId() const;
|
||||
std::string InstructionText(bool replaceRipRelative = true) const;
|
||||
int OpCount() const;
|
||||
const ZydisDecodedOperand & operator[](int index) const;
|
||||
std::string Mnemonic() const;
|
||||
std::string MnemonicId() const;
|
||||
const char* MemSizeName(int size) const;
|
||||
size_t BranchDestination() const;
|
||||
size_t ResolveOpValue(int opindex, const std::function<size_t(ZydisRegister)> & resolveReg) const;
|
||||
bool IsBranchGoingToExecute(size_t cflags, size_t ccx) const;
|
||||
static bool IsBranchGoingToExecute(ZydisMnemonic id, size_t cflags, size_t ccx);
|
||||
bool IsConditionalGoingToExecute(size_t cflags, size_t ccx) const;
|
||||
static bool IsConditionalGoingToExecute(ZydisMnemonic id, size_t cflags, size_t ccx);
|
||||
|
||||
enum RegAccessInfo : uint8_t
|
||||
{
|
||||
RAINone = 0,
|
||||
RAIRead = 1 << 0,
|
||||
RAIWrite = 1 << 1,
|
||||
RAIImplicit = 1 << 2,
|
||||
RAIExplicit = 1 << 3
|
||||
};
|
||||
|
||||
void RegInfo(uint8_t info[ZYDIS_REGISTER_MAX_VALUE + 1]) const;
|
||||
const char* FlagName(ZydisCPUFlag flag) const;
|
||||
|
||||
enum BranchType : uint32_t
|
||||
{
|
||||
// Basic types.
|
||||
BTRet = 1 << 0,
|
||||
BTCall = 1 << 1,
|
||||
BTFarCall = 1 << 2,
|
||||
BTFarRet = 1 << 3,
|
||||
BTSyscall = 1 << 4, // Also sysenter
|
||||
BTSysret = 1 << 5, // Also sysexit
|
||||
BTInt = 1 << 6,
|
||||
BTInt3 = 1 << 7,
|
||||
BTInt1 = 1 << 8,
|
||||
BTIret = 1 << 9,
|
||||
BTCondJmp = 1 << 10,
|
||||
BTUncondJmp = 1 << 11,
|
||||
BTFarJmp = 1 << 12,
|
||||
BTXbegin = 1 << 13,
|
||||
BTXabort = 1 << 14,
|
||||
BTRsm = 1 << 15,
|
||||
BTLoop = 1 << 16,
|
||||
|
||||
BTJmp = BTCondJmp | BTUncondJmp,
|
||||
|
||||
// Semantic groups (behaves like XX).
|
||||
BTCallSem = BTCall | BTFarCall | BTSyscall | BTInt,
|
||||
BTRetSem = BTRet | BTSysret | BTIret | BTFarRet| BTRsm,
|
||||
BTCondJmpSem = BTCondJmp | BTLoop | BTXbegin,
|
||||
BTUncondJmpSem = BTUncondJmp | BTFarJmp | BTXabort,
|
||||
|
||||
BTRtm = BTXabort | BTXbegin,
|
||||
BTFar = BTFarCall | BTFarJmp | BTFarRet,
|
||||
|
||||
BTAny = std::underlying_type_t<BranchType>(-1)
|
||||
};
|
||||
|
||||
bool IsBranchType(std::underlying_type_t<BranchType> bt) const;
|
||||
|
||||
// Shortcuts.
|
||||
bool IsRet() const { return IsBranchType(BTRet); }
|
||||
bool IsCall() const { return IsBranchType(BTCall); }
|
||||
bool IsJump() const { return IsBranchType(BTJmp); }
|
||||
bool IsLoop() const { return IsBranchType(BTLoop); }
|
||||
bool IsInt3() const { return IsBranchType(BTInt3); }
|
||||
private:
|
||||
static ZydisDecoder mDecoder;
|
||||
static ZydisFormatter mFormatter;
|
||||
static bool mInitialized;
|
||||
ZydisDecodedInstruction mInstr;
|
||||
char mInstrText[200];
|
||||
bool mSuccess;
|
||||
uint8_t mVisibleOpCount;
|
||||
};
|
||||
|
||||
#endif //ZYDIS_WRAPPER_H
|
||||
#ifndef ZYDIS_WRAPPER_H
|
||||
#define ZYDIS_WRAPPER_H
|
||||
|
||||
#include "Zydis/Zydis.h"
|
||||
#include <functional>
|
||||
|
||||
#define MAX_DISASM_BUFFER 16
|
||||
|
||||
class Zydis
|
||||
{
|
||||
public:
|
||||
static void GlobalInitialize();
|
||||
static void GlobalFinalize();
|
||||
Zydis();
|
||||
Zydis(const Zydis & capstone) = delete;
|
||||
~Zydis();
|
||||
bool Disassemble(size_t addr, const unsigned char data[MAX_DISASM_BUFFER]);
|
||||
bool Disassemble(size_t addr, const unsigned char* data, int size);
|
||||
bool DisassembleSafe(size_t addr, const unsigned char* data, int size);
|
||||
const ZydisDecodedInstruction* GetInstr() const;
|
||||
bool Success() const;
|
||||
const char* RegName(ZydisRegister reg) const;
|
||||
std::string OperandText(int opindex) const;
|
||||
int Size() const;
|
||||
size_t Address() const;
|
||||
bool IsFilling() const;
|
||||
bool IsUnusual() const;
|
||||
bool IsNop() const;
|
||||
bool IsPushPop() const;
|
||||
ZydisMnemonic GetId() const;
|
||||
std::string InstructionText(bool replaceRipRelative = true) const;
|
||||
int OpCount() const;
|
||||
const ZydisDecodedOperand & operator[](int index) const;
|
||||
std::string Mnemonic() const;
|
||||
std::string MnemonicId() const;
|
||||
const char* MemSizeName(int size) const;
|
||||
size_t BranchDestination() const;
|
||||
size_t ResolveOpValue(int opindex, const std::function<size_t(ZydisRegister)> & resolveReg) const;
|
||||
bool IsBranchGoingToExecute(size_t cflags, size_t ccx) const;
|
||||
static bool IsBranchGoingToExecute(ZydisMnemonic id, size_t cflags, size_t ccx);
|
||||
bool IsConditionalGoingToExecute(size_t cflags, size_t ccx) const;
|
||||
static bool IsConditionalGoingToExecute(ZydisMnemonic id, size_t cflags, size_t ccx);
|
||||
|
||||
enum RegAccessInfo : uint8_t
|
||||
{
|
||||
RAINone = 0,
|
||||
RAIRead = 1 << 0,
|
||||
RAIWrite = 1 << 1,
|
||||
RAIImplicit = 1 << 2,
|
||||
RAIExplicit = 1 << 3
|
||||
};
|
||||
|
||||
void RegInfo(uint8_t info[ZYDIS_REGISTER_MAX_VALUE + 1]) const;
|
||||
const char* FlagName(ZydisCPUFlag flag) const;
|
||||
|
||||
enum BranchType : uint32_t
|
||||
{
|
||||
// Basic types.
|
||||
BTRet = 1 << 0,
|
||||
BTCall = 1 << 1,
|
||||
BTFarCall = 1 << 2,
|
||||
BTFarRet = 1 << 3,
|
||||
BTSyscall = 1 << 4, // Also sysenter
|
||||
BTSysret = 1 << 5, // Also sysexit
|
||||
BTInt = 1 << 6,
|
||||
BTInt3 = 1 << 7,
|
||||
BTInt1 = 1 << 8,
|
||||
BTIret = 1 << 9,
|
||||
BTCondJmp = 1 << 10,
|
||||
BTUncondJmp = 1 << 11,
|
||||
BTFarJmp = 1 << 12,
|
||||
BTXbegin = 1 << 13,
|
||||
BTXabort = 1 << 14,
|
||||
BTRsm = 1 << 15,
|
||||
BTLoop = 1 << 16,
|
||||
|
||||
BTJmp = BTCondJmp | BTUncondJmp,
|
||||
|
||||
// Semantic groups (behaves like XX).
|
||||
BTCallSem = BTCall | BTFarCall | BTSyscall | BTInt,
|
||||
BTRetSem = BTRet | BTSysret | BTIret | BTFarRet | BTRsm,
|
||||
BTCondJmpSem = BTCondJmp | BTLoop | BTXbegin,
|
||||
BTUncondJmpSem = BTUncondJmp | BTFarJmp | BTXabort,
|
||||
|
||||
BTRtm = BTXabort | BTXbegin,
|
||||
BTFar = BTFarCall | BTFarJmp | BTFarRet,
|
||||
|
||||
BTAny = std::underlying_type_t<BranchType>(-1)
|
||||
};
|
||||
|
||||
bool IsBranchType(std::underlying_type_t<BranchType> bt) const;
|
||||
|
||||
// Shortcuts.
|
||||
bool IsRet() const { return IsBranchType(BTRet); }
|
||||
bool IsCall() const { return IsBranchType(BTCall); }
|
||||
bool IsJump() const { return IsBranchType(BTJmp); }
|
||||
bool IsLoop() const { return IsBranchType(BTLoop); }
|
||||
bool IsInt3() const { return IsBranchType(BTInt3); }
|
||||
private:
|
||||
static ZydisDecoder mDecoder;
|
||||
static ZydisFormatter mFormatter;
|
||||
static bool mInitialized;
|
||||
ZydisDecodedInstruction mInstr;
|
||||
char mInstrText[200];
|
||||
bool mSuccess;
|
||||
uint8_t mVisibleOpCount;
|
||||
};
|
||||
|
||||
#endif //ZYDIS_WRAPPER_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue