0
I have the following situation, the user must enter a memory address:
(I’m using this method, may not be correct for the following situation)
std::string TEMP_MEMORY_ADDRESS;
std::string MEMORY_ADDRESS = "0x";
std::cout << "Digite o endereco de Memoria: ";
std::getline(std::cin, TEMP_MEMORY_ADDRESS);
MEMORY_ADDRESS.append(TEMP_MEMORY_ADDRESS);
Beauty, now we have the memory address requested by the user and in Hexadecimal, the problem is: I have to play this address in the function Writeprocessmemory(), and according to the MICROSOFT this address must be in the following parameters:
BOOL WINAPI WriteProcessMemory(
_In_ HANDLE hProcess,
_In_ LPVOID lpBaseAddress,
_In_ LPCVOID lpBuffer,
_In_ SIZE_T nSize,
_Out_ SIZE_T *lpNumberOfBytesWritten
);
lpBaseAddress[in] = A pointer to the specified process base address where data is recorded
In this question, my question only goes to LPVOID lpBaseAddress which is where we need to fit the memory address typed by the user, and that’s where my problem comes in: The method I’m using is not working when I play the string in lpBaseAddress.
EXAMPLE:
int isSuccessful = WriteProcessMemory(hproc, (LPVOID)MEMORY_ADDRESS.c_str(), &NewValue, (DWORD)sizeof(NewValue), NULL);
Trying to play on the output dice what had on (LPVOID)MEMORY_ADDRESS.c_str() I realized it had a random value, and it wasn’t exactly the address I had provided.
seems yes a silly doubt, but I’m having difficulties in how I should provide the exact value of the memory address for the function Writeprocessmemory();
Thanks a lot, buddy, it seems silly, but I help a lot!
– Draek