> For the complete documentation index, see [llms.txt](https://easyauth.papelship.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://easyauth.papelship.com/csharp-document/main-functions/server-mapper.md).

# Server Mapper

The Serverside DLL Mapper injects dynamic link libraries directly from the authentication server into a target remote process memory space without ever saving the raw `.dll` file to physical storage or using vulnerable `LoadLibraryA` disk-based hooks.

## Technical Mechanism

```mermaid
sequenceDiagram
    participant CSharp as C# Application
    participant Server as EasyAuth Server
    participant Target as Target Process (Game / App)
    
    CSharp->>Server: ServerMap(fileId, "target.exe", licenseKey, apiKey)
    Server-->>CSharp: Encrypted PE Stream
    Note over CSharp,Target: Reflective Manual Map Execution
    CSharp->>Target: 1. VirtualAllocEx (Alloc Page)
    CSharp->>Target: 2. WriteProcessMemory (Map Sections)
    CSharp->>Target: 3. Resolve Imports & Base Relocations
    CSharp->>Target: 4. Execute DLL Entry Point (DLL_PROCESS_ATTACH)
    CSharp->>CSharp: Wipe intermediate memory buffers
```

## C# Implementation

{% tabs %}
{% tab title="Map by Process Name" %}

```csharp
using System;
using qPapelEasyAuth;

public class ModuleInjector
{
    public static bool InjectModuleByName(string fileAccessId, string targetProcessName, string licenseKey, string apiKey)
    {
        Console.WriteLine($"[*] Mapping file '{fileAccessId}' into process '{targetProcessName}'...");

        // Streams and manual-maps the remote DLL directly into the target process
        MapResult mapResult = qPapelEasyAuth.qPapelEasyAuth.ServerMap(fileAccessId, targetProcessName, licenseKey, apiKey);

        if (mapResult.Success)
        {
            Console.WriteLine("[+] Manual Map Success!");
            Console.WriteLine($"[+] Target PID    : {mapResult.ProcessId}");
            Console.WriteLine($"[+] Base Address  : 0x{mapResult.MappedBase.ToInt64():X}");
            return true;
        }

        Console.WriteLine($"[-] Manual Map Failed: {mapResult.Message} ({mapResult.ErrorName})");
        return false;
    }
}
```

{% endtab %}

{% tab title="Map by Explicit PID" %}

```csharp
public static bool InjectModuleByPid(string fileAccessId, uint targetPid, string licenseKey, string apiKey)
{
    Console.WriteLine($"[*] Mapping file '{fileAccessId}' into PID {targetPid}...");

    MapResult mapResult = qPapelEasyAuth.qPapelEasyAuth.ServerMapPid(fileAccessId, targetPid, licenseKey, apiKey);

    if (mapResult.Success)
    {
        Console.WriteLine($"[+] Module loaded at 0x{mapResult.MappedBase.ToInt64():X}");
        return true;
    }

    Console.WriteLine($"[-] Injection error: {mapResult.Message}");
    return false;
}
```

{% endtab %}
{% endtabs %}

## `MapResult` Properties

| Property     | Type     | Description                                                                      |
| ------------ | -------- | -------------------------------------------------------------------------------- |
| :---         | :---     | :---                                                                             |
| `Success`    | `bool`   | `true` if injection completed and `DllMain` returned success; otherwise `false`. |
| `ProcessId`  | `uint`   | Target operating system process identifier (PID).                                |
| `MappedBase` | `IntPtr` | Base virtual memory address where the module was mapped in target space.         |
| `ErrorName`  | `string` | Diagnostic error name if injection failed.                                       |
| `Message`    | `string` | Human-readable explanation.                                                      |

## Key Benefits

* **No Disk Trace**: Decryption occurs strictly inside encrypted memory segments.
* **Relocation Handling**: Native engine resolves 64-bit base relocations (`.reloc`) in target process space.
* **Import Resolution**: Resolves imports via custom kernel syscall table without creating suspicious remote API hooks.
* **TLS & Exception Table Setup**: Initializes SEH and Thread Local Storage (TLS) callbacks accurately.

{% hint style="warning" %}
Ensure the target process architecture matches the DLL architecture (`x64` to `x64`). Mapping 64-bit DLLs into 32-bit processes or vice-versa is not supported.
{% endhint %}
