M
M
Maxim Ivanov2016-05-10 22:04:38
C++ / C#
Maxim Ivanov, 2016-05-10 22:04:38

How can you manually manage memory in C++?

Here there is a dynamic allocation of memory through new

int* arr[10] = new int[10];
int* year = new int(2016);

Is it possible to somehow independently implement the new class? But how is it all arranged in pluses, at the compiler level, I would like to independently place any information in the cells, but how, could you demonstrate your own code examples? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2016-05-10
@splincodewd

I would like to independently place any information in the cells

What for? For fun?
You can write a simple class with a couple of private fields and public getters/setters, compile it with the g++ compiler, and then take IDA Pro with Hex-Rays and decompile the getters and setters. You will get a code consisting of only calls to cells, fields - these are memory cells, a getter or setter takes a pointer to a class (that is, an address in memory), adds a certain offset (a certain number) to the address - and gets a cell, into a cell you can write or read data, for example, you can assign the address of a string (char *) to it ... Moreover, the offset is always a constant, so another program can intrude into yours (with the help of hooks, on Android they are done using Cydia), and interact as part of it ...
In my opinion - very cool ...
А еще есть WriteProcessMemory/ReadProcessMemory, тоже прикольная штука...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question