Skip to content

t0mmysenf/hutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hutil

A lightweight Windows C library for external process memory manipulation. hutil provides a simple, session-based API to read and write memory of other processes, resolve dynamic memory addresses (DMA) through pointer chains, and find process/module information.

Features

  • Session-based API: Easily manage process handles and module base addresses.
  • Memory Operations: Read and write various data types (uint8_t, int32_t, int64_t, float, double) and arbitrary buffers.
  • Pointer Chain Resolution: Resolve dynamic addresses by following a base offset and a list of multi-level offsets.
  • Automatic Process Discovery: Find process IDs and module base addresses by name.
  • Clean Interface: Error handling through descriptive result codes.

Installation

Simply include hutil.h and hutil.c in your project, or add it as a library in your CMake configuration.

CMake

add_library(hutils STATIC hutil.c hutil.h)
target_link_libraries(your_project hutils)

Usage Example

Basic Initialization and Memory Reading

#include "hutil.h"
#include <stdio.h>

int main() {
    hutil_Session* session = NULL;
    
    // Initialize session for "target_game.exe" and its module "GameAssembly.dll"
    HUTIL_RESULT result = hutil_Init("target_game.exe", "GameAssembly.dll", &session);
    
    if (result != HUTIL_SUCCESS) {
        printf("Failed to initialize hutil session: %d\n", result);
        return 1;
    }

    uintptr_t targetAddress = 0x03A055D0;
    int32_t value = 0;

    if (hutil_ReadInt32(session, targetAddress, &value) == HUTIL_SUCCESS) {
        printf("Read value: %d\n", value);
        
        // Write a new value
        hutil_WriteInt32(session, targetAddress, 999);
    }

    hutil_Close(session);
    return 0;
}

Resolving Pointer Chains (DMA)

uintptr_t baseOffset = 0x001A2B3C;
uintptr_t offsets[] = { 0x10, 0x20, 0x30 };
uintptr_t resolvedAddress = 0;

HUTIL_RESULT res = hutil_FindDMAAddy(session, baseOffset, offsets, 3, &resolvedAddress);

if (res == HUTIL_SUCCESS) {
    float health = 0.0f;
    hutil_ReadFloat(session, resolvedAddress, &health);
    printf("Health: %.2f\n", health);
}

API Overview

Session Management

  • hutil_Init: Search for process/module and open a session.
  • hutil_Close: Close process handles and free session memory.

Address Resolution

  • hutil_FindDMAAddy: Navigate pointer chains to find dynamic addresses.

Reading Memory

  • hutil_ReadByte, hutil_ReadInt32, hutil_ReadInt64, hutil_ReadFloat, hutil_ReadDouble
  • hutil_ReadBuffer: Read arbitrary blocks of memory.

Writing Memory

  • hutil_WriteByte, hutil_WriteInt32, hutil_WriteInt64, hutil_WriteFloat, hutil_WriteDouble
  • hutil_WriteBuffer: Write arbitrary blocks of memory.

Requirements

  • Operating System: Windows
  • Compiler: Any C compiler with Windows API support (MinGW, MSVC, etc.)
  • Permissions: May require Administrator privileges depending on the target process.

About

A lightweight C library for Windows process memory manipulation and pointer chain resolution. Simple, session-based, and dependency-free.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors