0

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

3
Contributors
4
Replies
6
Views
5 Years
Discussion Span
Last Post by citizen5
1

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?

0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.