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 


[Help please..] Getting GG's HANDLE from maple's process
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
assaf84
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sat Aug 18, 2007 10:56 am    Post subject: [Help please..] Getting GG's HANDLE from maple's process Reply with quote

Well, that's about the only thing that I need..
I'm making a dll that will be injected to maple, and I want to put there the CRC bypass for GG and maple. The only problem is that I can't get GG's HANDLE from FindWindow.
I don't have a lot of ideas how to get it.. I can make another dll that will be injected into GG, but I really prefer that it'll be just 1 dll for maple.
Does anyone know how I can get it?

Thanks a lot...
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Aug 18, 2007 11:09 am    Post subject: Reply with quote

FindWindow retrieves a handle to the window, not the process. To get a handle of a process, use OpenProcess.
_________________
Back to top
View user's profile Send private message
assaf84
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sat Aug 18, 2007 11:27 am    Post subject: Reply with quote

Ahh.. Thanks!
I searched it in MSDN, and I see that I need the process ID.. Um... Sorry for all the questions, but how do I get it..?
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Aug 18, 2007 11:38 am    Post subject: Reply with quote

There's many ways of obtaining a process ID, you may want to search for one that suites your needs. Anyway, this is a function that Flyte posted a long time ago.

Code:
DWORD GetProcessID(char* strProcessName)       
{
   HANDLE hProcessSnap;
   PROCESSENTRY32 pe32;
   hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
   if(hProcessSnap == INVALID_HANDLE_VALUE)
      return FALSE;
   else
   {   
      pe32.dwSize = sizeof(PROCESSENTRY32);
      if(Process32First(hProcessSnap, &pe32) == 0)
      {
         CloseHandle(hProcessSnap);
         return FALSE;
      }
      else
      {
         do
         {
            if(stricmp(pe32.szExeFile, strProcessName) == 0)
            {
               CloseHandle(hProcessSnap);
               
            return pe32.th32ProcessID;
            }
         } while(Process32Next(hProcessSnap, &pe32));
      }
   }
   CloseHandle(hProcessSnap);
   return FALSE;
}

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

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sat Aug 18, 2007 11:46 am    Post subject: Reply with quote

Thanks a lot UnLmtD.. +rep for you Smile
Do u think that I can get GG's handle this way? I mean, is this:
Code:
hGG = (HANDLE)GetProcessID("GameMon.des");

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

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Aug 18, 2007 11:49 am    Post subject: Reply with quote

When I needed MapleStory PID, I did the fallowing
Code:
DWORD pID = GetProcessID("MapleStory.exe");


pID was holding the process ID, I bet you can do the same with gamemon.des

_________________
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sat Aug 18, 2007 12:05 pm    Post subject: Reply with quote

UnLmtD wrote:
FindWindow retrieves a handle to the window, not the process. To get a handle of a process, use OpenProcess.

OpenProcess = hooked.

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

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Aug 18, 2007 12:09 pm    Post subject: Reply with quote

sponge wrote:
UnLmtD wrote:
FindWindow retrieves a handle to the window, not the process. To get a handle of a process, use OpenProcess.

OpenProcess = hooked.


He can use OpenProcess while it's not hooking yet, and save the handle for later use.

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

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sat Aug 18, 2007 12:10 pm    Post subject: Reply with quote

But I'm using it inside Maple's process..

edit:
UnLmtD wrote:
sponge wrote:
UnLmtD wrote:
FindWindow retrieves a handle to the window, not the process. To get a handle of a process, use OpenProcess.

OpenProcess = hooked.


He can use OpenProcess while it's not hooking yet, and save the handle for later use.

You mean like using it inside some function, and after I get the handle I would NOP it all or something? XD
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Aug 18, 2007 12:17 pm    Post subject: Reply with quote

Quote:
You mean like using it inside some function, and after I get the handle I would NOP it all or something? XD


No, when you open MapleStory, GameGuard is launched. But it doesn't do it's SDT hooks right away (Not sure when it does userland hooks), it needs to initialize. So you can use that for your advantage.

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

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sat Aug 18, 2007 12:24 pm    Post subject: Reply with quote

um... I'll try doing it on my own first..

BTW, do I need to include anything for the GetProcessID function you gave?

edit: Solved, I needed Tlhelp32.h in my includes.


Last edited by assaf84 on Sat Aug 18, 2007 12:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Aug 18, 2007 12:26 pm    Post subject: Reply with quote

#include <tlhelp32.h> And don't forget to declare the function Smile
_________________
Back to top
View user's profile Send private message
assaf84
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sat Aug 18, 2007 12:45 pm    Post subject: Reply with quote

Dammit.. It just cant get the process ID! It never pass the:
Code:
while( !(pID = GetProcessID("GameMon.des")) )
         Sleep(100);


I put a beep before and after, and it gives me only 1 beep.
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Aug 18, 2007 1:08 pm    Post subject: Reply with quote

Umm, I don't know why. I just tried in a console application, it worked well...
Code:
#include <windows.h>
#include <tlhelp32.h>
#include <stdio.h>
#include <conio.h>

DWORD GetProcessID(char* strProcessName);
HANDLE hProcess;

int main(void)
{
   DWORD pID = GetProcessID("GameMon.des");
   //hProcess=OpenProcess(PROCESS_ALL_ACCESS ,TRUE,pID);

   printf("GameMon.des PID: %d",pID);
   _getch();

   return 0;
}


DWORD GetProcessID(char* strProcessName)          // <----- Thanks to Flyte
{
   HANDLE hProcessSnap;
   PROCESSENTRY32 pe32;
   hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
   if(hProcessSnap == INVALID_HANDLE_VALUE)
      return FALSE;
   else
   {   
      pe32.dwSize = sizeof(PROCESSENTRY32);
      if(Process32First(hProcessSnap, &pe32) == 0)
      {
         CloseHandle(hProcessSnap);
         return FALSE;
      }
      else
      {
         do
         {
            if(stricmp(pe32.szExeFile, strProcessName) == 0)
            {
               CloseHandle(hProcessSnap);
               
            return pe32.th32ProcessID;
            }
         } while(Process32Next(hProcessSnap, &pe32));
      }
   }
   CloseHandle(hProcessSnap);
   return FALSE;
}

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

Joined: 26 Feb 2006
Posts: 743

PostPosted: Sat Aug 18, 2007 1:14 pm    Post subject: Reply with quote

Patch MapleStory to store the handle returned by CreateProcess(Ex?) or find the (pointer to the) location where MapleStory stores the handle, then use that.

Also, use DbgPrint or w/e the value of GetLastError, that will give you a hint.
EDIT: My guess is OpenProcess is hooked to always return 0, so loop never breaks out.

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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