• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Staff applications for our PokéCommunity Daily and Social Media team are now open! Interested in joining staff? Then click here for more info!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Creating Your Own Hex Editor (VB.NET)

Akiba

[img]http://i.imgur.com/o3RYT4v.png[/img]
  • 4,262
    Posts
    13
    Years
    Introduction

    Hello all. Darthatron made a tutorial several years back on creating a Hex Editor and related hacking tools in VB6. The thread can be found here. As you all know, VB6 is run in Win16, which means that it can only be run on Win16 or Win32 machines. A very small amount of people use Win16 machines anymore, and this leaves Win64 developers at a loss. So my purpose is to create a tutorial using the new VB.NET, which is standardized and maintains support from Microsoft. The source code can be found at the bottom of the page.

    Resources

    All you need is an IDE (Integrated Development Environment) that can work with VB.NET.

    If you already have Microsoft Visual Studio, that's wonderful.

    Otherwise, for a much more lightweight yet almost equally effective IDE, you can get Sharpdevelop, which has a virtually identical layout. It can be found in my signature, or here.

    I will be demonstrating in Microsoft Visual Studio.

    Step 1: Create and Prepare Your Project.

    In your IDE, go to File->New->Project in MSVS or File->New->Solution in #Dev.

    Select the settings in the following pictures.

    Spoiler:


    Spoiler:


    Rename your form and application text to Main.vb and Main, respectively. I do this just because using Form1 is a bad programming habit. Naming in the project will be optional.

    Create a Button, name it 'open_button', change the text property to 'Open File...', and create a Rich Text Box, and name it 'hex_richtextbox'.

    Spoiler:


    Double-click on 'open_button' in the designer to create an event. We will use this in the next step.

    Create an Open File Dialog, and name it 'open_openfiledialog'. This is the dialog that we will use to browse for a file.

    Spoiler:


    Go into Main.vb where your event was created.

    At the very top, type 'Imports System.IO'. This will make our code easier to understand by reducing text needed to type.

    Under Public Class Main, type 'Dim hexString as String'. This will declare the string that we are going to use to display our hex values.

    Now your preparations are ready.

    Step 2: Programming the Application

    Your Main.vb should now look like this.

    Spoiler:


    Under the Click Event, type this.

    Spoiler:


    Explanation:

    Spoiler:


    This code reads the Hex from the selected file, and displays it in the textbox.

    Your code should now look like this.

    Spoiler:


    Now, your program can read the hex from a file!

    Click on the green arrow to compile your program.

    Spoiler:


    Part 3: Allowing only Hex Values to be Entered

    This step is short and sweet.

    Go to the designer, and click on the Rich Text Box once.
    Click on the Lightning button; this is where all possible events for that control are found.

    Double-click on the KeyPress event.

    Spoiler:


    Under the event sub, type this.

    Spoiler:


    Explanation:

    Spoiler:


    Your code should look like this.

    Spoiler:


    Now your textbox only accepts Hex characters.

    Part 4: Saving your File

    Now increase the size of your form to accommodate a Save button.

    Create a Button called 'save_button' and change the text property to 'Save File...'.

    Create a Save File Dialog and name it 'save_savefiledialog'.

    Spoiler:


    Create an event for 'save_button' the same way you did for 'open_button'.

    Under the Save event, type this.

    Spoiler:


    Explanation:

    Spoiler:


    This will save the file, and do nothing if it fails.

    Your code should look like this.

    Spoiler:


    Go back up to your open_button event, and wrap it in a [Try, Catch, End Try], so that the program doesn't crash if another program is using it.

    Your program is now done.

    Hope this helps to start the foundation for one of the next revolutionary hacking tools.

    If you could not follow the tutorial, the source code can be found in the attachments.

    Regards,
    ~Tosaka
     
    Last edited:
    Never mind I figured It out... You should really keep doing tutorials on VB.Net as I would love to learn how to make tools.
     
    Last edited:
    Never mind I figured It out... You should really keep doing tutorials on VB.Net as I would love to learn how to make tools.

    You're very welcome. I'll be sure to make more programming tutorials. Source code will be included each time. :)
     
    One thing I'd recommend you do is put additional spoilers to explain what each chunk of code does. I know a bit of VB.NET (I know more C# though...) but I didn't quite get all of it.

    Also, I was thinking on making a tutorial for people to make C#-oriented programs, if I can get off my lazy butt and do it. Would you be fine with it, seeing as you're covering one of the other Microsoft-oriented languages?

    I know C# and VB.NET exactly the same -- after all, they are exactly the same in structure, libraries, and effect. However, VB.NET is easier to deal with in that brackets are intimidating to some people.
    This website is a great VB.NET to C# and vice-verso converter tool. #Dev also has a feature in which it can convert an entire project to and fro VB.NET and C#.

    I'll add some more spoilers, sure.
     
    You're very welcome. I'll be sure to make more programming tutorials. Source code will be included each time. :)

    ^_^ Now a great tutorial (if not to complicated) would be some kind of simple inserting of an asm code into a fire red rom. Like a small tool that adds jpans saveblock patch and give one the option to add the flag extension and the var extension hack. I am new to programming so I do like the idea of additional spoilers to explain what each chunk of code does. And any good video tutorials or pdf tutorials you may know about to teach me the ins and outs of programming. VB.net seems to be very beginner friendly, I tried learning RGSS-Ruby Game Scripting System so I could make a ABS-Action Battle System for Pokémon Essentials but no one was willing to help, and I had no clue where to start as most of the rmxp scripts don't work with Pokémon Essentials. Any way I will learn how (Eventually) to program so all my ideas can be brought to life.

    P.S
    Thank you for taking your time to Educate us who have trouble with the learning curve of programming. I do have to say if there is any way possible to go over the little details that most don't pay any mind to.. I only say this because I just learned how to use setvar and compare commands in xse and that is only because no one ever really went into detail about these commands ( not to say A lot of others ).
     
    ^_^ Now a great tutorial (if not to complicated) would be some kind of simple inserting of an asm code into a fire red rom. Like a small tool that adds jpans saveblock patch and give one the option to add the flag extension and the var extension hack. I am new to programming so I do like the idea of additional spoilers to explain what each chunk of code does. And any good video tutorials or pdf tutorials you may know about to teach me the ins and outs of programming. VB.net seems to be very beginner friendly, I tried learning RGSS-Ruby Game Scripting System so I could make a ABS-Action Battle System for Pokémon Essentials but no one was willing to help, and I had no clue where to start as most of the rmxp scripts don't work with Pokémon Essentials. Any way I will learn how (Eventually) to program so all my ideas can be brought to life.

    P.S
    Thank you for taking your time to Educate us who have trouble with the learning curve of programming. I do have to say if there is any way possible to go over the little details that most don't pay any mind to.. I only say this because I just learned how to use setvar and compare commands in xse and that is only because no one ever really went into detail about these commands ( not to say A lot of others ).

    Ideas? Make sure you don't lose them. Meanwhile, I'd be happy to program some of them myself.
     
    ^_^ I shall never lose my ideas.. I am learning VB.net 2010 as we speak. I've decided to make a windows application that finds the sum of the first and last digit of a number. This great tutorial made me finally decide on what language to learn (VB.net) and I see that C#,Python and Ruby all seem to be very compatible with one another.

    PS. if you can give me some advice on making a Action battle system- for my pokemon abs game it would be much appreciated. I would like to learn how to code it in VB then I can translate it in to Ruby later on when I need it.
     
    I'm a bit confused, as I have never use VB before... VB .NET is different from the IDE right? So I go and download both of them?
     
    Thanks for making this! I've been considering making a poke-specific hex editor that lets you follow pointers, and lets you see when a section of code is being pointed to. This is great for getting started!
     
    The file is being saved totally corrupted :(

    Please, help-me, contact-me in the skype: ConradoP.S.A
    I'm brazilian, sorry the inglish. :P
     
    lmao I was such a noob when I was 13.

    VB.NET shouldn't be used at all, I'm going to write a tutorial series on modern hacking tools real soon.
     
    13 years? You can be anything, but not noob. Excellent tool even if not 100%, congratulations!! ^-^
     
    I'm flying back from Japan in a few hours.

    I'll probably write a bunch of tutorials and deprecate all these old ones lol
     
    I'm flying back from Japan in a few hours.

    I'll probably write a bunch of tutorials and deprecate all these old ones lol
    I'd really appreciate it if, at some point when it's possible, you wrote a tutorial demonstrating effective use of standard PokéScript, using Lapis as an assembler. And of course one for Sapphire for the folks who use in-built editors! :P
     
    I took a look at Lapis a while ago, it's pretty cool.

    My new ecosystem is essentially a collection of orthogonal npm packages that operate on ROMs with buffers and streams. I'd be interested in porting it to JS.

    Joexv just sent me the source for his Hex Helper, I'm reimplementing it in a Unixy way.
     
    I took a look at Lapis a while ago, it's pretty cool.

    My new ecosystem is essentially a collection of orthogonal npm packages that operate on ROMs with buffers and streams. I'd be interested in porting it to JS.
    [PokeCommunity.com] Creating Your Own Hex Editor (VB.NET)


    You make good tutorials. I'd like to see one of the first how-tos for this program and its standard to be done properly. :p
     
    Back
    Top