HelpReadProcessMemory in C#?

Posts 19 of 9 · Page 1 of 1
ReadProcessMemory in C#?
I have been doing all of my hacks recently in C++. In C++, when i want to read some memory i simple do ReadProcessMemory(); But in C# i'm having trouble figuring out how to get it to work? I tried googling it but i'm really not having any luck. Anyone have some nice C# code i could take a look at so i could try and learn? credits will be given to the one who helps me if i release anything of course.
It's the exact same, except that you need to use P/Invoke. There are tons of tutorials and source codes, even full modules for memory editing.
Quote Originally Posted by Biesi View Post
It's the exact same, except that you need to use P/Invoke. There are tons of tutorials and source codes, even full modules for memory editing.
It's not exactly the same. In C# when I try and read proc mem, intelisense tells me it's a bool - i.e. i cant say int x = readprocmem because it will just return 0 or 1. C++ does not not use bools at all in readprocmem. you declare what type you are reading and that's it. can you elaborate, or provide some viable source for me please?
Quote Originally Posted by HexMurder View Post


It's not exactly the same. In C# when I try and read proc mem, intelisense tells me it's a bool - i.e. i cant say int x = readprocmem because it will just return 0 or 1. C++ does not not use bools at all in readprocmem. you declare what type you are reading and that's it. can you elaborate, or provide some viable source for me please?
ReadProcessMemory does return BOOL (which is actually int) in C++. And if you're using it that way then you're doing it wrong anyways, no wonder that it won't work
Quote Originally Posted by Biesi View Post


ReadProcessMemory does return BOOL (which is actually int) in C++. And if you're using it that way then you're doing it wrong anyways, no wonder that it won't work
yeah figured it out now. Like i said it's not the same . Thanks anyway i was just being a noob.
Quote Originally Posted by HexMurder View Post


yeah figured it out now. Like i said it's not the same . Thanks anyway i was just being a noob.
Care to say how you solved it? (for the quality of the thread)
BOOL WINAPI ReadProcessMemory(
_In_ HANDLE hProcess,
_In_ LPCVOID lpBaseAddress,
_Out_ LPVOID lpBuffer,
_In_ SIZE_T nSize,
_Out_ SIZE_T *lpNumberOfBytesRead
);

Even though I have never touched it, My assumption is that lpBuffer is the result you want...
Solved. someone please close.
theoretically, you could take the process memory from a application that already monitors it, such as perf mon
Posts 19 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?