<?xml version="1.0"?>
<rss version="2.0"><channel><title>C/C++ Latest Topics</title><link>https://decodehub.org/forum/41-cc/</link><description>C/C++ Latest Topics</description><language>en</language><item><title><![CDATA[AntiDebug Engine – Multi-Layer Anti-Debugging & Early EntryPoint Protection for Windows]]></title><link>https://decodehub.org/topic/16-antidebug-engine-multi-layer-anti-debugging-early-entrypoint-protection-for-windows/</link><description><![CDATA[<h1>AntiDebug Engine – Multi-Layer Anti-Debugging &amp; Early EntryPoint Protection for Windows</h1><p><strong>AntiDebug Engine</strong> is a lightweight C++ anti-debugging framework for Windows applications. The project combines multiple independent debugger-detection techniques into a single protection layer and performs checks both during the early initialization stage and continuously while the application is running.</p><p>The main goal of the project is to make basic and common debugging attempts easier to detect by combining API-based, PEB-based, native NT API, timing, debug-register, window-detection, TLS callback, and EntryPoint checks.</p><hr><h2>Features</h2><h3><span class="ipsEmoji" title="">🔹</span> Multiple Anti-Debugging Techniques</h3><p>AntiDebug Engine currently implements several detection methods:</p><ul><li><p><code>IsDebuggerPresent()</code> detection</p></li><li><p><code>CheckRemoteDebuggerPresent()</code> detection</p></li><li><p>PEB <code>BeingDebugged</code> flag detection</p></li><li><p><code>NtQueryInformationProcess</code> / <code>ProcessDebugPort</code> detection</p></li><li><p><code>NtQueryInformationProcess</code> inline-hook detection</p></li><li><p>Debugger window detection</p></li><li><p>Timing-based debugger detection</p></li><li><p>CPU debug-register (<code>Dr0</code>–<code>Dr3</code> / <code>Dr7</code>) detection</p></li></ul><p>Each technique works independently, allowing multiple detection layers to be combined.</p><hr><h2><span class="ipsEmoji" title="">🔐</span> Early TLS Callback Protection</h2><p>The project registers a TLS callback using the MSVC CRT TLS callback mechanism.</p><p>The callback is executed during process initialization and performs an anti-debugging check before the normal application initialization flow continues.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>void NTAPI TLSCallback(PVOID DllHandle, DWORD Reason, PVOID Reserved)
{
    if (Reason == DLL_PROCESS_ATTACH)
    {
        AntiDebug::EntryPointCheck();
    }
}
</code></pre><p>This provides an additional protection layer before the application's normal entry-point logic is executed.</p><hr><h2><span class="ipsEmoji" title="">🚪</span> Fake EntryPoint / Real EntryPoint Architecture</h2><p>The project separates the visible entry point from the actual application initialization.</p><p>The execution flow is conceptually:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Process Start
     │
     ▼
TLS Callback
     │
     ├── Debugger detected → Terminate
     │
     ▼
Fake EntryPoint
     │
     ├── Debugger detected → Terminate
     │
     ▼
RealEntry()
     │
     ▼
Application
</code></pre><p>The <code>FakeEntry()</code> function performs another debugger check before transferring execution to <code>RealEntry()</code>.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>extern "C" __declspec(noreturn) void FakeEntry()
{
    if (AntiDebug::IsDebugging())
    {
        TerminateProcess(GetCurrentProcess(), 0);
    }

    RealEntry();

    ExitProcess(0);
}
</code></pre><p>This architecture allows the protection layer to be placed before the application's primary initialization code.</p><hr><h2><span class="ipsEmoji" title="">🧩</span> Continuous Background Monitoring</h2><p>After the application reaches <code>RealEntry()</code>, a detached monitoring thread periodically performs the complete anti-debugging routine.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>void AntiDebug::StartThreadedCheck()
{
    std::thread([] {
        while (true)
        {
            if (IsDebugging())
            {
                TerminateProcess(GetCurrentProcess(), 0);
            }

            std::this_thread::sleep_for(
                std::chrono::milliseconds(5)
            );
        }
    }).detach();
}
</code></pre><p>This means the checks are not limited to application startup. The process continues monitoring for debugger-related conditions while it is running.</p><hr><h1>Detection Methods</h1><h2>1. IsDebuggerPresent API</h2><p>Uses the Windows <code>IsDebuggerPresent()</code> API to determine whether the current process is being debugged.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>::IsDebuggerPresent();
</code></pre><hr><h2>2. Remote Debugger Detection</h2><p>Uses <code>CheckRemoteDebuggerPresent()</code> to check whether a debugger is attached to the process.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>BOOL isDebugger = FALSE;

