From 76215b86ff629da58aa94d4cf4093d2e67017412 Mon Sep 17 00:00:00 2001 From: kat Date: Fri, 20 Jun 2025 16:17:01 -0400 Subject: Move workflow_objc to API repo, remove CFString & relptr renderers --- plugins/workflow_objc/GlobalState.h | 79 +++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 plugins/workflow_objc/GlobalState.h (limited to 'plugins/workflow_objc/GlobalState.h') 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 +#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 objcStubsStartEnd; + std::unordered_map> selRefToImp; + std::unordered_map> selToImp; +}; + +typedef std::shared_ptr 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&); +}; -- cgit v1.3.1