Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bin iditor

Version 0.1Developer: ExEintel

bin iditor is a Windows desktop application that combines a classic hex editor with a binary editor. Any loaded file can be viewed and edited either as hexadecimal bytes or as raw binary 0/1 bits, with instant conversion between the two representations.

Written entirely in C using the Win32 API and compiled with MinGW-w64 GCC.

Logo


Table of Contents

  1. Overview
  2. Features
  3. Project Structure
  4. Requirements
  5. Building
  6. Usage
  7. The Table View
  8. Editing
  9. Keyboard Shortcuts
  10. Libraries
  11. Technical Notes
  12. Version History

Overview

bin iditor loads a file into memory (up to 2 MB) and presents it as a scrollable table:

00001 : 01001010 11001010 00101111 00001110 11100000 01010101 11110000 00110011
00002 : 01101000 01100101 01101100 01101100 01101111 00100000 01110111 01101111

The Binary View shows each byte as 8 bits; the Hex View shows the same bytes as two-digit hexadecimal values. The two views are live views of the same buffer — edit in either one and the other updates immediately.

The application uses a panel interface consisting of a menu bar, a toolbar, tab control, the main table window, and a status bar.


Features

  • Dual table views — Hex (00001 : 4A CA 2F 0E ...) and Binary (00001 : 01001010 11001010 ...).
  • Direct editing in both views:
    • Binary: type 0 / 1 at the bit cursor.
    • Hex: type two hex digits to replace a byte.
    • Delete / Backspace zero out the selected byte.
  • Value selection — select a range of values with the mouse (drag or Shift+click) or with Shift+arrows. Ctrl+C copies the selected values as text in the current view format, and the raw bytes are also placed on the clipboard.
  • Select AllCtrl+A selects the whole file.
  • Panel interface: menu bar (File, Edit, View, Help), toolbar buttons (Open, Save, Refresh, Copy, About), and two tabs (Binary View / Hex View).
  • Status bar with current mode, file size, selected offset, selection range, and byte value.
  • Open / Save / Save As with standard Windows file dialogs.
  • Refresh re-reads the file from disk (F5).
  • Command-line support — pass a file path to open it at startup.
  • 2 MB file size limit enforced by the library.
  • Unsaved-changes protection on Open / Exit / Refresh.

Project Structure

bin iditor\
├── bin-iditor.exe          Application executable
├── hex32.dll               Hex editor core library
├── convert.dll             Conversion library (hex <-> binary)
├── Readme.md               This technical documentation
├── logo.ico                Program icon (converted from logo.png)
├── logo.png                Source logo image
└── source\                 Source code directory
    ├── hex32.h             hex32.dll public interface
    ├── hex32.c             hex32.dll implementation
    ├── convert.h           convert.dll public interface
    ├── convert.c           convert.dll implementation
    ├── app_shared.h        Shared state between translation units
    ├── view.c              Editor table view window
    ├── bin-iditor.c        Main window, menu, tabs, file operations
    ├── resource.rc         Icon, About dialog, version resources
    ├── build.bat           Build script
    └── *.o / *.a           Build artifacts (object files, import libs)

Requirements

  • Windows 7 or later.
  • MinGW-w64 GCC (i686 or x86_64) with the C compiler and windres (resource compiler).
  • ffmpeg — only needed to regenerate logo.ico from logo.png:
    ffmpeg -i logo.png -vf scale=256:256 -f ico logo.ico
    
  • UCRT runtime (standard on modern Windows; included with MinGW-w64 ucrt builds).

Building

From the source\ directory run:

build.bat

The script performs four steps:

  1. Build hex32.dll from hex32.c
    gcc -O2 -Wall -Wextra -shared -o ..\hex32.dll hex32.c -DHEX32_EXPORTS -Wl,--out-implib,libhex32.a -static-libgcc
    
  2. Build convert.dll from convert.c
    gcc -O2 -Wall -Wextra -shared -o ..\convert.dll convert.c -DCONVERT_EXPORTS -Wl,--out-implib,libconvert.a -static-libgcc
    
  3. Compile resources (windres resource.rc -O coff -o resource.o).
  4. Compile and link the application
    gcc -O2 -Wall -Wextra -c view.c -o view.o
    gcc -O2 -Wall -Wextra -c bin-iditor.c -o bin-iditor.o
    gcc -o ..\bin-iditor.exe view.o bin-iditor.o resource.o -L. -lhex32 -lconvert -mwindows -static-libgcc -lcomctl32 -lcomdlg32 -lgdi32 -luser32 -lkernel32
    

The resulting bin-iditor.exe, hex32.dll, and convert.dll are written to the project root.

Note: The application imports the DLLs at startup, so hex32.dll and convert.dll must sit next to bin-iditor.exe (they do, by default).


Usage

  1. Start bin-iditor.exe (optionally with a file argument: bin-iditor.exe file.bin).
  2. Use File > Open (Ctrl+O) to load a file (up to 2 MB).
  3. Switch between Binary View and Hex View using the tabs, the View menu, or Ctrl+1 / Ctrl+2.
  4. Click a byte (or a bit in binary view) to select it, then edit (see Editing).
  5. To select a range of values, drag the mouse, use Shift+click, or hold Shift while navigating with the arrow keys. Copy with Edit > Copy or Ctrl+C.
  6. Use File > Save (Ctrl+S) or File > Save As to write changes back.
  7. Use Refresh (F5) or File > Refresh to re-read the file from disk.

The Table View

Each row of the table represents 8 bytes:

