Hi everyone,I created some code for allocate memory using VirtualAllocEx,but I always encounter the same problem, the allocation fails,I attached the code with this question,I need to fix this error.Thank you.
Reserves, commits, or changes the state of a region of memory within the virtual address space of a specified process. The function initializes the memory it allocates to zero.
To specify the NUMA node for the physical memory, see VirtualAllocExNuma.
Syntax
C++
LPVOID WINAPI VirtualAllocEx(
_In_ HANDLE hProcess,
_In_opt_ LPVOID lpAddress,
_In_ SIZE_T dwSize,
_In_ DWORD flAllocationType,
_In_ DWORD flProtect
);
Parameters
hProcess [in]
The handle to a process. The function allocates memory within the virtual address space of this process.
The handle must have the PROCESS_VM_OPERATION access right. For more information, see Process Security and Access Rights.