Small part of my code:

GetWindowThreadProcessId(hWnd, &dwID);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, dwID);
string value =" [_this] exec \"\\newfolder\\scripts\\start.sqf\"";
WriteProcessMemory(hProcess, (LPVOID) 0x09BA3F95, (LPVOID) &value, sizeof(&value), NULL);

I am 100 % sure it has to do with my value being a string but I haven't found anything helpful elsewhere, even though I've searched hard (in my opinion). So please, can anyone help me? I'm still a beginner in programming but a superficial explanation will do :)

Thank you

WriteProcessMemory expects a void* as buffer, but you're using a std::string.
So perhaps something like :

const_cast<char*>(value.c_str())

(untested)

But what on earth are you trying to do?

Thanks for your reply :) I'll give it a go as soon as possible. Now, what I am trying to do here is, that I realized it's time to advance in programming, so I thought "why not memory editing". So i took a random program, searched for a random text with Cheatengine, and now I am trying to replace it with my text. Just for learning purposes of course :) And now, well I'm just going to experiment around then.

Thank you very much. I got it working. I really appreciate your help :)

This article has been dead for over six months. Start a new discussion instead.