diff options
| author | kat <kat@vector35.com> | 2025-06-20 16:17:01 -0400 |
|---|---|---|
| committer | kat <kat@vector35.com> | 2025-06-23 10:40:55 -0400 |
| commit | 76215b86ff629da58aa94d4cf4093d2e67017412 (patch) | |
| tree | 06af88506096351e99053ab5ed9901ff892801f3 /plugins/workflow_objc/GlobalState.h | |
| parent | 17b2cb59846073fdbc08235555fd68cdb6852c42 (diff) | |
Move workflow_objc to API repo, remove CFString & relptr renderers
Diffstat (limited to 'plugins/workflow_objc/GlobalState.h')
| -rw-r--r-- | plugins/workflow_objc/GlobalState.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/plugins/workflow_objc/GlobalState.h b/plugins/workflow_objc/GlobalState.h new file mode 100644 index 00000000..38aeb384 --- /dev/null +++ b/plugins/workflow_objc/GlobalState.h @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2022-2023 Jon Palmisciano. All rights reserved. + * + * Use of this source code is governed by the BSD 3-Clause license; the full + * terms of the license can be found in the LICENSE.txt file. + */ + +#pragma once + +#include <condition_variable> +#include "BinaryNinja.h" + +#include "MessageHandler.h" + +/** + * Namespace to hold metadata flag key constants. + */ +namespace Flag { + +constexpr auto DidRunWorkflow = "objectiveNinja.didRunWorkflow"; +constexpr auto DidRunStructureAnalysis = "objectiveNinja.didRunStructureAnalysis"; + +} + +struct AnalysisInfo { + std::uint64_t imageBase; + bool hasObjcStubs = false; + std::pair<uint64_t, uint64_t> objcStubsStartEnd; + std::unordered_map<uint64_t, std::vector<uint64_t>> selRefToImp; + std::unordered_map<uint64_t, std::vector<uint64_t>> selToImp; +}; + +typedef std::shared_ptr<AnalysisInfo> SharedAnalysisInfo; + +/** + * Global state/storage interface. + */ +class GlobalState { + /** + * Get the ID for a view. + */ + static BinaryViewID id(BinaryViewRef); + +public: + /** + * Get the analysis info for a view. + */ + static SharedAnalysisInfo analysisInfo(BinaryViewRef); + + /** + * Get ObjC Message Handler for a view + */ + static MessageHandler* messageHandler(BinaryViewRef); + + /** + * Check if analysis info exists for a view. + */ + static bool hasAnalysisInfo(BinaryViewRef); + + /** + * Add a view to the list of ignored views. + */ + static void addIgnoredView(BinaryViewRef); + + /** + * Check if a view is ignored. + */ + static bool viewIsIgnored(BinaryViewRef); + + /** + * Check if the a metadata flag is present for a view. + */ + static bool hasFlag(BinaryViewRef, const std::string&); + + /** + * Set a metadata flag for a view. + */ + static void setFlag(BinaryViewRef, const std::string&); +}; |
