# What Is the version.dll Proxy in Wand-Enhancer? Purpose and Technical Implementation

> Learn how the version.dll proxy in Wand-Enhancer bypasses integrity checks to inject remote assets into app.asar. Discover its purpose and technical implementation.

- Repository: [k1tbyte/Wand-Enhancer](https://github.com/k1tbyte/Wand-Enhancer)
- Tags: internals
- Published: 2026-09-01

---

**The `version.dll` proxy is a native DLL that modifies the ASAR-integrity fuse byte in Electron to allow Wand-Enhancer to inject remote-panel assets into `app.asar` without triggering integrity validation errors.**

The `version.dll` proxy in Wand-Enhancer acts as a surgical bypass for Electron's archive protection mechanisms. According to the k1tbyte/Wand-Enhancer source code, this statically-linked native component enables the patcher to augment the Wand client with a mobile-accessible web interface while keeping modifications self-contained and reversible.

## Core Function of the version.dll Proxy

The proxy serves a single architectural purpose: **patching the ASAR-integrity fuse byte** that Electron uses to verify the `app.asar` archive. By flipping this byte, the DLL allows the patcher to perform three critical operations:

- **Inject remote-panel assets** from the compiled `web-panel/dist` bundle directly into the `app.asar` archive.
- **Expose the remote-panel’s WebSocket/HTTP server** on LAN port 3223, enabling mobile UI communication with the patched client.
- **Maintain self-containment** by residing side-by-side with Wand files and removing cleanly during restoration.

The proxy operates entirely within the Wand process context. It does not perform telemetry, network communication, or cross-process injection—its effect is strictly limited to loosening the ASAR integrity check for the current session.

## Build Process and Embedding

The proxy originates as C source code in [`tools/asar-fuses-bypass/library.c`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/tools/asar-fuses-bypass/library.c), compiled via CMake into a statically-linked native DLL. Static linking eliminates Visual C++ runtime dependencies, ensuring the proxy runs on systems without specific redistributables installed.

The compiled `version.dll` is embedded directly into the .NET assembly through `WandEnhancer/WandEnhancer.csproj`:

```xml
<EmbeddedResource Include="$(ProxyDllPath)" />

```

The logical resource name `proxydll` is defined in [`WandEnhancer/Constants.cs`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/WandEnhancer/Constants.cs) as `ProxyDllResouceName`, allowing the application to locate the embedded stream at runtime.

## Runtime Injection Flow

When the user initiates patching, the `Enhancer` class orchestrates the proxy deployment through a specific sequence:

1. **Extraction**: The `AttachProxyDll()` method in [`WandEnhancer/Core/Enhancer.cs`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/WandEnhancer/Core/Enhancer.cs) retrieves the embedded resource stream and writes it to `<WandRoot>\version.dll`.

2. **Automatic Loading**: Wand’s Electron main process loads `version.dll` automatically on startup because the file resides in the application root directory.

3. **Fuse Patching**: The DLL executes early in the process lifecycle, modifies the ASAR-integrity fuse byte (as implemented at line 114 of [`library.c`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/library.c)), and returns control to Electron.

4. **Asset Injection**: After the proxy is in place, `Enhancer.Patch()` calls `InjectRemotePanelFiles()` to unpack, modify, and repack `app.asar`; the proxy ensures Electron accepts the repacked archive as valid.

```csharp
// Extract the embedded version.dll to the Wand installation directory
private void AttachProxyDll()
{
    var asm = Assembly.GetExecutingAssembly();
    var dll = asm.GetManifestResourceStream(Constants.ProxyDllResouceName);
    if (dll == null) throw new Exception("[ENHANCER] Proxy DLL resource not found");

    var destPath = Path.Combine(_weModConfig.RootDirectory, "version.dll");
    using var fileStream = File.Create(destPath);
    dll.CopyTo(fileStream);               // Writes version.dll next to Wand.exe
    _logger("[ENHANCER] Proxy DLL attached", ELogType.Info);
}

// Main patch routine invokes AttachProxyDll after repacking app.asar
public void Patch()
{
    // … unpack, patch, repack logic …
    AttachProxyDll();                     // Inject the proxy
    _logger("[ENHANCER] Done!", ELogType.Success);
}

```

## Cleanup and Restoration

The modification remains non-destructive through deliberate cleanup logic. When the user restores a backup via the main interface, [`WandEnhancer/View/MainWindow/MainWindowVm.cs`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/WandEnhancer/View/MainWindow/MainWindowVm.cs) deletes the `version.dll` file from the Wand root directory. This removal ensures the original Wand installation remains untouched, with no residual proxy code or modified fuses persisting after restoration.

## Summary

- The `version.dll` proxy is a statically-compiled native DLL embedded as a resource in `WandEnhancer.csproj`.
- It patches Electron’s ASAR-integrity fuse byte to allow safe modification of `app.asar` archives.
- Deployed via `AttachProxyDll()` in [`Enhancer.cs`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/Enhancer.cs), it enables injection of the remote-panel bundle and activation of port 3223.
- The proxy operates only within the local Wand process and is removed during backup restoration via [`MainWindowVm.cs`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/MainWindowVm.cs).
- Source code in [`tools/asar-fuses-bypass/library.c`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/tools/asar-fuses-bypass/library.c) implements the low-level fuse modification.

## Frequently Asked Questions

### What exactly does the version.dll proxy modify in Electron?

The proxy targets the **ASAR-integrity fuse byte**, a memory flag that Electron checks before loading `app.asar`. By modifying this byte, the DLL signals that the archive is valid even after Wand-Enhancer injects external assets into the bundle. This occurs entirely within the Wand process space without altering the Electron binary on disk.

### Is the version.dll proxy persistent or temporary?

The proxy is **temporary and self-contained**. When the patcher runs, `AttachProxyDll()` writes the DLL to the Wand directory; when the user restores a backup, the cleanup routine in [`MainWindowVm.cs`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/MainWindowVm.cs) deletes the file. No system-wide changes or permanent hooks remain after removal.

### Does the proxy DLL communicate over the network?

**No.** The `version.dll` proxy performs no telemetry, network requests, or external communication. Its sole function is local process manipulation of the ASAR-integrity check. Network functionality—such as the WebSocket/HTTP server on port 3223—is handled by the injected remote-panel assets, not the native proxy itself.

### How is the proxy DLL compiled and embedded?

The proxy is compiled from [`tools/asar-fuses-bypass/library.c`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/tools/asar-fuses-bypass/library.c) using CMake with static linking to produce `version.dll`. The build output is embedded into the .NET assembly via an `<EmbeddedResource>` entry in `WandEnhancer.csproj` and referenced at runtime through the `ProxyDllResouceName` constant in [`Constants.cs`](https://github.com/k1tbyte/Wand-Enhancer/blob/main/Constants.cs).