Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 968 Bytes

File metadata and controls

27 lines (18 loc) · 968 Bytes

WriteProcessMemoryAPC - Nim

Description

WriteProcessMemoryAPC is an alternative to Windows' WriteProcessMemory that leverages APCs (Asynchronous Procedure Calls) to write into a process's memory. Instead of writing directly, it schedules a series of calls to RtlFillMemory via APCs to write byte by byte.

This is a Nim reimplementation of the original C technique.

Operation with APCs

  1. Create a suspended thread in the target process.
  2. For each byte to write:
    • Schedule an APC that will call RtlFillMemory.
    • The APC writes a single byte at a time.
  3. Resume the thread execution to process the APCs.
  4. Wait for execution to complete.
  5. Clean up resources.

Usage

WriteProcessMemoryAPC(hProcess: HANDLE, pAddress: ptr BYTE, pData: ptr BYTE, dwLength: DWORD): DWORD

Original C technique by x86matthew, reimplemented in Nim.