Rosalink Code Showcase


Rosalink is a hooking api made for modding video games and programs without having to mess with the executible.

Ready to use straight out of the box

Rosalink requires no additional setup

Simply include the header and source file and you're ready to go

View

Compile both for windows and linux

Create mods and hacks for both windows linux builds of a program with the same code.

View

Try it yourself

Try injecting this test program to see how easy it is to work with rosalink.

View

Rosalink usage

Simple template you can use to get started with rosalink

View

Watch rosalink in action.

Short video showing the test hook in action.

View

View code and documentation

Find out the full potential of rosalink by reading through the documentation or diving into the source code

View

Simple hooking straight out of the box.


Everything required to hook a funcion with rosalink is the target functions address and calling convention.

Simply import the Rosalink source and header file and you're ready to go implementing your own even parser or simply replacing already existing functions LinkHook .

#include "rosalink.h"

void HookFunction() {
  printf("Hello world.\n");
}

void main() {
  LinkHook hook((void*)(0xDEADBEEF), (void*)HookFunction);
}

Easy setup for cross compiling


Rosalink makes it easy to hook both windows and linux builds of programs with little to no extra setup

Simply define the cross compile const and pass both addresses to the hook constructor and rosalink figures out which address to use

#include "rosalink.h"

#define ROSALINK_CROSSCOMPILE 1

void HookFunction() {
  printf("Hello world.\n");
}

void main() {
  void* windowsAddress = 0xDEADBEEF;
  void* linuxAddress = 0xDEADC0DE;
  LinkHook hook(windowsAddress, linuxAddress, (void*)HookFunction);
}

Test Program To Inject.


Here we have a simple program we can try hooking.
It just calls the test function once every second printing the message "Hello from the test function".

Feel free to try hooking this simple program yourself simply compile the test program and open it up with a debugger or reverse engineering tool to find the test functions address and then following the code in the next example.

#include <stdio.h>
#include <unistd.h>

void TestFunction() {
  printf("Hello from the test function\n");
}

int main() {
  printf("Test running\n");

  while (1) {
    TestFunction();
    sleep(1);
  }
}

Rosalink usage


Here's a c++ file that you can compile as a shared object and inject into the test program to force it to execute the HookFunction function whenever the programs function at the provided address is called

Just make sure to replace the hookTarget offset with the target function ones and that it has the same parameters

Windows and cross compiling version example coming soon...

#include <stdio.h>
#include <unistd.h>

#include <fstream>
#include <iostream>
#include <string>
#include <thread>

#include "rosalink.h"

void HookFunction() {
  printf("Hello from the hook :)\n");
}

static void Attach() {
  // Get the base address of the executible we're injecting into
  std::ifstream file("/proc/self/maps");
  std::string line;
  std::getline(file, line);
  auto pos = line.find("-");
  auto truncated = line.substr(0, pos);
  auto base = std::stoul(truncated, nullptr, 16);

  // set the hook target to the address
  void* hookTarget = base + 0x1189;

  // Initalize and install our hook
  printf("RosaLink - Installing hook\n");
  LinkHook testFunctionHook(hookTarget, (void*)HookFunction);
}

int __attribute__((constructor)) Entry() {
  std::thread mainThread(Attach);
  mainThread.detach();

  return 0;
} 

Rosalink in action


Github repo and documentation coming soon.