CheckRemoteDebuggerPresent(
    GetCurrentProcess(),
    &amp;isDebugger
);
</code></pre><hr><h2>3. PEB BeingDebugged Flag</h2><p>The project directly accesses the Process Environment Block (PEB) and checks the <code>BeingDebugged</code> flag.</p><p>For x86:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>__readfsdword(0x30);
</code></pre><p>For x64:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>__readgsqword(0x60);
</code></pre><p>This provides a lower-level alternative to relying exclusively on the standard Windows debugging APIs.</p><hr><h2>4. NtQueryInformationProcess</h2><p>The project dynamically resolves <code>NtQueryInformationProcess</code> from <code>ntdll.dll</code> and queries <code>ProcessDebugPort</code>.</p><p>This allows the application to perform a native NT-level debugger check without statically importing the function.</p><hr><h2>5. NTDLL Inline Hook Detection</h2><p>The project performs a basic validation of the beginning of <code>NtQueryInformationProcess</code>.</p><p>Unexpected bytes may indicate that the function has been modified or redirected.</p><blockquote class="ipsQuote" cite="" data-ipsquote=""><div class="ipsQuote_contents" data-ipstruncate=""><p>Note: this is intentionally a lightweight heuristic rather than a complete integrity-verification system.</p></div></blockquote><hr><h2>6. Debugger Window Detection</h2><p>The project checks for several commonly used debugger windows, including:</p><ul><li><p>OllyDbg</p></li><li><p>x32dbg</p></li><li><p>x64dbg</p></li></ul><p>Example:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>FindWindowA("OLLYDBG", nullptr);
FindWindowA("Qt5QWindowIcon", "x32dbg");
FindWindowA("Qt5QWindowIcon", "x64dbg");
</code></pre><p>Additional debugger window signatures can be added easily.</p><hr><h2>7. Timing Check</h2><p>A small CPU workload is measured using <code>QueryPerformanceCounter()</code>.</p><p>The project compares the execution time against a predefined threshold. Significant delays may indicate debugging or instrumentation overhead.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>QueryPerformanceFrequency(&amp;freq);

QueryPerformanceCounter(&amp;t1);

// Test workload

QueryPerformanceCounter(&amp;t2);
</code></pre><hr><h2>8. Hardware Debug Register Detection</h2><p>The current thread context is queried using <code>GetThreadContext()</code> with <code>CONTEXT_DEBUG_REGISTERS</code>.</p><p>The implementation checks:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Dr0
Dr1
Dr2
Dr3
Dr7
</code></pre><p>If active hardware breakpoints are detected, the function reports a debugging condition.</p><hr><h1>Project Structure</h1><pre spellcheck="" class="ipsCode" data-language="text"><code>AntiDebug/
│
├── AntiDebug.h
├── AntiDebug.cpp
├── AntiDebugTLS.cpp
├── FakeEntry.cpp
└── Main.cpp
</code></pre><h3>AntiDebug.h</h3><p>Contains the AntiDebug namespace and function declarations.</p><h3>AntiDebug.cpp</h3><p>Contains the main debugger-detection implementations.</p><h3>AntiDebugTLS.cpp</h3><p>Registers the TLS callback responsible for performing an early anti-debugging check.</p><h3>FakeEntry.cpp</h3><p>Contains the intermediate EntryPoint and redirects execution to <code>RealEntry()</code>.</p><h3>Main.cpp</h3><p>Contains the actual application initialization and starts the continuous monitoring thread.</p><hr><h1>Requirements</h1><ul><li><p>Windows</p></li><li><p>Visual Studio / MSVC</p></li><li><p>C++17 or newer recommended</p></li><li><p>Windows SDK</p></li><li><p>x86 or x64 target</p></li></ul><p>The project is designed around Windows-specific APIs and therefore is <strong>Windows-only</strong>.</p><hr><h1>How to Use</h1><h3>1. Add the source files to your Visual Studio project</h3><p>Add:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>AntiDebug.h
AntiDebug.cpp
AntiDebugTLS.cpp
FakeEntry.cpp
Main.cpp
</code></pre><hr><h3>2. Configure the project architecture</h3><p>Build the project for the desired target:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>x86
</code></pre><p>or</p><pre spellcheck="" class="ipsCode" data-language="text"><code>x64
</code></pre><p>The PEB access implementation automatically selects the appropriate segment register depending on the compiler architecture.</p><hr><h3>3. Initialize the application through <code>RealEntry()</code></h3><p>Place the main application initialization inside:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>extern "C" void RealEntry()
{
    AntiDebug::StartThreadedCheck();

    // Application initialization
}
</code></pre><hr><h3>4. Configure the EntryPoint</h3><p>The intended execution architecture is:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>TLS Callback
      ↓
