Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


no idea how to use setthreadcontext

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
zakusa
Cheater
Reputation: 0

Joined: 09 Sep 2015
Posts: 48

PostPosted: Tue Oct 13, 2015 10:56 pm    Post subject: no idea how to use setthreadcontext Reply with quote

hi i saw that atom0s said that to use change register location you use set threadcontext but i need help my script isnt working below

#include <iostream>
#include <Windows.h>
#include <string>
#include <cstdlib>
using namespace std;
int Assemble()
{
__asm mov eax, 1
}


int main()
{
HWND process = FindWindow(NULL, "BOLOX");
if (process == 0) {
cerr << "game not opened";
} else {
DWORD p;
GetWindowThreadProcessId(process, &p);
HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, p);
if (!h) {
cerr << "you fail";
}
else {
int readcontent = SetThreadContext(h, (LPVOID)0x00000000, &Assemble, NULL);
system("PAUSE");
}
}
}
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Thu Oct 15, 2015 5:06 am    Post subject: Reply with quote

Your code suffers from conceptual error, i.e., each process has its own virtual memory space.

Also note that your SetThreadContext parameters are incorrect to say the least.
Back to top
View user's profile Send private message
STN
I post too much
Reputation: 43

Joined: 09 Nov 2005
Posts: 2676

PostPosted: Thu Oct 15, 2015 11:30 am    Post subject: Reply with quote

lol can't even imagine what you think you are passing to the API and what it is supposed to do.

The API only takes two parameters, read more here

https://msdn.microsoft.com/en-us/library/windows/desktop/ms680632(v=vs.85).aspx

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Oct 17, 2015 7:40 pm    Post subject: Reply with quote

I am just going to continue to lock your topics from now on. It is clear that you are making little to no effort in what you are doing. Instead you are just copy pasting code and expecting it to work. We are not going to spoon feed you answers on how to do things. It is very clear that you have little clue what you are doing with C/C++ in general and have no understanding of how to use API.

That said, I suggest you take the time to even learn the language before you attempt to get into game hacking related topics.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites