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 


Finding WoW Pid

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
cereal1
Cheater
Reputation: 0

Joined: 29 May 2007
Posts: 27

PostPosted: Wed Jul 23, 2008 4:20 pm    Post subject: Finding WoW Pid Reply with quote

In delphi 7 I can use

Code:
Pidhandle := OpenProcess(PROCESS_ALL_ACCESS,False,Pid);


To get the pidhandle of regular programs, calc.exe, explorer.exe, but i get a handle of 0 for WoW.exe. What do I need to do for the program to get the pid?


Last edited by cereal1 on Wed Jul 23, 2008 10:21 pm; edited 1 time in total
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: Wed Jul 23, 2008 4:48 pm    Post subject: Reply with quote

First off, there is no such thing as a "pidhandle." And even if there was it
would be two words. You're describing a PROCESS HANDLE (read it in the patronizing loud, slow voice to get desired effect). To obtain you need:

CreateToolhelp32Snapshot API
PROCESSENTRY32 Structure
Process32First API
Process32Next API
CloseHandle API

Declare hSnapshot as a HANDLE and then call CreateToolhelp32Snapshot with the appropriate parameters and have the return value go into hSnapshot. Declare a PROCESSENTRY32 structure and set dwSize to the size of the structure. Then call Process32First. Then do a do while loop where you compare the name of WoW's process to PROCESSENTRY32 member szExeFile. If they're equal open up the process with the pid as the PROCESSENTRY32 member th32ProcessID member (I forgot to say declare a handle to the process variable before but you should have). Then call CloseHandle on 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
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Wed Jul 23, 2008 5:28 pm    Post subject: Reply with quote

Code:
PROCESS_ALL_ACCESS


You might not have the right privelages to use that on WoW.exe

See http://msdn.microsoft.com/en-us/library/ms717797(VS.85).aspx
Back to top
View user's profile Send private message MSN Messenger
oib111
I post too much
Reputation: 0

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

PostPosted: Wed Jul 23, 2008 5:43 pm    Post subject: Reply with quote

To change privileges.

Code:

TOKEN_PRIVILEGES tp;
LUID luid;
HANDLE hToken;

OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)
tp.PrivilegeCount = 1;
tp.Privileges[0].luid = luid;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tp, NULL, NULL, NULL);

_________________


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
cereal1
Cheater
Reputation: 0

Joined: 29 May 2007
Posts: 27

PostPosted: Wed Jul 23, 2008 10:35 pm    Post subject: Reply with quote

noz3001 wrote:
Code:
PROCESS_ALL_ACCESS


You might not have the right privelages to use that on WoW.exe



Yeah, that might be the problem, I THINK I've added the code to adjust privileges correctly. Here's the code now with the AdjustTokenPrivileges stuff added.

Code:

var
  Form1: TForm1;
  Pid: Integer;
  Pidhandle: integer;
  Written: Cardinal;
  hToken: THandle;
  tp,tpPrev: TOKEN_PRIVILEGES;
  luid: integer;
  dwRetLen: Dword;

Const
  process = 'wow.exe';    //Change this back to wow.exe when finished
  SE_DEBUG_NAME = 'SeDebugPrivilege';

function GetID(Const ExeFileName: string; var ProcessId: integer): boolean;
var
  ContinueLoop: BOOL;
  FSnapshotHandle: THandle;
  FProcessEntry32: TProcessEntry32;
begin
  result := false;
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
  while integer(ContinueLoop) <> 0 do begin
   if (StrIComp(PChar(ExtractFileName(FProcessEntry32.szExeFile)), PChar(ExeFileName)) = 0)
      or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0)  then begin
      ProcessId:= FProcessEntry32.th32ProcessID;
      result := true;
      break;
   end;
   ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
  end;
  CloseHandle(FSnapshotHandle);

OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken);
LookupPrivilegeValue(NIL, SE_DEBUG_NAME, tp.Privileges[0].LUID);
tp.PrivilegeCount := 1;
tp.Privileges[0].LUID := LUID;
tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, tp, sizeof(tp), tpPrev, dwretlen);

end;


I've just been clicking a button to see if I've got the handle:

Code:
procedure TForm1.btn_NoClip_OnClick(Sender: TObject);
begin
if GetID(process, Pid) then
Showmessage(IntToStr(Pid));
Pidhandle := OpenProcess(PROCESS_ALL_ACCESS,False,Pid);
lbl_handle.Caption:= ('Pid = '+(IntToStr(PidHandle)));

end;


If I do
Code:
AdjustTokenPrivileges(hToken, FALSE, &tp, NULL, NULL, NULL);
like posted above I get this error "[Error] There is no overloaded version of 'AdjustTokenPrivileges' that can be called with these arguments"
No errors the way I have it now but it still doesnt get the Pid for wow.exe.


Last edited by cereal1 on Wed Jul 23, 2008 11:23 pm; edited 4 times in total
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Thu Jul 24, 2008 4:36 am    Post subject: Reply with quote

You could always try CreateProcess and get a handle that way.
Back to top
View user's profile Send private message MSN Messenger
STN
I post too much
Reputation: 43

Joined: 09 Nov 2005
Posts: 2673

PostPosted: Thu Jul 24, 2008 6:15 am    Post subject: Reply with quote

meh, just a little google and there's plenty to be found.

http://www.extalia.com/forums/viewtopic.php?f=21&t=2456

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

Joined: 29 May 2007
Posts: 27

PostPosted: Thu Jul 24, 2008 1:35 pm    Post subject: Reply with quote

STN wrote:
meh, just a little google and there's plenty to be found.



That sample trainer uses AdjustTokenPrivileges, which doesn't seem to work with WoW.
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: Thu Jul 24, 2008 1:59 pm    Post subject: Reply with quote

x0r wrote:
I'm assuming Warden is getting in the way.


QFT

_________________


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
cereal1
Cheater
Reputation: 0

Joined: 29 May 2007
Posts: 27

PostPosted: Thu Jul 24, 2008 10:38 pm    Post subject: Reply with quote

oib111 wrote:
x0r wrote:
I'm assuming Warden is getting in the way.


QFT


CE can do it easy enough, well maybe not easily. I'll look through the source and see what I can find.
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

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

PostPosted: Thu Jul 24, 2008 10:42 pm    Post subject: Reply with quote

http://forum.cheatengine.org/viewtopic.php?p=2638101#2638101
_________________
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
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Thu Jul 24, 2008 11:26 pm    Post subject: Reply with quote

Check out 'The Governor', its a program to monitor what Warden does:
http://www.rootkit.com/newsread_print.php?newsid=371

It might help with getting into WoW.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    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