├── .github
└── workflows
│ ├── docs-deploy.yml
│ └── kdoc-deploy.yml
├── .gitignore
├── Core
├── .gitignore
├── CMakeLists.txt
├── dexkit
│ ├── analyze.cpp
│ ├── beans.cpp
│ ├── common.cpp
│ ├── dex_item.cpp
│ ├── dex_item_batch_find.cpp
│ ├── dex_item_find.cpp
│ ├── dex_item_matcher.cpp
│ ├── dexkit.cpp
│ ├── include
│ │ ├── analyze.h
│ │ ├── beans.h
│ │ ├── common.h
│ │ ├── constant.h
│ │ ├── dex_item.h
│ │ ├── dexkit.h
│ │ ├── dexkit_error.h
│ │ ├── dexkit_error_list.h
│ │ ├── file_helper.h
│ │ ├── mmap_windows.h
│ │ ├── package_trie.h
│ │ ├── schema
│ │ │ ├── encode_value_generated.h
│ │ │ ├── enums_generated.h
│ │ │ ├── matchers_generated.h
│ │ │ ├── querys_generated.h
│ │ │ ├── ranges_generated.h
│ │ │ └── results_generated.h
│ │ └── string_match.h
│ └── utils
│ │ ├── byte_code_util.h
│ │ ├── dex_descriptor_util.h
│ │ └── opcode_util.h
├── main.cpp
└── third_party
│ ├── aho_corasick_trie
│ └── acdat
│ │ ├── AhoCorasickDoubleArrayTrie.h
│ │ ├── Builder.h
│ │ └── State.h
│ ├── flatbuffers
│ └── include
│ │ └── flatbuffers
│ │ ├── allocator.h
│ │ ├── array.h
│ │ ├── base.h
│ │ ├── buffer.h
│ │ ├── buffer_ref.h
│ │ ├── code_generator.h
│ │ ├── code_generators.h
│ │ ├── default_allocator.h
│ │ ├── detached_buffer.h
│ │ ├── file_manager.h
│ │ ├── flatbuffer_builder.h
│ │ ├── flatbuffers.h
│ │ ├── flatc.h
│ │ ├── flex_flat_util.h
│ │ ├── flexbuffers.h
│ │ ├── grpc.h
│ │ ├── hash.h
│ │ ├── idl.h
│ │ ├── minireflect.h
│ │ ├── pch
│ │ ├── flatc_pch.h
│ │ └── pch.h
│ │ ├── reflection.h
│ │ ├── reflection_generated.h
│ │ ├── registry.h
│ │ ├── stl_emulation.h
│ │ ├── string.h
│ │ ├── struct.h
│ │ ├── table.h
│ │ ├── util.h
│ │ ├── vector.h
│ │ ├── vector_downward.h
│ │ └── verifier.h
│ ├── parallel_hashmap
│ └── parallel_hashmap
│ │ ├── btree.h
│ │ ├── meminfo.h
│ │ ├── phmap.h
│ │ ├── phmap_base.h
│ │ ├── phmap_bits.h
│ │ ├── phmap_config.h
│ │ ├── phmap_dump.h
│ │ ├── phmap_fwd_decl.h
│ │ └── phmap_utils.h
│ ├── slicer
│ ├── bytecode_encoder.cc
│ ├── code_ir.cc
│ ├── common.cc
│ ├── control_flow_graph.cc
│ ├── debuginfo_encoder.cc
│ ├── dex_bytecode.cc
│ ├── dex_format.cc
│ ├── dex_ir.cc
│ ├── dex_ir_builder.cc
│ ├── dex_utf8.cc
│ ├── export
│ │ └── slicer
│ │ │ ├── arrayview.h
│ │ │ ├── buffer.h
│ │ │ ├── bytecode_encoder.h
│ │ │ ├── chronometer.h
│ │ │ ├── code_ir.h
│ │ │ ├── common.h
│ │ │ ├── control_flow_graph.h
│ │ │ ├── debuginfo_encoder.h
│ │ │ ├── dex_bytecode.h
│ │ │ ├── dex_format.h
│ │ │ ├── dex_instruction_list.h
│ │ │ ├── dex_ir.h
│ │ │ ├── dex_ir_builder.h
│ │ │ ├── dex_leb128.h
│ │ │ ├── dex_utf8.h
│ │ │ ├── hash_table.h
│ │ │ ├── index_map.h
│ │ │ ├── instrumentation.h
│ │ │ ├── intrusive_list.h
│ │ │ ├── memview.h
│ │ │ ├── reader.h
│ │ │ ├── scopeguard.h
│ │ │ ├── tryblocks_encoder.h
│ │ │ └── writer.h
│ ├── instrumentation.cc
│ ├── reader.cc
│ ├── tryblocks_encoder.cc
│ └── writer.cc
│ └── thread_helper
│ ├── ThreadPool.h
│ └── ThreadVariable.h
├── LICENSE
├── README.md
├── README_zh.md
├── build.gradle
├── demo
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── luckypray
│ │ └── dexkit
│ │ └── demo
│ │ ├── DemoApplication.java
│ │ ├── MainActivity.java
│ │ ├── PlayActivity.java
│ │ ├── RandomUtil.java
│ │ ├── RouterManager.java
│ │ ├── annotations
│ │ └── Router.java
│ │ └── hook
│ │ └── Hooker.kt
│ └── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ ├── activity_main.xml
│ └── activity_play.xml
│ ├── mipmap-anydpi-v26
│ ├── ic_launcher.xml
│ └── ic_launcher_round.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values-night
│ └── themes.xml
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── themes.xml
├── dexkit-android
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── gradle.properties
├── proguard-rules.pro
└── src
│ └── main
│ └── AndroidManifest.xml
├── dexkit
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── main
│ ├── cpp
│ │ ├── CMakeLists.txt
│ │ └── native-bridge.cpp
│ └── java
│ │ └── org
│ │ └── luckypray
│ │ └── dexkit
│ │ ├── Alias.kt
│ │ ├── DexKitBridge.kt
│ │ ├── annotations
│ │ └── DexKitDsl.kt
│ │ ├── exceptions
│ │ ├── NoResultException.kt
│ │ └── NonUniqueResultException.kt
│ │ ├── query
│ │ ├── BatchFindClassUsingStrings.kt
│ │ ├── BatchFindMethodUsingStrings.kt
│ │ ├── FindClass.kt
│ │ ├── FindField.kt
│ │ ├── FindMethod.kt
│ │ ├── MatcherCollections.kt
│ │ ├── base
│ │ │ ├── BaseQuery.kt
│ │ │ ├── IAnnotationEncodeValue.kt
│ │ │ ├── INumberEncodeValue.kt
│ │ │ └── IQuery.kt
│ │ ├── enums
│ │ │ ├── AnnotationEncodeValueType.kt
│ │ │ ├── AnnotationVisibilityType.kt
│ │ │ ├── MatchType.kt
│ │ │ ├── NumberEncodeValueType.kt
│ │ │ ├── OpCodeMatchType.kt
│ │ │ ├── RetentionPolicyType.kt
│ │ │ ├── StringMatchType.kt
│ │ │ ├── TargetElementType.kt
│ │ │ └── UsingType.kt
│ │ └── matchers
│ │ │ ├── AnnotationElementMatcher.kt
│ │ │ ├── AnnotationElementsMatcher.kt
│ │ │ ├── AnnotationEncodeArrayMatcher.kt
│ │ │ ├── AnnotationMatcher.kt
│ │ │ ├── AnnotationsMatcher.kt
│ │ │ ├── ClassMatcher.kt
│ │ │ ├── EncodeValues.kt
│ │ │ ├── FieldMatcher.kt
│ │ │ ├── FieldsMatcher.kt
│ │ │ ├── InterfacesMatcher.kt
│ │ │ ├── MethodMatcher.kt
│ │ │ ├── MethodsMatcher.kt
│ │ │ ├── ParameterMatcher.kt
│ │ │ ├── ParametersMatcher.kt
│ │ │ ├── StringMatchersGroup.kt
│ │ │ ├── UsingFieldMatcher.kt
│ │ │ └── base
│ │ │ ├── AccessFlagsMatcher.kt
│ │ │ ├── AnnotationEncodeValueMatcher.kt
│ │ │ ├── IntRange.kt
│ │ │ ├── NumberEncodeValueMatcher.kt
│ │ │ ├── OpCodesMatcher.kt
│ │ │ ├── StringMatcher.kt
│ │ │ └── TargetElementTypesMatcher.kt
│ │ ├── result
│ │ ├── AnnotationData.kt
│ │ ├── AnnotationElementData.kt
│ │ ├── AnnotationEncodeArrayData.kt
│ │ ├── AnnotationEncodeValue.kt
│ │ ├── ClassData.kt
│ │ ├── DataCollections.kt
│ │ ├── FieldData.kt
│ │ ├── FieldUsingType.kt
│ │ ├── MethodData.kt
│ │ ├── UsingFieldData.kt
│ │ └── base
│ │ │ └── BaseData.kt
│ │ ├── schema
│ │ ├── AccessFlagsMatcher.kt
│ │ ├── AnnotationElementMatcher.kt
│ │ ├── AnnotationElementMeta.kt
│ │ ├── AnnotationElementsMatcher.kt
│ │ ├── AnnotationEncodeArray.kt
│ │ ├── AnnotationEncodeArrayMatcher.kt
│ │ ├── AnnotationEncodeValue.kt
│ │ ├── AnnotationEncodeValueMatcher.kt
│ │ ├── AnnotationEncodeValueMeta.kt
│ │ ├── AnnotationEncodeValueType.kt
│ │ ├── AnnotationMatcher.kt
│ │ ├── AnnotationMeta.kt
│ │ ├── AnnotationMetaArrayHolder.kt
│ │ ├── AnnotationVisibilityType.kt
│ │ ├── AnnotationsMatcher.kt
│ │ ├── BatchClassMeta.kt
│ │ ├── BatchClassMetaArrayHolder.kt
│ │ ├── BatchFindClassUsingStrings.kt
│ │ ├── BatchFindMethodUsingStrings.kt
│ │ ├── BatchMethodMeta.kt
│ │ ├── BatchMethodMetaArrayHolder.kt
│ │ ├── BatchUsingStringsMatcher.kt
│ │ ├── ClassMatcher.kt
│ │ ├── ClassMeta.kt
│ │ ├── ClassMetaArrayHolder.kt
│ │ ├── EncodeValueBoolean.kt
│ │ ├── EncodeValueByte.kt
│ │ ├── EncodeValueChar.kt
│ │ ├── EncodeValueDouble.kt
│ │ ├── EncodeValueFloat.kt
│ │ ├── EncodeValueInt.kt
│ │ ├── EncodeValueLong.kt
│ │ ├── EncodeValueNull.kt
│ │ ├── EncodeValueShort.kt
│ │ ├── EncodeValueString.kt
│ │ ├── FieldMatcher.kt
│ │ ├── FieldMeta.kt
│ │ ├── FieldMetaArrayHolder.kt
│ │ ├── FieldsMatcher.kt
│ │ ├── FindClass.kt
│ │ ├── FindField.kt
│ │ ├── FindMethod.kt
│ │ ├── IntRange.kt
│ │ ├── InterfacesMatcher.kt
│ │ ├── LongRange.kt
│ │ ├── MatchType.kt
│ │ ├── MethodMatcher.kt
│ │ ├── MethodMeta.kt
│ │ ├── MethodMetaArrayHolder.kt
│ │ ├── MethodsMatcher.kt
│ │ ├── Number.kt
│ │ ├── OpCodeMatchType.kt
│ │ ├── OpCodesMatcher.kt
│ │ ├── ParameterMatcher.kt
│ │ ├── ParametersAnnotationMetaArrayHoler.kt
│ │ ├── ParametersMatcher.kt
│ │ ├── RetentionPolicyType.kt
│ │ ├── StringMatchType.kt
│ │ ├── StringMatcher.kt
│ │ ├── TargetElementType.kt
│ │ ├── TargetElementTypesMatcher.kt
│ │ ├── UsingFieldMatcher.kt
│ │ ├── UsingFieldMeta.kt
│ │ ├── UsingFieldMetaArrayHolder.kt
│ │ └── UsingType.kt
│ │ ├── util
│ │ ├── DexSignUtil.kt
│ │ ├── InstanceUtil.kt
│ │ ├── MUtf8Util.java
│ │ ├── OpCodeUtil.kt
│ │ ├── StringUnicodeEncoderDecoder.java
│ │ └── WeakCache.kt
│ │ └── wrap
│ │ ├── DexClass.kt
│ │ ├── DexField.kt
│ │ ├── DexMethod.kt
│ │ └── ISerializable.kt
│ └── test
│ └── java
│ └── org
│ └── luckypray
│ └── dexkit
│ ├── JavaReadMeTest.java
│ ├── KtReadMeTest.kt
│ ├── LibLoader.kt
│ ├── UnitTest.kt
│ └── util
│ └── InstanceUtilTest.kt
├── doc-source
├── .gitignore
├── package.json
├── src
│ ├── .vuepress
│ │ ├── config.ts
│ │ └── configs
│ │ │ ├── client.ts
│ │ │ ├── template.ts
│ │ │ └── utils.ts
│ ├── en
│ │ ├── about
│ │ │ ├── about.md
│ │ │ └── contacts.md
│ │ ├── guide
│ │ │ ├── example.md
│ │ │ ├── home.md
│ │ │ ├── knowledge.md
│ │ │ ├── performance-optimization.md
│ │ │ ├── quick-start.md
│ │ │ ├── run-on-desktop.md
│ │ │ └── structural-zoom-table.md
│ │ └── index.md
│ ├── index.md
│ └── zh-cn
│ │ ├── about
│ │ ├── about.md
│ │ └── contacts.md
│ │ ├── guide
│ │ ├── example.md
│ │ ├── home.md
│ │ ├── knowledge.md
│ │ ├── performance-optimization.md
│ │ ├── quick-start.md
│ │ ├── run-on-desktop.md
│ │ └── structural-zoom-table.md
│ │ └── index.md
└── yarn.lock
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── lint-rules
├── .gitignore
├── build.gradle
└── src
│ └── main
│ └── java
│ └── org
│ └── luckypray
│ └── dexkit
│ └── lint
│ ├── DexKitIssueRegistry.kt
│ ├── detector
│ ├── DexKitCreateDetector.kt
│ └── DexKitDataFirstDetector.kt
│ └── util
│ └── Utils.kt
├── main
├── .gitignore
├── README.md
├── build.gradle
└── src
│ └── main
│ └── java
│ └── Main.kt
├── schema
├── .gitignore
├── README.md
├── fbs
│ ├── encode_value.fbs
│ ├── enums.fbs
│ ├── matchers.fbs
│ ├── querys.fbs
│ ├── ranges.fbs
│ └── results.fbs
└── gen_code.py
└── settings.gradle
/.github/workflows/docs-deploy.yml:
--------------------------------------------------------------------------------
1 | name: Vuepress Document Deploy
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | paths:
8 | - 'doc-source/**'
9 | - '.github/workflows/docs-deploy.yml'
10 |
11 | permissions:
12 | contents: write
13 |
14 | jobs:
15 | vuepress-doc-deploy:
16 | runs-on: ubuntu-latest
17 |
18 | steps:
19 | - name: Clone master branch
20 | uses: actions/checkout@v3.3.0
21 |
22 | - name: vuepress-deploy
23 | uses: jenkey2011/vuepress-deploy@master
24 | env:
25 | ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
26 | TARGET_REPO: ${{ github.repository }}
27 | TARGET_BRANCH: docs
28 | BUILD_SCRIPT: |
29 | git config --global --add safe.directory "*" \
30 | && cd doc-source && yarn -i --network-timeout 1000000000 && yarn docs:build
31 | BUILD_DIR: ../docs
32 |
--------------------------------------------------------------------------------
/.github/workflows/kdoc-deploy.yml:
--------------------------------------------------------------------------------
1 | name: KDoc Build and Deploy
2 |
3 | on:
4 | push:
5 | tags:
6 | - '**'
7 |
8 | jobs:
9 | KDoc-deploy:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Clone master branch
14 | uses: actions/checkout@v3.3.0
15 |
16 | - name: Prepare Java 17
17 | uses: actions/setup-java@v3.10.0
18 | with:
19 | java-version: 17
20 | distribution: adopt
21 |
22 | - name: Cache Gradle packages
23 | uses: actions/cache@v3
24 | with:
25 | path: ~/.gradle/caches
26 | key: ${{ runner.os }}-gradle-${{ hashFiles('/*.gradle') }}-${{ hashFiles('/*.gradle.kts') }}
27 |
28 | - name: Build KDoc and deploy
29 | env:
30 | ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
31 | run: |
32 | chmod +x ./gradlew \
33 | && ./gradlew clean \
34 | && ./gradlew :dexkit-android:dokkaHtml \
35 | && ./gradlew :dexkit-android:updateKDoc
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 | /build
4 | /captures
5 | .gradle
6 | .externalNativeBuild
7 | .cxx
8 | local.properties
9 |
10 | /docs
11 | /apk
--------------------------------------------------------------------------------
/Core/.gitignore:
--------------------------------------------------------------------------------
1 | ### C++ template
2 | # Prerequisites
3 | *.d
4 |
5 | # Compiled Object files
6 | *.slo
7 | *.lo
8 | *.o
9 | *.obj
10 |
11 | # Precompiled Headers
12 | *.gch
13 | *.pch
14 |
15 | # Compiled Dynamic libraries
16 | *.so
17 | *.dylib
18 | *.dll
19 |
20 | # Fortran module files
21 | *.mod
22 | *.smod
23 |
24 | # Compiled Static libraries
25 | *.lai
26 | *.la
27 | *.a
28 | *.lib
29 |
30 | # Executables
31 | *.exe
32 | *.out
33 | *.app
34 |
35 | ### CMake template
36 | CMakeLists.txt.user
37 | CMakeCache.txt
38 | CMakeFiles
39 | CMakeScripts
40 | Testing
41 | Makefile
42 | cmake_install.cmake
43 | install_manifest.txt
44 | compile_commands.json
45 | CTestTestfile.cmake
46 | _deps
47 |
48 |
49 | cmake-build*/
50 | .idea
51 | #CMakeLists.txt
52 |
53 | *.dex
54 | *.apk
55 | /apks
--------------------------------------------------------------------------------
/Core/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.4.1...3.27)
2 | project(dexkit)
3 |
4 | find_program(CCACHE ccache)
5 |
6 | if (CCACHE)
7 | set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
8 | set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
9 | endif ()
10 |
11 | set(CMAKE_CXX_STANDARD 20)
12 |
13 | file(GLOB_RECURSE SLICER_SRC_FILES third_party/slicer/*.cc)
14 | file(GLOB_RECURSE DEXKIT_SRC_FILES dexkit/*.cpp)
15 |
16 | set(SLICER_SOURCES
17 | ${SLICER_SRC_FILES}
18 | )
19 |
20 | set(COMPILE_FLAGS "-Wno-empty-body -Wno-unused-private-field \
21 | -Wno-unused-value -Wno-unused-variable -Wno-unused-function")
22 | set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")
23 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")
24 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
25 |
26 | add_library(${PROJECT_NAME}_static
27 | STATIC
28 | ${SLICER_SOURCES}
29 | ${DEXKIT_SRC_FILES}
30 | )
31 | target_include_directories(${PROJECT_NAME}_static
32 | PUBLIC
33 | dexkit/include
34 | third_party/slicer/export
35 | third_party/thread_helper
36 | third_party/aho_corasick_trie
37 | third_party/parallel_hashmap
38 | third_party/flatbuffers/include
39 | )
40 | target_link_libraries(${PROJECT_NAME}_static
41 | PUBLIC
42 | z
43 | )
44 |
45 | option(EXECUTABLE_TEST "execute test cpp" OFF)
46 | if (EXECUTABLE_TEST)
47 | link_libraries(z ${PROJECT_NAME}_static)
48 | add_executable(${PROJECT_NAME}
49 | main.cpp
50 | )
51 | endif ()
--------------------------------------------------------------------------------
/Core/dexkit/common.cpp:
--------------------------------------------------------------------------------
1 | // DexKit - An high-performance runtime parsing library for dex
2 | // implemented in C++.
3 | // Copyright (C) 2022-2023 LuckyPray
4 | // https://github.com/LuckyPray/DexKit
5 | //
6 | // This program is free software: you can redistribute it and/or
7 | // modify it under the terms of the GNU Lesser General Public
8 | // License as published by the Free Software Foundation, either
9 | // version 3 of the License, or (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | // .
19 | // .
20 |
21 | #include "common.h"
22 |
23 | #include
24 | #include
25 |
26 | namespace dexkit {
27 |
28 | void _checkFailed(const char *expr, int line, const char *file) {
29 | printf("\nDEXKIT_CHECK failed [%s] at %s:%d\n\n", expr, file, line);
30 | abort();
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/Core/dexkit/include/analyze.h:
--------------------------------------------------------------------------------
1 | // DexKit - An high-performance runtime parsing library for dex
2 | // implemented in C++.
3 | // Copyright (C) 2022-2023 LuckyPray
4 | // https://github.com/LuckyPray/DexKit
5 | //
6 | // This program is free software: you can redistribute it and/or
7 | // modify it under the terms of the GNU Lesser General Public
8 | // License as published by the Free Software Foundation, either
9 | // version 3 of the License, or (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | // .
19 | // .
20 |
21 | #pragma once
22 |
23 | #include "schema/querys_generated.h"
24 | #include "schema/matchers_generated.h"
25 |
26 | // max depth of analyze type.
27 | // type name must in this dex->TypeIds()
28 | // type class maybe in this dex->TypeIds() or other dex->TypeIds()
29 | #define MAX_ANALYZE_TYPE_DEPTH 2
30 |
31 | namespace dexkit {
32 |
33 | // optional init
34 | const uint32_t kClassAnnotation = 0x0010;
35 | const uint32_t kFieldAnnotation = 0x0020;
36 | const uint32_t kMethodAnnotation = 0x0040;
37 | const uint32_t kParamAnnotation = 0x0080;
38 |
39 | // code
40 | const uint32_t kUsingString = 0x0100;
41 | const uint32_t kMethodInvoking = 0x0200;
42 | const uint32_t kCallerMethod = 0x0400; // cross
43 | const uint32_t kMethodUsingField = 0x0800;
44 | const uint32_t kRwFieldMethod = 0x1000; // cross
45 | const uint32_t kOpSequence = 0x2000;
46 | const uint32_t kUsingNumber = 0x4000;
47 |
48 | struct AnalyzeRet {
49 | uint32_t need_flags = 0;
50 | std::vector declare_class;
51 | };
52 |
53 | AnalyzeRet Analyze(const schema::ClassMatcher *matcher, int dex_depth);
54 | AnalyzeRet Analyze(const schema::FieldMatcher *matcher, int dex_depth);
55 | AnalyzeRet Analyze(const schema::MethodMatcher *matcher, int dex_depth);
56 |
57 | AnalyzeRet Analyze(const schema::AnnotationEncodeArrayMatcher *matcher, int dex_depth);
58 | AnalyzeRet Analyze(const schema::AnnotationElementMatcher *matcher, int dex_depth);
59 | AnalyzeRet Analyze(const schema::AnnotationElementsMatcher *matcher, int dex_depth);
60 | AnalyzeRet Analyze(const schema::AnnotationMatcher *matcher, int dex_depth);
61 | AnalyzeRet Analyze(const schema::AnnotationsMatcher *matcher, int dex_depth);
62 | AnalyzeRet Analyze(const schema::InterfacesMatcher *matcher, int dex_depth);
63 | AnalyzeRet Analyze(const schema::FieldsMatcher *matcher, int dex_depth);
64 | AnalyzeRet Analyze(const schema::MethodsMatcher *matcher, int dex_depth);
65 |
66 | AnalyzeRet Analyze(const schema::ParameterMatcher *matcher, int dex_depth);
67 | AnalyzeRet Analyze(const schema::ParametersMatcher *matcher, int dex_depth);
68 |
69 | } // namespace dexkit
--------------------------------------------------------------------------------
/Core/dexkit/include/constant.h:
--------------------------------------------------------------------------------
1 | // DexKit - An high-performance runtime parsing library for dex
2 | // implemented in C++.
3 | // Copyright (C) 2022-2023 LuckyPray
4 | // https://github.com/LuckyPray/DexKit
5 | //
6 | // This program is free software: you can redistribute it and/or
7 | // modify it under the terms of the GNU Lesser General Public
8 | // License as published by the Free Software Foundation, either
9 | // version 3 of the License, or (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | // .
19 | // .
20 |
21 | #pragma once
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #include "slicer/dex_ir.h"
28 |
29 | // null_param is used to match any param
30 | const static std::optional> null_param = std::nullopt;
31 | const static std::vector empty_param;
32 |
33 | // init cached flag
34 | constexpr dex::u4 fHeader = 0x0001;
35 | constexpr dex::u4 fString = 0x0002;
36 | constexpr dex::u4 fType = 0x0004;
37 | constexpr dex::u4 fProto = 0x0008;
38 | constexpr dex::u4 fField = 0x0010;
39 | constexpr dex::u4 fMethod = 0x0020;
40 | constexpr dex::u4 fAnnotation = 0x0040;
41 | constexpr dex::u4 fOpCodeSeq = 0x1000;
42 | constexpr dex::u4 fDefault = fHeader | fString | fType | fProto | fMethod;
43 |
44 | // used field flag
45 | constexpr dex::u4 fGetting = 0x1;
46 | constexpr dex::u4 fSetting = 0x2;
47 | constexpr dex::u4 fUsing = fGetting | fSetting;
48 |
49 | // match type
50 | // mFull : full string match, eg.
51 | // full_match(search = "abc", target = "abc") = true
52 | // full_match(search = "abc", target = "abcd") = false
53 | constexpr dex::u4 mFull = 0;
54 | // mContains : contains string match, eg.
55 | // contains_match(search = "abc", target = "abcd") = true
56 | // contains_match(search = "abc", target = "abc") = true
57 | // contains_match(search = "abc", target = "ab") = false
58 | constexpr dex::u4 mContains = 1;
59 | // mSimilarRegex : similar regex matches, only support: '^', '$' eg.
60 | // similar_regex_match(search = "abc", target = "abc") == true
61 | // similar_regex_match(search = "^abc", target = "abc") == true
62 | // similar_regex_match(search = "abc$", target = "bc") == true
63 | // similar_regex_match(search = "^abc$", target = "abc") == true
64 | // similar_regex_match(search = "^abc$", target = "abcd") == false
65 | constexpr dex::u4 mSimilarRegex = 2;
66 |
--------------------------------------------------------------------------------
/Core/dexkit/include/dexkit_error.h:
--------------------------------------------------------------------------------
1 | // DexKit - An high-performance runtime parsing library for dex
2 | // implemented in C++.
3 | // Copyright (C) 2022-2023 LuckyPray
4 | // https://github.com/LuckyPray/DexKit
5 | //
6 | // This program is free software: you can redistribute it and/or
7 | // modify it under the terms of the GNU Lesser General Public
8 | // License as published by the Free Software Foundation, either
9 | // version 3 of the License, or (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | // .
19 | // .
20 |
21 | #pragma once
22 |
23 | #include
24 |
25 | namespace dexkit {
26 |
27 | enum class Error : uint16_t {
28 | #define DEXKIT_ERROR(name, msg) name,
29 | #include "dexkit_error_list.h"
30 | DEXKIT_ERROR_LIST(DEXKIT_ERROR)
31 | #undef DEXKIT_ERROR_LIST
32 | #undef DEXKIT_ERROR
33 | };
34 |
35 | constexpr std::string_view error_messages[] = {
36 | #define DEXKIT_ERROR(name, msg) msg,
37 | #include "dexkit_error_list.h"
38 | DEXKIT_ERROR_LIST(DEXKIT_ERROR)
39 | #undef DEXKIT_ERROR_LIST
40 | #undef DEXKIT_ERROR
41 | };
42 |
43 | constexpr size_t error_messages_size = sizeof(error_messages) / sizeof(std::string_view);
44 |
45 | inline std::string_view GetErrorMessage(Error e) {
46 | if (static_cast(e) >= error_messages_size) return "";
47 | return error_messages[static_cast(e)];
48 | }
49 |
50 | } // namespace dexkit
--------------------------------------------------------------------------------
/Core/dexkit/include/dexkit_error_list.h:
--------------------------------------------------------------------------------
1 | // DexKit - An high-performance runtime parsing library for dex
2 | // implemented in C++.
3 | // Copyright (C) 2022-2023 LuckyPray
4 | // https://github.com/LuckyPray/DexKit
5 | //
6 | // This program is free software: you can redistribute it and/or
7 | // modify it under the terms of the GNU Lesser General Public
8 | // License as published by the Free Software Foundation, either
9 | // version 3 of the License, or (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | // .
19 | // .
20 |
21 | #ifndef DEXKIT_ERROR_LIST_H
22 | #define DEXKIT_ERROR_LIST_H
23 |
24 |
25 | // V(name, msg)
26 | #define DEXKIT_ERROR_LIST(V) \
27 | V(SUCCESS, "Success") \
28 | V(EXPORT_DEX_FP_NULL, "Export dex file pointer is null") \
29 | V(FILE_NOT_FOUND, "File not found") \
30 | V(OPEN_ZIP_FILE_FAILED, "Open zip file failed") \
31 | V(OPEN_FILE_FAILED, "Open file failed") \
32 | V(ADD_DEX_AFTER_CROSS_BUILD, "Add dex after cross build")\
33 | V(WRITE_FILE_INCOMPLETE, "Incomplete file written")
34 |
35 |
36 | #endif //DEXKIT_ERROR_LIST_H
37 | #undef DEXKIT_ERROR_LIST_H
--------------------------------------------------------------------------------
/Core/dexkit/include/package_trie.h:
--------------------------------------------------------------------------------
1 | // DexKit - An high-performance runtime parsing library for dex
2 | // implemented in C++.
3 | // Copyright (C) 2022-2023 LuckyPray
4 | // https://github.com/LuckyPray/DexKit
5 | //
6 | // This program is free software: you can redistribute it and/or
7 | // modify it under the terms of the GNU Lesser General Public
8 | // License as published by the Free Software Foundation, either
9 | // version 3 of the License, or (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | // .
19 | // .
20 |
21 | #pragma once
22 |
23 | #include
24 | #include
25 |
26 | namespace trie {
27 |
28 | const int NODE_SIZE = UINT8_MAX + 1;
29 |
30 | struct PackageTrie {
31 | std::vector> nodes;
32 | std::vector flags;
33 |
34 | PackageTrie() {
35 | nodes.emplace_back(NODE_SIZE, -1);
36 | flags.emplace_back(0);
37 | }
38 |
39 | void insert(const std::string_view word, bool is_white, bool ignore_case = false) {
40 | int currentNode = 0;
41 |
42 | for (uint8_t c : word) {
43 | if (ignore_case) {
44 | c = c >= 'A' && c <= 'Z' ? (c + 32) : c;
45 | }
46 | if (nodes[currentNode][c] == -1) {
47 | nodes[currentNode][c] = (int) nodes.size();
48 | nodes.emplace_back(NODE_SIZE, -1);
49 | flags.emplace_back(0);
50 | }
51 | currentNode = nodes[currentNode][c];
52 | }
53 |
54 | flags[currentNode] = flags[currentNode] | (1 << is_white);
55 | }
56 |
57 | uint8_t search(const std::string_view word, bool ignore_case = false) {
58 | int currentNode = 0;
59 | std::vector result;
60 |
61 | uint8_t flag = 0;
62 |
63 | for (uint8_t c : word) {
64 | if (ignore_case) {
65 | c = c >= 'A' && c <= 'Z' ? (c + 32) : c;
66 | }
67 | if (nodes[currentNode][c] == -1) {
68 | return flag;
69 | }
70 | currentNode = nodes[currentNode][c];
71 |
72 | if (flags[currentNode]) {
73 | if (flags[currentNode] & 1) {
74 | flag |= 1;
75 | }
76 | if (flags[currentNode] & 2) {
77 | flag |= 2;
78 | }
79 | }
80 | }
81 |
82 | return flag;
83 | }
84 | };
85 |
86 | }
--------------------------------------------------------------------------------
/Core/dexkit/utils/byte_code_util.h:
--------------------------------------------------------------------------------
1 | // DexKit - An high-performance runtime parsing library for dex
2 | // implemented in C++.
3 | // Copyright (C) 2022-2023 LuckyPray
4 | // https://github.com/LuckyPray/DexKit
5 | //
6 | // This program is free software: you can redistribute it and/or
7 | // modify it under the terms of the GNU Lesser General Public
8 | // License as published by the Free Software Foundation, either
9 | // version 3 of the License, or (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see
18 | // .
19 | // .
20 |
21 | #pragma once
22 |
23 | #include "slicer/dex_format.h"
24 |
25 | namespace dexkit {
26 |
27 | inline dex::u4 ReadInt(const dex::u2 **ptr) {
28 | const dex::u2 *p = *ptr;
29 | int res = *p++;
30 | res |= (*p++ << 16);
31 | *ptr = p;
32 | return res;
33 | }
34 |
35 | inline dex::u4 ReadInt(const dex::u2 *ptr) {
36 | return ptr[0] | (ptr[1] << 16);
37 | }
38 |
39 | inline dex::u2 ReadShort(const dex::u2 **ptr) {
40 | const dex::u2 *p = *ptr;
41 | int res = *p++;
42 | *ptr = p;
43 | return res;
44 | }
45 |
46 | inline dex::u2 ReadShort(const dex::u2 *ptr) {
47 | return *ptr;
48 | }
49 |
50 | inline dex::u8 ReadLong(const dex::u2 **ptr) {
51 | const dex::u2 *p = *ptr;
52 | dex::u8 res = *p++;
53 | res |= ((dex::u8) *p++ << 16);
54 | res |= ((dex::u8) *p++ << 32);
55 | res |= ((dex::u8) *p++ << 48);
56 | *ptr = p;
57 | return res;
58 | }
59 |
60 | inline dex::u8 ReadLong(const dex::u2 *ptr) {
61 | return ptr[0] | ((dex::u8) ptr[1] << 16) | ((dex::u8) ptr[2] << 32) | ((dex::u8) ptr[3] << 48);
62 | }
63 |
64 | inline dex::u4 ReadULeb128(const dex::u1 **ptr) {
65 | const dex::u1 *p = *ptr;
66 | dex::u1 size = 0;
67 | dex::u4 res = 0;
68 | do {
69 | res |= (*p & 0x7f) << 7 * size++;
70 | } while ((*p++ & 0x80) == 0x80);
71 | *ptr = p;
72 | return res;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/Core/third_party/flatbuffers/include/flatbuffers/allocator.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef FLATBUFFERS_ALLOCATOR_H_
18 | #define FLATBUFFERS_ALLOCATOR_H_
19 |
20 | #include "flatbuffers/base.h"
21 |
22 | namespace flatbuffers {
23 |
24 | // Allocator interface. This is flatbuffers-specific and meant only for
25 | // `vector_downward` usage.
26 | class Allocator {
27 | public:
28 | virtual ~Allocator() {}
29 |
30 | // Allocate `size` bytes of memory.
31 | virtual uint8_t *allocate(size_t size) = 0;
32 |
33 | // Deallocate `size` bytes of memory at `p` allocated by this allocator.
34 | virtual void deallocate(uint8_t *p, size_t size) = 0;
35 |
36 | // Reallocate `new_size` bytes of memory, replacing the old region of size
37 | // `old_size` at `p`. In contrast to a normal realloc, this grows downwards,
38 | // and is intended specifcally for `vector_downward` use.
39 | // `in_use_back` and `in_use_front` indicate how much of `old_size` is
40 | // actually in use at each end, and needs to be copied.
41 | virtual uint8_t *reallocate_downward(uint8_t *old_p, size_t old_size,
42 | size_t new_size, size_t in_use_back,
43 | size_t in_use_front) {
44 | FLATBUFFERS_ASSERT(new_size > old_size); // vector_downward only grows
45 | uint8_t *new_p = allocate(new_size);
46 | memcpy_downward(old_p, old_size, new_p, new_size, in_use_back,
47 | in_use_front);
48 | deallocate(old_p, old_size);
49 | return new_p;
50 | }
51 |
52 | protected:
53 | // Called by `reallocate_downward` to copy memory from `old_p` of `old_size`
54 | // to `new_p` of `new_size`. Only memory of size `in_use_front` and
55 | // `in_use_back` will be copied from the front and back of the old memory
56 | // allocation.
57 | void memcpy_downward(uint8_t *old_p, size_t old_size, uint8_t *new_p,
58 | size_t new_size, size_t in_use_back,
59 | size_t in_use_front) {
60 | memcpy(new_p + new_size - in_use_back, old_p + old_size - in_use_back,
61 | in_use_back);
62 | memcpy(new_p, old_p, in_use_front);
63 | }
64 | };
65 |
66 | } // namespace flatbuffers
67 |
68 | #endif // FLATBUFFERS_ALLOCATOR_H_
69 |
--------------------------------------------------------------------------------
/Core/third_party/flatbuffers/include/flatbuffers/buffer_ref.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef FLATBUFFERS_BUFFER_REF_H_
18 | #define FLATBUFFERS_BUFFER_REF_H_
19 |
20 | #include "flatbuffers/base.h"
21 | #include "flatbuffers/verifier.h"
22 |
23 | namespace flatbuffers {
24 |
25 | // Convenient way to bundle a buffer and its length, to pass it around
26 | // typed by its root.
27 | // A BufferRef does not own its buffer.
28 | struct BufferRefBase {}; // for std::is_base_of
29 |
30 | template struct BufferRef : BufferRefBase {
31 | BufferRef() : buf(nullptr), len(0), must_free(false) {}
32 | BufferRef(uint8_t *_buf, uoffset_t _len)
33 | : buf(_buf), len(_len), must_free(false) {}
34 |
35 | ~BufferRef() {
36 | if (must_free) free(buf);
37 | }
38 |
39 | const T *GetRoot() const { return flatbuffers::GetRoot(buf); }
40 |
41 | bool Verify() {
42 | Verifier verifier(buf, len);
43 | return verifier.VerifyBuffer(nullptr);
44 | }
45 |
46 | uint8_t *buf;
47 | uoffset_t len;
48 | bool must_free;
49 | };
50 |
51 | } // namespace flatbuffers
52 |
53 | #endif // FLATBUFFERS_BUFFER_REF_H_
54 |
--------------------------------------------------------------------------------
/Core/third_party/flatbuffers/include/flatbuffers/default_allocator.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef FLATBUFFERS_DEFAULT_ALLOCATOR_H_
18 | #define FLATBUFFERS_DEFAULT_ALLOCATOR_H_
19 |
20 | #include "flatbuffers/allocator.h"
21 | #include "flatbuffers/base.h"
22 |
23 | namespace flatbuffers {
24 |
25 | // DefaultAllocator uses new/delete to allocate memory regions
26 | class DefaultAllocator : public Allocator {
27 | public:
28 | uint8_t *allocate(size_t size) FLATBUFFERS_OVERRIDE {
29 | return new uint8_t[size];
30 | }
31 |
32 | void deallocate(uint8_t *p, size_t) FLATBUFFERS_OVERRIDE { delete[] p; }
33 |
34 | static void dealloc(void *p, size_t) { delete[] static_cast(p); }
35 | };
36 |
37 | // These functions allow for a null allocator to mean use the default allocator,
38 | // as used by DetachedBuffer and vector_downward below.
39 | // This is to avoid having a statically or dynamically allocated default
40 | // allocator, or having to move it between the classes that may own it.
41 | inline uint8_t *Allocate(Allocator *allocator, size_t size) {
42 | return allocator ? allocator->allocate(size)
43 | : DefaultAllocator().allocate(size);
44 | }
45 |
46 | inline void Deallocate(Allocator *allocator, uint8_t *p, size_t size) {
47 | if (allocator)
48 | allocator->deallocate(p, size);
49 | else
50 | DefaultAllocator().deallocate(p, size);
51 | }
52 |
53 | inline uint8_t *ReallocateDownward(Allocator *allocator, uint8_t *old_p,
54 | size_t old_size, size_t new_size,
55 | size_t in_use_back, size_t in_use_front) {
56 | return allocator ? allocator->reallocate_downward(old_p, old_size, new_size,
57 | in_use_back, in_use_front)
58 | : DefaultAllocator().reallocate_downward(
59 | old_p, old_size, new_size, in_use_back, in_use_front);
60 | }
61 |
62 | } // namespace flatbuffers
63 |
64 | #endif // FLATBUFFERS_DEFAULT_ALLOCATOR_H_
65 |
--------------------------------------------------------------------------------
/Core/third_party/flatbuffers/include/flatbuffers/file_manager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef FLATBUFFERS_FILE_MANAGER_H_
18 | #define FLATBUFFERS_FILE_MANAGER_H_
19 |
20 | #include
21 | #include
22 |
23 | #include "flatbuffers/util.h"
24 |
25 | namespace flatbuffers {
26 |
27 | // A File interface to write data to file by default or
28 | // save only file names
29 | class FileManager {
30 | public:
31 | FileManager() = default;
32 | virtual ~FileManager() = default;
33 |
34 | virtual bool SaveFile(const std::string &absolute_file_name,
35 | const std::string &content) = 0;
36 |
37 | virtual bool LoadFile(const std::string &absolute_file_name,
38 | std::string *buf) = 0;
39 |
40 | private:
41 | // Copying is not supported.
42 | FileManager(const FileManager &) = delete;
43 | FileManager &operator=(const FileManager &) = delete;
44 | };
45 |
46 | } // namespace flatbuffers
47 |
48 | #endif // FLATBUFFERS_FILE_MANAGER_H_
49 |
--------------------------------------------------------------------------------
/Core/third_party/flatbuffers/include/flatbuffers/flex_flat_util.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef FLATBUFFERS_FLEX_FLAT_UTIL_H_
18 | #define FLATBUFFERS_FLEX_FLAT_UTIL_H_
19 |
20 | #include "flatbuffers/flatbuffers.h"
21 | #include "flatbuffers/flexbuffers.h"
22 |
23 | namespace flexbuffers {
24 |
25 | // Verifies the `nested` flexbuffer within a flatbuffer vector is valid.
26 | inline bool VerifyNestedFlexBuffer(
27 | const flatbuffers::Vector *const nested,
28 | flatbuffers::Verifier &verifier) {
29 | if (!nested) return true;
30 | return verifier.Check(flexbuffers::VerifyBuffer(
31 | nested->data(), nested->size(), verifier.GetFlexReuseTracker()));
32 | }
33 |
34 | } // namespace flexbuffers
35 |
36 | #endif // FLATBUFFERS_FLEX_FLAT_UTIL_H_
37 |
--------------------------------------------------------------------------------
/Core/third_party/flatbuffers/include/flatbuffers/pch/flatc_pch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef FLATBUFFERS_FLATC_PCH_H_
18 | #define FLATBUFFERS_FLATC_PCH_H_
19 |
20 | // stl
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | // flatbuffers
33 | #include "flatbuffers/pch/pch.h"
34 | #include "flatbuffers/code_generators.h"
35 | #include "flatbuffers/flatbuffers.h"
36 | #include "flatbuffers/flexbuffers.h"
37 | #include "flatbuffers/idl.h"
38 |
39 | #endif // FLATBUFFERS_FLATC_PCH_H_
40 |
--------------------------------------------------------------------------------
/Core/third_party/flatbuffers/include/flatbuffers/pch/pch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef FLATBUFFERS_PCH_H_
18 | #define FLATBUFFERS_PCH_H_
19 |
20 | // stl
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include