FakeEntry
      ↓
RealEntry
      ↓
Application
</code></pre><p>The project's build/link configuration must therefore be arranged so that the desired entry-point flow is actually used.</p><hr><h1>Detection Flow</h1><p>The central function is:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>bool AntiDebug::IsDebugging()
{
    if (IsDebuggerPresentAPI()) return true;
    if (IsRemoteDebuggerPresentAPI()) return true;
    if (CheckPEBFlag()) return true;
    if (CheckNtQueryInfo()) return true;
    if (CheckNtInlineHooks()) return true;
    if (CheckDbgWindows()) return true;
    if (CheckTiming()) return true;
    if (CheckDRxRegisters()) return true;

    return false;
}
</code></pre><p>A positive result from any detection method causes the protection layer to report a debugger condition.</p><p>The current implementation responds by terminating the process:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>TerminateProcess(
    GetCurrentProcess(),
    0
);
</code></pre><hr><h1>Why Multiple Checks?</h1><p>No single anti-debugging technique is perfect.</p><p>For example:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>API Detection
      +
PEB Detection
      +
NT Query Detection
      +
Timing Detection
      +
Debug Register Detection
      +
Window Detection
      +
TLS Callback
      +
Continuous Monitoring
</code></pre><p>Combining different techniques creates a layered detection architecture instead of relying on a single indicator.</p><hr><h1>Customization</h1><p>The project is designed to be extended.</p><p>Additional checks can be added to:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>AntiDebug::IsDebugging()
</code></pre><p>For example:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>if (NewDetectionMethod())
    return true;
