question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to update the binary handler content?

See original GitHub issue

Hi,

I’m creating a simple emulator for LowUIR and during my test I need to modify the content of the Binary Handler (as in a self modifying program).

As far as I understood the only way in doing this is by using the BinHandler.UpdateCode function, that return a new handler. The function accepts an array of bytes that represent the full content of the new handler. This is a bit annoying if I have to modify just a couple of bytes (but I understand that you want to maintain BinHandler immutable).

My current strategy is:

  • Convert the VA with a raw offset inside the buffer
  • Read the handler buffer and modify the given bytes at the calculated offset
  • create an handler with the update buffer

Is there any other easier way of doing this or what I described is the proper way?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sangkilccommented, Apr 22, 2019

Please checkout: 40e7be659ede4305cc36630e38fbc462525f2943

You should now be able to modify the buffer by:

// hdl = BinHandler
hdl.FileInfo.BinReader.Bytes.[idx] <- byteValue

Or even by:

hdl.FileInfo.BinReader.Bytes <- newArray
1reaction
sangkilccommented, Apr 18, 2019

I am reopening the issue so that we don’t forget.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to update a record in a Binary File? | CBSE Class XII
CBSE Class 12 Computer Science In this video, you will learn how to update a record in a binary file. ... File Handling...
Read more >
Python program to modify the content of a Binary File
Step 5: Write the new object at the position “pos” and hence the record is updated and print “record successfully updated”. Step 6:...
Read more >
Updating and Deleting Existing Binary Data (C#)
Updating and Deleting Existing Binary Data (C#) · Step 1: Updating the Data Access Layer · Step 2: Adding the Business Logic Layer...
Read more >
Updating Record in Binary File in Python Programming
Updating records in Binary File: There is no any pre defined function available in python to update records in binary file in python....
Read more >
How to update a binary file
I'm creating a GUI, and I use a method "getStudentInfo()" of the Student object return data type to retrieve information from the JTextFields ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found