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 


injection keeps failing
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Mon May 26, 2008 9:56 am    Post subject: Reply with quote

Uh.. relook at the params of CreateRemoteThread:

Code:
HANDLE WINAPI CreateRemoteThread(
  __in   HANDLE hProcess,
  __in   LPSECURITY_ATTRIBUTES lpThreadAttributes,
  __in   SIZE_T dwStackSize,
  __in   LPTHREAD_START_ROUTINE lpStartAddress,
  __in   LPVOID lpParameter,
  __in   DWORD dwCreationFlags,
  __out  LPDWORD lpThreadId
);


pThreadId
    A pointer to a variable that receives the thread identifier.
    If this parameter is NULL, the thread identifier is not returned.



The last param is a storage buffer to hold an ID, not a handle. This should be casted as something like:

Code:
DWORD dwThreadId = NULL;
CreateRemoteThread( ... , &dwThreadId );

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 26, 2008 10:06 am    Post subject: Reply with quote

Ok, I fixed it. But now errorcode isn't being initialized. So if I initialize it to NULL/0 because it's not being used it says:

Quote:

First-chance exception at 0x7c82145e in Dll Injector.exe: 0xC0000005: Access violation writing location 0x00000000.
Unhandled exception at 0x7c82145e in Dll Injector.exe: 0xC0000005: Access violation writing location 0x00000000.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Mon May 26, 2008 10:10 am    Post subject: Reply with quote

Code:
            if(WaitForSingleObject(hThread, INFINITE) != WAIT_FAILED) {
               LPDWORD exitcode;
               if(GetExitCodeThread(hThread, exitcode)) {
                  Inject = (exitcode == NULL) ? FALSE : TRUE;
               }


I assume you mean that. Change it to DWORD exitcode; and put it at the top with the rest of the other variables for the function. Then call GetExitCodeThread using &exitcode instead of just exitcode.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 26, 2008 11:05 am    Post subject: Reply with quote

Thank you Wiccaan. It finally works now. I do have a question though. How would I make it so that it can detect if that process is still running. So then if you end the process it will take the process name out of my editbox and I can refresh the process list. And mainly, I had another thread that nobody could seem to help with, but with my second editbox displaying the process name selected is supposed to display the process name whenever you click/double click a process name. But it only displays if you hover over a button. My code is:

Code:

case WM_NOTIFY:
   GetIndexName();
   break;


But if I filter it it won't work at all:

Code:

case WM_NOTIFY:
   switch(LOWORD(wParam)) {
      case IDC_PROCESS_EDIT:
         GetIndexName();
         break;
   }
break;

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Mon May 26, 2008 11:38 am    Post subject: Reply with quote

Up to you how you want to do it, you could remove the item based on it's index. Or you could clear the full list and refill it.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 26, 2008 12:12 pm    Post subject: Reply with quote

Nonono, how would I detect that it stopped?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Mon May 26, 2008 12:22 pm    Post subject: Reply with quote

loop createtool32helpsnapshot
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 26, 2008 12:26 pm    Post subject: Reply with quote

Somehow I think there is a better way...
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Mon May 26, 2008 1:52 pm    Post subject: Reply with quote

oib111 wrote:
Somehow I think there is a better way...


PsSetCreateProcessNotifyRoutine

http://www.osronline.com/DDKx/kmarch/k108_5lwy.htm

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 26, 2008 2:04 pm    Post subject: Reply with quote

example plz o.o I have no idea how to even go about doing that.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Mon May 26, 2008 2:29 pm    Post subject: Reply with quote

Im pretty sure you have to code a driver, but if you don't want to do that, then just loop CreateToolhelp32Snapshot.

Else, here's an example. It's called Process Hunter



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.


_________________
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Mon May 26, 2008 2:30 pm    Post subject: Reply with quote

There's no need for you to code a driver for such a task, I believe Wiccaan already answered your question in one of your topics.
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 26, 2008 2:36 pm    Post subject: Reply with quote

Yeah I've seen that before. I think I'll just loop CreateToolhelp32Snapshot. But what do I do to compare the snapshots. I can't just do:

Code:

if(hSnapshot2 == hSnapshot) {
}

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Mon May 26, 2008 9:10 pm    Post subject: Reply with quote

That's where your program becomes different from everyone else's. Razz

I, personally, would probably create an array of process name strings, and do some checking via indexes, like so:

Code:

//Declared somewhere else:
char *procNames1[10];
char *procNames2[10];

//...

//...

for( int i = 0; i < 10; i++ ) {
      if( strcmp( procNames1[i], procNames2[i] ) != 0 ) //do update
}


It's your program, though. =P

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 26, 2008 9:51 pm    Post subject: Reply with quote

Code:

hSnapshot2 = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
PROCESSENTRY32 Pe32;
Pe32.dwSize = sizeof(PROCESSENTRY32);
Process32First(hSnapshot2, &Pe32);
do {
   if(strcmp(pe32.szExeFile, Pe32.szExeFile) != 0) {
      SendMessage(hList, LB_RESETCONTENT, NULL, NULL);
      ListProcess();
   }
} while(Process32Next(hSnapshot2, &Pe32));
CloseHandle(hSnapshot2);


And I could put that in a timer or something that does that like every 3 seconds. But of course then I guess I would have to make my hSnapshot and pe32 variables global...

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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