33 lines
2.0 KiB
Markdown
33 lines
2.0 KiB
Markdown
# Prestige injector (Rust)
|
|
|
|
`PrestigeInjector.exe` loads `prestige_native.dll` into a running Minecraft **1.21.11 Fabric** JVM (64-bit, Fabric Loader 0.19.x,
|
|
Fabric API installed). It uses the same overall method as the openvape bundle, written from scratch in Rust with no external crates.
|
|
|
|
## How it works
|
|
|
|
1. **Injector** lists visible `java.exe`/`javaw.exe` windows (refreshed every 750 ms), then runs `LoadLibraryW` in the chosen
|
|
process through `CreateRemoteThread` and confirms the module is mapped.
|
|
2. **`prestige_native.dll`** (`DllMain` only spawns a worker thread):
|
|
- waits for `jvm.dll`, `JNI_GetCreatedJavaVMs`, attaches, acquires the JVMTI redefine/retransform capabilities;
|
|
- writes the embedded payload jar (the remapped `prestige-*.jar`) to `%TEMP%\PrestigeLoader`;
|
|
- `FabricLauncherBase.getLauncher().addToClassPath(jar)` so payload and game classes share the Knot class loader;
|
|
- registers `NativeBridge.classBytes` / `NativeBridge.redefine` and calls `Bootstrap.start()`.
|
|
3. **`Bootstrap`** (Java) waits for the client window, then for every ClassTransform hook target gets the current class bytes
|
|
(JVMTI retransform capture), runs the hooks through `InPlaceTransformer` and redefines the class. The bundled ClassTransform
|
|
inlines hook handlers into the target methods, so normally nothing is added to the class and a plain redefine works. If a
|
|
transformer ever does add methods (a running JVM cannot), they are moved into generated `dev.zprestige.prestige.hooks.H*`
|
|
helper classes, call sites become `invokestatic`, and private member access goes through `Access` MethodHandles.
|
|
Finally the Prestige and ClickGUI entrypoints run on the client thread.
|
|
|
|
Log: `prestige-native.log` beside the DLL, plus `[Prestige-Inject]` lines in the game log.
|
|
|
|
## Build
|
|
|
|
```powershell
|
|
.\build-injector.ps1 # gradlew remapJar, cargo build --release, copies to dist\
|
|
```
|
|
|
|
## Use
|
|
|
|
Start a Fabric 1.21.11 instance, then run `dist\PrestigeInjector.exe` (or `PrestigeInjector.exe <pid> [dll]`).
|