offset : byte0  byte1  byte2  ...   byte7
  • Binary View: each byte is shown as 8 bits, most-significant first.
  • Hex View: each byte is shown as two uppercase hexadecimal digits.

Offsets are zero-padded, one-based decimal numbers (00001, 00002, ...) matching the 00001 : ... table style.

Navigation and selection work with the mouse (click any byte/bit) and the keyboard (see shortcuts below). The selected byte is highlighted in blue; in binary view a caret underlines the current bit position.

Selection

  • Single value: click a byte (or a bit) — it is highlighted in dark blue.
  • Range: drag the mouse, Shift+click, or hold Shift while moving with the arrow keys. The range is highlighted in light blue and its extent is shown in the status bar as Sel: lo-hi (N bytes).
  • Select all: Ctrl+A selects the entire file.
  • Copy: Ctrl+C (or Edit > Copy, or the Copy toolbar button) copies the selected values to the clipboard in two forms:
    • Text — the visible values in the current view format, space separated (e.g. 4A CA 2F in hex view, 01001010 11001010 in binary view), available to any text editor.
    • Raw bytes — the actual file bytes, placed under the custom clipboard format bin iditor binary data for use by other binary-aware tools.

Editing always collapses the selection back to the caret position.


Editing

Action How it works
Edit a bit (Binary View) Position the bit caret and type 0 or 1. The caret advances automatically.
Edit a byte (Hex View) Type two hex digits (0-9 A-F). The byte is replaced and selection advances.
Zero a byte Delete sets the selected byte to 0x00.
Zero previous byte and move back Backspace sets the previous byte to 0x00 and moves the selection back.

Every edit marks the buffer as MODIFIED (shown in the title bar and status bar) until the file is saved.


Keyboard Shortcuts

Key Action
Move selection (per bit in Binary View)
Move selection up/down by one row
Shift+arrows Extend the selection range
Home / End Start / end of the current row
Ctrl+Home Start of file
Ctrl+End End of file
PgUp / PgDn Move up / down several rows
0 / 1 Set the current bit (Binary View only)
0-9 A-F Enter hex digits (Hex View only)
Del Set the selected byte to 0x00
Backspace Zero the previous byte and step back
Ctrl+A Select all values
Ctrl+C Copy selected values (text + raw bytes)
Ctrl+O Open file
Ctrl+S Save file
Ctrl+1 Binary View
Ctrl+2 Hex View
F5 Refresh (reload from disk)

Libraries

The application is split into a thin GUI shell and two reusable libraries.

hex32.dll — Hex editor core

Provides in-memory buffer management and file I/O.

Function Description
int hexbuf_init(HEXBUF *buf, size_t capacity) Allocate buffer with initial capacity.
void hexbuf_free(HEXBUF *buf) Release all resources.
int hexbuf_load(HEXBUF *buf, const char *path, size_t max_size) Load file; returns HEXBUF_OK (0), HEXBUF_ERR (-1), or HEXBUF_ERR_TOO_BIG (-2).
int hexbuf_save(const HEXBUF *buf, const char *path) Write buffer to file.
unsigned char hexbuf_get(HEXBUF *buf, size_t offset) Read byte at offset.
int hexbuf_set(HEXBUF *buf, size_t offset, unsigned char value) Write byte at offset.
size_t hexbuf_size(const HEXBUF *buf) Current buffer size.
const char *hexbuf_filename(const HEXBUF *buf) Loaded file path or NULL.

The buffer is a simple structure:

typedef struct {
    unsigned char *data;   /* raw byte array            */
    size_t size;           /* number of valid bytes     */
    size_t capacity;       /* allocated capacity        */
    char   *filename;      /* source file path (owned)  */
} HEXBUF;

convert.dll — Conversion library

Performs hexadecimal ↔ binary conversions.

Function Description
void convert_byte_to_bin(unsigned char byte, char out[9]) Byte → 8-character binary string.
int convert_bin_to_byte(const char *bin, unsigned char *out) 8-character binary string → byte.
void convert_offset_str(size_t offset, int one_based, char *out, size_t out_sz) Format a file offset as a zero-padded 5-digit string.
void convert_hex_to_bin(const char *hex, size_t len, char *out) Hex string → binary string (4 bits per digit).

Technical Notes

  • File size limit: HEX32_MAX_FILE_SIZE is defined as 2 * 1024 * 1024 bytes (2 MB) in hex32.h. Files exceeding the limit are rejected with HEXBUF_ERR_TOO_BIG and a warning message.
  • Language / encoding: The program uses the ANSI (narrow-character) Win32 APIs throughout and English user interface text.
  • Rendering: The table view is drawn directly with GDI (TextOut, double-buffered WM_PAINT), using a fixed-width font (Consolas, falling back to Courier New). This keeps the bit/byte columns perfectly aligned.
  • Threading: Single-threaded, message-pump based. The buffer is only mutated from the UI thread.
  • Static CRT: Both DLLs and the executable are built with -static-libgcc; the standard UCRT (part of Windows) is used.

Version History

0.1 (current)

  • Initial release.
  • Hex and binary table views with editing.
  • Value selection: mouse drag, Shift+click, Shift+arrows, Select All (Ctrl+A).
  • Copy selected values as text and raw bytes (Ctrl+C).
  • Menu bar, toolbar, tabs, status bar.
  • File open/save/save-as with 2 MB limit.
  • Refresh from disk, command-line file argument.
  • hex32.dll and convert.dll libraries.

Credits

Developer: ExEintel License: Proprietary / all rights reserved.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages