Merge branch 'x64dbg:development' into development
This commit is contained in:
commit
14e72cfa10
|
|
@ -0,0 +1,148 @@
|
|||
---
|
||||
Checks: '
|
||||
-*,
|
||||
bugprone-argument-comment,
|
||||
bugprone-assert-side-effect,
|
||||
bugprone-bad-signal-to-kill-thread,
|
||||
bugprone-branch-clone,
|
||||
bugprone-copy-constructor-init,
|
||||
bugprone-dangling-handle,
|
||||
bugprone-dynamic-static-initializers,
|
||||
bugprone-fold-init-type,
|
||||
bugprone-forward-declaration-namespace,
|
||||
bugprone-forwarding-reference-overload,
|
||||
bugprone-inaccurate-erase,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-integer-division,
|
||||
bugprone-lambda-function-name,
|
||||
bugprone-macro-parentheses,
|
||||
bugprone-macro-repeated-side-effects,
|
||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
bugprone-misplaced-pointer-arithmetic-in-alloc,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-move-forwarding-reference,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-no-escape,
|
||||
bugprone-parent-virtual-call,
|
||||
bugprone-posix-return,
|
||||
bugprone-reserved-identifier,
|
||||
bugprone-sizeof-container,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-spuriously-wake-up-functions,
|
||||
bugprone-string-constructor,
|
||||
bugprone-string-integer-assignment,
|
||||
bugprone-string-literal-with-embedded-nul,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-include,
|
||||
bugprone-suspicious-memset-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-suspicious-string-compare,
|
||||
bugprone-suspicious-memory-comparison,
|
||||
bugprone-suspicious-realloc-usage,
|
||||
bugprone-swapped-arguments,
|
||||
bugprone-terminating-continue,
|
||||
bugprone-throw-keyword-missing,
|
||||
bugprone-too-small-loop-variable,
|
||||
bugprone-undefined-memory-manipulation,
|
||||
bugprone-undelegated-constructor,
|
||||
bugprone-unhandled-self-assignment,
|
||||
bugprone-unused-raii,
|
||||
bugprone-unused-return-value,
|
||||
bugprone-use-after-move,
|
||||
bugprone-virtual-near-miss,
|
||||
cert-dcl21-cpp,
|
||||
cert-dcl58-cpp,
|
||||
cert-err34-c,
|
||||
cert-err52-cpp,
|
||||
cert-err60-cpp,
|
||||
cert-flp30-c,
|
||||
cert-msc50-cpp,
|
||||
cert-msc51-cpp,
|
||||
cert-str34-c,
|
||||
cppcoreguidelines-interfaces-global-init,
|
||||
cppcoreguidelines-narrowing-conversions,
|
||||
cppcoreguidelines-pro-type-member-init,
|
||||
cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
cppcoreguidelines-slicing,
|
||||
google-default-arguments,
|
||||
google-explicit-constructor,
|
||||
google-runtime-operator,
|
||||
hicpp-exception-baseclass,
|
||||
hicpp-multiway-paths-covered,
|
||||
misc-misplaced-const,
|
||||
misc-new-delete-overloads,
|
||||
misc-no-recursion,
|
||||
misc-non-copyable-objects,
|
||||
misc-throw-by-value-catch-by-reference,
|
||||
misc-unconventional-assign-operator,
|
||||
misc-uniqueptr-reset-release,
|
||||
modernize-avoid-bind,
|
||||
modernize-concat-nested-namespaces,
|
||||
modernize-deprecated-headers,
|
||||
modernize-deprecated-ios-base-aliases,
|
||||
modernize-loop-convert,
|
||||
modernize-make-shared,
|
||||
modernize-make-unique,
|
||||
modernize-pass-by-value,
|
||||
modernize-raw-string-literal,
|
||||
modernize-redundant-void-arg,
|
||||
modernize-replace-auto-ptr,
|
||||
modernize-replace-disallow-copy-and-assign-macro,
|
||||
modernize-replace-random-shuffle,
|
||||
modernize-return-braced-init-list,
|
||||
modernize-shrink-to-fit,
|
||||
modernize-unary-static-assert,
|
||||
modernize-use-auto,
|
||||
modernize-use-bool-literals,
|
||||
modernize-use-emplace,
|
||||
modernize-use-equals-default,
|
||||
modernize-use-equals-delete,
|
||||
modernize-use-nodiscard,
|
||||
modernize-use-noexcept,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
modernize-use-transparent-functors,
|
||||
modernize-use-uncaught-exceptions,
|
||||
mpi-buffer-deref,
|
||||
mpi-type-mismatch,
|
||||
openmp-use-default-none,
|
||||
performance-faster-string-find,
|
||||
performance-for-range-copy,
|
||||
performance-implicit-conversion-in-loop,
|
||||
performance-inefficient-algorithm,
|
||||
performance-inefficient-string-concatenation,
|
||||
performance-inefficient-vector-operation,
|
||||
performance-move-const-arg,
|
||||
performance-move-constructor-init,
|
||||
performance-no-automatic-move,
|
||||
performance-noexcept-move-constructor,
|
||||
performance-trivially-destructible,
|
||||
performance-type-promotion-in-math-fn,
|
||||
performance-unnecessary-copy-initialization,
|
||||
performance-unnecessary-value-param,
|
||||
portability-simd-intrinsics,
|
||||
readability-avoid-const-params-in-decls,
|
||||
readability-const-return-type,
|
||||
readability-container-size-empty,
|
||||
readability-convert-member-functions-to-static,
|
||||
readability-delete-null-pointer,
|
||||
readability-deleted-default,
|
||||
readability-inconsistent-declaration-parameter-name,
|
||||
readability-make-member-function-const,
|
||||
readability-misleading-indentation,
|
||||
readability-misplaced-array-index,
|
||||
readability-non-const-parameter,
|
||||
readability-redundant-control-flow,
|
||||
readability-redundant-declaration,
|
||||
readability-redundant-function-ptr-dereference,
|
||||
readability-redundant-smartptr-get,
|
||||
readability-redundant-string-cstr,
|
||||
readability-redundant-string-init,
|
||||
readability-simplify-subscript-expr,
|
||||
readability-static-accessed-through-instance,
|
||||
readability-static-definition-in-anonymous-namespace,
|
||||
readability-string-compare,
|
||||
readability-uniqueptr-delete-release,
|
||||
readability-use-anyofallof
|
||||
'
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<value>style=allman, convert-tabs, align-pointer=type, align-reference=middle, indent=spaces, indent-namespaces, indent-col1-comments, pad-oper, unpad-paren, keep-one-line-blocks, close-templates</value>
|
||||
</setting>
|
||||
<setting name="Ignore" serializeAs="String">
|
||||
<value />
|
||||
<value>src/cross/vendor;src/gui/Src/ThirdPartyLibs/md4c</value>
|
||||
</setting>
|
||||
<setting name="License" serializeAs="String">
|
||||
<value />
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=6 -DX64DBG_RELEASE=${{ startsWith(github.ref, 'refs/tags/') && 'ON' || 'OFF' }}
|
||||
cmake --build build
|
||||
|
||||
- name: Upload Artifacts
|
||||
|
|
@ -42,8 +42,31 @@ jobs:
|
|||
include-hidden-files: true
|
||||
retention-days: 1
|
||||
|
||||
docs:
|
||||
# Skip building pull requests from the same repository
|
||||
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Build Documentation
|
||||
run: |
|
||||
docs\makechm.bat
|
||||
|
||||
- name: Upload Documentation
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: docs/x64dbg.chm
|
||||
if-no-files-found: error
|
||||
include-hidden-files: true
|
||||
retention-days: 1
|
||||
|
||||
package:
|
||||
needs: cmake
|
||||
needs: [cmake, docs]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
@ -63,7 +86,13 @@ jobs:
|
|||
name: build-x86
|
||||
path: bin
|
||||
|
||||
- name: Prepare release
|
||||
- name: Download Documentation
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: docs
|
||||
|
||||
- name: Prepare Release
|
||||
run: |
|
||||
curl.exe -L https://github.com/x64dbg/translations/releases/download/translations/qm.zip -o bin\qm.zip
|
||||
7z x bin\qm.zip -obin
|
||||
|
|
@ -71,7 +100,7 @@ jobs:
|
|||
$timestamp = Get-Date (Get-Date).ToUniversalTime() -Format "yyyy-MM-dd_HH-mm"
|
||||
echo "timestamp=$timestamp" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Upload Artifacts
|
||||
- name: Upload Snapshot
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: snapshot_${{ env.timestamp }}
|
||||
|
|
@ -83,7 +112,7 @@ jobs:
|
|||
include-hidden-files: true
|
||||
compression-level: 9
|
||||
|
||||
- name: Upload Artifacts
|
||||
- name: Upload Symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: symbols-snapshot_${{ env.timestamp }}
|
||||
|
|
@ -93,3 +122,13 @@ jobs:
|
|||
if-no-files-found: error
|
||||
include-hidden-files: true
|
||||
compression-level: 9
|
||||
|
||||
- name: Upload Plugin SDK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: x64dbg-pluginsdk
|
||||
path: |
|
||||
release/pluginsdk
|
||||
if-no-files-found: error
|
||||
include-hidden-files: true
|
||||
compression-level: 9
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
name: Cross
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
# Automatically cancel previous runs of this workflow on the same branch
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
cmake:
|
||||
# Skip building pull requests from the same repository
|
||||
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [windows-latest, ubuntu-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Visual Studio Development Environment
|
||||
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005 # v4.3.0
|
||||
with:
|
||||
cache: true
|
||||
modules: qtwebsockets
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd src/cross
|
||||
cmake -B build -G Ninja -DCMAKE_UNITY_BUILD=ON
|
||||
cmake --build build
|
||||
|
|
@ -5,6 +5,8 @@
|
|||
/bin/*.ini
|
||||
/bin/*.chm
|
||||
/bin/*.zip
|
||||
/bin/release-notes.md
|
||||
!/bin/themes/
|
||||
/src/**/x64/
|
||||
/src/**/Win32/
|
||||
/src/gui_build/
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ endif()
|
|||
|
||||
# Options
|
||||
option(X64DBG_BUILD_IN_TREE "" ON)
|
||||
option(X64DBG_RELEASE "" OFF)
|
||||
|
||||
# Variables
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
|
@ -53,32 +54,25 @@ find_package(Qt5 REQUIRED
|
|||
WinExtras
|
||||
)
|
||||
|
||||
# Target: zydis_wrapper
|
||||
set(zydis_wrapper_SOURCES
|
||||
cmake.toml
|
||||
"src/zydis_wrapper/Zydis/Zydis.h"
|
||||
"src/zydis_wrapper/zydis/Zydis.c"
|
||||
"src/zydis_wrapper/zydis_wrapper.cpp"
|
||||
"src/zydis_wrapper/zydis_wrapper.h"
|
||||
)
|
||||
# Subdirectory: src/zydis_wrapper
|
||||
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
|
||||
if(CMAKE_FOLDER)
|
||||
set(CMAKE_FOLDER "${CMAKE_FOLDER}/src/zydis_wrapper")
|
||||
else()
|
||||
set(CMAKE_FOLDER "src/zydis_wrapper")
|
||||
endif()
|
||||
add_subdirectory("src/zydis_wrapper")
|
||||
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
|
||||
|
||||
add_library(zydis_wrapper STATIC)
|
||||
|
||||
target_sources(zydis_wrapper PRIVATE ${zydis_wrapper_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${zydis_wrapper_SOURCES})
|
||||
|
||||
target_compile_definitions(zydis_wrapper PUBLIC
|
||||
ZYCORE_STATIC_BUILD
|
||||
ZYDIS_STATIC_BUILD
|
||||
)
|
||||
|
||||
target_include_directories(zydis_wrapper PUBLIC
|
||||
"src/zydis_wrapper"
|
||||
)
|
||||
|
||||
target_include_directories(zydis_wrapper PRIVATE
|
||||
"src/zydis_wrapper/Zydis"
|
||||
)
|
||||
# Subdirectory: src/gui/Src/ThirdPartyLibs/md4c
|
||||
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
|
||||
if(CMAKE_FOLDER)
|
||||
set(CMAKE_FOLDER "${CMAKE_FOLDER}/src/gui/Src/ThirdPartyLibs/md4c")
|
||||
else()
|
||||
set(CMAKE_FOLDER "src/gui/Src/ThirdPartyLibs/md4c")
|
||||
endif()
|
||||
add_subdirectory("src/gui/Src/ThirdPartyLibs/md4c")
|
||||
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
|
||||
|
||||
# Target: bridge
|
||||
set(bridge_SOURCES
|
||||
|
|
@ -221,6 +215,7 @@ set(dbg_SOURCES
|
|||
"src/dbg/analysis/xrefsanalysis.h"
|
||||
"src/dbg/animate.cpp"
|
||||
"src/dbg/animate.h"
|
||||
"src/dbg/args.h"
|
||||
"src/dbg/argument.cpp"
|
||||
"src/dbg/argument.h"
|
||||
"src/dbg/assemble.cpp"
|
||||
|
|
@ -323,6 +318,7 @@ set(dbg_SOURCES
|
|||
"src/dbg/jansson/jansson_x64dbg.h"
|
||||
"src/dbg/jit.cpp"
|
||||
"src/dbg/jit.h"
|
||||
"src/dbg/jobqueue.h"
|
||||
"src/dbg/label.cpp"
|
||||
"src/dbg/label.h"
|
||||
"src/dbg/loop.cpp"
|
||||
|
|
@ -405,6 +401,7 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${dbg_SOURCES})
|
|||
|
||||
target_compile_definitions(dbg PRIVATE
|
||||
BUILD_DBG
|
||||
NOMINMAX
|
||||
)
|
||||
|
||||
target_include_directories(dbg PRIVATE
|
||||
|
|
@ -439,6 +436,7 @@ target_link_libraries(dbg PRIVATE
|
|||
Shlwapi
|
||||
Ws2_32
|
||||
Wininet
|
||||
Iphlpapi
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4) # x86
|
||||
|
|
@ -625,6 +623,8 @@ set(gui_SOURCES
|
|||
"src/gui/Src/Gui/HexLineEdit.cpp"
|
||||
"src/gui/Src/Gui/HexLineEdit.h"
|
||||
"src/gui/Src/Gui/HexLineEdit.ui"
|
||||
"src/gui/Src/Gui/ImageTextBrowser.cpp"
|
||||
"src/gui/Src/Gui/ImageTextBrowser.h"
|
||||
"src/gui/Src/Gui/LineEditDialog.cpp"
|
||||
"src/gui/Src/Gui/LineEditDialog.h"
|
||||
"src/gui/Src/Gui/LineEditDialog.ui"
|
||||
|
|
@ -661,6 +661,9 @@ set(gui_SOURCES
|
|||
"src/gui/Src/Gui/ReferenceManager.h"
|
||||
"src/gui/Src/Gui/RegistersView.cpp"
|
||||
"src/gui/Src/Gui/RegistersView.h"
|
||||
"src/gui/Src/Gui/ReleaseNotesDialog.cpp"
|
||||
"src/gui/Src/Gui/ReleaseNotesDialog.h"
|
||||
"src/gui/Src/Gui/ReleaseNotesDialog.ui"
|
||||
"src/gui/Src/Gui/RichTextItemDelegate.cpp"
|
||||
"src/gui/Src/Gui/RichTextItemDelegate.h"
|
||||
"src/gui/Src/Gui/SEHChainView.cpp"
|
||||
|
|
@ -727,6 +730,9 @@ set(gui_SOURCES
|
|||
"src/gui/Src/QHexEdit/XByteArray.cpp"
|
||||
"src/gui/Src/QHexEdit/XByteArray.h"
|
||||
"src/gui/Src/ThirdPartyLibs/ldconvert/ldconvert.h"
|
||||
"src/gui/Src/ThirdPartyLibs/md4c/md4c-entity.h"
|
||||
"src/gui/Src/ThirdPartyLibs/md4c/md4c-html.h"
|
||||
"src/gui/Src/ThirdPartyLibs/md4c/md4c.h"
|
||||
"src/gui/Src/Tracer/TraceBrowser.cpp"
|
||||
"src/gui/Src/Tracer/TraceBrowser.h"
|
||||
"src/gui/Src/Tracer/TraceDump.cpp"
|
||||
|
|
@ -802,6 +808,12 @@ add_library(gui SHARED)
|
|||
target_sources(gui PRIVATE ${gui_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${gui_SOURCES})
|
||||
|
||||
if(X64DBG_RELEASE) # X64DBG_RELEASE
|
||||
target_compile_definitions(gui PUBLIC
|
||||
X64DBG_RELEASE
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(gui PRIVATE
|
||||
BUILD_LIB
|
||||
NOMINMAX
|
||||
|
|
@ -829,11 +841,16 @@ if(NOT TARGET bridge)
|
|||
message(FATAL_ERROR "Target \"bridge\" referenced by \"gui\" does not exist!")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET md4c-html)
|
||||
message(FATAL_ERROR "Target \"md4c-html\" referenced by \"gui\" does not exist!")
|
||||
endif()
|
||||
|
||||
target_link_libraries(gui PRIVATE
|
||||
Qt5::Widgets
|
||||
Qt5::WinExtras
|
||||
zydis_wrapper
|
||||
bridge
|
||||
md4c-html
|
||||
winmm
|
||||
wininet
|
||||
)
|
||||
|
|
@ -978,6 +995,8 @@ if(MSVC) # msvc
|
|||
"/DELAYLOAD:user32.dll"
|
||||
"/DELAYLOAD:wintrust.dll"
|
||||
"/DELAYLOAD:$<TARGET_FILE_NAME:bridge>"
|
||||
"/NOIMPLIB"
|
||||
"/NOEXP"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
|
|
@ -153,7 +153,6 @@
|
|||
0x00FE WM_INPUT_DEVICE_CHANGE
|
||||
0x00FF WM_INPUT
|
||||
0x0100 WM_KEYDOWN
|
||||
0x0100 WM_KEYFIRST
|
||||
0x0101 WM_KEYUP
|
||||
0x0102 WM_CHAR
|
||||
0x0103 WM_DEADCHAR
|
||||
|
|
@ -284,7 +283,6 @@
|
|||
0x01B1 LB_MULTIPLEADDSTRING
|
||||
0x01B2 LB_GETLISTBOXINFO
|
||||
0x01E1 MN_GETHMENU
|
||||
0x0200 WM_MOUSEFIRST
|
||||
0x0200 WM_MOUSEMOVE
|
||||
0x0201 WM_LBUTTONDOWN
|
||||
0x0202 WM_LBUTTONUP
|
||||
|
|
@ -295,7 +293,6 @@
|
|||
0x0207 WM_MBUTTONDOWN
|
||||
0x0208 WM_MBUTTONUP
|
||||
0x0209 WM_MBUTTONDBLCLK
|
||||
0x0209 WM_MOUSELAST
|
||||
0x020A WM_MOUSEWHEEL
|
||||
0x020B WM_XBUTTONDOWN
|
||||
0x020C WM_XBUTTONUP
|
||||
|
|
|
|||
27
cmake.toml
27
cmake.toml
|
|
@ -4,6 +4,7 @@ cmkr-include = "cmake/cmkr.cmake"
|
|||
|
||||
[options]
|
||||
X64DBG_BUILD_IN_TREE = true
|
||||
X64DBG_RELEASE = false
|
||||
|
||||
[variables]
|
||||
CMAKE_MODULE_PATH = "${CMAKE_SOURCE_DIR}/cmake"
|
||||
|
|
@ -26,24 +27,8 @@ x64 = "CMAKE_SIZEOF_VOID_P EQUAL 8"
|
|||
[find-package]
|
||||
Qt5 = { components = ["Widgets", "WinExtras"] }
|
||||
|
||||
[target.zydis_wrapper]
|
||||
type = "static"
|
||||
sources = [
|
||||
"src/zydis_wrapper/*.cpp",
|
||||
"src/zydis_wrapper/*.h",
|
||||
"src/zydis_wrapper/Zydis/Zydis.h",
|
||||
"src/zydis_wrapper/zydis/Zydis.c",
|
||||
]
|
||||
include-directories = [
|
||||
"src/zydis_wrapper",
|
||||
]
|
||||
private-include-directories = [
|
||||
"src/zydis_wrapper/Zydis",
|
||||
]
|
||||
compile-definitions = [
|
||||
"ZYCORE_STATIC_BUILD",
|
||||
"ZYDIS_STATIC_BUILD",
|
||||
]
|
||||
[subdir."src/zydis_wrapper"]
|
||||
[subdir."src/gui/Src/ThirdPartyLibs/md4c"]
|
||||
|
||||
[target.bridge]
|
||||
type = "shared"
|
||||
|
|
@ -105,6 +90,7 @@ private-link-libraries = [
|
|||
"Shlwapi",
|
||||
"Ws2_32",
|
||||
"Wininet",
|
||||
"Iphlpapi",
|
||||
]
|
||||
x86.private-link-libraries = [
|
||||
"src/dbg/dbghelp/dbghelp_x86.lib",
|
||||
|
|
@ -128,6 +114,7 @@ x64.private-link-libraries = [
|
|||
]
|
||||
private-compile-definitions = [
|
||||
"BUILD_DBG",
|
||||
"NOMINMAX",
|
||||
]
|
||||
private-include-directories = [
|
||||
"src/dbg",
|
||||
|
|
@ -158,6 +145,7 @@ private-link-libraries = [
|
|||
"Qt5::WinExtras",
|
||||
"::zydis_wrapper",
|
||||
"::bridge",
|
||||
"::md4c-html",
|
||||
"winmm",
|
||||
"wininet",
|
||||
]
|
||||
|
|
@ -184,6 +172,7 @@ private-compile-definitions = [
|
|||
"NOMINMAX",
|
||||
"X64DBG",
|
||||
]
|
||||
X64DBG_RELEASE.compile-definitions = ["X64DBG_RELEASE"]
|
||||
include-after = ["cmake/deps.cmake"]
|
||||
|
||||
[target.gui.properties]
|
||||
|
|
@ -236,6 +225,8 @@ msvc.link-options = [
|
|||
"/DELAYLOAD:user32.dll",
|
||||
"/DELAYLOAD:wintrust.dll",
|
||||
"/DELAYLOAD:$<TARGET_FILE_NAME:bridge>",
|
||||
"/NOIMPLIB",
|
||||
"/NOEXP",
|
||||
]
|
||||
msvc.link-libraries = [
|
||||
"Delayimp",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,48 @@
|
|||
option(ENABLE_SANITIZERS "Enable sanitizers" OFF)
|
||||
if(ENABLE_SANITIZERS)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "^MSVC$")
|
||||
# NOTE: There is bug in Clang-CL that makes address sanitizers not work for all projects.
|
||||
# The main issue is the 'world' project, which has WINDOWS_EXPORT_ALL_SYMBOLS.
|
||||
# This issue will likely be fixed in a later version of Clang-CL, but for now you should
|
||||
# configure with -DCMAKE_C_COMPILER=clang.exe -DCMAKE_CXX_COMPILER=clang++.exe to enable
|
||||
# UB sanitizers.
|
||||
message(WARNING "Enabling Clang-CL sanitizers (Clang works better)...")
|
||||
add_compile_options(-fsanitize=address,undefined)
|
||||
|
||||
# Reference: https://devblogs.microsoft.com/cppblog/addresssanitizer-asan-for-windows-with-msvc/
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(ASAN_LIB_SUFFIX "x86_64")
|
||||
else()
|
||||
set(ASAN_LIB_SUFFIX "i386")
|
||||
endif()
|
||||
set(ASAN_LINKER_FLAGS "/wholearchive:clang_rt.asan-${ASAN_LIB_SUFFIX}.lib /wholearchive:clang_rt.asan_cxx-${ASAN_LIB_SUFFIX}.lib")
|
||||
else()
|
||||
message(STATUS "Enabling Clang sanitizers...")
|
||||
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
|
||||
set(ASAN_LINKER_FLAGS "-fsanitize=address,undefined")
|
||||
endif()
|
||||
|
||||
# NOTE: Only set linker flags for executables and shared libraries
|
||||
# the add_link_options command would add flags to static libraries as well
|
||||
# which causes issues with symbols being defined in multiple places.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${ASAN_LINKER_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${ASAN_LINKER_FLAGS}")
|
||||
|
||||
if(WIN32)
|
||||
# NOTE: The sanitizer library only supports the static release runtime
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
# Reference: https://learn.microsoft.com/en-us/cpp/build/reference/fsanitize
|
||||
message(WARNING "Enabling MSVC sanitizers (Clang has better support)...")
|
||||
add_compile_options(/fsanitize=address)
|
||||
add_link_options(/INCREMENTAL:NO)
|
||||
else()
|
||||
message (FATAL_ERROR "Unsupported compiler for sanitizers: ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Visual Studio generator specific flags
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
# HACK: DO NOT this to add compiler flags/definitions, use target_compile_options on a
|
||||
|
|
@ -16,6 +61,8 @@ if(MSVC)
|
|||
$<$<CONFIG:Release,MinSizeRel,RelWithDebInfo>:/OPT:REF>
|
||||
$<$<CONFIG:Release,MinSizeRel,RelWithDebInfo>:/OPT:ICF>
|
||||
)
|
||||
# Enable big objects (unity build)
|
||||
add_compile_options(/bigobj)
|
||||
endif()
|
||||
|
||||
# Make the project look nicer in IDEs
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
function(init_submodule folder)
|
||||
set(full_path "${CMAKE_CURRENT_SOURCE_DIR}/${folder}")
|
||||
set(full_path "${CMAKE_CURRENT_LIST_DIR}/../${folder}")
|
||||
if(NOT EXISTS ${full_path})
|
||||
message(FATAL_ERROR "Submodule folder does not exist: ${full_path}")
|
||||
endif()
|
||||
|
|
@ -9,7 +9,7 @@ function(init_submodule folder)
|
|||
message(STATUS "Submodule '${folder}' not initialized, running git...")
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse --show-toplevel
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/.."
|
||||
OUTPUT_VARIABLE git_root
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(MSVC_BIN_DIR $ENV{MSVC_BIN_DIR})
|
||||
set(CMAKE_C_COMPILER ${MSVC_BIN_DIR}/cl)
|
||||
set(CMAKE_CXX_COMPILER ${MSVC_BIN_DIR}/cl)
|
||||
set(CMAKE_RC_COMPILER ${MSVC_BIN_DIR}/rc)
|
||||
|
||||
set(CMAKE_PROJECT_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/qt-wine.cmake)
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
include_guard()
|
||||
|
||||
message(STATUS "Configuring Qt for Wine cross-compilation...")
|
||||
|
||||
set(QT_HOST_BIN_DIR ${CMAKE_CURRENT_LIST_DIR}/wine)
|
||||
|
||||
function(qt5_host_tool name)
|
||||
if (NOT TARGET Qt5::${name})
|
||||
add_executable(Qt5::${name} IMPORTED)
|
||||
|
||||
set(imported_location ${QT_HOST_BIN_DIR}/${name})
|
||||
|
||||
# FIXME run after deps.cmake to enable next
|
||||
#if(NOT EXISTS ${imported_location})
|
||||
# message(FATAL_ERROR "Qt5 tool not found: ${imported_location}")
|
||||
#endif()
|
||||
|
||||
set_target_properties(Qt5::${name} PROPERTIES
|
||||
IMPORTED_LOCATION ${imported_location}
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
qt5_host_tool(windeployqt)
|
||||
qt5_host_tool(qmake)
|
||||
qt5_host_tool(moc)
|
||||
qt5_host_tool(rcc)
|
||||
qt5_host_tool(uic)
|
||||
|
||||
|
|
@ -11,11 +11,8 @@ file(MAKE_DIRECTORY "${RELEASE_DIR}")
|
|||
# Setup pluginsdk directories
|
||||
set(PLUGINSDK_DIR "${RELEASE_DIR}/pluginsdk")
|
||||
file(MAKE_DIRECTORY "${PLUGINSDK_DIR}")
|
||||
file(MAKE_DIRECTORY "${PLUGINSDK_DIR}/dbghelp")
|
||||
file(MAKE_DIRECTORY "${PLUGINSDK_DIR}/DeviceNameResolver")
|
||||
file(MAKE_DIRECTORY "${PLUGINSDK_DIR}/jansson")
|
||||
file(MAKE_DIRECTORY "${PLUGINSDK_DIR}/lz4")
|
||||
file(MAKE_DIRECTORY "${PLUGINSDK_DIR}/TitanEngine")
|
||||
file(MAKE_DIRECTORY "${PLUGINSDK_DIR}/XEDParse")
|
||||
|
||||
# Setup release directories
|
||||
|
|
@ -28,16 +25,10 @@ file(MAKE_DIRECTORY "${RELEASE_DIR}/release/x64")
|
|||
set(PLUGINSDK_DIR "${RELEASE_DIR}/pluginsdk")
|
||||
|
||||
# Copy directories
|
||||
file(COPY "${ROOT_DIR}/src/dbg/dbghelp/" DESTINATION "${PLUGINSDK_DIR}/dbghelp")
|
||||
file(COPY "${ROOT_DIR}/src/dbg/DeviceNameResolver/" DESTINATION "${PLUGINSDK_DIR}/DeviceNameResolver")
|
||||
file(COPY "${ROOT_DIR}/src/dbg/jansson/" DESTINATION "${PLUGINSDK_DIR}/jansson")
|
||||
file(COPY "${ROOT_DIR}/src/dbg/lz4/" DESTINATION "${PLUGINSDK_DIR}/lz4")
|
||||
file(COPY "${ROOT_DIR}/src/dbg/TitanEngine/" DESTINATION "${PLUGINSDK_DIR}/TitanEngine")
|
||||
file(COPY "${ROOT_DIR}/src/dbg/XEDParse/" DESTINATION "${PLUGINSDK_DIR}/XEDParse")
|
||||
|
||||
# Remove TitanEngine.txt
|
||||
file(REMOVE "${PLUGINSDK_DIR}/TitanEngine/TitanEngine.txt")
|
||||
|
||||
# Copy headers
|
||||
file(GLOB PLUGIN_HEADERS
|
||||
"${ROOT_DIR}/src/dbg/_plugin_types.h"
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
run
|
||||
|
|
@ -0,0 +1 @@
|
|||
run
|
||||
|
|
@ -0,0 +1 @@
|
|||
run
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 Martin Storsjo
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#. msvcenv.sh
|
||||
|
||||
# /showIncludes
|
||||
unixify_path='/^Note: including file: /{ s/z:([\\/])/\1/i; s,\\,/,g; }'
|
||||
# /E
|
||||
unixify_line='/^[[:blank:]]*#[[:blank:]]*line[[:blank:]]/{ s/z:([\\/])/\1/i; s,\\\\,/,g; }'
|
||||
# Warnings and Errors
|
||||
unixify_note='/^[zZ]:.*\([[:digit:]]+\): (note|error C[[:digit:]]{4}|warning C[[:digit:]]{4}): /{ s/z:([\\/])/\1/ig; s,\\,/,g; }'
|
||||
|
||||
export WINE_MSVC_STDOUT_SED="$unixify_path;$unixify_line;$unixify_note"
|
||||
export WINE_MSVC_STDERR_SED="$unixify_path"
|
||||
|
||||
"$MSVC_BIN_DIR"/wine-msvc.sh "$QT_BIN_DIR"/$(basename $0).exe "$@"
|
||||
|
||||
ec=$?
|
||||
[ $ec -ne 0 ] && exit $ec
|
||||
|
||||
# Postprocess
|
||||
for a in "$@"; do
|
||||
case $a in
|
||||
[-/]P) arg_P=$a ;;
|
||||
[-/]Fi*) arg_Fi=${a:3} ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Unixify paths for /P
|
||||
if [ -n "$arg_P" ] && [ -f "$arg_Fi" ]; then
|
||||
if sed --help 2>&1 | grep '\-i extension' >/dev/null; then
|
||||
inplace=(-i '') # BSD sed
|
||||
else
|
||||
inplace=(-i) # GNU sed
|
||||
fi
|
||||
sed "${inplace[@]}" -E 's/\r//;'"$unixify_line" "$arg_Fi"
|
||||
fi
|
||||
|
||||
exit $ec
|
||||
|
|
@ -0,0 +1 @@
|
|||
run
|
||||
|
|
@ -0,0 +1 @@
|
|||
run
|
||||
2
deps
2
deps
|
|
@ -1 +1 @@
|
|||
Subproject commit 5b16b5f74c0f7abd4bcef9a58f449b8d55c526c3
|
||||
Subproject commit 31f6cc57999d78dd5f99f59ab56e8465fbb9256f
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
_build*/
|
||||
*.chm
|
||||
python-2.7.18.amd64.portable/
|
||||
hha.dll
|
||||
hhc.exe
|
||||
itcc.dll
|
||||
*.7z
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
## Prerequisites
|
||||
```sh
|
||||
sudo apt update
|
||||
sudo apt install cmake ninja-build wine
|
||||
```
|
||||
|
||||
## Install MSVC
|
||||
Download https://github.com/mstorsjo/msvc-wine
|
||||
```sh
|
||||
cd msvc-wine
|
||||
./vsdownload.py --accept-license --dest ~/opt/msvc Microsoft.VisualStudio.Workload.VCTools Microsoft.VisualStudio.Component.VC.ATL
|
||||
./install.sh ~/opt/msvc
|
||||
```
|
||||
|
||||
## Build
|
||||
x86
|
||||
```sh
|
||||
cd x64dbg
|
||||
export MSVC_BIN_DIR=~/opt/msvc/bin/x86
|
||||
export QT_BIN_DIR=~/src/x64dbg/build32/_deps/qt5-src/bin
|
||||
cmake -B build32 -DCMAKE_TOOLCHAIN_FILE=cmake/msvc-wine.cmake -G Ninja
|
||||
cmake --build build32 -j4
|
||||
```
|
||||
|
||||
x64
|
||||
```sh
|
||||
cd x64dbg
|
||||
export MSVC_BIN_DIR=~/opt/msvc/bin/x64
|
||||
export QT_BIN_DIR=~/src/x64dbg/build64/_deps/qt5-src/bin
|
||||
cmake -B build64 -DCMAKE_TOOLCHAIN_FILE=cmake/msvc-wine.cmake -G Ninja
|
||||
cmake --build build64 -j4
|
||||
```
|
||||
|
||||
## Issues
|
||||
- ```LINK : fatal error LNK1158: cannot run 'rc.exe'```
|
||||
> Fix: winecfg -> Drives -> Remove drives with alternative path to x64dbg src (like: E: -> ~/src)
|
||||
|
||||
|
|
@ -4,10 +4,15 @@ Documentation repository for [x64dbg](http://x64dbg.com) at [Read the Docs](http
|
|||
|
||||
## Building
|
||||
|
||||
1. Download https://github.com/x64dbg/docs/releases/download/python27-portable/python-2.7.18.amd64.portable.7z
|
||||
2. Extract to the `python-2.7.18.amd64.portable` folder
|
||||
3. run `makechm.bat`. It will build the .CHM help file.
|
||||
Run `makechm.bat`. It will build the .CHM help file.
|
||||
|
||||
When first building the .CHM help file, it automatically downloads
|
||||
[python 2.7.18 portable](https://github.com/x64dbg/docs/releases/download/python27-portable/python-2.7.18.amd64.portable.7z) and
|
||||
[Microsoft HTML Help Compiler 4.74.8702](https://github.com/x64dbg/deps/releases/download/dependencies/hhc-4.74.8702.7z) from GitHub.
|
||||
Then, `7z` is used to extract the downloaded archive, so make sure [7-zip](https://7-zip.org/) is installed, and `7z` command can be accessed from
|
||||
the current directory.
|
||||
|
||||
Note: The following patch was applied:
|
||||
|
||||
|
||||
Add `relpath = relpath.replace(os.path.sep, '/')` after `C:\Python27\Lib\site-packages\recommonmark\transform.py` line `63`
|
||||
|
|
@ -20,3 +20,5 @@ This section contains various commands that are only used or available in a scri
|
|||
scriptload
|
||||
scriptdll
|
||||
scriptcmd
|
||||
scriptrun
|
||||
scriptexec
|
||||
|
|
@ -12,6 +12,10 @@ For example `scriptcmd add rax, 0x1245` will execute the command `add rax, 0x123
|
|||
|
||||
This command does not set any result variables.
|
||||
|
||||
## execution behavior
|
||||
|
||||
This command blocks until the specified command completes execution. Script execution is handled by a single dedicated thread, ensuring commands execute in the order they are submitted without interference from other operations.
|
||||
|
||||
## example
|
||||
|
||||
This command can be used in combination with [SetBreakpointCommand](../conditional-breakpoint-control/SetBreakpointCommand.md) to execute scripts on breakpoint callbacks:
|
||||
|
|
@ -21,7 +25,7 @@ fn_addr = module.dll:$0x1234 // module.dll RVA 0x1234
|
|||
bp fn_addr
|
||||
SetBreakpointCommand fn_addr, "scriptcmd call mycallback"
|
||||
|
||||
// make sure the script is not unloaded
|
||||
// TODO: make sure the script is not unloaded (using run)
|
||||
|
||||
mycallback:
|
||||
log "fn({arg.get(0)}, {arg.get(1)})"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
# scriptexec
|
||||
|
||||
Load and execute a script file in a single operation.
|
||||
|
||||
## arguments
|
||||
|
||||
`arg1` Script file path to load and execute.
|
||||
|
||||
## result
|
||||
|
||||
This command does not set any result variables.
|
||||
|
||||
## execution behavior
|
||||
|
||||
This command blocks until the script completes execution. It performs the following operations:
|
||||
1. Loads the specified script file
|
||||
2. Executes the script from the beginning
|
||||
3. Automatically unloads the script only if execution completes successfully
|
||||
|
||||
Script execution is handled by a single dedicated thread, ensuring that only one script runs at a time.
|
||||
|
||||
## notes
|
||||
|
||||
- Cannot be used from within a running script
|
||||
- If script execution fails or is aborted, the script remains loaded
|
||||
- This is the most convenient way to run standalone scripts
|
||||
- Execution always starts from the beginning of the script
|
||||
- You can use the Script tab context menu to abort a running script if needed
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# scriptrun
|
||||
|
||||
Run the currently loaded script from the current position.
|
||||
|
||||
## arguments
|
||||
|
||||
`arg1` (optional) Line number to stop execution at. If not provided, the script runs until completion.
|
||||
|
||||
## result
|
||||
|
||||
This command does not set any result variables.
|
||||
|
||||
## execution behavior
|
||||
|
||||
This command blocks until the script completes execution, reaches the specified stop line, encounters an error, or is manually aborted. Script execution is handled by a single dedicated thread, ensuring that only one script runs at a time.
|
||||
|
||||
## prerequisites
|
||||
|
||||
A script must be loaded using [`scriptload`](scriptload.md) before using this command.
|
||||
|
||||
## notes
|
||||
|
||||
- Only one script can run at a time
|
||||
- Execution starts from the current script instruction pointer
|
||||
- The script instruction pointer is automatically managed during execution
|
||||
- Use [`scriptabort`](scriptabort.md) to stop a running script
|
||||
|
|
@ -89,7 +89,7 @@ language = None
|
|||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = ['_build*', 'Thumbs.db', '.DS_Store', 'README.md', '.git', 'python-2.7.18.amd64.portable']
|
||||
exclude_patterns = ['_build*', 'Thumbs.db', '.DS_Store', 'README.md', '.git', 'python-2.7.18.amd64.portable*']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# BridgeAlloc
|
||||
|
||||
Function description.
|
||||
Allocate a memory buffer for use by x64dbg. The memory is freed by [BridgeFree](./BridgeFree.md).
|
||||
|
||||
```c++
|
||||
void* BridgeAlloc(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# BridgeFree
|
||||
|
||||
Function description.
|
||||
Free a memory buffer previously allocated by [BridgeAlloc](./BridgeAlloc.md).
|
||||
|
||||
```c++
|
||||
void BridgeFree(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# GuiAddLogMessage
|
||||
|
||||
Adds a message to the log. The message will be shown in the log window and on the status bar at the bottom of x64dbg.
|
||||
Adds a message to the log. The message will be shown in the log window and on the status bar at the bottom of x64dbg. The message is shown in plain text. To show formatted message, use [GuiAddLogMessageHtml](./GuiAddLogMessageHtml.md).
|
||||
|
||||
```c++
|
||||
void GuiAddLogMessage(
|
||||
|
|
@ -32,5 +32,6 @@ Invoke GuiAddLogMessage, Addr szMsg
|
|||
|
||||
## Related functions
|
||||
|
||||
- [GuiAddLogMessageHtml](./GuiAddLogMessageHtml.md)
|
||||
- [GuiLogClear](./GuiLogClear.md)
|
||||
- [GuiAddStatusBarMessage](./GuiAddStatusBarMessage.md)
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# GuiAddLogMessageHtml
|
||||
|
||||
Adds a message in HTML to the log. The message will be shown in the log window and on the status bar at the bottom of x64dbg.
|
||||
|
||||
The message is formatted in HTML, so links and color tags can be added. Remember to escape any HTML special characters when some text from the debuggee needs to be logged.
|
||||
|
||||
```c++
|
||||
void GuiAddLogMessageHtml(
|
||||
const char* msg // string containg HTML-formatted message to add to log
|
||||
);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`msg` String containing the HTML-formatted message to add to the log. Ensure that a carriage line and return feed are included with the string for it to properly display it. Encoding is UTF-8.
|
||||
|
||||
## Return Value
|
||||
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
GuiAddLogMessageHtml("<b>This <i>formatted</i> text will be displayed in the <u>log view</u></b>.\n");
|
||||
```
|
||||
|
||||
```nasm
|
||||
.data
|
||||
szMsg db "<b>This <i>formatted</i> text will be displayed in the <u>log view</u></b>",13,10,0 ; CRLF
|
||||
|
||||
.code
|
||||
Invoke GuiAddLogMessageHtml, Addr szMsg
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
||||
- [GuiAddLogMessage](./GuiAddLogMessage.md)
|
||||
- [GuiLogClear](./GuiLogClear.md)
|
||||
- [GuiAddStatusBarMessage](./GuiAddStatusBarMessage.md)
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
# GuiAddQWidgetTab
|
||||
|
||||
Function description.
|
||||
Add a Qt QWidget object as a new tab in the GUI.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiAddQWidgetTab(QWidget* qWidget);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`qWidget` The Qt QWidget object.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
@ -22,4 +22,4 @@ Example code.
|
|||
|
||||
## Related functions
|
||||
|
||||
- List of related functions
|
||||
- [GuiCloseQWidgetTab](./GuiCloseQWidgetTab.md)
|
||||
|
|
@ -1,25 +1,20 @@
|
|||
# GuiAutoCompleteAddCmd
|
||||
|
||||
Function description.
|
||||
Add a command to the auto-completion list of the command bar. This function is automatically called by x64dbg when a command is registered, therefore plugin developers do not need to call this function.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiAutoCompleteAddCmd(const char* cmd);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`cmd` The command that is added to the auto-completion list of the command bar.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
Example code.
|
||||
```
|
||||
This function does not return a value.
|
||||
|
||||
## Related functions
|
||||
|
||||
- List of related functions
|
||||
- [GuiAutoCompleteDelCmd](./GuiAutoCompleteDelCmd.md)
|
||||
- [GuiAutoCompleteClearAll](./GuiAutoCompleteClearAll.md)
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
# GuiCloseQWidgetTab
|
||||
|
||||
Function description.
|
||||
Close a Qt QWidget tab added by a plugin.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiCloseQWidgetTab(QWidget* qWidget);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`qWidget` The Qt QWidget object of the tab to close.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
@ -22,4 +22,4 @@ Example code.
|
|||
|
||||
## Related functions
|
||||
|
||||
- List of related functions
|
||||
- [GuiAddQWidgetTab](./GuiAddQWidgetTab.md)
|
||||
|
|
@ -8,7 +8,9 @@ void GuiDisplayWarning(const char* title, const char* text)
|
|||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`title` Dialog title in UTF-8 encoding.
|
||||
|
||||
`text` Dialog text in UTF-8 encoding.
|
||||
|
||||
## Return Value
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
# GuiDumpAt
|
||||
|
||||
Function description.
|
||||
Change the address of the dump window to the given virtual address, to show the dump at this address.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiDumpAt(duint va);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`va` Virtual address of the pointer to dump.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
@ -22,4 +22,4 @@ Example code.
|
|||
|
||||
## Related functions
|
||||
|
||||
- List of related functions
|
||||
- [GuiDumpAtN](./GuiDumpAtN.md)
|
||||
|
|
@ -1,18 +1,20 @@
|
|||
# GuiDumpAtN
|
||||
|
||||
Function description.
|
||||
Change the address of the Nth dump window to the given virtual address, to show the dump at this address in the specified dump window.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiDumpAtN(duint va, int index)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`va` Virtual address of the pointer to dump.
|
||||
|
||||
`index` Index of the dump window.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
@ -22,4 +24,4 @@ Example code.
|
|||
|
||||
## Related functions
|
||||
|
||||
- List of related functions
|
||||
- [GuiDumpAt](./GuiDumpAt.md)
|
||||
|
|
@ -1,18 +1,20 @@
|
|||
# GuiExecuteOnGuiThread
|
||||
|
||||
Function description.
|
||||
Execute a callback function on the GUI thread.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
typedef void (*GUICALLBACK)();
|
||||
|
||||
void GuiExecuteOnGuiThread(GUICALLBACK cbGuiThread);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`cbGuiThread` A function pointer to the callback function.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
@ -22,4 +24,4 @@ Example code.
|
|||
|
||||
## Related functions
|
||||
|
||||
- List of related functions
|
||||
- [GuiExecuteOnGuiThreadEx](./GuiExecuteOnGuiThreadEx.md)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# GuiExecuteOnGuiThreadEx
|
||||
|
||||
Execute a callback function on the GUI thread. The callback function has a user-defined parameter.
|
||||
|
||||
```c++
|
||||
typedef void (*GUICALLBACKEX)(void*);
|
||||
|
||||
void void GuiExecuteOnGuiThreadEx(GUICALLBACKEX cbGuiThread, void* userdata);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`cbGuiThread` A function pointer to the callback function.
|
||||
|
||||
`userdata` A user-defined parameter that is passed to the callback function.
|
||||
|
||||
## Return Value
|
||||
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
Example code.
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
||||
- [GuiExecuteOnGuiThread](./GuiExecuteOnGuiThread.md)
|
||||
|
|
@ -1,23 +1,23 @@
|
|||
# GuiFocusView
|
||||
|
||||
Function description.
|
||||
Change the active view to the given view.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiFocusView(int hWindow);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`hWindow` One of the following values: GUI_DISASSEMBLY, GUI_DUMP, GUI_STACK, GUI_GRAPH, GUI_MEMMAP, GUI_SYMMOD, GUI_THREADS.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
Example code.
|
||||
GuiFocusView(GUI_DISASSEMBLY); // focus on the disassembly tab.
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Returns into a variable a pointer to a string containing notes and information that a user has made relating to the target being debugged (the debuggee). The function GuiGetGlobalNotes can be used to get the global notes stored by a user.
|
||||
|
||||
```c++
|
||||
void GuiGetDebuggeeNotes(char** text)
|
||||
void GuiGetDebuggeeNotes(char** text);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Returns the main window handle for x6dbg as a HWND variable
|
|||
## Example
|
||||
|
||||
```c++
|
||||
hWnd = GuiGetWindowHandle();
|
||||
HWND hWnd = GuiGetWindowHandle();
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Returns the status of the internal update flag, which can be disabled via GuiUpdateDisable function or enabled vis the GuiUpdateEnable function.
|
||||
|
||||
```c++
|
||||
bool GuiIsUpdateDisabled()
|
||||
bool GuiIsUpdateDisabled();
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
# GuiScriptAdd
|
||||
|
||||
Function description.
|
||||
Reload the script view with a new script.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiScriptAdd(int count, const char** lines);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`count` Number of lines;
|
||||
|
||||
`lines` A buffer containing `count` pointers to UTF-8 strings, each representing a single line. This buffer is freed by [BridgeFree](../bridge/BridgeFree.md) afterwards.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,9 @@
|
|||
# GuiScriptClear
|
||||
|
||||
Function description.
|
||||
Set the script view to empty.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
Example code.
|
||||
void GuiScriptClear();
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
# GuiScriptEnableHighlighting
|
||||
|
||||
Function description.
|
||||
Set whether syntax highlighting in the script view is enabled.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiScriptEnableHighlighting(bool enable);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`enable` `True` to enable syntax highlighting in the script view, `false` otherwise.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
Example code.
|
||||
GuiScriptEnableHighlighting(true);
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
# GuiScriptError
|
||||
|
||||
Function description.
|
||||
Pop up a message box to alert the user about script error.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiScriptError(int line, const char* message);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`line` Line number where the script error occurred.
|
||||
|
||||
`message` The error message.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Function description.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiScriptMessage(const char* message);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
|
@ -12,7 +12,7 @@ Function definition.
|
|||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
# GuiScriptMsgyn
|
||||
|
||||
Function description.
|
||||
Pop up a message box containing yes/no choices.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
int GuiScriptMsgyn(const char* message);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`message` The content of the yes/no choices message box.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
1 if the user chose yes, 0 if the user chose no.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
Function description.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiScriptSetInfoLine(int line, const char* info);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`line` Parameter description.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
# GuiScriptSetIp
|
||||
|
||||
Function description.
|
||||
Set the current line in the script view.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiScriptSetIp(int line);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`line` The line number of the new current line.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
Example code.
|
||||
GuiScriptSetIp(0);
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
# GuiScriptSetTitle
|
||||
|
||||
Function description.
|
||||
Set the window title of the script view.
|
||||
|
||||
```c++
|
||||
Function definition.
|
||||
void GuiScriptSetTitle(const char* title);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
`param1` Parameter description.
|
||||
`title` Window title of the script view.
|
||||
|
||||
## Return Value
|
||||
|
||||
Return value description.
|
||||
This function does not return a value.
|
||||
|
||||
## Example
|
||||
|
||||
```c++
|
||||
Example code.
|
||||
GuiScriptSetTitle("Window Title");
|
||||
```
|
||||
|
||||
## Related functions
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ This section contains information about the Graphical User Interface GUI functio
|
|||
:maxdepth: 1
|
||||
|
||||
GuiAddLogMessage
|
||||
GuiAddLogMessageHtml
|
||||
GuiAddQWidgetTab
|
||||
GuiAddRecentFile
|
||||
GuiAddStatusBarMessage
|
||||
|
|
@ -20,6 +21,7 @@ This section contains information about the Graphical User Interface GUI functio
|
|||
GuiDumpAt
|
||||
GuiDumpAtN
|
||||
GuiExecuteOnGuiThread
|
||||
GuiExecuteOnGuiThreadEx
|
||||
GuiFocusView
|
||||
GuiGetDebuggeeNotes
|
||||
GuiGetDisassembly
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ If you came here because someone told you to read the manual, start by reading *
|
|||
gui/index
|
||||
commands/index
|
||||
developers/index
|
||||
licenses/index
|
||||
licenses
|
||||
|
||||
|
||||
Indices and tables
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# Licenses
|
||||
|
||||
- [x64dbg](https://github.com/x64dbg/x64dbg): [`GPL`](https://github.com/x64dbg/x64dbg/blob/development/LICENSE)
|
||||
- [TitanEngine](https://github.com/x64dbg/TitanEngine): [`LGPL`](https://github.com/x64dbg/TitanEngine/blob/x64dbg/LICENSE)
|
||||
- [GleeBug](https://github.com/x64dbg/GleeBug): [`MIT`](https://github.com/x64dbg/GleeBug/blob/vs2015/LICENSE)
|
||||
- [asmtk](https://github.com/asmjit/asmtk): [`zlib`](https://github.com/asmjit/asmtk/blob/master/LICENSE.md)
|
||||
- [asmjit](https://github.com/asmjit/asmjit/blob/master/LICENSE.md): [`zlib`](https://github.com/asmjit/asmjit/blob/master/LICENSE.md)
|
||||
- [XEDParse](https://github.com/x64dbg/xedparse): [`LGPL`](https://github.com/x64dbg/XEDParse/blob/master/LICENSE)
|
||||
- [jansson](https://github.com/x64dbg/jansson): [`MIT`](https://github.com/x64dbg/jansson/blob/master/LICENSE)
|
||||
- [Zydis](https://github.com/zyantific/zydis): [`MIT`](https://github.com/zyantific/zydis/blob/master/LICENSE)
|
||||
- [lz4](https://github.com/x64dbg/lz4): [`BSD`](https://github.com/x64dbg/lz4/blob/master/LICENSE)
|
||||
- [Qt 5](https://www.qt.io/): [`LGPL`](https://www.qt.io/licensing/open-source-lgpl-obligations)
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# x64dbg documentation
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 x64dbg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# asmjit
|
||||
|
||||
Copyright (c) 2008-2017, Petr Kobalicek
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# GleeBug
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 x64dbg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
Licenses
|
||||
========
|
||||
|
||||
**Licenses:**
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
x64dbglicense
|
||||
LICENSE
|
||||
titanlicense
|
||||
gleebuglicense
|
||||
zydislicense
|
||||
xedparselicense
|
||||
asmjitlicense
|
||||
janssonlicense
|
||||
lz4license
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# jansson
|
||||
|
||||
Copyright (c) 2009-2018 Petri Lehtinen <petri@digip.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# LZ4
|
||||
|
||||
LZ4 Library
|
||||
Copyright (c) 2011-2014, Yann Collet
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
# TitanEngine Update
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
|
@ -1,687 +0,0 @@
|
|||
# License of x64dbg
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
THIS DOCUMENT HAS BEEN MODIFIED
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Treatment of plugins
|
||||
|
||||
This license does not affect plugins, i.e., dynamically linked
|
||||
libraries, that use the provided plugin interface mechanism of x64dbg
|
||||
for contibuting additional features to the x64dbg project and can only
|
||||
be run from x64dbg. In fact you are allowed to create and share
|
||||
(non-)commercial, non-standalone closed-source plugins for x64dbg under
|
||||
your own license.
|
||||
|
||||
3. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
4. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
5. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
6. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
7. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
8. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
9. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
10. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
11. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
12. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
13. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
14. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
15. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
16. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
17. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
18. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
# XEDParse
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# Zydis
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Florian Bernd
|
||||
Copyright (c) 2018 Joel Höner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
REM Command file for Sphinx documentation
|
||||
set PYTHONNOUSERSITE=1
|
||||
set PYTHONHOME=%CD%\python-2.7.18.amd64.portable
|
||||
set PATH=%PYTHONHOME%;%PYTHONHOME%\Scripts;%PATH%
|
||||
set PORTABLE_PYTHON=%~dp0python-2.7.18.amd64.portable
|
||||
|
||||
if not exist "%PORTABLE_PYTHON%" (
|
||||
echo Portable Python not found!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set PATH=%PORTABLE_PYTHON%;%PORTABLE_PYTHON%\Scripts;%PATH%
|
||||
set SPHINXBUILD=sphinx-build
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
|
|
|
|||
|
|
@ -1,13 +1,32 @@
|
|||
@echo off
|
||||
if "%VSVARSALLPATH%"=="" set VSVARSALLPATH=c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
|
||||
echo Setting VS Path
|
||||
call "%VSVARSALLPATH%"
|
||||
|
||||
cd /d "%~dp0"
|
||||
|
||||
set PORTABLE_PYTHON=%~dp0python-2.7.18.amd64.portable
|
||||
if not exist "%PORTABLE_PYTHON%\python.exe" (
|
||||
echo Downloading portable Python...
|
||||
curl.exe -L -O https://github.com/x64dbg/docs/releases/download/python27-portable/python-2.7.18.amd64.portable.7z
|
||||
7z x python-2.7.18.amd64.portable.7z -opython-2.7.18.amd64.portable
|
||||
)
|
||||
|
||||
if not exist "%~dp0hhc.exe" (
|
||||
echo Downloading HTML Help Workshop...
|
||||
pause
|
||||
curl.exe -L -O https://github.com/x64dbg/deps/releases/download/dependencies/hhc-4.74.8702.7z
|
||||
7z x hhc-4.74.8702.7z
|
||||
)
|
||||
|
||||
echo Building Help Project
|
||||
call make htmlhelp
|
||||
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
|
||||
echo Applying CHM hacks
|
||||
copy theme.js .\_build\htmlhelp\_static\js\theme.js
|
||||
type hacks.css >> .\_build\htmlhelp\_static\css\theme.css
|
||||
echo Building CHM File
|
||||
hhc .\_build\htmlhelp\x64dbgdoc.hhp
|
||||
copy .\_build\htmlhelp\x64dbgdoc.chm x64dbg.chm
|
||||
hhc.exe .\_build\htmlhelp\x64dbgdoc.hhp
|
||||
copy /Y .\_build\htmlhelp\x64dbgdoc.chm x64dbg.chm
|
||||
if not exist "x64dbg.chm" (
|
||||
echo Failed to build CHM file!
|
||||
exit /b 1
|
||||
)
|
||||
echo Finished
|
||||
97
release.bat
97
release.bat
|
|
@ -1,97 +0,0 @@
|
|||
@echo off
|
||||
set RELEASEDIR=.\release
|
||||
rmdir /S /Q %RELEASEDIR%
|
||||
mkdir %RELEASEDIR%
|
||||
|
||||
echo pluginsdk
|
||||
|
||||
mkdir %RELEASEDIR%\pluginsdk
|
||||
mkdir %RELEASEDIR%\pluginsdk\dbghelp
|
||||
mkdir %RELEASEDIR%\pluginsdk\DeviceNameResolver
|
||||
mkdir %RELEASEDIR%\pluginsdk\jansson
|
||||
mkdir %RELEASEDIR%\pluginsdk\lz4
|
||||
mkdir %RELEASEDIR%\pluginsdk\TitanEngine
|
||||
mkdir %RELEASEDIR%\pluginsdk\XEDParse
|
||||
|
||||
xcopy src\dbg\dbghelp %RELEASEDIR%\pluginsdk\dbghelp /S /Y
|
||||
xcopy src\dbg\DeviceNameResolver %RELEASEDIR%\pluginsdk\DeviceNameResolver /S /Y
|
||||
xcopy src\dbg\jansson %RELEASEDIR%\pluginsdk\jansson /S /Y
|
||||
xcopy src\dbg\lz4 %RELEASEDIR%\pluginsdk\lz4 /S /Y
|
||||
xcopy src\dbg\TitanEngine %RELEASEDIR%\pluginsdk\TitanEngine /S /Y
|
||||
del %RELEASEDIR%\pluginsdk\TitanEngine\TitanEngine.txt /F /Q
|
||||
xcopy src\dbg\XEDParse %RELEASEDIR%\pluginsdk\XEDParse /S /Y
|
||||
copy src\dbg\_plugin_types.h %RELEASEDIR%\pluginsdk\_plugin_types.h
|
||||
copy src\dbg\_plugins.h %RELEASEDIR%\pluginsdk\_plugins.h
|
||||
copy src\dbg\_scriptapi*.h %RELEASEDIR%\pluginsdk\_scriptapi*.h
|
||||
copy src\dbg\_dbgfunctions.h %RELEASEDIR%\pluginsdk\_dbgfunctions.h
|
||||
copy src\bridge\bridge*.h %RELEASEDIR%\pluginsdk\bridge*.h
|
||||
|
||||
genlib bin\x32\x32bridge.dll
|
||||
copy x32bridge.a %RELEASEDIR%\pluginsdk\libx32bridge.a
|
||||
del x32bridge.def
|
||||
del x32bridge.a
|
||||
copy bin\x32\x32bridge.lib %RELEASEDIR%\pluginsdk\x32bridge.lib
|
||||
|
||||
genlib bin\x32\x32dbg.dll
|
||||
copy x32dbg.a %RELEASEDIR%\pluginsdk\libx32dbg.a
|
||||
del x32dbg.def
|
||||
del x32dbg.a
|
||||
copy bin\x32\x32dbg.lib %RELEASEDIR%\pluginsdk\x32dbg.lib
|
||||
|
||||
genlib bin\x64\x64bridge.dll
|
||||
copy x64bridge.a %RELEASEDIR%\pluginsdk\libx64bridge.a
|
||||
del x64bridge.def
|
||||
del x64bridge.a
|
||||
copy bin\x64\x64bridge.lib %RELEASEDIR%\pluginsdk\x64bridge.lib
|
||||
|
||||
genlib bin\x64\x64dbg.dll
|
||||
copy x64dbg.a %RELEASEDIR%\pluginsdk\libx64dbg.a
|
||||
del x64dbg.def
|
||||
del x64dbg.a
|
||||
copy bin\x64\x64dbg.lib %RELEASEDIR%\pluginsdk\x64dbg.lib
|
||||
|
||||
echo release
|
||||
|
||||
mkdir %RELEASEDIR%\release
|
||||
mkdir %RELEASEDIR%\release\translations
|
||||
mkdir %RELEASEDIR%\release\x32
|
||||
mkdir %RELEASEDIR%\release\x64
|
||||
|
||||
xcopy deps\x32 %RELEASEDIR%\release\x32 /S /Y
|
||||
xcopy deps\x64 %RELEASEDIR%\release\x64 /S /Y
|
||||
xcopy bin\themes %RELEASEDIR%\release\themes /S /Y /I
|
||||
|
||||
copy help\x64dbg.chm %RELEASEDIR%\release\
|
||||
copy bin\x96dbg.exe %RELEASEDIR%\release\
|
||||
copy bin\mnemdb.json %RELEASEDIR%\release\
|
||||
copy bin\errordb.txt %RELEASEDIR%\release\
|
||||
copy bin\exceptiondb.txt %RELEASEDIR%\release\
|
||||
copy bin\ntstatusdb.txt %RELEASEDIR%\release\
|
||||
copy bin\winconstants.txt %RELEASEDIR%\release\
|
||||
xcopy bin\translations\*.qm %RELEASEDIR%\release\translations /S /Y
|
||||
copy bin\x32\x32bridge.dll %RELEASEDIR%\release\x32\
|
||||
copy bin\x32\x32dbg.dll %RELEASEDIR%\release\x32\
|
||||
copy bin\x32\x32dbg.exe %RELEASEDIR%\release\x32\
|
||||
copy bin\x32\x32dbg.exe %RELEASEDIR%\release\x32\x32dbg-unsigned.exe
|
||||
copy bin\x32\x32gui.dll %RELEASEDIR%\release\x32\
|
||||
copy bin\x32\loaddll.exe %RELEASEDIR%\release\x32\
|
||||
copy bin\x64\x64bridge.dll %RELEASEDIR%\release\x64\
|
||||
copy bin\x64\x64dbg.dll %RELEASEDIR%\release\x64\
|
||||
copy bin\x64\x64dbg.exe %RELEASEDIR%\release\x64\
|
||||
copy bin\x64\x64dbg.exe %RELEASEDIR%\release\x64\x64dbg-unsigned.exe
|
||||
copy bin\x64\x64gui.dll %RELEASEDIR%\release\x64\
|
||||
copy bin\x64\loaddll.exe %RELEASEDIR%\release\x64\
|
||||
|
||||
echo "creating commithash.txt"
|
||||
git rev-parse HEAD > %RELEASEDIR%\commithash.txt
|
||||
|
||||
echo "copying PDB files"
|
||||
mkdir %RELEASEDIR%\pdb
|
||||
mkdir %RELEASEDIR%\pdb\x32
|
||||
mkdir %RELEASEDIR%\pdb\x64
|
||||
|
||||
copy bin\*.pdb %RELEASEDIR%\pdb\
|
||||
copy bin\x32\*.pdb %RELEASEDIR%\pdb\x32\
|
||||
copy bin\x64\*.pdb %RELEASEDIR%\pdb\x64\
|
||||
|
||||
exit 0
|
||||
|
|
@ -15,7 +15,7 @@ extern GUISENDMESSAGE _gui_sendmessage;
|
|||
extern GUITRANSLATETEXT _gui_translate_text;
|
||||
|
||||
//DBG typedefs
|
||||
typedef const char* (*DBGDBGINIT)();
|
||||
typedef const char* (*DBGDBGINIT)(bool blocking);
|
||||
typedef duint(*DBGMEMFINDBASEADDR)(duint addr, duint* size);
|
||||
typedef bool (*DBGMEMREAD)(duint addr, void* dest, duint size, duint* read);
|
||||
typedef bool (*DBGMEMWRITE)(duint addr, const void* src, duint size, duint* written);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
static HINSTANCE hInst;
|
||||
static Utf8Ini settings;
|
||||
static wchar_t szWorkingDirectory[MAX_PATH] = L"";
|
||||
static wchar_t szUserDirectory[MAX_PATH] = L"";
|
||||
static wchar_t szIniFile[MAX_PATH] = L"";
|
||||
static CRITICAL_SECTION csIni;
|
||||
|
|
@ -79,6 +80,9 @@ static const wchar_t* InitializeUserDirectory(HINSTANCE hMainModule, const wchar
|
|||
|
||||
*backslash = L'\0';
|
||||
|
||||
// Preserve the working directory for the debuggee
|
||||
GetCurrentDirectoryW(_countof(szWorkingDirectory), szWorkingDirectory);
|
||||
|
||||
// Set the current directory to the application directory
|
||||
SetCurrentDirectoryW(szUserDirectory);
|
||||
|
||||
|
|
@ -230,6 +234,14 @@ BRIDGE_IMPEXP const wchar_t* BridgeInit(BRIDGE_CONFIG* config)
|
|||
LOADEXPORT(_dbg_getbranchdestination);
|
||||
LOADEXPORT(_dbg_sendmessage);
|
||||
|
||||
// GUI
|
||||
if(config->hGuiModule != nullptr)
|
||||
{
|
||||
hInst = config->hGuiModule;
|
||||
szLib = L"headless";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Imported DLLs (GUI)
|
||||
LOADLIBRARY(L"ldconvert.dll");
|
||||
loadIfExists(L"Qt5Core.dll");
|
||||
|
|
@ -250,15 +262,6 @@ BRIDGE_IMPEXP const wchar_t* BridgeInit(BRIDGE_CONFIG* config)
|
|||
loadIfExists(L"bearer\\qgenericbearer.dll");
|
||||
loadIfExists(L"bearer\\qnativewifibearer.dll");
|
||||
loadIfExists(L"iconengines\\qsvgicon.dll");
|
||||
|
||||
// GUI
|
||||
if(config->hGuiModule != nullptr)
|
||||
{
|
||||
hInst = config->hGuiModule;
|
||||
szLib = L"headless";
|
||||
}
|
||||
else
|
||||
{
|
||||
LOADLIBRARY(gui_lib);
|
||||
}
|
||||
LOADEXPORT(_gui_guiinit);
|
||||
|
|
@ -474,6 +477,11 @@ BRIDGE_IMPEXP unsigned int BridgeGetNtBuildNumber()
|
|||
return NtBuildNumber;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP const wchar_t* BridgeWorkingDirectory()
|
||||
{
|
||||
return szWorkingDirectory;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP const wchar_t* BridgeUserDirectory()
|
||||
{
|
||||
return szUserDirectory;
|
||||
|
|
@ -694,7 +702,12 @@ BRIDGE_IMPEXP void DbgClearBookmarkRange(duint start, duint end)
|
|||
// FIXME return on success?
|
||||
BRIDGE_IMPEXP const char* DbgInit()
|
||||
{
|
||||
return _dbg_dbginit();
|
||||
return _dbg_dbginit(false);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP const char* DbgInitBlocking()
|
||||
{
|
||||
return _dbg_dbginit(true);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void DbgExit()
|
||||
|
|
@ -1579,6 +1592,11 @@ BRIDGE_IMPEXP bool DbgTypeVisit(const TYPEVISITDATA* data)
|
|||
return !!_dbg_sendmessage(DBG_TYPE_VISIT, (void*)data, nullptr);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void DbgUpdateGui(duint disasm_addr, bool stack)
|
||||
{
|
||||
_dbg_sendmessage(DBG_UPDATE_GUI, (void*)disasm_addr, (void*)stack);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP const char* GuiTranslateText(const char* Source)
|
||||
{
|
||||
EnterCriticalSection(&csTranslate);
|
||||
|
|
@ -1636,8 +1654,11 @@ BRIDGE_IMPEXP void GuiUpdateEnable(bool updateNow)
|
|||
{
|
||||
bDisableGUIUpdate = false;
|
||||
if(updateNow)
|
||||
{
|
||||
DbgUpdateGui(0, false);
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void GuiUpdateDisable()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,6 +146,12 @@ BRIDGE_IMPEXP bool BridgeIsProcessElevated();
|
|||
/// <returns>NtBuildNumber</returns>
|
||||
BRIDGE_IMPEXP unsigned int BridgeGetNtBuildNumber();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the original working directory when starting the debugger.
|
||||
/// The working directory is changed to the x64dbg directory after initialization.
|
||||
/// </summary>
|
||||
BRIDGE_IMPEXP const wchar_t* BridgeWorkingDirectory();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the user directory (without trailing backslash).
|
||||
/// </summary>
|
||||
|
|
@ -352,6 +358,7 @@ typedef enum
|
|||
DBG_GET_SYMBOL_INFO_AT, // param1=duint addr, param2=SYMBOLINFO* info
|
||||
DBG_XREF_ADD_MULTI, // param1=const XREF_EDGE* edges, param2=duint count
|
||||
DBG_TYPE_VISIT, // param1=TYPEVISITDATA* data, param2=unused
|
||||
DBG_UPDATE_GUI, // param1=disasm_addr, param2=bool stack
|
||||
} DBGMSG;
|
||||
|
||||
typedef enum
|
||||
|
|
@ -1097,6 +1104,7 @@ typedef struct _TYPEDESCRIPTOR
|
|||
|
||||
//Debugger functions
|
||||
BRIDGE_IMPEXP const char* DbgInit();
|
||||
BRIDGE_IMPEXP const char* DbgInitBlocking();
|
||||
BRIDGE_IMPEXP void DbgExit();
|
||||
BRIDGE_IMPEXP bool DbgMemRead(duint va, void* dest, duint size);
|
||||
BRIDGE_IMPEXP bool DbgMemWrite(duint va, const void* src, duint size);
|
||||
|
|
@ -1223,6 +1231,7 @@ BRIDGE_IMPEXP void DbgGetSymbolInfo(const SYMBOLPTR* symbolptr, SYMBOLINFO* info
|
|||
BRIDGE_IMPEXP DEBUG_ENGINE DbgGetDebugEngine();
|
||||
BRIDGE_IMPEXP bool DbgGetSymbolInfoAt(duint addr, SYMBOLINFO* info);
|
||||
BRIDGE_IMPEXP duint DbgXrefAddMulti(const XREF_EDGE* edges, duint count);
|
||||
BRIDGE_IMPEXP void DbgUpdateGui(duint disasm_addr, bool stack);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,224 @@
|
|||
# This file is automatically generated from cmake.toml - DO NOT EDIT
|
||||
# See https://github.com/build-cpp/cmkr for more information
|
||||
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
|
||||
endif()
|
||||
|
||||
set(CMKR_ROOT_PROJECT OFF)
|
||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(CMKR_ROOT_PROJECT ON)
|
||||
|
||||
# Bootstrap cmkr and automatically regenerate CMakeLists.txt
|
||||
include("../../cmake/cmkr.cmake" OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
|
||||
if(CMKR_INCLUDE_RESULT)
|
||||
cmkr()
|
||||
endif()
|
||||
|
||||
# Enable folder support
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# Create a configure-time dependency on cmake.toml to improve IDE support
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS cmake.toml)
|
||||
endif()
|
||||
|
||||
# Options
|
||||
option(LIBPL_ENABLE_CLI "" OFF)
|
||||
option(LIBPL_ENABLE_TESTS "" OFF)
|
||||
option(LIBWOLV_ENABLE_TESTS "" OFF)
|
||||
|
||||
project(cross)
|
||||
|
||||
include("widgets/Qt.cmake")
|
||||
|
||||
# Subdirectory: widgets
|
||||
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
|
||||
if(CMAKE_FOLDER)
|
||||
set(CMAKE_FOLDER "${CMAKE_FOLDER}/widgets")
|
||||
else()
|
||||
set(CMAKE_FOLDER widgets)
|
||||
endif()
|
||||
add_subdirectory(widgets)
|
||||
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
|
||||
|
||||
# Subdirectory: vendor
|
||||
set(CMKR_CMAKE_FOLDER ${CMAKE_FOLDER})
|
||||
if(CMAKE_FOLDER)
|
||||
set(CMAKE_FOLDER "${CMAKE_FOLDER}/vendor")
|
||||
else()
|
||||
set(CMAKE_FOLDER vendor)
|
||||
endif()
|
||||
add_subdirectory(vendor)
|
||||
set(CMAKE_FOLDER ${CMKR_CMAKE_FOLDER})
|
||||
|
||||
# Target: minidump
|
||||
set(minidump_SOURCES
|
||||
cmake.toml
|
||||
"minidump/FileParser.cpp"
|
||||
"minidump/FileParser.h"
|
||||
"minidump/GotoDialog.cpp"
|
||||
"minidump/GotoDialog.h"
|
||||
"minidump/MainWindow.cpp"
|
||||
"minidump/MainWindow.h"
|
||||
"minidump/MainWindow.ui"
|
||||
"minidump/MiniDisassembly.cpp"
|
||||
"minidump/MiniDisassembly.h"
|
||||
"minidump/MiniHexDump.cpp"
|
||||
"minidump/MiniHexDump.h"
|
||||
"minidump/MiniMemoryMap.cpp"
|
||||
"minidump/MiniMemoryMap.h"
|
||||
"minidump/Navigation.cpp"
|
||||
"minidump/Navigation.h"
|
||||
"minidump/REToolSync.cpp"
|
||||
"minidump/REToolSync.h"
|
||||
"minidump/main.cpp"
|
||||
"minidump/udmp-utils.h"
|
||||
)
|
||||
|
||||
qt_executable(minidump ${minidump_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${minidump_SOURCES})
|
||||
|
||||
target_compile_features(minidump PRIVATE
|
||||
cxx_std_20
|
||||
)
|
||||
|
||||
if(NOT TARGET linux-pe)
|
||||
message(FATAL_ERROR "Target \"linux-pe\" referenced by \"minidump\" does not exist!")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET udmp-parser)
|
||||
message(FATAL_ERROR "Target \"udmp-parser\" referenced by \"minidump\" does not exist!")
|
||||
endif()
|
||||
|
||||
target_link_libraries(minidump PRIVATE
|
||||
x64dbg::widgets
|
||||
httplib::httplib
|
||||
linux-pe
|
||||
udmp-parser
|
||||
)
|
||||
|
||||
get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT)
|
||||
if(NOT CMKR_VS_STARTUP_PROJECT)
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT minidump)
|
||||
endif()
|
||||
|
||||
# Target: remote_table
|
||||
set(remote_table_SOURCES
|
||||
cmake.toml
|
||||
"remote_table/JsonRpcClient.cpp"
|
||||
"remote_table/JsonRpcClient.h"
|
||||
"remote_table/MainWindow.cpp"
|
||||
"remote_table/MainWindow.h"
|
||||
"remote_table/MainWindow.ui"
|
||||
"remote_table/OverlayFrame.cpp"
|
||||
"remote_table/OverlayFrame.h"
|
||||
"remote_table/OverlayFrame.ui"
|
||||
"remote_table/RemoteTable.cpp"
|
||||
"remote_table/RemoteTable.h"
|
||||
"remote_table/TableRpcData.h"
|
||||
"remote_table/TableServer.cpp"
|
||||
"remote_table/TableServer.h"
|
||||
"remote_table/main.cpp"
|
||||
)
|
||||
|
||||
qt_executable(remote_table ${remote_table_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${remote_table_SOURCES})
|
||||
|
||||
target_compile_features(remote_table PRIVATE
|
||||
cxx_std_20
|
||||
)
|
||||
|
||||
target_link_libraries(remote_table PRIVATE
|
||||
x64dbg::widgets
|
||||
nlohmann_json::nlohmann_json
|
||||
)
|
||||
|
||||
get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT)
|
||||
if(NOT CMKR_VS_STARTUP_PROJECT)
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT remote_table)
|
||||
endif()
|
||||
|
||||
# Target: release_notes
|
||||
set(release_notes_SOURCES
|
||||
cmake.toml
|
||||
"release_notes/main.cpp"
|
||||
)
|
||||
|
||||
qt_executable(release_notes ${release_notes_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${release_notes_SOURCES})
|
||||
|
||||
target_compile_features(release_notes PRIVATE
|
||||
cxx_std_20
|
||||
)
|
||||
|
||||
target_include_directories(release_notes PRIVATE
|
||||
release_notes
|
||||
)
|
||||
|
||||
target_link_libraries(release_notes PRIVATE
|
||||
x64dbg::widgets
|
||||
)
|
||||
|
||||
get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT)
|
||||
if(NOT CMKR_VS_STARTUP_PROJECT)
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT release_notes)
|
||||
endif()
|
||||
|
||||
# Target: hex_viewer
|
||||
set(hex_viewer_SOURCES
|
||||
cmake.toml
|
||||
"hex_viewer/CodeEditor.cpp"
|
||||
"hex_viewer/CodeEditor.h"
|
||||
"hex_viewer/DataTable.cpp"
|
||||
"hex_viewer/DataTable.h"
|
||||
"hex_viewer/File.cpp"
|
||||
"hex_viewer/File.h"
|
||||
"hex_viewer/GotoDialog.cpp"
|
||||
"hex_viewer/GotoDialog.h"
|
||||
"hex_viewer/MainWindow.cpp"
|
||||
"hex_viewer/MainWindow.h"
|
||||
"hex_viewer/MainWindow.ui"
|
||||
"hex_viewer/MiniHexDump.cpp"
|
||||
"hex_viewer/MiniHexDump.h"
|
||||
"hex_viewer/Navigation.cpp"
|
||||
"hex_viewer/Navigation.h"
|
||||
"hex_viewer/PatternHighlighter.cpp"
|
||||
"hex_viewer/PatternHighlighter.h"
|
||||
"hex_viewer/PatternLanguage.cpp"
|
||||
"hex_viewer/PatternLanguage.h"
|
||||
"hex_viewer/Styled.h"
|
||||
"hex_viewer/main.cpp"
|
||||
)
|
||||
|
||||
qt_executable(hex_viewer ${hex_viewer_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${hex_viewer_SOURCES})
|
||||
|
||||
target_compile_features(hex_viewer PRIVATE
|
||||
cxx_std_20
|
||||
)
|
||||
|
||||
target_include_directories(hex_viewer PRIVATE
|
||||
hex_viewer
|
||||
)
|
||||
|
||||
if(NOT TARGET libpl)
|
||||
message(FATAL_ERROR "Target \"libpl\" referenced by \"hex_viewer\" does not exist!")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET libpl-gen)
|
||||
message(FATAL_ERROR "Target \"libpl-gen\" referenced by \"hex_viewer\" does not exist!")
|
||||
endif()
|
||||
|
||||
target_link_libraries(hex_viewer PRIVATE
|
||||
x64dbg::widgets
|
||||
libpl
|
||||
libpl-gen
|
||||
fmt::fmt-header-only
|
||||
)
|
||||
|
||||
get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT)
|
||||
if(NOT CMKR_VS_STARTUP_PROJECT)
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT hex_viewer)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
|
||||
[cmake]
|
||||
version = "3.19"
|
||||
cmkr-include = "../../cmake/cmkr.cmake"
|
||||
|
||||
[project]
|
||||
name = "cross"
|
||||
include-after = ["widgets/Qt.cmake"]
|
||||
|
||||
[options]
|
||||
LIBPL_ENABLE_CLI = false
|
||||
LIBPL_ENABLE_TESTS = false
|
||||
LIBWOLV_ENABLE_TESTS = false
|
||||
|
||||
[subdir.widgets]
|
||||
|
||||
[subdir.vendor]
|
||||
|
||||
[template.qt_executable]
|
||||
type = "executable"
|
||||
add-function = "qt_executable"
|
||||
pass-sources = true
|
||||
compile-features = ["cxx_std_20"]
|
||||
|
||||
[target.minidump]
|
||||
type = "qt_executable"
|
||||
sources = [
|
||||
"minidump/*.cpp",
|
||||
"minidump/*.h",
|
||||
"minidump/*.ui",
|
||||
"minidump/*.qrc",
|
||||
]
|
||||
link-libraries = [
|
||||
"x64dbg::widgets",
|
||||
"httplib::httplib",
|
||||
"::linux-pe",
|
||||
"::udmp-parser",
|
||||
]
|
||||
|
||||
[target.remote_table]
|
||||
type = "qt_executable"
|
||||
sources = [
|
||||
"remote_table/*.cpp",
|
||||
"remote_table/*.h",
|
||||
"remote_table/*.ui",
|
||||
"remote_table/*.qrc",
|
||||
]
|
||||
link-libraries = [
|
||||
"x64dbg::widgets",
|
||||
"nlohmann_json::nlohmann_json",
|
||||
]
|
||||
|
||||
[target.release_notes]
|
||||
type = "qt_executable"
|
||||
sources = [
|
||||
"release_notes/*.cpp",
|
||||
"release_notes/*.h",
|
||||
"release_notes/*.ui",
|
||||
]
|
||||
include-directories = ["release_notes"]
|
||||
link-libraries = [
|
||||
"x64dbg::widgets",
|
||||
]
|
||||
|
||||
[target.hex_viewer]
|
||||
type = "qt_executable"
|
||||
sources = [
|
||||
"hex_viewer/*.cpp",
|
||||
"hex_viewer/*.h",
|
||||
"hex_viewer/*.ui",
|
||||
"hex_viewer/*.qrc",
|
||||
]
|
||||
link-libraries = [
|
||||
"x64dbg::widgets",
|
||||
"::libpl",
|
||||
"::libpl-gen",
|
||||
"fmt::fmt-header-only",
|
||||
]
|
||||
private-include-directories = [
|
||||
"hex_viewer",
|
||||
]
|
||||
|
|
@ -0,0 +1,288 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** BSD License Usage
|
||||
** Alternatively, you may use this file under the terms of the BSD license
|
||||
** as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
||||
** contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "CodeEditor.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QTextBlock>
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
#include <QAction>
|
||||
|
||||
CodeEditor::CodeEditor(QWidget* parent)
|
||||
: QPlainTextEdit(parent)
|
||||
{
|
||||
setWordWrapMode(QTextOption::NoWrap);
|
||||
lineNumberArea = new LineNumberArea(this);
|
||||
|
||||
connect(this, &CodeEditor::blockCountChanged, this, &CodeEditor::updateLineNumberAreaWidth);
|
||||
connect(this, &CodeEditor::updateRequest, this, &CodeEditor::updateLineNumberArea);
|
||||
connect(this, &CodeEditor::cursorPositionChanged, this, &CodeEditor::highlightCurrentLine);
|
||||
|
||||
updateLineNumberAreaWidth(0);
|
||||
highlightCurrentLine();
|
||||
}
|
||||
|
||||
int CodeEditor::lineNumberAreaWidth()
|
||||
{
|
||||
int digits = 1;
|
||||
int max = qMax(1, blockCount());
|
||||
while(max >= 10)
|
||||
{
|
||||
max /= 10;
|
||||
++digits;
|
||||
}
|
||||
|
||||
return 3 + measureFontWidth("7") * digits;
|
||||
}
|
||||
|
||||
void CodeEditor::setErrorLine(int line)
|
||||
{
|
||||
mErrorLine = line;
|
||||
highlightCurrentLine();
|
||||
}
|
||||
|
||||
void CodeEditor::setTokenHighlights(const QString & token, const QList<int> & lines)
|
||||
{
|
||||
mHighlightToken = token;
|
||||
mHighlightLines = lines;
|
||||
highlightCurrentLine(); // TODO: this will now be done twice
|
||||
}
|
||||
|
||||
void CodeEditor::setHackedReadonly(bool readonly)
|
||||
{
|
||||
mHackedReadonly = readonly;
|
||||
}
|
||||
|
||||
int CodeEditor::measureFontWidth(const QString & str)
|
||||
{
|
||||
auto metrics = fontMetrics();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
return metrics.horizontalAdvance(str);
|
||||
#else
|
||||
return metrics.width(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */)
|
||||
{
|
||||
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
|
||||
}
|
||||
|
||||
void CodeEditor::updateLineNumberArea(const QRect & rect, int dy)
|
||||
{
|
||||
if(dy)
|
||||
lineNumberArea->scroll(0, dy);
|
||||
else
|
||||
lineNumberArea->update(0, rect.y(), lineNumberArea->width(), rect.height());
|
||||
|
||||
if(rect.contains(viewport()->rect()))
|
||||
updateLineNumberAreaWidth(0);
|
||||
}
|
||||
|
||||
void CodeEditor::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
QPlainTextEdit::resizeEvent(e);
|
||||
|
||||
QRect cr = contentsRect();
|
||||
lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
|
||||
}
|
||||
|
||||
void CodeEditor::changeEvent(QEvent* event)
|
||||
{
|
||||
if(event->type() == QEvent::StyleChange)
|
||||
{
|
||||
highlightCurrentLine();
|
||||
}
|
||||
else if(event->type() == QEvent::FontChange)
|
||||
{
|
||||
setTabStopDistance(measureFontWidth(" "));
|
||||
}
|
||||
QPlainTextEdit::changeEvent(event);
|
||||
}
|
||||
|
||||
void CodeEditor::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
// Shift+Enter does something sus
|
||||
if((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) && event->modifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(mHackedReadonly)
|
||||
{
|
||||
// https://doc.qt.io/qt-6/qplaintextedit.html#read-only-key-bindings
|
||||
switch(event->key())
|
||||
{
|
||||
case Qt::Key_Copy:
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_Down:
|
||||
case Qt::Key_PageUp:
|
||||
case Qt::Key_PageDown:
|
||||
case Qt::Key_Home:
|
||||
case Qt::Key_End:
|
||||
case Qt::Key_Shift:
|
||||
case Qt::Key_Alt:
|
||||
case Qt::Key_Control:
|
||||
case Qt::Key_Meta:
|
||||
break;
|
||||
case Qt::Key_A:
|
||||
// Select all
|
||||
if(event->modifiers() & (Qt::ControlModifier | Qt::MetaModifier))
|
||||
break;
|
||||
case Qt::Key_C:
|
||||
// Copy
|
||||
if(event->modifiers() & (Qt::ControlModifier | Qt::MetaModifier))
|
||||
break;
|
||||
default:
|
||||
{
|
||||
QKeySequence seq(event->modifiers() | event->key());
|
||||
Q_FOREACH(auto action, actions())
|
||||
{
|
||||
auto shortcut = action->shortcut();
|
||||
if(!shortcut.isEmpty() && shortcut == seq)
|
||||
{
|
||||
action->trigger();
|
||||
event->accept();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
QPlainTextEdit::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void CodeEditor::highlightCurrentLine()
|
||||
{
|
||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||
|
||||
if(!mHackedReadonly /* isReadOnly() */)
|
||||
{
|
||||
QTextEdit::ExtraSelection selection;
|
||||
selection.format.setBackground(selectedLineHighlightColor());
|
||||
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
selection.cursor = textCursor();
|
||||
selection.cursor.clearSelection();
|
||||
extraSelections.append(selection);
|
||||
}
|
||||
|
||||
if(mErrorLine != -1)
|
||||
{
|
||||
QTextEdit::ExtraSelection selection;
|
||||
selection.format.setBackground(errorLineHighlightColor());
|
||||
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
selection.cursor = textCursor();
|
||||
selection.cursor.clearSelection();
|
||||
selection.cursor.setPosition(document()->findBlockByLineNumber(mErrorLine - 1).position());
|
||||
extraSelections.append(selection);
|
||||
}
|
||||
|
||||
if(!mHighlightToken.isEmpty())
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
|
||||
if(mHighlightLines.empty())
|
||||
{
|
||||
// Global selection
|
||||
auto plainText = toPlainText();
|
||||
|
||||
QStringMatcher matcher(mHighlightToken);
|
||||
for(auto from = 0; ;)
|
||||
{
|
||||
auto index = matcher.indexIn(plainText, from);
|
||||
if(index == -1)
|
||||
break;
|
||||
|
||||
QTextEdit::ExtraSelection currentWord;
|
||||
currentWord.format.setFontUnderline(true);
|
||||
cursor.setPosition(index, QTextCursor::MoveAnchor);
|
||||
cursor.setPosition(index + mHighlightToken.length(), QTextCursor::KeepAnchor);
|
||||
currentWord.cursor = cursor;
|
||||
extraSelections.append(currentWord);
|
||||
|
||||
from = index + mHighlightToken.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setExtraSelections(extraSelections);
|
||||
}
|
||||
|
||||
void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter painter(lineNumberArea);
|
||||
painter.setFont(font());
|
||||
|
||||
painter.fillRect(event->rect(), lineNumberBackgroundColor());
|
||||
|
||||
QTextBlock block = firstVisibleBlock();
|
||||
int blockNumber = block.blockNumber();
|
||||
int top = qRound(blockBoundingGeometry(block).translated(contentOffset()).top());
|
||||
int bottom = top + qRound(blockBoundingRect(block).height());
|
||||
|
||||
while(block.isValid() && top <= event->rect().bottom())
|
||||
{
|
||||
if(block.isVisible() && bottom >= event->rect().top())
|
||||
{
|
||||
QString number = QString::number(blockNumber + 1);
|
||||
painter.setPen(lineNumberColor());
|
||||
painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(), Qt::AlignRight, number);
|
||||
}
|
||||
|
||||
block = block.next();
|
||||
top = bottom;
|
||||
bottom = top + qRound(blockBoundingRect(block).height());
|
||||
++blockNumber;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** BSD License Usage
|
||||
** Alternatively, you may use this file under the terms of the BSD license
|
||||
** as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
||||
** contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
#include "Styled.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPaintEvent;
|
||||
class QResizeEvent;
|
||||
class QSize;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class LineNumberArea;
|
||||
|
||||
class CodeEditor : public QPlainTextEdit, Styled<CodeEditor>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// One Dark Pro
|
||||
CSS_COLOR(selectedLineHighlightColor, "#2c313c");
|
||||
CSS_COLOR(errorLineHighlightColor, "#c24039");
|
||||
CSS_COLOR(lineNumberColor, "#5c6370");
|
||||
CSS_COLOR(lineNumberBackgroundColor, "#282c34");
|
||||
|
||||
CSS_COLOR(keywordColor, "#c678dd");
|
||||
CSS_COLOR(instructionColor, "#c678dd");
|
||||
|
||||
CSS_COLOR(globalVariableColor, "#e06c75");
|
||||
CSS_COLOR(localVariableColor, "#e06c75");
|
||||
CSS_COLOR(constantColor, "#56b6c2");
|
||||
CSS_COLOR(integerTypeColor, "#d19a66");
|
||||
|
||||
CSS_COLOR(commentColor, "#5c6370");
|
||||
CSS_COLOR(metadataColor, "#5c6370");
|
||||
CSS_COLOR(functionColor, "#61afef");
|
||||
CSS_COLOR(stringColor, "#98c379");
|
||||
CSS_COLOR(operatorColor, "#c678dd");
|
||||
|
||||
public:
|
||||
CodeEditor(QWidget* parent = nullptr);
|
||||
|
||||
void lineNumberAreaPaintEvent(QPaintEvent* event);
|
||||
int lineNumberAreaWidth();
|
||||
void setErrorLine(int line);
|
||||
void setTokenHighlights(const QString & token, const QList<int> & lines);
|
||||
void setHackedReadonly(bool readonly);
|
||||
|
||||
int measureFontWidth(const QString & str);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void changeEvent(QEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
private slots:
|
||||
void updateLineNumberAreaWidth(int newBlockCount);
|
||||
void highlightCurrentLine();
|
||||
void updateLineNumberArea(const QRect & rect, int dy);
|
||||
|
||||
private:
|
||||
QWidget* lineNumberArea;
|
||||
int mErrorLine = -1;
|
||||
QString mHighlightToken;
|
||||
QList<int> mHighlightLines;
|
||||
bool mHackedReadonly = false;
|
||||
};
|
||||
|
||||
class LineNumberArea : public QWidget
|
||||
{
|
||||
public:
|
||||
LineNumberArea(CodeEditor* editor)
|
||||
: QWidget(editor)
|
||||
, codeEditor(editor)
|
||||
{
|
||||
}
|
||||
|
||||
QSize sizeHint() const override
|
||||
{
|
||||
return QSize(codeEditor->lineNumberAreaWidth(), 0);
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override
|
||||
{
|
||||
codeEditor->lineNumberAreaPaintEvent(event);
|
||||
}
|
||||
|
||||
private:
|
||||
CodeEditor* codeEditor;
|
||||
};
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
#include "DataTable.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
DataTable::DataTable(QWidget* parent)
|
||||
: StdTable(parent)
|
||||
{
|
||||
auto type = [this](const QString & name, DataFn fn)
|
||||
{
|
||||
mTypes.emplace_back(name, std::move(fn));
|
||||
};
|
||||
|
||||
type("Address", [this](duint start, duint end)
|
||||
{
|
||||
auto size = end - start + 1;
|
||||
if(size > 1)
|
||||
{
|
||||
return QString("0x%1 - 0x%2 (0x%3 bytes)").arg(ToHexString(start)).arg(ToHexString(end)).arg(ToHexString(size));
|
||||
}
|
||||
else
|
||||
{
|
||||
return "0x" + ToHexString(start);
|
||||
}
|
||||
});
|
||||
|
||||
type("Binary (u8)", [this](duint start, duint end)
|
||||
{
|
||||
uint8_t data = 0;
|
||||
read(&data, start, sizeof(data));
|
||||
uint8_t mask = 0x80;
|
||||
QString result = "0b0";
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
if(data & mask)
|
||||
result += "1";
|
||||
else
|
||||
result += "0";
|
||||
}
|
||||
return result;
|
||||
});
|
||||
type("uint8_t", [this](duint start, duint end)
|
||||
{
|
||||
return primitive<uint8_t>(start);
|
||||
});
|
||||
type("int8_t", [this](duint start, duint end)
|
||||
{
|
||||
return primitive<int8_t>(start);
|
||||
});
|
||||
type("uint16_t", [this](duint start, duint end)
|
||||
{
|
||||
return primitive<uint16_t>(start);
|
||||
});
|
||||
type("int16_t", [this](duint start, duint end)
|
||||
{
|
||||
return primitive<int16_t>(start);
|
||||
});
|
||||
|
||||
int width = 1;
|
||||
for(size_t i = 0; i < mTypes.size(); i++)
|
||||
{
|
||||
width = qMax(width, mTypes[i].first.length());
|
||||
}
|
||||
addColumnAt(getCharWidth() * width + 8, "Type", true);
|
||||
addColumnAt(0, "Value", false);
|
||||
|
||||
setRowCount(mTypes.size());
|
||||
for(size_t i = 0; i < mTypes.size(); i++)
|
||||
{
|
||||
setCellContent(i, ColType, mTypes[i].first);
|
||||
}
|
||||
}
|
||||
|
||||
void DataTable::selectionChanged(duint start, duint end)
|
||||
{
|
||||
for(size_t i = 0; i < mTypes.size(); i++)
|
||||
{
|
||||
auto value = mTypes[i].second(start, end);
|
||||
setCellContent(i, ColValue, value);
|
||||
}
|
||||
reloadData();
|
||||
}
|
||||
|
||||
bool DataTable::read(void* destination, duint addr, duint size)
|
||||
{
|
||||
return DbgMemRead(addr, destination, size);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include <BasicView/StdTable.h>
|
||||
|
||||
class DataTable : public StdTable
|
||||
{
|
||||
public:
|
||||
explicit DataTable(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void selectionChanged(duint start, duint end);
|
||||
|
||||
private:
|
||||
bool read(void* destination, duint addr, duint size);
|
||||
|
||||
template<class T>
|
||||
QString primitive(duint addr)
|
||||
{
|
||||
T data = {};
|
||||
if(!read(&data, addr, sizeof(data)))
|
||||
{
|
||||
return "???";
|
||||
}
|
||||
return QString("%1").arg(data);
|
||||
}
|
||||
|
||||
enum Columns
|
||||
{
|
||||
ColType,
|
||||
ColValue,
|
||||
};
|
||||
|
||||
using DataFn = std::function<QString(duint, duint)>;
|
||||
|
||||
std::vector<std::pair<QString, DataFn>> mTypes;
|
||||
};
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#include "File.h"
|
||||
|
||||
File::File(duint virtualBase, const QString & fileName)
|
||||
: mVirtualBase(virtualBase)
|
||||
{
|
||||
mFile = new QFile(fileName, this);
|
||||
if(!mFile->open(QIODevice::ReadOnly))
|
||||
{
|
||||
throw std::runtime_error("Failed to open file: " + fileName.toUtf8().toStdString());
|
||||
}
|
||||
mSize = mFile->size();
|
||||
}
|
||||
|
||||
File::~File()
|
||||
{
|
||||
if(mFile != nullptr)
|
||||
{
|
||||
mFile->close();
|
||||
delete mFile;
|
||||
mFile = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool File::read(duint addr, void* dest, duint size)
|
||||
{
|
||||
if(addr < mVirtualBase || addr + size > mVirtualBase + mSize)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto offset = addr - mVirtualBase;
|
||||
mFile->seek(offset);
|
||||
return mFile->read((char*)dest, size) == size;
|
||||
}
|
||||
|
||||
bool File::getRange(duint addr, duint & base, duint & size)
|
||||
{
|
||||
if(!isValidPtr(addr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
base = mVirtualBase;
|
||||
size = mSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool File::isCodePtr(duint addr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool File::isValidPtr(duint addr)
|
||||
{
|
||||
return addr >= mVirtualBase && addr < mVirtualBase + mSize;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QFile>
|
||||
#include "Bridge.h"
|
||||
|
||||
// TODO: implement as mapped file
|
||||
class File : public QObject, public MemoryProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit File(duint virtualBase, const QString & fileName);
|
||||
~File();
|
||||
|
||||
protected:
|
||||
bool read(duint addr, void* dest, duint size) override;
|
||||
bool getRange(duint addr, duint & base, duint & size) override;
|
||||
bool isCodePtr(duint addr) override;
|
||||
bool isValidPtr(duint addr) override;
|
||||
|
||||
private:
|
||||
duint mVirtualBase = 0;
|
||||
duint mSize = 0;
|
||||
QFile* mFile = nullptr;
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#include "GotoDialog.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
GotoDialog::GotoDialog(QWidget* parent, bool checkAddress)
|
||||
: QInputDialog(parent)
|
||||
, mCheckAddress(checkAddress)
|
||||
{
|
||||
setInputMode(InputMode::TextInput);
|
||||
setLabelText(tr("Address:"));
|
||||
setWindowTitle(tr("Goto"));
|
||||
}
|
||||
|
||||
duint GotoDialog::address() const
|
||||
{
|
||||
return mAddress;
|
||||
}
|
||||
|
||||
void GotoDialog::done(int r)
|
||||
{
|
||||
if(r == Accepted)
|
||||
{
|
||||
auto ok = false;
|
||||
mAddress = textValue().toLongLong(&ok, 16);
|
||||
if(!ok)
|
||||
return;
|
||||
if(mCheckAddress && !DbgMemIsValidReadPtr(mAddress))
|
||||
return;
|
||||
}
|
||||
QInputDialog::done(r);
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <QInputDialog>
|
||||
#include "Types.h"
|
||||
|
||||
class GotoDialog : public QInputDialog
|
||||
{
|
||||
public:
|
||||
GotoDialog(QWidget* parent = nullptr, bool checkAddress = true);
|
||||
using QInputDialog::exec;
|
||||
|
||||
duint address() const;
|
||||
|
||||
protected:
|
||||
void done(int r) override;
|
||||
|
||||
private:
|
||||
bool mCheckAddress = true;
|
||||
duint mAddress = 0;
|
||||
};
|
||||
|
|
@ -0,0 +1,406 @@
|
|||
#include "MainWindow.h"
|
||||
#include "./ui_MainWindow.h"
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSplitter>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QSpacerItem>
|
||||
#include <cinttypes>
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setupNavigation();
|
||||
setupWidgets();
|
||||
|
||||
// Load the dump provided on the command line
|
||||
auto args = qApp->arguments();
|
||||
if(args.length() > 1)
|
||||
{
|
||||
loadFile(args.at(1));
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::loadFile(const QString & path)
|
||||
{
|
||||
DbgSetMemoryProvider(nullptr);
|
||||
|
||||
if(mFile != nullptr)
|
||||
{
|
||||
delete mFile;
|
||||
mFile = nullptr;
|
||||
}
|
||||
|
||||
duint virtualBase = 0;
|
||||
try
|
||||
{
|
||||
mFile = new File(virtualBase, path);
|
||||
}
|
||||
catch(const std::exception & x)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), x.what());
|
||||
}
|
||||
|
||||
DbgSetMemoryProvider(mFile);
|
||||
|
||||
// Reload the views
|
||||
mHexDump->loadFile(mFile);
|
||||
emit mNavigation->gotoDump(virtualBase);
|
||||
}
|
||||
|
||||
void MainWindow::setupNavigation()
|
||||
{
|
||||
mNavigation = new Navigation(this);
|
||||
connect(mNavigation, &Navigation::focusWindow, [this](Navigation::Window window)
|
||||
{
|
||||
switch(window)
|
||||
{
|
||||
case Navigation::Dump:
|
||||
mHexDump->setFocus();
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Unknown window: " << window;
|
||||
break;
|
||||
}
|
||||
});
|
||||
connect(mNavigation, &Navigation::gotoAddress, [this](Navigation::Window window, duint address)
|
||||
{
|
||||
switch(window)
|
||||
{
|
||||
case Navigation::Dump:
|
||||
qDebug() << "Dump at: " << address;
|
||||
gotoHexDump(address, 1);
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Unknown window: " << window;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
struct DefaultArchitecture : Architecture
|
||||
{
|
||||
bool disasm64() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool addr64() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} gArchitecture;
|
||||
|
||||
Architecture* GlobalArchitecture()
|
||||
{
|
||||
return &gArchitecture;
|
||||
}
|
||||
|
||||
void MainWindow::setupWidgets()
|
||||
{
|
||||
mHexDump = new MiniHexDump(mNavigation, GlobalArchitecture(), this);
|
||||
mCodeEditor = new CodeEditor(this);
|
||||
mCodeEditor->setFont(Config()->monospaceFont());
|
||||
mHighlighter = new PatternHighlighter(mCodeEditor, mCodeEditor->document());
|
||||
mLogBrowser = new QTextBrowser(this);
|
||||
mLogBrowser->setFont(Config()->monospaceFont());
|
||||
mLogBrowser->setOpenExternalLinks(true);
|
||||
mLogBrowser->setOpenLinks(false);
|
||||
connect(mLogBrowser, &QTextBrowser::anchorClicked, this, &MainWindow::onLogAnchorClicked);
|
||||
mTypeWidget = new TypeWidget(this);
|
||||
|
||||
mDataTable = new DataTable(this);
|
||||
connect(mHexDump, &MiniHexDump::selectionUpdated, [this]()
|
||||
{
|
||||
mDataTable->selectionChanged(mHexDump->getSelectionStart(), mHexDump->getSelectionEnd());
|
||||
});
|
||||
connect(mTypeWidget, &TypeWidget::itemSelectionChanged, [this]()
|
||||
{
|
||||
auto type = mTypeWidget->selectedType();
|
||||
if(!type.empty())
|
||||
{
|
||||
gotoHexDump(type.type.addr + type.type.offset, type.type.sizeBits / 8);
|
||||
}
|
||||
});
|
||||
|
||||
auto hl = new QHBoxLayout();
|
||||
//hl->addSpacing()
|
||||
hl->addStretch(1);
|
||||
hl->addWidget(new QCheckBox("Auto"));
|
||||
auto runButton = new QPushButton("Run");
|
||||
connect(runButton, &QPushButton::pressed, this, &MainWindow::onButtonRunPressed);
|
||||
hl->addWidget(runButton);
|
||||
hl->setContentsMargins(4, 4, 4, 0);
|
||||
|
||||
auto vl = new QVBoxLayout();
|
||||
vl->addWidget(mCodeEditor);
|
||||
vl->addLayout(hl);
|
||||
vl->setContentsMargins(0, 0, 0, 0);
|
||||
vl->setSpacing(0);
|
||||
|
||||
auto codeWidget = new QWidget();
|
||||
codeWidget->setLayout(vl);
|
||||
|
||||
auto codeSplitter = new QSplitter(Qt::Vertical, this);
|
||||
codeSplitter->addWidget(codeWidget);
|
||||
codeSplitter->addWidget(mTypeWidget);
|
||||
codeSplitter->setStretchFactor(0, 80);
|
||||
codeSplitter->setStretchFactor(0, 20);
|
||||
|
||||
mStructTabs = new QTabWidget(this);
|
||||
mStructTabs->addTab(mDataTable, "Inspector");
|
||||
mStructTabs->addTab(mLogBrowser, "Console");
|
||||
|
||||
auto hexSplitter = new QSplitter(Qt::Vertical, this);
|
||||
hexSplitter->addWidget(mHexDump);
|
||||
hexSplitter->addWidget(mStructTabs);
|
||||
hexSplitter->setStretchFactor(0, 65);
|
||||
hexSplitter->setStretchFactor(1, 35);
|
||||
|
||||
auto mainSplitter = new QSplitter(Qt::Horizontal, this);
|
||||
mainSplitter->addWidget(hexSplitter);
|
||||
mainSplitter->addWidget(codeSplitter);
|
||||
mainSplitter->setStretchFactor(0, 58);
|
||||
mainSplitter->setStretchFactor(1, 42);
|
||||
|
||||
setCentralWidget(mainSplitter);
|
||||
centralWidget()->setContentsMargins(3, 3, 3, 3);
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Load_file_triggered()
|
||||
{
|
||||
// TODO: remember the previous browse directory
|
||||
auto fileName = QFileDialog::getOpenFileName(this, "Load file", QString(), "All files (*)");
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
loadFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::logHandler(LogLevel level, const char* message)
|
||||
{
|
||||
Q_UNUSED(level);
|
||||
|
||||
auto html = QString(message);
|
||||
html += "\n";
|
||||
html.replace("\t", " ");
|
||||
html = html.toHtmlEscaped();
|
||||
html.replace(QChar(' '), QString(" "));
|
||||
html.replace(QString("\r\n"), QString("<br/>\n"));
|
||||
html.replace(QChar('\n'), QString("<br/>\n"));
|
||||
|
||||
static QRegularExpression addressRegExp(R"((<source>:)(\d+:\d+))");
|
||||
html.replace(addressRegExp, "<a href=\"navigate://localhost/#\\2\">\\1\\2</a>");
|
||||
|
||||
QTextCursor cursor(mLogBrowser->document());
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.beginEditBlock();
|
||||
cursor.insertBlock();
|
||||
// hack to not insert too many newlines: https://lists.qt-project.org/pipermail/qt-interest-old/2011-July/034725.html
|
||||
cursor.deletePreviousChar();
|
||||
cursor.insertHtml(html);
|
||||
cursor.endEditBlock();
|
||||
}
|
||||
|
||||
void MainWindow::compileError(const CompileError & error)
|
||||
{
|
||||
Q_UNUSED(error);
|
||||
// TODO: highlight error lines
|
||||
}
|
||||
|
||||
void MainWindow::evalError(const EvalError & error)
|
||||
{
|
||||
auto errorLine = error.location.line;
|
||||
auto errorColumn = error.location.column;
|
||||
if(errorLine > 0)
|
||||
{
|
||||
mCodeEditor->setErrorLine(errorLine);
|
||||
|
||||
auto cursor = mCodeEditor->textCursor();
|
||||
cursor.clearSelection();
|
||||
cursor.setPosition(mCodeEditor->document()->findBlockByLineNumber(errorLine - 1).position() + errorColumn - 1);
|
||||
mCodeEditor->setTextCursor(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::typeValueCallback(const TYPEDESCRIPTOR* type, char* dest, size_t* destCount)
|
||||
{
|
||||
auto itr = mNames.find(type->id);
|
||||
if(itr == mNames.end())
|
||||
return false;
|
||||
|
||||
const auto & str = itr->second;
|
||||
if(*destCount <= str.second)
|
||||
{
|
||||
*destCount = str.second + 1;
|
||||
return false;
|
||||
}
|
||||
strcpy_s(dest, *destCount, mStringPool.data() + str.first);
|
||||
return true;
|
||||
}
|
||||
|
||||
TreeNode MainWindow::typeVisit(TreeNode parent, const VisitInfo & info)
|
||||
{
|
||||
if(parent == nullptr)
|
||||
{
|
||||
mCurrentBase = info.offset;
|
||||
}
|
||||
|
||||
auto id = mNextId++;
|
||||
{
|
||||
auto valueLen = strlen(info.value);
|
||||
auto valueIndex = mStringPool.size();
|
||||
mStringPool.resize(mStringPool.size() + valueLen + 1);
|
||||
memcpy(mStringPool.data() + valueIndex, info.value, valueLen + 1);
|
||||
mNames[id] = {valueIndex, valueLen};
|
||||
}
|
||||
|
||||
std::string name = info.type_name;
|
||||
if(*info.variable_name)
|
||||
{
|
||||
name += " ";
|
||||
name += info.variable_name;
|
||||
}
|
||||
TYPEDESCRIPTOR td = {};
|
||||
td.magic = TYPEDESCRIPTOR_MAGIC;
|
||||
td.expanded = true;
|
||||
td.reverse = info.big_endian;
|
||||
td.name = name.c_str();
|
||||
td.addr = mCurrentBase;
|
||||
td.id = id;
|
||||
td.sizeBits = info.size * 8;
|
||||
// TODO: detect primitive types and exclude them from the toString callback
|
||||
td.offset = info.offset - mCurrentBase;
|
||||
td.callback = [](const TYPEDESCRIPTOR * type, char* dest, size_t* destCount)
|
||||
{
|
||||
return ((MainWindow*)type->userdata)->typeValueCallback(type, dest, destCount);
|
||||
};
|
||||
td.userdata = this;
|
||||
auto node = mTypeWidget->typeAddNode((QTreeWidgetItem*)parent, &td);
|
||||
qDebug() << QString::asprintf("[%p->%p] %s %s |%s| (address: 0x%" PRIX64 ", size: 0x%" PRIX64 ", line: %d)\n",
|
||||
parent,
|
||||
node,
|
||||
info.type_name,
|
||||
info.variable_name,
|
||||
info.value,
|
||||
info.offset,
|
||||
info.size,
|
||||
info.line
|
||||
);
|
||||
return node;
|
||||
}
|
||||
|
||||
void MainWindow::typeClear()
|
||||
{
|
||||
mCurrentBase = 0;
|
||||
mStringPool.clear();
|
||||
mNames.clear();
|
||||
}
|
||||
|
||||
void MainWindow::gotoHexDump(duint address, duint size)
|
||||
{
|
||||
duint viewStart = mHexDump->getTableOffset() * mHexDump->getBytePerRowCount();
|
||||
duint viewSize = mHexDump->getViewableRowsCount() * mHexDump->getBytePerRowCount();
|
||||
duint viewEnd = viewStart + viewSize;
|
||||
duint alignedAddress = address - address % 16;
|
||||
// Make sure the address is in view
|
||||
if(address < viewStart || address >= viewEnd)
|
||||
{
|
||||
mHexDump->printDumpAt(alignedAddress, false, false, true);
|
||||
}
|
||||
// Go to the aligned address and then set the selection
|
||||
mHexDump->printDumpAt(alignedAddress, true, false, false);
|
||||
mHexDump->setSingleSelection(address);
|
||||
if(size > 1)
|
||||
{
|
||||
mHexDump->expandSelectionUpTo(address + size - 1);
|
||||
}
|
||||
mHexDump->updateViewport();
|
||||
}
|
||||
|
||||
void MainWindow::onLogAnchorClicked(const QUrl & url)
|
||||
{
|
||||
if(url.scheme() == "navigate")
|
||||
{
|
||||
auto fragment = url.fragment(QUrl::FullyDecoded);
|
||||
QStringList split = fragment.split(':');
|
||||
auto line = split[0].toInt();
|
||||
auto column = split[1].toInt();
|
||||
|
||||
auto cursor = mCodeEditor->textCursor();
|
||||
cursor.clearSelection();
|
||||
cursor.setPosition(mCodeEditor->document()->findBlockByLineNumber(line - 1).position() + column - 1);
|
||||
mCodeEditor->setTextCursor(cursor);
|
||||
|
||||
mCodeEditor->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onButtonRunPressed()
|
||||
{
|
||||
// TODO: change this?
|
||||
QString includeDir = QApplication::applicationDirPath();
|
||||
includeDir += "\\includes";
|
||||
auto includeUtf8 = includeDir.toUtf8();
|
||||
const char* includes[1] = {includeUtf8.constData()};
|
||||
|
||||
auto source = mCodeEditor->toPlainText().toUtf8();
|
||||
|
||||
PatternRunArgs args = {};
|
||||
args.userdata = this;
|
||||
args.root = nullptr;
|
||||
args.source = source.constData();
|
||||
args.filename = "<source>";
|
||||
args.base = 0x0;
|
||||
#ifdef _WIN64
|
||||
args.size = 0x7FFFFFFFFFFFFFFF;
|
||||
#else
|
||||
args.size = 0x7FFFFFFF;
|
||||
#endif // _WIN64
|
||||
args.includes_count = std::size(includes);
|
||||
args.includes_data = includes;
|
||||
args.log_handler = [](void* userdata, LogLevel level, const char* message)
|
||||
{
|
||||
((MainWindow*)userdata)->logHandler(level, message);
|
||||
};
|
||||
args.compile_error = [](void* userdata, const CompileError * error)
|
||||
{
|
||||
((MainWindow*)userdata)->compileError(*error);
|
||||
};
|
||||
args.eval_error = [](void* userdata, const EvalError * error)
|
||||
{
|
||||
((MainWindow*)userdata)->evalError(*error);
|
||||
};
|
||||
args.data_source = [](void*, uint64_t address, void* buffer, size_t size)
|
||||
{
|
||||
// TODO: page cache?
|
||||
return DbgMemRead(address, buffer, size);
|
||||
};
|
||||
args.visit = [](void* userdata, TreeNode parent, const VisitInfo * info) -> TreeNode
|
||||
{
|
||||
return ((MainWindow*)userdata)->typeVisit(parent, *info);
|
||||
};
|
||||
// TODO: support removing type nodes from the API?
|
||||
// TODO: callback on remove of type node
|
||||
mTypeWidget->clearTypes();
|
||||
typeClear();
|
||||
mLogBrowser->clear();
|
||||
mCodeEditor->setErrorLine(-1);
|
||||
qDebug() << "test";
|
||||
auto status = PatternRun(&args);
|
||||
mTypeWidget->updateValuesSlot();
|
||||
mStructTabs->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "MiniHexDump.h"
|
||||
#include "Navigation.h"
|
||||
#include "File.h"
|
||||
#include "CodeEditor.h"
|
||||
#include "PatternHighlighter.h"
|
||||
#include "PatternLanguage.h"
|
||||
#include <Gui/TypeWidget.h>
|
||||
#include <QTextBrowser>
|
||||
#include "DataTable.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void onButtonRunPressed();
|
||||
void onLogAnchorClicked(const QUrl & url);
|
||||
void gotoHexDump(duint address, duint size);
|
||||
|
||||
void on_action_Load_file_triggered();
|
||||
|
||||
private:
|
||||
void loadFile(const QString & path);
|
||||
void setupNavigation();
|
||||
void setupWidgets();
|
||||
void logHandler(LogLevel level, const char* message);
|
||||
void compileError(const CompileError & error);
|
||||
void evalError(const EvalError & error);
|
||||
bool typeValueCallback(const TYPEDESCRIPTOR* type, char* dest, size_t* destCount);
|
||||
TreeNode typeVisit(TreeNode parent, const VisitInfo & info);
|
||||
void typeClear();
|
||||
|
||||
private:
|
||||
Ui::MainWindow* ui = nullptr;
|
||||
Navigation* mNavigation = nullptr;
|
||||
MiniHexDump* mHexDump = nullptr;
|
||||
File* mFile = nullptr;
|
||||
CodeEditor* mCodeEditor = nullptr;
|
||||
PatternHighlighter* mHighlighter = nullptr;
|
||||
QTextBrowser* mLogBrowser = nullptr;
|
||||
TypeWidget* mTypeWidget = nullptr;
|
||||
DataTable* mDataTable = nullptr;
|
||||
QTabWidget* mStructTabs = nullptr;
|
||||
|
||||
int mNextId = 100;
|
||||
uint64_t mCurrentBase = 0;
|
||||
std::vector<char> mStringPool;
|
||||
std::map<int, std::pair<size_t, size_t>> mNames;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1200</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>hex_viewer</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1200</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="action_Load_file"/>
|
||||
</widget>
|
||||
<addaction name="menu_File"/>
|
||||
</widget>
|
||||
<action name="action_Load_file">
|
||||
<property name="text">
|
||||
<string>&Load file</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
#include "MiniHexDump.h"
|
||||
#include "GotoDialog.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
MiniHexDump::MiniHexDump(Navigation* navigation, Architecture* architecture, QWidget* parent)
|
||||
: HexDump(architecture, parent)
|
||||
, mNavigation(navigation)
|
||||
{
|
||||
mPointerUnderliningEnabled = false;
|
||||
mSelectionUnderliningEnabled = true;
|
||||
hexAsciiSlot();
|
||||
setupMenu();
|
||||
}
|
||||
|
||||
void MiniHexDump::loadFile(File* file)
|
||||
{
|
||||
mFile = file;
|
||||
mMemPage->setAttributes(0, 0);
|
||||
setRowCount(0);
|
||||
reloadData();
|
||||
}
|
||||
|
||||
void MiniHexDump::hexAsciiSlot()
|
||||
{
|
||||
int charwidth = getCharWidth();
|
||||
ColumnDescriptor wColDesc;
|
||||
DataDescriptor dDesc;
|
||||
|
||||
wColDesc.isData = true; //hex byte
|
||||
wColDesc.itemCount = 16;
|
||||
wColDesc.separator = mAsciiSeparator ? mAsciiSeparator : 4;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = HexByte;
|
||||
wColDesc.data = dDesc;
|
||||
appendResetDescriptor(8 + charwidth * 47, tr("Hex"), false, wColDesc);
|
||||
|
||||
wColDesc.isData = true; //ascii byte
|
||||
wColDesc.itemCount = 16;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
appendDescriptor(8 + charwidth * 16, tr("ASCII"), false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
appendDescriptor(0, "", false, wColDesc);
|
||||
|
||||
reloadData();
|
||||
}
|
||||
|
||||
void MiniHexDump::setupMenu()
|
||||
{
|
||||
addMenuAction(TableAction(TR("Goto Address"), "G"), [this]()
|
||||
{
|
||||
GotoDialog gotoDialog(this);
|
||||
if(gotoDialog.exec() == QDialog::Accepted)
|
||||
emit mNavigation->gotoAddress(Navigation::Dump, gotoDialog.address());
|
||||
});
|
||||
addMenuAction(TR("Copy Address"), [this]()
|
||||
{
|
||||
Bridge::CopyToClipboard(ToPtrString(rvaToVa(getInitialSelection())));
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <BasicView/HexDump.h>
|
||||
#include "File.h"
|
||||
#include "MagicMenu.h"
|
||||
#include "Navigation.h"
|
||||
|
||||
class MiniHexDump : public HexDump, public MagicMenu<MiniHexDump>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MiniHexDump(Navigation* navigation, Architecture* architecture, QWidget* parent = nullptr);
|
||||
void loadFile(File* file);
|
||||
|
||||
private slots:
|
||||
void hexAsciiSlot();
|
||||
|
||||
private:
|
||||
File* mFile = nullptr;
|
||||
int mAsciiSeparator = 0;
|
||||
Navigation* mNavigation = nullptr;
|
||||
|
||||
void setupMenu();
|
||||
};
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#include "Navigation.h"
|
||||
|
||||
Navigation::Navigation(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void Navigation::gotoDump(duint address)
|
||||
{
|
||||
gotoFocus(Window::Dump, address);
|
||||
}
|
||||
|
||||
void Navigation::gotoDisassembly(duint address)
|
||||
{
|
||||
gotoFocus(Window::Disassembly, address);
|
||||
}
|
||||
|
||||
void Navigation::gotoMemoryMap(duint address)
|
||||
{
|
||||
gotoFocus(Window::MemoryMap, address);
|
||||
}
|
||||
|
||||
void Navigation::gotoFocus(Window window, duint address)
|
||||
{
|
||||
emit gotoAddress(window, address);
|
||||
emit focusWindow(window);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include "Types.h"
|
||||
|
||||
class Navigation : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Navigation(QObject* parent = nullptr);
|
||||
|
||||
enum Window
|
||||
{
|
||||
Dump,
|
||||
Disassembly,
|
||||
MemoryMap,
|
||||
};
|
||||
|
||||
void gotoDump(duint address);
|
||||
void gotoDisassembly(duint address);
|
||||
void gotoMemoryMap(duint address);
|
||||
|
||||
signals:
|
||||
void gotoAddress(Navigation::Window window, duint address);
|
||||
void focusWindow(Navigation::Window window);
|
||||
|
||||
private:
|
||||
void gotoFocus(Window window, duint address);
|
||||
};
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
#include "PatternHighlighter.h"
|
||||
|
||||
PatternHighlighter::PatternHighlighter(const CodeEditor* style, QTextDocument* parent)
|
||||
: QSyntaxHighlighter(parent)
|
||||
{
|
||||
refreshColors(style);
|
||||
}
|
||||
|
||||
static const char* keywords[] =
|
||||
{
|
||||
"struct",
|
||||
"union",
|
||||
"enum",
|
||||
"bitfield",
|
||||
"float",
|
||||
"double",
|
||||
"char",
|
||||
"char16",
|
||||
"bool",
|
||||
"str",
|
||||
"auto",
|
||||
"namespace",
|
||||
"using",
|
||||
"fn",
|
||||
"if",
|
||||
"else",
|
||||
"match",
|
||||
"break",
|
||||
"continue",
|
||||
"try",
|
||||
"catch",
|
||||
"return",
|
||||
"in",
|
||||
"out",
|
||||
"static"
|
||||
};
|
||||
|
||||
static const char* instructions[] =
|
||||
{
|
||||
"addressof",
|
||||
"sizeof",
|
||||
"import",
|
||||
};
|
||||
|
||||
struct Format
|
||||
{
|
||||
Format(QTextCharFormat & format)
|
||||
: format(format)
|
||||
{
|
||||
}
|
||||
|
||||
Format && self()
|
||||
{
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
Format && italic()
|
||||
{
|
||||
format.setFontItalic(true);
|
||||
return self();
|
||||
}
|
||||
|
||||
Format && bold()
|
||||
{
|
||||
format.setFontWeight(QFont::Bold);
|
||||
return self();
|
||||
}
|
||||
|
||||
Format && color(const QColor & color)
|
||||
{
|
||||
format.setForeground(color);
|
||||
return self();
|
||||
}
|
||||
|
||||
Format && color(const QColorWrapper & color)
|
||||
{
|
||||
format.setForeground(color());
|
||||
return self();
|
||||
}
|
||||
|
||||
private:
|
||||
QTextCharFormat & format;
|
||||
};
|
||||
|
||||
void PatternHighlighter::refreshColors(const CodeEditor* style)
|
||||
{
|
||||
highlightingRules.clear();
|
||||
|
||||
auto addRule = [this](const char* regex)
|
||||
{
|
||||
highlightingRules.append({ QRegularExpression(regex), QTextCharFormat() });
|
||||
if(!highlightingRules.back().pattern.isValid())
|
||||
{
|
||||
qFatal("Invalid regular expression");
|
||||
}
|
||||
return Format(highlightingRules.back().format);
|
||||
};
|
||||
|
||||
// Rules added later can override previous rules (since they are applied in order)
|
||||
|
||||
// operators
|
||||
addRule(R"regex([+\-=^|&%*/<>]+)regex")
|
||||
.color(style->operatorColor);
|
||||
addRule(R"regex([\$\?:@~!])regex")
|
||||
.bold()
|
||||
.color(style->operatorColor);
|
||||
|
||||
// constants: 12, 0x33
|
||||
addRule(R"regex(\b\d+\b)regex")
|
||||
.color(style->constantColor);
|
||||
addRule(R"regex(\b0x[0-9A-Fa-f]+\b)regex")
|
||||
.color(style->constantColor);
|
||||
addRule(R"regex(\b(true|false)\b)regex")
|
||||
.color(style->constantColor);
|
||||
|
||||
// Keywords
|
||||
{
|
||||
QTextCharFormat keywordFormat;
|
||||
keywordFormat.setForeground(style->keywordColor());
|
||||
|
||||
for(const QString & pattern : keywords)
|
||||
highlightingRules.append({ QRegularExpression(QString("\\b%1\\b").arg(pattern)), keywordFormat });
|
||||
}
|
||||
addRule(R"regex(|\[\[|\]\])regex")
|
||||
.bold()
|
||||
.color(style->keywordColor);
|
||||
|
||||
// Instructions
|
||||
{
|
||||
QTextCharFormat instructionFormat;
|
||||
instructionFormat.setForeground(style->instructionColor());
|
||||
instructionFormat.setFontWeight(QFont::Bold);
|
||||
|
||||
for(const QString & pattern : instructions)
|
||||
{
|
||||
auto escapedRegex = QRegularExpression::escape(pattern);
|
||||
highlightingRules.append({ QRegularExpression(QString("\\b%1\\b").arg(escapedRegex)), instructionFormat });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// preprocessor definitions
|
||||
addRule(R"regex(\w*#(pragma|define|include|ifdef|ifndef|endif|error).+$)regex")
|
||||
.bold()
|
||||
.color(style->instructionColor);
|
||||
|
||||
// function(
|
||||
addRule(R"regex(\b[-a-zA-Z$._:][-a-zA-Z$._:0-9]*\w*(?=\())regex")
|
||||
.bold()
|
||||
.color(style->functionColor);
|
||||
|
||||
// string literal
|
||||
addRule(R"regex("(?:\\.|[^"\\])*")regex")
|
||||
.color(style->stringColor);
|
||||
|
||||
// i64 and other types
|
||||
addRule(R"regex(\b[us]\d+\b)regex")
|
||||
.color(style->integerTypeColor);
|
||||
|
||||
// Line comments
|
||||
addRule(R"regex(//.*$)regex")
|
||||
.color(style->commentColor);
|
||||
|
||||
// Block comments
|
||||
addRule(R"regex(\/\*[\s\S]*?\*\/)regex")
|
||||
.color(style->commentColor);
|
||||
}
|
||||
|
||||
void PatternHighlighter::highlightBlock(const QString & text)
|
||||
{
|
||||
for(int i = 0; i < highlightingRules.size(); i++)
|
||||
{
|
||||
const HighlightingRule & rule = highlightingRules[i];
|
||||
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
|
||||
while(matchIterator.hasNext())
|
||||
{
|
||||
QRegularExpressionMatch match = matchIterator.next();
|
||||
setFormat(match.capturedStart(), match.capturedLength(), rule.format);
|
||||
}
|
||||
}
|
||||
setCurrentBlockState(0);
|
||||
|
||||
int startIndex = 0;
|
||||
if(previousBlockState() != 1)
|
||||
startIndex = text.indexOf(commentStartExpression);
|
||||
|
||||
while(startIndex >= 0)
|
||||
{
|
||||
QRegularExpressionMatch match = commentEndExpression.match(text, startIndex);
|
||||
int endIndex = match.capturedStart();
|
||||
int commentLength = 0;
|
||||
if(endIndex == -1)
|
||||
{
|
||||
setCurrentBlockState(1);
|
||||
commentLength = text.length() - startIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
commentLength = endIndex - startIndex + match.capturedLength();
|
||||
}
|
||||
setFormat(startIndex, commentLength, multiLineCommentFormat);
|
||||
startIndex = text.indexOf(commentStartExpression, startIndex + commentLength);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QTextCharFormat>
|
||||
#include <QRegularExpression>
|
||||
#include "CodeEditor.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTextDocument;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class PatternHighlighter : public QSyntaxHighlighter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PatternHighlighter(const CodeEditor* style, QTextDocument* parent = 0);
|
||||
void refreshColors(const CodeEditor* style);
|
||||
|
||||
protected:
|
||||
void highlightBlock(const QString & text) override;
|
||||
|
||||
private:
|
||||
struct HighlightingRule
|
||||
{
|
||||
QRegularExpression pattern;
|
||||
QTextCharFormat format;
|
||||
};
|
||||
QVector<HighlightingRule> highlightingRules;
|
||||
|
||||
QTextCharFormat multiLineCommentFormat;
|
||||
QRegularExpression commentStartExpression = QRegularExpression(QStringLiteral("/\\*"));
|
||||
QRegularExpression commentEndExpression = QRegularExpression(QStringLiteral("\\*/"));
|
||||
};
|
||||
|
|
@ -0,0 +1,468 @@
|
|||
#include "PatternLanguage.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include <wolv/utils/string.hpp>
|
||||
|
||||
#include <pl/pattern_language.hpp>
|
||||
#include <pl/pattern_visitor.hpp>
|
||||
#include <pl/patterns/pattern.hpp>
|
||||
#include <pl/patterns/pattern_array_dynamic.hpp>
|
||||
#include <pl/patterns/pattern_array_static.hpp>
|
||||
#include <pl/patterns/pattern_bitfield.hpp>
|
||||
#include <pl/patterns/pattern_boolean.hpp>
|
||||
#include <pl/patterns/pattern_character.hpp>
|
||||
#include <pl/patterns/pattern_enum.hpp>
|
||||
#include <pl/patterns/pattern_float.hpp>
|
||||
#include <pl/patterns/pattern_padding.hpp>
|
||||
#include <pl/patterns/pattern_pointer.hpp>
|
||||
#include <pl/patterns/pattern_signed.hpp>
|
||||
#include <pl/patterns/pattern_string.hpp>
|
||||
#include <pl/patterns/pattern_struct.hpp>
|
||||
#include <pl/patterns/pattern_union.hpp>
|
||||
#include <pl/patterns/pattern_unsigned.hpp>
|
||||
#include <pl/patterns/pattern_wide_character.hpp>
|
||||
#include <pl/patterns/pattern_wide_string.hpp>
|
||||
#include <pl/patterns/pattern_error.hpp>
|
||||
|
||||
using namespace pl;
|
||||
|
||||
class ApiPatternVisitor : public PatternVisitor
|
||||
{
|
||||
public:
|
||||
explicit ApiPatternVisitor(const PatternRunArgs* visitor)
|
||||
: m_args(visitor)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternBitfieldField & pattern) override
|
||||
{
|
||||
formatValue(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternBoolean & pattern) override
|
||||
{
|
||||
formatValue(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternFloat & pattern) override
|
||||
{
|
||||
formatValue(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternSigned & pattern) override
|
||||
{
|
||||
formatValue(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternUnsigned & pattern) override
|
||||
{
|
||||
formatValue(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternCharacter & pattern) override
|
||||
{
|
||||
formatString(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternEnum & pattern) override
|
||||
{
|
||||
formatString(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternString & pattern) override
|
||||
{
|
||||
formatString(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternWideCharacter & pattern) override
|
||||
{
|
||||
formatString(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternWideString & pattern) override
|
||||
{
|
||||
formatString(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::Pattern & pattern) override
|
||||
{
|
||||
formatString(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternPadding & pattern) override
|
||||
{
|
||||
// TODO: add padding support?
|
||||
wolv::util::unused(pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternStruct & pattern) override
|
||||
{
|
||||
formatObject(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternUnion & pattern) override
|
||||
{
|
||||
formatObject(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternBitfield & pattern) override
|
||||
{
|
||||
formatObject(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternArrayDynamic & pattern) override
|
||||
{
|
||||
formatArray(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternArrayStatic & pattern) override
|
||||
{
|
||||
formatArray(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternBitfieldArray & pattern) override
|
||||
{
|
||||
formatArray(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternError & pattern) override
|
||||
{
|
||||
formatString(&pattern);
|
||||
}
|
||||
|
||||
void visit(ptrn::PatternPointer & pattern) override
|
||||
{
|
||||
formatPointer(&pattern);
|
||||
}
|
||||
|
||||
void treePush(TreeNode node)
|
||||
{
|
||||
m_treeStack.push_back(node);
|
||||
}
|
||||
|
||||
void treePop()
|
||||
{
|
||||
m_treeStack.pop_back();
|
||||
}
|
||||
|
||||
TreeNode treeTop()
|
||||
{
|
||||
return m_treeStack.empty() ? m_args->root : m_treeStack.back();
|
||||
}
|
||||
|
||||
private:
|
||||
static std::string debugPattern(const char* title, const ptrn::Pattern* pattern)
|
||||
{
|
||||
std::string p;
|
||||
p += ::fmt::format("{}(\n", title);
|
||||
p += ::fmt::format(" offset = {:#x}\n", pattern->getOffset());
|
||||
p += ::fmt::format(" size = {:#x}\n", pattern->getSize());
|
||||
p += ::fmt::format(" variableName = {}\n", pattern->getVariableName()); // name of the variable (or var[array_idx])
|
||||
p += ::fmt::format(" displayName = {}\n",
|
||||
pattern->getDisplayName()); // [[name("Whatever")]] (falls back to variable name)
|
||||
p += ::fmt::format(" formattedName = {}\n",
|
||||
pattern->getFormattedName()); // formatted type name (falls back to type name)
|
||||
p += ::fmt::format(" typeName = {}\n", pattern->getTypeName()); // name of the type (without struct or array size)
|
||||
p += ::fmt::format(" line = {}\n", pattern->getLine()); // source line
|
||||
p += ::fmt::format(" visibility = {}\n", (int) pattern->getVisibility());
|
||||
//p += format(" endian = {}\n", (int) pattern->getEndian());
|
||||
//p += format(" section = {}\n", pattern->getSection());
|
||||
p += ::fmt::format(" comment = {}\n", pattern->getComment());
|
||||
p += ::fmt::format(" color = {:#x}\n", pattern->getColor());
|
||||
p += ::fmt::format(" sealed = {}\n", pattern->isSealed());
|
||||
p += ::fmt::format(")");
|
||||
return p;
|
||||
}
|
||||
|
||||
TreeNode apiVisit(const char* reason, const ptrn::Pattern* pattern, const std::string & value)
|
||||
{
|
||||
// TODO: array elements,
|
||||
auto formattedTypeName = pattern->getFormattedName();
|
||||
auto displayName = pattern->getDisplayName();
|
||||
auto comment = pattern->getComment();
|
||||
VisitInfo info =
|
||||
{
|
||||
.type_name = formattedTypeName.c_str(),
|
||||
.variable_name = displayName.c_str(),
|
||||
.offset = pattern->getOffset(),
|
||||
.size = pattern->getSize(),
|
||||
.line = pattern->getLine(),
|
||||
.color = pattern->getColor(),
|
||||
.value = value.c_str(),
|
||||
.comment = comment.c_str(),
|
||||
.reason = reason,
|
||||
.big_endian = pattern->getEndian() == std::endian::big,
|
||||
};
|
||||
return m_args->visit(m_args->userdata, treeTop(), &info);
|
||||
}
|
||||
|
||||
static std::string readFormatter(ptrn::Pattern* pattern)
|
||||
{
|
||||
if(const auto & functionName = pattern->getReadFormatterFunction(); !functionName.empty())
|
||||
{
|
||||
return pattern->toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
void formatValue(ptrn::Pattern* pattern)
|
||||
{
|
||||
if(pattern->getVisibility() == ptrn::Visibility::Hidden) return;
|
||||
if(pattern->getVisibility() == ptrn::Visibility::TreeHidden) return;
|
||||
|
||||
auto value = readFormatter(pattern);
|
||||
if(value.empty())
|
||||
{
|
||||
// TODO: sealed support?
|
||||
|
||||
// char, bool, u128, i128, double, std::string, std::shared_ptr<ptrn::Pattern>
|
||||
value = std::visit(wolv::util::overloaded
|
||||
{
|
||||
// TODO: print full-width
|
||||
[&](std::integral auto value) -> std::string
|
||||
{ return ::fmt::format("0x{:0{}X}\t{}", value, pattern->getSize() * 2, value); },
|
||||
[&](std::floating_point auto value) -> std::string
|
||||
{ return ::fmt::format("{}", value); },
|
||||
[&](const std::string & value) -> std::string
|
||||
{ return ::fmt::format("\"{}\"", value); },
|
||||
[&](bool value) -> std::string
|
||||
{ return value ? "true" : "false"; },
|
||||
[&](char value) -> std::string
|
||||
{ return ::fmt::format("'{}'", value); },
|
||||
[&](const std::shared_ptr<ptrn::Pattern> & value) -> std::string
|
||||
{ return ::fmt::format("\"{}\"", value->toString()); },
|
||||
[&](const u128 & value) -> std::string
|
||||
{return ::fmt::format("{}", value); },
|
||||
[&](const i128 & value) -> std::string
|
||||
{return ::fmt::format("{}", value); },
|
||||
}, pattern->getValue());
|
||||
}
|
||||
|
||||
apiVisit("formatValue", pattern, value);
|
||||
}
|
||||
|
||||
void formatString(ptrn::Pattern* pattern)
|
||||
{
|
||||
if(pattern->getVisibility() == ptrn::Visibility::Hidden) return;
|
||||
if(pattern->getVisibility() == ptrn::Visibility::TreeHidden) return;
|
||||
|
||||
apiVisit("formatString", pattern, pattern->toString());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void formatObject(T* pattern)
|
||||
{
|
||||
if(pattern->getVisibility() == ptrn::Visibility::Hidden) return;
|
||||
if(pattern->getVisibility() == ptrn::Visibility::TreeHidden) return;
|
||||
|
||||
auto objectNode = apiVisit("formatObject", pattern, readFormatter(pattern));
|
||||
if(!pattern->isSealed())
|
||||
{
|
||||
treePush(objectNode);
|
||||
pattern->forEachEntry(0, pattern->getEntryCount(), [&](u64, auto member)
|
||||
{
|
||||
member->accept(*this);
|
||||
});
|
||||
treePop();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void formatArray(T* pattern)
|
||||
{
|
||||
if(pattern->getVisibility() == ptrn::Visibility::Hidden) return;
|
||||
if(pattern->getVisibility() == ptrn::Visibility::TreeHidden) return;
|
||||
|
||||
auto arrayNode = apiVisit("formatArray", pattern, readFormatter(pattern));
|
||||
if(!pattern->isSealed())
|
||||
{
|
||||
treePush(arrayNode);
|
||||
pattern->forEachEntry(0, pattern->getEntryCount(), [&](u64, auto member)
|
||||
{
|
||||
member->accept(*this);
|
||||
});
|
||||
treePop();
|
||||
}
|
||||
}
|
||||
|
||||
void formatPointer(ptrn::PatternPointer* pattern)
|
||||
{
|
||||
if(pattern->getVisibility() == ptrn::Visibility::Hidden) return;
|
||||
if(pattern->getVisibility() == ptrn::Visibility::TreeHidden) return;
|
||||
|
||||
auto pointerNode = apiVisit("formatPointer", pattern, readFormatter(pattern));
|
||||
if(!pattern->isSealed())
|
||||
{
|
||||
treePush(pointerNode);
|
||||
pattern->getPointedAtPattern()->accept(*this);
|
||||
treePop();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const PatternRunArgs* m_args = nullptr;
|
||||
std::vector<TreeNode> m_treeStack;
|
||||
};
|
||||
|
||||
PatternStatus PatternRun(const PatternRunArgs* args)
|
||||
{
|
||||
// Create and configure Pattern Language runtime
|
||||
PatternLanguage runtime;
|
||||
|
||||
auto logCallback = [args](auto level, const auto & message)
|
||||
{
|
||||
std::string stripped = message;
|
||||
while(!stripped.empty() && std::isspace(stripped.back()))
|
||||
{
|
||||
stripped.pop_back();
|
||||
}
|
||||
if(args->log_handler != nullptr)
|
||||
{
|
||||
args->log_handler(args->userdata, (LogLevel)(int) level, stripped.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(level)
|
||||
{
|
||||
using
|
||||
enum core::LogConsole::Level;
|
||||
|
||||
case Debug:
|
||||
::fmt::print("[DEBUG] {}\n", stripped);
|
||||
break;
|
||||
case Info:
|
||||
::fmt::print("[INFO] {}\n", stripped);
|
||||
break;
|
||||
case Warning:
|
||||
::fmt::print("[WARN] {}\n", stripped);
|
||||
break;
|
||||
case Error:
|
||||
::fmt::print("[ERROR] {}\n", stripped);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
runtime.setLogCallback(logCallback);
|
||||
|
||||
std::vector<std::fs::path> includePaths(args->includes_count);
|
||||
for(size_t i = 0; i < includePaths.size(); i++)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
includePaths[i] = *wolv::util::utf8ToWstring(args->includes_data[i]);
|
||||
#else
|
||||
includePaths[i] = args->includes_data[i];
|
||||
#endif
|
||||
}
|
||||
runtime.setIncludePaths(includePaths);
|
||||
|
||||
for(size_t i = 0; i < args->defines_count; i++)
|
||||
{
|
||||
runtime.addDefine(args->defines_data[i]);
|
||||
}
|
||||
|
||||
auto dangerCallback = [args]()
|
||||
{
|
||||
return args->allow_dangerous_functions;
|
||||
};
|
||||
runtime.setDangerousFunctionCallHandler(dangerCallback);
|
||||
auto dataCallback = [args](u64 address, void* buffer, size_t size)
|
||||
{
|
||||
if(!args->data_source(args->userdata, address, buffer, size))
|
||||
{
|
||||
core::err::E0011.throwError(fmt::format("Failed to read address 0x{:X}[0x{:X}].", address, size));
|
||||
}
|
||||
};
|
||||
runtime.setDataSource(args->base, args->size, dataCallback);
|
||||
|
||||
// Execute pattern file
|
||||
auto filename = args->filename;
|
||||
if(filename == nullptr)
|
||||
{
|
||||
filename = api::Source::DefaultSource;
|
||||
}
|
||||
if(!runtime.executeString(args->source, filename))
|
||||
{
|
||||
auto compileErrors = runtime.getCompileErrors();
|
||||
if(!compileErrors.empty())
|
||||
{
|
||||
if(args->compile_error == nullptr)
|
||||
{
|
||||
fmt::print("Compilation failed\n");
|
||||
}
|
||||
|
||||
for(const auto & error : compileErrors)
|
||||
{
|
||||
auto pretty = error.format();
|
||||
if(args->compile_error == nullptr)
|
||||
{
|
||||
fmt::print("{}\n", pretty);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto & location = error.getLocation();
|
||||
CompileError cerror =
|
||||
{
|
||||
.location = {
|
||||
.file = location.source->source.c_str(),
|
||||
.line = location.line,
|
||||
.column = location.column,
|
||||
.length = location.length,
|
||||
},
|
||||
.message = error.getMessage().c_str(),
|
||||
.description = error.getMessage().c_str(),
|
||||
.pretty = pretty.c_str(),
|
||||
};
|
||||
args->compile_error(args->userdata, &cerror);
|
||||
}
|
||||
}
|
||||
return PatternCompileError;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto error = runtime.getEvalError().value();
|
||||
if(args->eval_error == nullptr)
|
||||
{
|
||||
fmt::print("Pattern Error: {}:{} -> {}\n", error.line, error.column, error.message);
|
||||
}
|
||||
else
|
||||
{
|
||||
EvalError cerror =
|
||||
{
|
||||
.location = {
|
||||
.file = filename,
|
||||
.line = error.line,
|
||||
.column = error.column,
|
||||
.length = 0,
|
||||
},
|
||||
.pretty = error.message.c_str(),
|
||||
};
|
||||
args->eval_error(args->userdata, &cerror);
|
||||
}
|
||||
|
||||
return PatternEvalError;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ApiPatternVisitor visitor(args);
|
||||
for(const auto & pattern : runtime.getPatterns())
|
||||
{
|
||||
pattern->accept(visitor);
|
||||
}
|
||||
return PatternSuccess;
|
||||
}
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
args->log_handler(args->userdata, LogLevelError, e.what());
|
||||
return PatternEvalError;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LogLevelDebug = 0,
|
||||
LogLevelInfo = 1,
|
||||
LogLevelWarning = 2,
|
||||
LogLevelError = 3,
|
||||
} LogLevel;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* file;
|
||||
uint32_t line;
|
||||
uint32_t column;
|
||||
size_t length;
|
||||
} SourceLocation;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SourceLocation location;
|
||||
const char* message;
|
||||
const char* description;
|
||||
const char* pretty;
|
||||
} CompileError;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SourceLocation location;
|
||||
const char* pretty;
|
||||
} EvalError;
|
||||
|
||||
typedef void* TreeNode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* type_name;
|
||||
const char* variable_name;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
uint32_t line;
|
||||
uint32_t color;
|
||||
const char* value;
|
||||
const char* comment;
|
||||
const char* reason;
|
||||
bool big_endian;
|
||||
} VisitInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void* userdata;
|
||||
TreeNode root;
|
||||
const char* source;
|
||||
const char* filename;
|
||||
uint64_t base;
|
||||
uint64_t size;
|
||||
const char** defines_data;
|
||||
size_t defines_count;
|
||||
const char** includes_data;
|
||||
size_t includes_count;
|
||||
bool allow_dangerous_functions;
|
||||
|
||||
void (*log_handler)(void* userdata, LogLevel level, const char* message);
|
||||
|
||||
void (*compile_error)(void* userdata, const CompileError* error);
|
||||
|
||||
void (*eval_error)(void* userdata, const EvalError* error);
|
||||
|
||||
bool (*data_source)(void* userdata, uint64_t address, void* buffer, size_t size);
|
||||
|
||||
TreeNode(*visit)(void* userdata, TreeNode parent, const VisitInfo* info);
|
||||
} PatternRunArgs;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PatternSuccess,
|
||||
PatternCompileError,
|
||||
PatternEvalError,
|
||||
} PatternStatus;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
PatternStatus PatternRun(const PatternRunArgs* args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
|
||||
template<class Widget>
|
||||
class Styled
|
||||
{
|
||||
bool polished = false;
|
||||
|
||||
friend class QColorWrapper;
|
||||
|
||||
protected:
|
||||
QWidget* widget() { return (Widget*)(this); }
|
||||
};
|
||||
|
||||
class QColorWrapper
|
||||
{
|
||||
QWidget* widget;
|
||||
QColor color;
|
||||
|
||||
public:
|
||||
explicit QColorWrapper(QWidget* widget, QColor defaultColor = {})
|
||||
: widget(widget)
|
||||
, color(defaultColor)
|
||||
{
|
||||
}
|
||||
|
||||
QColor operator()() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
QColor get(bool ensurePolished = true) const
|
||||
{
|
||||
if(ensurePolished && widget)
|
||||
{
|
||||
widget->ensurePolished();
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
void set(QColor color)
|
||||
{
|
||||
this->color = color;
|
||||
this->widget = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
#define CSS_COLOR(name, defaultColor) \
|
||||
QColorWrapper name = QColorWrapper(Styled::widget(), defaultColor); \
|
||||
Q_PROPERTY(QColor name READ get_##name WRITE set_##name) \
|
||||
QColor get_##name() const { return name.get(false); } \
|
||||
void set_##name(QColor color) { name.set(color); }
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
#include <QApplication>
|
||||
#include <QStyleFactory>
|
||||
#include <QPalette>
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#error Your Qt version is likely too old, upgrade to 5.12 or higher
|
||||
#endif // QT_VERSION
|
||||
|
||||
// https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
app.setStyle(QStyleFactory::create("Fusion"));
|
||||
|
||||
#if 0
|
||||
QColor lightGray(190, 190, 190);
|
||||
QColor gray(128, 128, 128);
|
||||
QColor midDarkGray(100, 100, 100);
|
||||
QColor darkGray(53, 53, 53);
|
||||
QColor black(25, 25, 25);
|
||||
QColor blue(42, 130, 218);
|
||||
QColor white(255, 255, 255);
|
||||
|
||||
QPalette darkPalette;
|
||||
darkPalette.setColor(QPalette::Window, darkGray);
|
||||
darkPalette.setColor(QPalette::WindowText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Base, black);
|
||||
darkPalette.setColor(QPalette::AlternateBase, darkGray);
|
||||
darkPalette.setColor(QPalette::ToolTipBase, darkGray);
|
||||
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Text, lightGray);
|
||||
darkPalette.setColor(QPalette::Button, darkGray);
|
||||
darkPalette.setColor(QPalette::ButtonText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Link, blue);
|
||||
darkPalette.setColor(QPalette::Highlight, blue);
|
||||
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
|
||||
darkPalette.setColor(QPalette::Light, blue);
|
||||
darkPalette.setColor(QPalette::Dark, midDarkGray);
|
||||
|
||||
darkPalette.setColor(QPalette::Active, QPalette::Button, gray.darker());
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::Light, darkGray);
|
||||
|
||||
app.setPalette(darkPalette);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
QColor black(40, 42, 54);
|
||||
QColor white(248, 248, 242);
|
||||
QColor lightBlue(139, 233, 253);
|
||||
QColor green(80, 250, 123);
|
||||
QColor yellow(229, 238, 138);
|
||||
QColor red(255, 85, 85);
|
||||
QColor purple(189, 147, 249);
|
||||
QColor darkBlue(98, 114, 164);
|
||||
QColor grey(68, 71, 90);
|
||||
QColor orange(255, 184, 108);
|
||||
QColor pink(255, 121, 198);
|
||||
|
||||
QPalette dark;
|
||||
dark.setColor(QPalette::Window, black);
|
||||
dark.setColor(QPalette::WindowText, white);
|
||||
dark.setColor(QPalette::Base, black);
|
||||
dark.setColor(QPalette::AlternateBase, grey);
|
||||
dark.setColor(QPalette::ToolTipBase, black);
|
||||
dark.setColor(QPalette::ToolTipText, lightBlue);
|
||||
dark.setColor(QPalette::Text, white);
|
||||
dark.setColor(QPalette::Button, black);
|
||||
dark.setColor(QPalette::ButtonText, white);
|
||||
dark.setColor(QPalette::BrightText, grey);
|
||||
dark.setColor(QPalette::Link, green);
|
||||
dark.setColor(QPalette::LinkVisited, purple);
|
||||
dark.setColor(QPalette::Highlight, grey);
|
||||
dark.setColor(QPalette::HighlightedText, white);
|
||||
dark.setColor(QPalette::Light, grey);
|
||||
|
||||
dark.setColor(QPalette::Disabled, QPalette::Button, darkBlue);
|
||||
dark.setColor(QPalette::Disabled, QPalette::ButtonText, darkBlue);
|
||||
dark.setColor(QPalette::Disabled, QPalette::Text, darkBlue);
|
||||
dark.setColor(QPalette::Disabled, QPalette::WindowText, darkBlue);
|
||||
|
||||
app.setPalette(dark);
|
||||
#endif
|
||||
|
||||
QPalette palette;
|
||||
|
||||
QColor oneDarkBackground("#282c34");
|
||||
QColor oneDarkForeground("#abb2bf");
|
||||
QColor oneDarkComment("#5c6370");
|
||||
QColor oneDarkKeyword("#c678dd");
|
||||
QColor oneDarkFunction("#61afef");
|
||||
QColor oneDarkString("#98c379");
|
||||
QColor oneDarkNumber("#d19a66");
|
||||
QColor oneDarkVariable("#e06c75");
|
||||
QColor oneDarkConstant("#56b6c2");
|
||||
|
||||
palette.setColor(QPalette::Window, oneDarkBackground);
|
||||
palette.setColor(QPalette::WindowText, oneDarkForeground);
|
||||
palette.setColor(QPalette::Base, QColor("#21252b"));
|
||||
palette.setColor(QPalette::AlternateBase, QColor("#2c313c")); // used for alternate row color in tree
|
||||
palette.setColor(QPalette::ToolTipBase, QColor("#3a3f4b"));
|
||||
palette.setColor(QPalette::ToolTipText, oneDarkForeground);
|
||||
palette.setColor(QPalette::Text, oneDarkForeground);
|
||||
palette.setColor(QPalette::Button, QColor("#3a3f4b"));
|
||||
palette.setColor(QPalette::ButtonText, oneDarkForeground);
|
||||
palette.setColor(QPalette::BrightText, oneDarkVariable);
|
||||
palette.setColor(QPalette::Link, oneDarkFunction);
|
||||
palette.setColor(QPalette::LinkVisited, oneDarkFunction);
|
||||
palette.setColor(QPalette::Highlight, oneDarkFunction);
|
||||
palette.setColor(QPalette::HighlightedText, oneDarkBackground);
|
||||
|
||||
palette.setColor(QPalette::Light, oneDarkBackground.lighter(120));
|
||||
palette.setColor(QPalette::Midlight, oneDarkBackground.lighter(110));
|
||||
palette.setColor(QPalette::Mid, oneDarkBackground.darker(110));
|
||||
palette.setColor(QPalette::Dark, oneDarkBackground.darker(130));
|
||||
palette.setColor(QPalette::Shadow, oneDarkBackground.darker(160));
|
||||
|
||||
palette.setColor(QPalette::Disabled, QPalette::WindowText, oneDarkComment);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Text, oneDarkComment);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Text, oneDarkComment);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ButtonText, oneDarkComment);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Highlight, oneDarkBackground.darker(150));
|
||||
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, oneDarkComment);
|
||||
|
||||
app.setPalette(palette);
|
||||
|
||||
QColor separator(99, 99, 99);
|
||||
QColor header(75, 75, 75);
|
||||
|
||||
// TODO: how is this derived by qt?
|
||||
separator = QColor("#616671");
|
||||
header = QColor("#484d59");
|
||||
|
||||
ConfigurationPalette p;
|
||||
p.background = oneDarkBackground;
|
||||
p.darkGrey = separator;
|
||||
p.lightGrey = header;
|
||||
p.black = oneDarkForeground;
|
||||
|
||||
Configuration config(p);
|
||||
|
||||
auto hexText = config.Colors["HexDumpTextColor"];
|
||||
config.Colors["HexDumpByte00Color"] = oneDarkConstant;
|
||||
config.Colors["HexDumpByte7FColor"] = oneDarkVariable;
|
||||
config.Colors["HexDumpByteFFColor"] = oneDarkVariable;
|
||||
config.Colors["HexDumpByteIsPrintColor"] = oneDarkString;
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
add_library(minidump INTERFACE)
|
||||
target_sources(minidump INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniDisassembly.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniDisassembly.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniHexDump.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniHexDump.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniMemoryMap.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniMemoryMap.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniDump.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MiniDump.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/udmp-parser.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/udmp-utils.h
|
||||
)
|
||||
|
|
@ -0,0 +1,477 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "FileParser.h"
|
||||
#include "Bridge.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "udmp-parser.h"
|
||||
#include "udmp-utils.h"
|
||||
|
||||
#include <linuxpe>
|
||||
|
||||
struct DumpMemoryProvider : MemoryProvider
|
||||
{
|
||||
void setParser(udmpparser::UserDumpParser* parser)
|
||||
{
|
||||
mParser = parser;
|
||||
}
|
||||
|
||||
bool read(duint addr, void* dest, duint size) override
|
||||
{
|
||||
if(mParser == nullptr)
|
||||
return false;
|
||||
|
||||
auto block = mParser->GetMemBlock(addr);
|
||||
if(block == nullptr || block->State == MEM_FREE)
|
||||
return false;
|
||||
|
||||
auto rva = addr - block->BaseAddress;
|
||||
|
||||
// TODO: support page alignment zeroes
|
||||
if(rva + size >= block->DataSize)
|
||||
return false;
|
||||
|
||||
memcpy(dest, block->Data + rva, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool getRange(duint addr, duint & base, duint & size) override
|
||||
{
|
||||
if(mParser == nullptr)
|
||||
return false;
|
||||
|
||||
auto block = mParser->GetMemBlock(addr);
|
||||
if(block == nullptr || block->State == MEM_FREE)
|
||||
return false;
|
||||
|
||||
base = block->BaseAddress;
|
||||
size = block->DataSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isCodePtr(duint addr) override
|
||||
{
|
||||
auto block = mParser->GetMemBlock(addr);
|
||||
if(block == nullptr || block->State == MEM_FREE)
|
||||
return false;
|
||||
|
||||
switch(block->Protect & 0xFF)
|
||||
{
|
||||
case PAGE_EXECUTE:
|
||||
case PAGE_EXECUTE_READ:
|
||||
case PAGE_EXECUTE_WRITECOPY:
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool isValidPtr(duint addr) override
|
||||
{
|
||||
auto block = mParser->GetMemBlock(addr);
|
||||
if(block == nullptr || block->State == MEM_FREE)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
udmpparser::UserDumpParser* mParser = nullptr;
|
||||
};
|
||||
|
||||
struct GlobalArchitecture : Architecture
|
||||
{
|
||||
bool disasm64() const override { return mDisasm64; }
|
||||
bool addr64() const override { return disasm64(); }
|
||||
|
||||
void setDisasm64(bool disasm64)
|
||||
{
|
||||
mDisasm64 = disasm64;
|
||||
}
|
||||
|
||||
private:
|
||||
bool mDisasm64 = false;
|
||||
} gArchitecture;
|
||||
|
||||
struct DmpFileParser : FileParser
|
||||
{
|
||||
udmpparser::UserDumpParser mDmp;
|
||||
DumpMemoryProvider mMemory;
|
||||
uint64_t mEntryPoint = 0;
|
||||
|
||||
bool disasm64() override
|
||||
{
|
||||
const auto & threads = mDmp.GetThreads();
|
||||
if(threads.empty())
|
||||
{
|
||||
qDebug() << "No threads in dump (this is unexpected)";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto threadId = mDmp.GetForegroundThreadId();
|
||||
const udmpparser::Thread_t* thread = nullptr;
|
||||
if(threadId.has_value())
|
||||
{
|
||||
thread = &mDmp.GetThreads().at(threadId.value());
|
||||
}
|
||||
else
|
||||
{
|
||||
thread = &mDmp.GetThreads().begin()->second;
|
||||
}
|
||||
bool disasm64 = false;
|
||||
std::visit([&](auto && arg)
|
||||
{
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
if constexpr(std::is_same_v<T, udmpparser::Context64_t>)
|
||||
{
|
||||
disasm64 = true;
|
||||
mEntryPoint = arg.Rip;
|
||||
}
|
||||
else if constexpr(std::is_same_v<T, udmpparser::Context32_t>)
|
||||
{
|
||||
disasm64 = false;
|
||||
mEntryPoint = arg.Eip;
|
||||
}
|
||||
}, thread->Context);
|
||||
return disasm64;
|
||||
}
|
||||
|
||||
std::vector<MemoryRegion> MemoryRegions() const override
|
||||
{
|
||||
std::vector<MemoryRegion> regions;
|
||||
const auto & mem = mDmp.GetMem();
|
||||
for(const auto & itr : mem)
|
||||
{
|
||||
regions.emplace_back();
|
||||
MemoryRegion & region = regions.back();
|
||||
const udmpparser::MemBlock_t & block = itr.second;
|
||||
region.BaseAddress = block.BaseAddress;
|
||||
region.RegionSize = block.RegionSize;
|
||||
region.State = StateToStringShort(block.State);
|
||||
if(block.State != MEM_FREE)
|
||||
{
|
||||
region.AllocationBase = block.AllocationBase;
|
||||
region.Protect = ProtectToStringShort(block.Protect);
|
||||
region.AllocationProtect = ProtectToStringShort(block.AllocationProtect);
|
||||
region.Type = TypeToStringShort(block.Type);
|
||||
}
|
||||
|
||||
auto module = mDmp.GetModule(block.BaseAddress);
|
||||
if(module != nullptr)
|
||||
{
|
||||
// TODO: add module base here?
|
||||
region.Info = module->ModuleName;
|
||||
}
|
||||
}
|
||||
return regions;
|
||||
}
|
||||
|
||||
uint64_t entryPoint() const override
|
||||
{
|
||||
return mEntryPoint;
|
||||
}
|
||||
};
|
||||
|
||||
#define PAGE_SIZE 0x1000
|
||||
#define ROUND_TO_PAGES(Size) (((uint64_t)(Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
|
||||
struct PeFileParser : FileParser, MemoryProvider
|
||||
{
|
||||
const uint8_t* mBegin = nullptr;
|
||||
const uint8_t* mEnd = nullptr;
|
||||
|
||||
struct Section
|
||||
{
|
||||
std::string name;
|
||||
uint64_t addr = 0;
|
||||
uint64_t size = 0;
|
||||
uint32_t protect = 0;
|
||||
std::vector<uint8_t> data;
|
||||
const uint8_t* rawPtr = nullptr;
|
||||
uint64_t rawSize = 0;
|
||||
};
|
||||
|
||||
bool mDisasm64 = false;
|
||||
uint64_t mImageBase = 0;
|
||||
uint64_t mSizeOfImage = 0;
|
||||
uint64_t mEntryPoint = 0;
|
||||
std::vector<Section> mSections;
|
||||
|
||||
bool Parse(const uint8_t* begin, const uint8_t* end, std::string & error)
|
||||
{
|
||||
mBegin = begin;
|
||||
mEnd = end;
|
||||
|
||||
auto pdh = (win::dos_header_t*)begin;
|
||||
if(pdh->e_magic != win::DOS_HDR_MAGIC)
|
||||
{
|
||||
error = "invalid DOS header magic";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto pfh = pdh->get_file_header();
|
||||
switch(pfh->machine)
|
||||
{
|
||||
case win::machine_id::amd64:
|
||||
{
|
||||
auto pnth = pdh->get_nt_headers<true>();
|
||||
if(pnth->signature != win::NT_HDR_MAGIC)
|
||||
{
|
||||
error = "invalid PE header magic";
|
||||
return false;
|
||||
}
|
||||
|
||||
mDisasm64 = true;
|
||||
|
||||
duint sectionAlignment = pnth->optional_header.section_alignment;
|
||||
duint fileAlignment = pnth->optional_header.file_alignment;
|
||||
if(sectionAlignment > PAGE_SIZE)
|
||||
sectionAlignment = PAGE_SIZE;
|
||||
mImageBase = pnth->optional_header.image_base;
|
||||
mSizeOfImage = ROUND_TO_PAGES(pnth->optional_header.size_image); // TODO: shouldn't this be regions?
|
||||
mEntryPoint = pnth->optional_header.entry_point;
|
||||
if(mEntryPoint > 0 || !pnth->file_header.characteristics.dll_file)
|
||||
mEntryPoint += mImageBase;
|
||||
|
||||
auto sectionAlign = [sectionAlignment](duint value)
|
||||
{
|
||||
return (value + (sectionAlignment - 1)) & ~(sectionAlignment - 1);
|
||||
};
|
||||
|
||||
auto fileAlign = [fileAlignment](duint value)
|
||||
{
|
||||
return (value + (fileAlignment - 1)) & ~(fileAlignment - 1);
|
||||
};
|
||||
|
||||
// Align the sections
|
||||
for(uint32_t i = 0; i < pnth->file_header.num_sections; i++)
|
||||
{
|
||||
const auto & section = *pnth->get_section(i);
|
||||
|
||||
std::string name;
|
||||
for(auto ch : section.name.short_name)
|
||||
{
|
||||
if(ch == '\0')
|
||||
break;
|
||||
name.push_back(ch);
|
||||
}
|
||||
|
||||
Section s;
|
||||
s.name = name;
|
||||
s.addr = mImageBase + sectionAlign(section.virtual_address);
|
||||
s.size = (section.virtual_size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
|
||||
|
||||
if(!section.characteristics.mem_read)
|
||||
{
|
||||
s.protect = PAGE_NOACCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
s.protect = section.characteristics.mem_write ? PAGE_READWRITE : PAGE_READONLY;
|
||||
if(section.characteristics.mem_execute)
|
||||
{
|
||||
s.protect <<= 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Extend the last section to SizeOfImage under the right circumstances
|
||||
if(i + 1 == pnth->file_header.num_sections && sectionAlignment < PAGE_SIZE)
|
||||
{
|
||||
auto totalSize = s.addr + s.size;
|
||||
totalSize -= mImageBase;
|
||||
if(mSizeOfImage > totalSize)
|
||||
s.size += mSizeOfImage - totalSize;
|
||||
}
|
||||
|
||||
// TODO: check alignment
|
||||
s.rawPtr = begin + section.ptr_raw_data;
|
||||
s.rawSize = section.size_raw_data;
|
||||
if(s.rawSize > 0)
|
||||
{
|
||||
if(s.rawPtr + s.rawSize > end)
|
||||
{
|
||||
s.name += " (invalid raw pointer)";
|
||||
s.rawSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "[section]" << "name:" << QString::fromStdString(name);
|
||||
qDebug() << " " << "raw addr:" << ToHexString(section.ptr_raw_data) << "raw size:" << ToHexString(section.size_raw_data);
|
||||
qDebug() << " " << "vaddr:" << ToHexString(section.virtual_address) << "vsize:" << ToHexString(section.virtual_size);
|
||||
qDebug() << " ->" << "addr:" << ToHexString(s.addr) << "size:" << ToHexString(s.size) << "raw addr:" << ToHexString(s.rawPtr - begin) << "raw size:" << ToHexString(s.rawSize);
|
||||
|
||||
mSections.push_back(s);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case win::machine_id::i386:
|
||||
{
|
||||
auto pnth = pdh->get_nt_headers<false>();
|
||||
mDisasm64 = false;
|
||||
error = "32-bit executables not yet supported";
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
error = "unsupported architecture";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool disasm64() override
|
||||
{
|
||||
return mDisasm64;
|
||||
}
|
||||
|
||||
std::vector<MemoryRegion> MemoryRegions() const override
|
||||
{
|
||||
std::vector<MemoryRegion> regions;
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
regions.emplace_back();
|
||||
MemoryRegion & region = regions.back();
|
||||
region.BaseAddress = section.addr;
|
||||
region.RegionSize = section.size;
|
||||
region.State = StateToStringShort(MEM_COMMIT);
|
||||
region.AllocationBase = mImageBase;
|
||||
region.Protect = ProtectToStringShort(section.protect);
|
||||
region.AllocationProtect = ProtectToStringShort(PAGE_EXECUTE_READWRITE | PAGE_WRITECOMBINE);
|
||||
region.Type = TypeToStringShort(MEM_IMAGE);
|
||||
region.Info = section.name;
|
||||
}
|
||||
return regions;
|
||||
}
|
||||
|
||||
uint64_t entryPoint() const override
|
||||
{
|
||||
return mEntryPoint;
|
||||
}
|
||||
|
||||
bool read(duint addr, void* dest, duint size) override
|
||||
{
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
// TODO: support reading across sections
|
||||
if(addr >= section.addr && addr + size <= section.addr + section.size)
|
||||
{
|
||||
auto u8dest = (uint8_t*)dest;
|
||||
auto startOffset = addr - section.addr;
|
||||
for(size_t i = 0; i < size; i++)
|
||||
{
|
||||
auto readOffset = startOffset + i;
|
||||
if(readOffset < section.rawSize)
|
||||
{
|
||||
u8dest[i] = section.rawPtr[readOffset];
|
||||
}
|
||||
else
|
||||
{
|
||||
u8dest[i] = 0; // padding
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool getRange(duint addr, duint & base, duint & size) override
|
||||
{
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
if(addr >= section.addr && addr < section.addr + section.size)
|
||||
{
|
||||
base = section.addr;
|
||||
size = section.size;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isCodePtr(duint addr) override
|
||||
{
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
if(addr >= section.addr && addr < section.addr + section.size)
|
||||
{
|
||||
return (section.protect & 0xF0) != 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isValidPtr(duint addr) override
|
||||
{
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
if(addr >= section.addr && addr < section.addr + section.size)
|
||||
{
|
||||
return section.protect != PAGE_NOACCESS;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<FileParser> FileParser::Create(const uint8_t* begin, const uint8_t* end, std::string & error)
|
||||
{
|
||||
// Invalidate the global memory provider (TODO: localize everything)
|
||||
DbgSetMemoryProvider(nullptr);
|
||||
|
||||
auto size = end - begin;
|
||||
if(size < 4)
|
||||
{
|
||||
error = "File too small";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint8_t magic[4];
|
||||
memcpy(&magic, begin, sizeof(magic));
|
||||
|
||||
uint8_t mdmpMagic[4] = {'M', 'D', 'M', 'P'};
|
||||
if(memcmp(magic, mdmpMagic, sizeof(mdmpMagic)) == 0)
|
||||
{
|
||||
auto parser = std::make_unique<DmpFileParser>();
|
||||
udmpparser::MemoryView_t memoryView(begin, end);
|
||||
if(!parser->mDmp.Parse(memoryView))
|
||||
{
|
||||
error = "Minidump parsing failed!";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gArchitecture.setDisasm64(parser->disasm64());
|
||||
parser->mMemory.setParser(&parser->mDmp);
|
||||
DbgSetMemoryProvider(&parser->mMemory);
|
||||
return parser;
|
||||
}
|
||||
|
||||
uint8_t peMagic[2] = {'M', 'Z'};
|
||||
if(memcmp(magic, peMagic, sizeof(peMagic)) == 0)
|
||||
{
|
||||
auto parser = std::make_unique<PeFileParser>();
|
||||
if(!parser->Parse(begin, end, error))
|
||||
{
|
||||
error = "Failed to parse PE (" + error + ")";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gArchitecture.setDisasm64(parser->disasm64());
|
||||
DbgSetMemoryProvider(parser.get());
|
||||
return parser;
|
||||
}
|
||||
|
||||
error = "Unsupported file format!";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Architecture* GlobalArchitecture()
|
||||
{
|
||||
return &gArchitecture;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Disassembler/Architecture.h"
|
||||
|
||||
struct MemoryRegion
|
||||
{
|
||||
uint64_t BaseAddress = 0;
|
||||
uint64_t RegionSize = 0;
|
||||
std::string State;
|
||||
uint64_t AllocationBase = -1;
|
||||
std::string AllocationProtect;
|
||||
std::string Protect;
|
||||
std::string Type;
|
||||
std::string Info;
|
||||
};
|
||||
|
||||
struct FileParser
|
||||
{
|
||||
static std::unique_ptr<FileParser> Create(const uint8_t* begin, const uint8_t* end, std::string & error);
|
||||
|
||||
virtual ~FileParser() = default;
|
||||
virtual bool disasm64() = 0;
|
||||
virtual std::vector<MemoryRegion> MemoryRegions() const = 0;
|
||||
virtual uint64_t entryPoint() const = 0;
|
||||
};
|
||||
|
||||
// TODO: replace this with something smarter
|
||||
Architecture* GlobalArchitecture();
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#include "GotoDialog.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
GotoDialog::GotoDialog(QWidget* parent, bool checkAddress)
|
||||
: QInputDialog(parent)
|
||||
, mCheckAddress(checkAddress)
|
||||
{
|
||||
setInputMode(InputMode::TextInput);
|
||||
setLabelText(tr("Address:"));
|
||||
setWindowTitle(tr("Goto"));
|
||||
}
|
||||
|
||||
duint GotoDialog::address() const
|
||||
{
|
||||
return mAddress;
|
||||
}
|
||||
|
||||
void GotoDialog::done(int r)
|
||||
{
|
||||
if(r == Accepted)
|
||||
{
|
||||
auto ok = false;
|
||||
mAddress = textValue().toLongLong(&ok, 16);
|
||||
if(!ok)
|
||||
return;
|
||||
if(mCheckAddress && !DbgMemIsValidReadPtr(mAddress))
|
||||
return;
|
||||
}
|
||||
QInputDialog::done(r);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue