> 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/documentation/core-functions/manual-mapping.md).

# Manual Mapping

EasyAuth provides a server-assisted manual mapping engine that injects dynamic-link libraries (DLLs) directly from the cloud into target game or application processes without ever writing the binary to disk.

***

## Server-Assisted Manual Map (`easyauth::server_map`)

### `easyauth::server_map`

Fetches a cloud-hosted payload, resolves imports, applies relocations, and injects it into a running target process.

```cpp
map_result server_map(
    const std::string& access_id,
    const std::string& target_process,
    const std::string& key = "",
    const std::string& api_key = ""
);
```

#### Parameters

* `access_id`: The identifier of the DLL file configured on the EasyAuth dashboard.
* `target_process`: Target process name (e.g. `"notepad.exe"`, `"cs2.exe"`, `"Valorant-Win64-Shipping.exe"`).
* `key`: User license key (required for protected payloads).
* `api_key`: Product API key.

#### Return Structure (`map_result`)

```cpp
struct map_result {
    bool success;           // true if memory injection succeeded
    uint32_t process_id;    // Process ID of the injected target
    uintptr_t mapped_base;  // Base address of the injected module in target memory
    std::string error_name; // Error identifier
    std::string message;    // Detailed status explanation
};
```

#### Example

```cpp
#include "qPapelEasyAuth.h"
#include <iostream>

int main() {
    // ... initialize and authenticate ...

    std::cout << "[*] Mapping cloud DLL into game process...\n";
    auto map_res = easyauth::server_map("aimbot_core_dll", "game.exe", user_key, api_key);

    if (map_res.success) {
        std::cout << "[+] Module successfully mapped!\n";
        std::cout << "    -> Target PID : " << map_res.process_id << "\n";
        std::cout << "    -> Mapped Base: 0x" << std::hex << map_res.mapped_base << "\n";
    } else {
        std::cerr << "[-] Mapping Failed: " << map_res.message << "\n";
    }

    return 0;
}
```

***

## In-Memory Manual Map Engine (`easyauth::manual_map_dll`)

If you have already downloaded raw DLL bytes into RAM via `get_file()`, you can execute manual mapping directly using a process handle:

```cpp
bool manual_map_dll(
    void* hProcess,
    const std::vector<uint8_t>& dll_bytes,
    void* pPreAllocatedBase = nullptr,
    bool server_patched = true
);
```

#### Features

* **PE Header Erasing**: Automatically scrubs DOS and NT headers to prevent memory dumping tools from discovering the loaded module.
* **TLS Callback Execution**: Invokes Thread Local Storage (TLS) callbacks prior to executing `DllMain`.
* **Section Protection**: Applies strict `PAGE_EXECUTE_READ` and `PAGE_READONLY` attributes to specific section pages.