</code></pre><p>Possible future extensions include:</p><ul><li><p>Additional process/environment checks</p></li><li><p>More debugger signatures</p></li><li><p>Module integrity verification</p></li><li><p>Import/address validation</p></li><li><p>Additional native API checks</p></li><li><p>Configurable detection policies</p></li><li><p>Logging/debug mode for development</p></li><li><p>Per-check enable/disable configuration</p></li></ul><hr><h1>Important Notes</h1><p>This project is intended as an <strong>anti-debugging research and software-protection example</strong>.</p><p>Anti-debugging techniques are heuristic by nature and can produce false positives depending on the environment, virtualization software, instrumentation frameworks, security products, or compatibility layers.</p><p>Some checks may also become unreliable across different Windows versions or compiler configurations.</p><p>The project should therefore be tested thoroughly before being integrated into production software.</p><p>[Hidden Content]</p>]]></description><guid isPermaLink="false">16</guid><pubDate>Wed, 26 Aug 2026 21:54:28 +0000</pubDate></item><item><title>C++ anti process</title><link>https://decodehub.org/topic/55-c-anti-process/</link><description><![CDATA[<h1><strong>Anti-Process</strong></h1><p>This simply stops any process from looking at your program, task manager, process hacker and any application including debuggers.</p><h2><strong>How it Works</strong></h2><p>so we simply place a hook on <code>NTQUERYSYSTEMINFORMATION</code> and return false always to crash applications trying to query information about our process. i also included another way of detecting file start ups that will not allow files to be started via doing the same exact thing to <code>CreateProccessW</code> of setting a hook and returning false always.</p><h2><strong>Usage</strong></h2><p>To integrate Anti-Process into your project, simply include the provided code snippets into your existing code.</p><p><video class="ipsEmbeddedVideo ipsRichText__align--block" data-controller="core.global.core.embeddedvideo" controls="" title="" preload="metadata"><source src="https://decodehub.org/uploads/monthly_2026_09/318625778-2e276b4e-cf49-41a4-af85-373e90d8cb74.mp4.12b920006436cd96a5504697da6a58e5.mp4#t=0" type="video/mp4">[Hidden Content]</source></video></p><p>[Hidden Content]</p>]]></description><guid isPermaLink="false">55</guid><pubDate>Sat, 05 Sep 2026 21:37:40 +0000</pubDate></item><item><title>ManualMap DLL Injector &#x2013; Automated Manual-Map DLL Injection Framework for Windows</title><link>https://decodehub.org/topic/19-manualmap-dll-injector-automated-manual-map-dll-injection-framework-for-windows/</link><description><![CDATA[<h1>ManualMap Injector – Automated Manual-Map DLL Injection Framework for Windows</h1><p><strong>ManualMap Injector</strong> is a Windows C++ DLL injection framework designed to manually map a DLL into a target process instead of relying on the standard <code>LoadLibrary</code>-based injection approach.</p><p>The project includes a process-monitoring layer that continuously searches for configured target executables and schedules DLL injection after a user-defined delay.</p><p>The manual mapping engine handles the main PE loading tasks internally, including section mapping, relocations, imports, TLS callbacks, optional x64 exception support, memory protection adjustment, and post-mapping cleanup.</p><hr><h1>Features</h1><h3><span class="ipsEmoji" title="">🔹</span> Manual Map DLL Injection</h3><p>Instead of loading the DLL through the normal Windows loader path, the project manually places the PE image into the target process and executes a mapping routine inside the remote process.</p><p>The mapper allocates memory according to the DLL's <code>SizeOfImage</code>, copies the PE header and individual sections, and then performs the required initialization steps.</p><hr><h3><span class="ipsEmoji" title="">🔹</span> Automatic Process Detection</h3><p>The injector continuously scans the running processes and compares their executable names against a configurable target list.</p><p>Example configuration:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>std::vector&lt;TargetConfig&gt; targets = {
    { L"example.exe", "test.dll" },
    { L"example.bin", "test.dll" }
};
</code></pre><p>Multiple target executables can therefore use the same DLL configuration.</p><hr><h3><span class="ipsEmoji" title="">🔹</span> Configurable Injection Delay</h3><p>Before an injection is attempted, the injector waits for a user-defined number of seconds.</p><p>Example:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Wait time (seconds): 5
</code></pre><p>This can be useful when the target application requires additional startup time before the DLL is mapped.</p><hr><h3><span class="ipsEmoji" title="">🔹</span> Multiple Process Instance Support</h3><p>The scanner does not assume that only one instance of a target process exists.</p><p>Every matching PID is processed individually.</p><p>The project also maintains an internal <code>(PID + DLL)</code> key so the same DLL is not repeatedly scheduled for the same process instance.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>struct InjectKey {
    DWORD pid;
    std::string dll;
};
</code></pre><p>This allows multiple instances of the same executable to be handled independently.</p><hr><h1>Manual Mapping Engine</h1><p>The core of the project is the <code>ManualMapDll()</code> function.</p><p>Its mapping pipeline can be summarized as:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>DLL File
   │
   ▼
PE Validation
   │
   ▼
Architecture Check
   │
   ▼
Remote Image Allocation
   │
   ▼
PE Header Mapping
   │
   ▼
Section Mapping
   │
   ▼
Mapping Data
   │
   ▼
Remote Mapping Routine
   │
   ├── Relocations
   ├── Imports
   ├── TLS Callbacks
   └── Exception Support
   │
   ▼
DLL Entry Point
   │
   ▼
Memory Protection
   │
   ▼
