Example #1
0
 /// <summary>
 /// Allocates a block of memory in the target process.
 /// </summary>
 /// <param name="hProcess">Handle to the process in which memory will be allocated.</param>
 /// <param name="nSize">Number of bytes to be allocated.  Default is 0x1000.</param>
 /// <param name="dwAllocationType">The type of memory allocation.  See <see cref="MemoryAllocType"/></param>
 /// <param name="dwProtect">The memory protection for the region of pages to be allocated. If the pages are being committed, you can specify any one of the <see cref="MemoryProtectType"/> constants.</param>
 /// <returns>Returns zero on failure, or the base address of the allocated block of memory on success.</returns>
 public static uint AllocateMemory(IntPtr hProcess, int nSize, uint dwAllocationType, uint dwProtect)
 {
     return(Imports.VirtualAllocEx(hProcess, 0, nSize, dwAllocationType, dwProtect));
 }