Hexadecimal...

tetrahydrex

In Runtime
Messages
239
Salutations,

could someone please show me how to make a hex editor in either Visual Basic..or Delphi, or C++?

but with code that isn't over complexified, i might not be able to understand it :(

or direct me to a tutorial?

I am writing a program with an engine that requires hex editing capabilities.

Thank You. :)
 
Well, that isn't too difficult. I've included below the psuedocode procedure to follow.

Code:
get file specification
open file for read/write
read values into memory
display buffer portion to screen
edit buffer
refresh display
write buffer to file
close file

While this is a very simple program, it does use memory to keep from thrashing the hard drive as much and so that edits can be committed AFTER verification rather than by default. You will need to simply use an integer or real variable to store the values and display them in hex. You will need to take a character value as an array to store input for translation to the numeric value. This is needed since you have to input letters and numbers for true hex entry. Remember to dynamically size and resize the buffer used as you edit. I hope this will help you out.
 
Thank You :)

But what I meant was I need to learn how to write the algorithm that willl convert the binary to hex and then process it.
 
No you actually don't if you are using C or C++ to write it. Both have facilities to display integers as binary, decimal and/or hexadecimal built in. Check out the docs online for the printf function in C or the "extraction operator" in C++. Both have format specifiers to do it for you, and since it is only a matter of displaying it in a mode for a human to mesh with, then you don't have to worry about it as much. Input can be done more easily in C than in C++ (since I don't recall a format specifier for the "insertion operator"), simply use scanf (Carefully or it will eat your program!) and the correct specifier to accept the input as a hexidecimal value. Always remember, computers only know about binary and what to do with the values to convert them for display, they don't "see" any difference between decimal and hexadecimal and octal and binary at all in reality. I hope this will help you get started. Write some code and then repost it if you get stuck, I'll be glad to help if I can.
 
How about this, (i've not tested it), but print a var able as a long hex number, (%lx), and then print the same as a char (%c).

unsigned char var;
scanf ("%c", &var);
printf ("Hex %lx, char %c", var, var);

using scanf is great, but it's also a great way to introduce bugs, but since i imagine that you're writting this program for yourself, then that's not going to matter so much.
 
Thank You :)

But i kind of stopped C++ because it got hard and the tutorials weren't helping :(

so i'm in Delphi now.

i'm very sorry for wasting your time :(
 
It's not a waste of time. And I'm sorry, but you said C++ in your post. I can't specifically help you out in Delphi, but the same things hold true for the algorithm of the thing. 16 decimal is 16, whether I write it as 10000 binary or 10 hexadecimal. And the machine and most languages have a facility to accept diferent input notations and display results as different notation formats. Perhaps I've misunderstood what it is that you are wanting to do. Have patients with me please and don't give up, it has been a LONG, *LOONG* time since I studied Pascal or used Delphi. Post details specifically of what it needs to do and I'll try again. Walking away from a problem with programming just leaves one result, a problem.
 
oh, thanks :)

The program is to edit system files and change other settings as well, for example: tcpip.sys, and change the 10 concurrent connection limitation in Windows XP.

I also want to change the XP bootscreen, but that requires Hex also, and some other things as well.

Which is why I need for the program to be able to modify the hex codes in these files.

When released, the program will be available at: http://hex.hackershome.net
It is Tecravox.

The next program is an IM client also being written in Delphi, but i'll have to edit, accept and interpret hex codes, it will connect to AIM, MSN, ICQ, Yahoo!, Jabber.

The program (Tecravox) is a System Manipulator that enables the user to change various system settings safely and in a user-friendly fashion, it will also explain how these things work and attempt to guide the users on a path to better understand their computer and operating system environment.
 
tcpip.sys is 1029 lines of compiled code... to change that 10 connection limit you're going to need a little more than a hex editor.
 
Back
Top Bottom