Reputation: 101
I'm looking for functions to write and read process memory similar to the Win32API calls in windows.h but I can't seem to find any for standard C++ and I would like it to be platform independent.
Upvotes: 1
Views: 387
Reputation: 43472
Which functions are you using on Windows? We're not sure what it is you're asking for, but if you show us what you're doing successfully there, we'll be able to help you find the equivalents on other platforms.
Upvotes: 0
Reputation: 411
The C++ standard supports memcpy(), memset(), memmove(), and memcmp(). There is also and STL utility, std::copy(). These are all platform independent.
Upvotes: 0
Reputation: 26171
You can get platform independent because those kinds of API calls are dependent on the OS kernel, you'd need to create wrappers for each type(read, write) and change the internal API call based on a PP define (such as _WIN32
)
Upvotes: 0
Reputation: 231163
There is no standard C++ API for accessing the memory of other processes. Standard C++ does not even have the concept of a 'process' at all. Moreover, the contents of the memory of other processes is highly platform-dependent, so adding a shim layer for porting to other OSes is the least of your problems.
Upvotes: 6