Cleanup
</code></pre><hr><h1>PE Validation</h1><p>Before mapping begins, the DLL is validated as a PE image.</p><p>The mapper checks the DOS signature:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>if (reinterpret_cast&lt;IMAGE_DOS_HEADER*&gt;(pSrcData)-&gt;e_magic != 0x5A4D)
{
    return false;
}
</code></pre><p>It then locates the NT headers and checks whether the DLL architecture matches the injector architecture.</p><pre spellcheck="" class="ipsCode" data-language="text"><code>x86 injector → x86 DLL
x64 injector → x64 DLL
</code></pre><p>The source checks <code>IMAGE_FILE_HEADER::Machine</code> against the current build architecture before continuing.</p><hr><h1>Remote Image Allocation</h1><p>The mapper allocates memory inside the target process according to the PE image size:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>VirtualAllocEx(
    hProc,
    nullptr,
    pOldOptHeader-&gt;SizeOfImage,
    MEM_COMMIT | MEM_RESERVE,
    PAGE_READWRITE
);
</code></pre><p>The mapped image is initially allocated as writable memory before the individual section protections are configured later.</p><hr><h1>PE Header &amp; Section Mapping</h1><p>The PE header is copied into the allocated image and each section containing raw data is copied to its corresponding virtual address.</p><p>Conceptually:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Original DLL
│
├── PE Headers
├── .text
├── .rdata
├── .data
├── .rsrc
└── .reloc
       │
       ▼
Target Process Memory
│
├── PE Headers
├── .text
├── .rdata
├── .data
├── .rsrc
└── .reloc
</code></pre><p>The implementation writes the initial header and then iterates through <code>IMAGE_SECTION_HEADER</code> entries to map the individual sections.</p><hr><h1>Relocation Processing</h1><p>If the DLL cannot be loaded at its preferred image base, the mapper processes the PE relocation directory.</p><p>The shellcode calculates the difference between the preferred image base and the actual mapped address:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>BYTE* LocationDelta = pBase - pOpt-&gt;ImageBase;
</code></pre><p>Relocation entries are then processed and adjusted according to the target architecture.</p><p>The project supports:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>IMAGE_REL_BASED_HIGHLOW  → x86
IMAGE_REL_BASED_DIR64    → x64
</code></pre><p>This allows the mapped image to operate from a different memory address than its original preferred base.</p><hr><h1>Import Resolution</h1><p>The manual mapper resolves imported modules and functions manually.</p><p>For each import descriptor, the mapping routine calls:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>LoadLibraryA()
</code></pre><p>and resolves imported functions through:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>GetProcAddress()
</code></pre><p>Both ordinal-based and name-based imports are handled.</p><hr><h1>TLS Callback Support</h1><p>The mapper also checks whether the DLL contains a TLS directory.</p><p>If TLS callbacks are present, they are executed with:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>DLL_PROCESS_ATTACH
</code></pre><p>This allows DLLs that rely on TLS initialization callbacks to receive their expected initialization notification.</p><hr><h1>x64 Exception Support</h1><p>For 64-bit builds, the mapper can optionally register the DLL's exception runtime function table through:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>RtlAddFunctionTable()
</code></pre><p>The relevant exception directory is located through:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>IMAGE_DIRECTORY_ENTRY_EXCEPTION
</code></pre><p>If registration fails, the mapper reports the failure through its mapping status structure.</p><blockquote class="ipsQuote" cite="" data-ipsquote=""><div class="ipsQuote_contents" data-ipstruncate=""><p>Exception support is architecture-dependent and is only enabled for x64 builds in the current implementation.</p></div></blockquote><hr><h1>DLL Entry Point</h1><p>After the required PE initialization steps have completed, the mapper calls the DLL's entry point:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>_DllMain(
    pBase,
    pData-&gt;fdwReasonParam,
    pData-&gt;reservedParam
);
</code></pre><p>By default, the injector passes:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>DLL_PROCESS_ATTACH
</code></pre><p>as the reason parameter.</p><hr><h1>Section Protection Adjustment</h1><p>After successful mapping, the project can restore memory permissions according to each PE section's characteristics.</p><p>For example:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Read-only section
Writable section
Executable + readable section
</code></pre><p>The implementation uses <code>VirtualProtectEx()</code> and derives the protection from the section's <code>IMAGE_SCN_MEM_*</code> flags.</p><p>This provides a more appropriate memory layout than leaving the entire mapped image permanently executable and writable.</p><hr><h1>Optional PE Cleanup</h1><p>The mapper provides optional cleanup functionality.</p><h3>Clear PE Header</h3><p>When enabled, the first <code>0x1000</code> bytes of the mapped image are overwritten after initialization.</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>ClearHeader
</code></pre><h3>Clear Non-Needed Sections</h3><p>The mapper can also clear selected sections such as:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>.reloc
.rsrc
.pdata
</code></pre><p>depending on the enabled options and exception-support configuration.</p><p>These options are configurable through the <code>ManualMapDll()</code> parameters.</p><hr><h1>Remote Mapping Routine</h1><p>The mapping work is performed by the <code>Shellcode()</code> routine inside the target process.</p><p>The injector prepares a <code>MANUAL_MAPPING_DATA</code> structure containing function pointers and mapping parameters:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>struct MANUAL_MAPPING_DATA
{
    f_LoadLibraryA pLoadLibraryA;
    f_GetProcAddress pGetProcAddress;

#ifdef _WIN64
    f_RtlAddFunctionTable pRtlAddFunctionTable;
#endif

    BYTE* pbase;
    HINSTANCE hMod;
    DWORD fdwReasonParam;
    LPVOID reservedParam;
    BOOL SEHSupport;
};
</code></pre><p>The structure is written into the target process before the remote mapping routine is started.</p><hr><h1>Mapping Status &amp; Error Handling</h1><p>The mapper communicates its status through the <code>hMod</code> field.</p><p>The implementation uses special values to indicate mapping problems:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>0x404040 → Invalid mapping state
0x505050 → Exception support failure
</code></pre><p>The injector continuously checks the mapping structure until the mapping routine reports a result.</p><hr><h1>Automatic Monitoring</h1><p>After initialization, the injector continuously scans for configured processes.</p><p>The basic runtime flow is:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Start Injector
      │
      ▼
