Okay, this question is not regular, and maybe stupid, cause im not familiar with pointers and links in c++:
So i have some data in memory of another process (http://prntscr.com/zmfb4p), it's about 1200-1600 bytes. I have a driver, which can do kernel read-write to needed process. I have a user-mode application, which one communicate with driver like that:
int reading_data = driver.readvirtualmemory<int>(<processId>, <adress to read>, <size to read>);
It works as intended with small data types, but i can't understand, how to get "large" amount of bytes and store it:
Allocating memory to store data:
char* test_buf = new char[size_matricies_buffer]; // allocating memory and creating a pointer to it ~1200-1600 depends on situation
*test_buf = driver.ReadVirtualMemory<char>(<process>, <address>, static_cast<uint32_t>(size_matricies_buffer)); // filling allocated memory with data?
It compiles, and works, but when im trying to get access to *test i get an error:
cout << "buf: " << *test_buf << " | " << &test_buf << endl;
Unhandled exception at 0x00007FF6D1DD1671 in Mysoftware.exe: 0xC0000005: Access violation writing location 0x00000000C21C833C.
Any idea what im missing here?
char
. What exactly does theReadVirtualMemory
do? Why not give it the buffer to copy the data into? – Sami Kuhmonen Feb 15 at 17:01cout << "buf: " << *test_buf
the*test_buf
is most likely not a null terminated string. Although I would expectAccess violation reading location
instead ofAccess violation writing location
– drescherjm Feb 15 at 17:09