I am trying to use a function in my DLL called
Code:
BOOL ReadProcessMemory(
HANDLE hProcess,
LPCVOID lpBaseAddress,
LPVOID lpBuffer,
SIZE_T nSize,
SIZE_T* lpNumberOfBytesRead
);
I want to convert a LPVOID variable to a cli::array<Byte^,Dimension>^
Can anyone help, please? Btw, I am kind of a beginner, but I know how to deal with Manged code than unmanaged. I have used this function before in C#, so I know the function reads the values in memory into that variable. Thanks!
BTW, this all written in Managed C++ 2005 in Visual Studio 2005.
here is my existing code
Code:
HANDLE hProcess = OpenProcess(PROCESS_VM_READ,true,processId);
UInt32^ dwProcessId = Convert::ToUInt32(hProcess);
array<Byte^,1>^ buffer = gcnew array<Byte^,1>(bufferSize);
LPVOID lBuffer;
SIZE_T *lpNumberOfBytesRead;
ReadProcessMemory(hProcess,
(LPCVOID)IntPtr((int)memoryAddress),
lBuffer,
Convert::ToUInt32(buffer->Length),
lpNumberOfBytesRead);