summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2023-05-18 12:44:11 -0400
committerkat <kat@vector35.com>2023-05-18 12:44:33 -0400
commit1bd42a73e612f50c68d802acda674c21a30e980c (patch)
treec93704af02ae5c0b005cc9086400834179e21d1b /binaryninjaapi.h
parentac3490ad00ba9d7d4298565168163b9becc66deb (diff)
Add ReadPointer to BinaryReader class
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 21549c92..f4b1d9dc 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -5516,6 +5516,14 @@ namespace BinaryNinja {
*/
uint64_t Read64();
+ /*! Read a pointer (size of BinaryView::GetAddressSize()) from the current cursor position and advance
+ and advance it that many bytes
+
+ \throws ReadException
+ \return The value that was read
+ */
+ uint64_t ReadPointer();
+
/*! Read a uint16_t from the current cursor position, explicitly as a little endian value,
and advance the cursor by 4 bytes
@@ -5540,6 +5548,14 @@ namespace BinaryNinja {
*/
uint64_t ReadLE64();
+ /*! Read a pointer (size of BinaryView::GetAddressSize()) as little-endian from the current cursor
+ position and advance and advance it that many bytes
+
+ \throws ReadException
+ \return The value that was read
+ */
+ uint64_t ReadLEPointer();
+
/*! Read a uint16_t from the current cursor position, explicitly as a big endian value,
and advance the cursor by 4 bytes
@@ -5564,6 +5580,14 @@ namespace BinaryNinja {
*/
uint64_t ReadBE64();
+ /*! Read a pointer (size of BinaryView::GetAddressSize()) as big-endian from the current cursor
+ position and advance and advance it that many bytes
+
+ \throws ReadException
+ \return The value that was read
+ */
+ uint64_t ReadBEPointer();
+
/*! Try reading a value, returning false whenever that read fails
\param dest Address to write the bytes to
@@ -5616,6 +5640,13 @@ namespace BinaryNinja {
*/
bool TryRead64(uint64_t& result);
+ /*! Try reading a pointer (size of BinaryView::GetAddressSize())
+
+ \param result Reference to a uint64_t to write to
+ \return Whether the read succeeded.
+ */
+ bool TryReadPointer(uint64_t& result);
+
/*! Try reading a uint16_t, explicitly as little endian
\param result Reference to a uint16_t to write to
@@ -5637,6 +5668,13 @@ namespace BinaryNinja {
*/
bool TryReadLE64(uint64_t& result);
+ /*! Try reading a pointer (size of BinaryView::GetAddressSize()) as little-endian
+
+ \param result Reference to a uint64_t to write to
+ \return Whether the read succeeded.
+ */
+ bool TryReadLEPointer(uint64_t& result);
+
/*! Try reading a uint16_t, explicitly as big endian
\param result Reference to a uint16_t to write to
@@ -5658,6 +5696,13 @@ namespace BinaryNinja {
*/
bool TryReadBE64(uint64_t& result);
+ /*! Try reading a pointer (size of BinaryView::GetAddressSize()) as big-endian
+
+ \param result Reference to a uint64_t to write to
+ \return Whether the read succeeded.
+ */
+ bool TryReadBEPointer(uint64_t& result);
+
/*! Get the current cursor position
\return The current cursor position