| View previous topic :: View next topic |
| Author |
Message |
cereal1 Cheater
Reputation: 0
Joined: 29 May 2007 Posts: 27
|
Posted: Wed Jul 23, 2008 4:20 pm Post subject: Finding WoW Pid |
|
|
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 |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jul 23, 2008 4:48 pm Post subject: |
|
|
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 |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jul 23, 2008 5:43 pm Post subject: |
|
|
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 |
|
 |
cereal1 Cheater
Reputation: 0
Joined: 29 May 2007 Posts: 27
|
Posted: Wed Jul 23, 2008 10:35 pm Post subject: |
|
|
| noz3001 wrote: |
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 |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Thu Jul 24, 2008 4:36 am Post subject: |
|
|
| You could always try CreateProcess and get a handle that way.
|
|
| Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2673
|
|
| Back to top |
|
 |
cereal1 Cheater
Reputation: 0
Joined: 29 May 2007 Posts: 27
|
Posted: Thu Jul 24, 2008 1:35 pm Post subject: |
|
|
| 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 |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Thu Jul 24, 2008 1:59 pm Post subject: |
|
|
| 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 |
|
 |
cereal1 Cheater
Reputation: 0
Joined: 29 May 2007 Posts: 27
|
Posted: Thu Jul 24, 2008 10:38 pm Post subject: |
|
|
| 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 |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
|
| Back to top |
|
 |
|