Sometimes it’s all about having the right tool for editing. I’ve built a hex editor which can come in handy for many of those users who want to edit files (especially the binary ones). It can also be used in your program because I added the argument option.
It’s written in C# with .NET 2.0
Features:
- View file in hex
- Edit at provided offset (hex or int) – to provide a hex number please insert H in the front of the number, for example: 2D will be H2D
- Find specified string (use 0 to specify a null character)
- Edit from command line : hexeditor.exe path offset value , for example: hexeditor.exe “c:test.exe” H23 test
Download:
Source code: http://rapidshare.com/files/95709335/HexEditor.rar.html
Binary file: http://rapidshare.com/files/95709694/HexEditor.exe.html
.NET Framework: http://www.microsoft.com/downloads/…displaylang=en
November 27, 2008 at 12:59 am
To prevent a nasty crash, you might want to add this …
private void OpenFile_Click(object sender, EventArgs e)
{
path = txtFileName.Text;
if (path.Length == 0)
{
MessageBox.Show(“Please enter a file name!”);
return;
}
if ( !File.Exists(path) )
{
MessageBox.Show(“No such file!”);
return;
}
November 27, 2008 at 1:01 am
I failed to mention that the fix above is for the case when you select the open button with an invalid (or no) file entry.
December 2, 2008 at 12:51 pm
Mario, thanks for the feedback.
I knew I didn’t deal with that problem the minute I published the it on this blog. The fact is that I wanted to stick to the idea and not very much on the actual code. Anyway it’s not a very big problem/bug!
December 29, 2008 at 10:34 pm
muie
January 22, 2009 at 4:40 pm
Hi there,
Thanks for sharing this master piece with us all:
Good Luck
Nadine
March 24, 2009 at 12:51 pm
A very cool sample.
Keep it up.