 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Fri Jul 19, 2013 11:45 am Post subject: ZwTerminateProcess crashes |
|
|
After I attach my driver using KeStackAttachProcess to the target application, I try to call ZwTerminateProcess to close the process after I'm done with it but each time I call it I get a BSOD.
| Code: |
ZwTerminateProcess ( NtCurrentProcess (), ntStatus );
|
I thought that I couldn't terminate the process while I was still attached to it, so I removed that code and put it in my unload function (which by then has already detached itself from the game) and tried this:
| Code: |
ZwTerminateProcess ( hTarget, ntStatus );
|
with hTarget being ofcourse the handle to the target process. While I was still attached to the target I did hTarget = NtCurrentProcess ().
I read on msdn that they wanted me to use a kernel handle, so I used ZwOpenProcess to try and locate the handle like so:
| Code: |
ntStatus = ZwOpenProcess ( &hTarget, DELETE, NULL, (PCLIENTID) &dwProcessID );
if ( ntStatus == STATUS_SUCCESS )
TerminateProcess ( hTarget, ntStatus );
|
but that still didn't cut it.
so i'm confused now and I have no idea what i'm doing wrong.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25823 Location: The netherlands
|
Posted: Fri Jul 19, 2013 12:11 pm Post subject: |
|
|
Perhaps your handle doesn't have the rights to Terminate ?
Also, I take it you meant ZwTerminateProcess ?
Another method to get a handle:
| Code: |
if (PsLookupProcessByProcessId((PVOID)(UINT_PTR)(processid),&selectedprocess)==STATUS_SUCCESS)
{
DbgPrint("Calling ObOpenObjectByPointer\n");
ntStatus=ObOpenObjectByPointer (
selectedprocess,
0,
NULL,
PROCESS_ALL_ACCESS,
*PsProcessType,
KernelMode, //UserMode,
&ProcessHandle);
DbgPrint("ntStatus=%x",ntStatus);
}
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sat Jul 20, 2013 1:40 pm Post subject: |
|
|
Thanks that worked out fine.
Appreciate the help!
|
|
| Back to top |
|
 |
|
|
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
|
|