Check DLL Files
      │
      ▼
Ask For Delay
      │
      ▼
Start Process Scanner
      │
      ▼
Find Target Process
      │
      ▼
Check PID + DLL
      │
      ├── Already handled → Skip
      │
      ▼
Schedule Injection
      │
      ▼
Wait
      │
      ▼
Manual Map DLL
      │
      ▼
Monitor Process
      │
      └── Process exits → Remove from tracking
</code></pre><p>The process-tracking set is periodically cleaned so that terminated processes can be detected again if a new instance starts.</p><hr><h1>Console Interface</h1><p>The injector creates a console window and displays its current state.</p><p>Example:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Wait time (seconds): 5

Scanning. | Active clients: 1
Scanning.. | Active clients: 2
Scanning... | Active clients: 2
Scanning | Active clients: 1
</code></pre><p>The console title can also be customized through:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>SetConsoleTitleA();
</code></pre><hr><h1>Project Structure</h1><pre spellcheck="" class="ipsCode" data-language="text"><code>ManualMapInjector/
│
├── injector.cpp
├── injector.h
├── ManualMap.cpp
├── Shellcode.cpp
└── target DLL
</code></pre><p>The exact file organization can be adjusted depending on how the project is structured in Visual Studio.</p><hr><h1>How to Use</h1><h2>1. Build the Injector</h2><p>Open the project in Visual Studio and select the appropriate architecture:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>x86
</code></pre><p>or:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>x64
</code></pre><p>The DLL must use the same architecture as the injector and target process.</p><hr><h2>2. Place the DLL</h2><p>Place the DLL specified in the target configuration next to the injector executable or provide the desired path.</p><p>Example:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>{ L"example.exe", "test.dll" }
</code></pre><hr><h2>3. Configure Target Processes</h2><p>Edit the target list:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>std::vector&lt;TargetConfig&gt; targets = {
    { L"example.exe", "test.dll" },
    { L"example.bin", "test.dll" }
};
</code></pre><p>You can add additional target executable names as required.</p><hr><h2>4. Start the Injector</h2><p>Launch the injector and enter the desired delay:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Wait time (seconds): 5
</code></pre><p>The injector will then begin scanning for matching processes.</p><hr><h2>5. Start the Target Application</h2><p>When a configured process is detected, the injector creates a delayed injection task.</p><p>Once the configured delay expires, the DLL is passed to the manual mapping engine.</p><hr><h1>Configuration Options</h1><p>The main mapper exposes several configuration parameters:</p><pre spellcheck="" class="ipsCode language-cpp" data-language="C++"><code>ManualMapDll(
    hProc,
    pSrcData,
    FileSize,
    ClearHeader,
    ClearNonNeededSections,
    AdjustProtections,
    SEHExceptionSupport,
    fdwReason,
    lpReserved
);
</code></pre><p>Available options include:</p><div class="ipsRichText__table-wrapper"><table style="min-width: 40px;"><colgroup><col style="min-width:20px;"><col style="min-width:20px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Option</p></th><th colspan="1" rowspan="1"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1"><p><code>ClearHeader</code></p></td><td colspan="1" rowspan="1"><p>Clears the mapped PE header after initialization</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>ClearNonNeededSections</code></p></td><td colspan="1" rowspan="1"><p>Clears selected sections after mapping</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>AdjustProtections</code></p></td><td colspan="1" rowspan="1"><p>Restores section memory protections</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>SEHExceptionSupport</code></p></td><td colspan="1" rowspan="1"><p>Enables x64 exception-function registration</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>fdwReason</code></p></td><td colspan="1" rowspan="1"><p>DLL entry-point reason</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>lpReserved</code></p></td><td colspan="1" rowspan="1"><p>Reserved parameter passed to the DLL entry point</p></td></tr></tbody></table></div><p>The default configuration enables header cleanup, unnecessary-section cleanup, protection adjustment, and x64 exception support.</p><hr><h1>Advantages</h1><h3><span class="ipsEmoji" title="">✔</span> No Standard DLL Loader Dependency</h3><p>The mapping process does not simply rely on the standard <code>LoadLibrary()</code> mechanism to load the target DLL.</p><h3><span class="ipsEmoji" title="">✔</span> PE-Level Mapping</h3><p>The project works directly with the PE structures and performs the required initialization stages itself.</p><h3><span class="ipsEmoji" title="">✔</span> Automatic Process Monitoring</h3><p>Target processes are discovered automatically.</p><h3><span class="ipsEmoji" title="">✔</span> Multiple Target Names</h3><p>Different executable names can be configured.</p><h3><span class="ipsEmoji" title="">✔</span> Multiple Instances</h3><p>Each process PID is tracked independently.</p><h3><span class="ipsEmoji" title="">✔</span> x86 / x64 Support</h3><p>The architecture is detected at compile time and the appropriate relocation type is selected.</p><h3><span class="ipsEmoji" title="">✔</span> TLS Support</h3><p>TLS callbacks contained in the mapped image are processed.</p><h3><span class="ipsEmoji" title="">✔</span> Optional x64 Exception Support</h3><p>Runtime function tables can be registered for 64-bit images.</p><h3><span class="ipsEmoji" title="">✔</span> Memory Cleanup</h3><p>Temporary mapping data and shellcode memory are released after successful mapping.</p><hr><h1>Limitations</h1><p>This implementation is a lightweight manual mapping framework and is not a complete replacement for the Windows PE loader.</p><p>Potential compatibility limitations may include:</p><ul><li><p>DLLs with unusual loader requirements</p></li><li><p>Complex loader dependencies</p></li><li><p>Advanced TLS behavior</p></li><li><p>Loader-lock-sensitive initialization</p></li><li><p>Unusual exception/unwind configurations</p></li><li><p>Architecture mismatches</p></li><li><p>Protected or restricted target processes</p></li><li><p>DLLs depending on loader-specific behavior</p></li></ul><p>The project should therefore be tested against the specific DLLs and target applications it is intended to support.</p><hr><h1>Technical Overview</h1><pre spellcheck="" class="ipsCode" data-language="text"><code>┌─────────────────────────────┐
│       Injector Process      │
├─────────────────────────────┤
│ Process Scanner             │
│ Target Configuration        │
│ Delay Scheduler             │
│ PID Tracking                │
│ DLL File Loader             │
└──────────────┬──────────────┘
               │
               ▼
