summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2022-12-20 17:15:03 +0800
committerXusheng <xusheng@vector35.com>2022-12-21 11:42:54 +0800
commit0e5e2fad380cdda9e53294d90f7e0fd90c959280 (patch)
tree54e7d187d8409d8f4fccf9a3e8a0e5e90e962fad /binaryninjaapi.h
parent74dfc90a4291ff12228288e45bdbfe714869bac3 (diff)
Add support for adding magic values into expression parser
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 70f7b97e..f3009fd5 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -4909,6 +4909,61 @@ namespace BinaryNinja {
\return The created Logger
*/
Ref<Logger> CreateLogger(const std::string& name);
+
+ /*! Add a magic value to the expression parser
+
+ If the magic value already exists, its value gets updated.
+ The magic value can be used in the expression by a `$` followed by its name, e.g., `$foobar`.
+ It is optionally to include the `$` when calling this function, i.e., calling with `foobar` and `$foobar`
+ has the same effect.
+
+ \param name Name for the magic value to add or update
+ \param value Value for the magic value
+ */
+ void AddExpressionParserMagicValue(const std::string& name, uint64_t value);
+
+ /*! Remove a magic value from the expression parser
+
+ If the magic value gets referenced after removal, an error will occur during the parsing.
+
+ \param name Name for the magic value to remove
+ \param value Value for the magic value
+ */
+ void RemoveExpressionParserMagicValue(const std::string& name);
+
+ /*! Add a list of magic value to the expression parser
+
+ The vector `names` and `values` must have the same size. The ith name in the `names` will correspond to
+ the ith value in the `values`.
+
+ If a magic value already exists, its value gets updated.
+ The magic value can be used in the expression by a `$` followed by its name, e.g., `$foobar`.
+ It is optionally to include the `$` when calling this function, i.e., calling with `foobar` and `$foobar`
+ has the same effect.
+
+ \param name Name for the magic values to add or update
+ \param value Values for the magic value
+ */
+ void AddExpressionParserMagicValues(const std::vector<std::string>& names, const std::vector<uint64_t>& values);
+
+ /*! Remove a list of magic value from the expression parser
+
+ If any of the magic values gets referenced after removal, an error will occur during the parsing.
+
+ \param name Names for the magic value to remove
+ */
+ void RemoveExpressionParserMagicValues(const std::vector<std::string>& names);
+
+ /*! Get the value of an expression parser magic value
+
+ If the quried magic value exists, the function returns true and the magic value is returned in `value`.
+ If the quried magic value does not exist, the function returns false.
+
+ \param[in] name Name for the magic value to query
+ \param[out] value Value for the magic value
+ \return Whether the magic value exists
+ */
+ bool GetExpressionParserMagicValue(const std::string& name, uint64_t* value);
};