┌─────────────────────────────┐
│      ManualMapDll()         │
├─────────────────────────────┤
│ PE Validation               │
│ Architecture Validation     │
│ Remote Memory Allocation    │
│ Header Mapping              │
│ Section Mapping             │
│ Mapping Data                │
│ Remote Mapping Routine      │
└──────────────┬──────────────┘
               │
               ▼
┌─────────────────────────────┐
│        Shellcode()          │
├─────────────────────────────┤
│ Relocations                 │
│ Import Resolution           │
│ TLS Callbacks               │
│ x64 Exception Support       │
│ DLL Entry Point             │
└──────────────┬──────────────┘
               │
               ▼
┌─────────────────────────────┐
│       Target Process        │
│       Mapped DLL            │
└─────────────────────────────┘
</code></pre><p>[Hidden Content]</p>]]></description><guid isPermaLink="false">19</guid><pubDate>Wed, 26 Aug 2026 22:15:42 +0000</pubDate></item><item><title>C++ anti suspend</title><link>https://decodehub.org/topic/56-c-anti-suspend/</link><description><![CDATA[<h1><strong>Anti-Suspend</strong></h1><p>Anti-Suspend is a tool designed to detect x64dbg detaching, thread suspension, and perform other related functions.</p><p>This project was inspired by [Hidden Content].</p><h2><strong>How it Works</strong></h2><p>The tool creates a dummy thread that triggers when suspended or when the file is suspended. It utilizes <code>DebugActiveProcessStop</code> to stop debugging of a process previously attached to a debugger or utilized by a program for suspension. After that, it pushes the suspension limits to max. then at the end, it checks if the thread can be suspended. If the return does not equal <code>(DWORD)-1</code>, it shows either suspension or previous attachment of a debugger.</p><h2><strong>Usage</strong></h2><p>To integrate Anti-Suspend into your project, simply include the provided code snippets into your existing code.</p><p>[Hidden Content]</p>]]></description><guid isPermaLink="false">56</guid><pubDate>Sat, 05 Sep 2026 21:38:49 +0000</pubDate></item><item><title>C++ anti breakpoint</title><link>https://decodehub.org/topic/54-c-anti-breakpoint/</link><description><![CDATA[<p><span style="font-family: Helvetica, Arial, sans-serif;">Anti-Breakpoints is a simple method to counteract breakpoint detection by x64dbg and ScyllaHide, as well as anti-breakpoint techniques using job objects.</span><br><img class="ipsImage ipsImage_thumbnailed ipsRichText__align--block" data-fileid="62" src="https://decodehub.org/uploads/monthly_2026_09/318372251-9bf9c535-3325-4ac8-b6ea-061377dd77a6.thumb.png.ff3d07fd8eba8bd57e19ca39c4a70ad8.png" alt="318372251-9bf9c535-3325-4ac8-b6ea-061377dd77a6.png" title="318372251-9bf9c535-3325-4ac8-b6ea-061377dd77a6.png" width="1000" height="608" data-full-image="https://decodehub.org/uploads/monthly_2026_09/318372251-9bf9c535-3325-4ac8-b6ea-061377dd77a6.png.ff57b2d506f067adbb618328bd21cad5.png" loading="lazy"></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="63" src="https://decodehub.org/uploads/monthly_2026_09/318372494-691ba62d-e2ae-41b9-b422-4a116137254c.png.f91dc7e66694b363cba9fff231ffc4bf.png" alt="318372494-691ba62d-e2ae-41b9-b422-4a116137254c.png" title="318372494-691ba62d-e2ae-41b9-b422-4a116137254c.png" width="913" height="689" loading="lazy"></p><h2><strong>How it Works</strong></h2><p>The anti-breakpoints method implemented in this project helps prevent breakpoint detection by x64dbg and ScyllaHide. It utilizes job objects to provide a anti-breakpoint mechanism.</p><h2><strong>Usage</strong></h2><p>To use Anti-Breakpoints in your project, simply include the provided code snippets into your existing codebase.</p><p>[Hidden Content]</p>]]></description><guid isPermaLink="false">54</guid><pubDate>Sat, 05 Sep 2026 21:35:19 +0000</pubDate></item></channel></rss>
