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 


[VB6 Tips] Killing Processes

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

Joined: 04 Jan 2008
Posts: 72
Location: Republic of Korea (South Korea)

PostPosted: Mon Jan 28, 2008 7:16 am    Post subject: [VB6 Tips] Killing Processes Reply with quote

Can I post this on General programming section?? Anyway i'll post it... if it isn't right then quote me please...;

We usually use these five ways when we kill process. On this topic, I'll give you ways to kill processes.(There are many ways but i'll introduce five ways.)

1. OpenProcess -> TerminateProcess
Mostly, we use this method.
This is an example for it.
Code:
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32.dll" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
    Private Const PROCESS_TERMINATE = 1&
    Private Const ProcessID = 621 'You have to put process id here
    Dim hProcess As Long
    hProcess = OpenProcess(PROCESS_TERMINATE, 0, ProcessID)
    'Open Process
    TerminateProcess hProcess, 0& ' Terminate Process
    'Return Handle
    CloseHandle hProcess

We use mostly but it isn't safe. Because, it doesn't return resources completely.

2. CreateRemoteThread -> ExitProcess
I want you to use this method. It is better than the first one, i think.
Code:

Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CreateRemoteThread Lib "kernel32.dll" (ByVal hProcess As Long, ByRef lpThreadAttributes As Any, ByVal dwStackSize As Long, ByRef lpStartAddress As Long, ByRef lpParameter As Any, ByVal dwCreationFlags As Long, ByRef lpThreadId As Long) As Long
Private Declare Function GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long

 

    Private Const PROCESS_CREATE_THREAD = 2&
    Private Const ProcessID = 621 ' You have to put process id here
    Dim hProcess As Long, KernelModule As Long, hThread As Long, ThreadID As Long
    hProcess = OpenProcess(PROCESS_CREATE_THREAD, 0, ProcessID)
    'Open
    KernelModule = GetModuleHandle("KERNEL32.DLL") 'Get KERNEL32.DLL Base Address
    hThread = CreateRemoteThread (hProcess, ByVal 0, 0, ByVal GetProcAddress(KernelModule, "ExitProcess"), ByVal 0&, 0, ThreadID) ' Create thread with ExitProcess's address
    ' Returns handle
    CloseHandle hThread
    CloseHandle hProcess


3. DebugActiveProcess
DebugActiveProcess debugs process and if we use this, and the process will be debugged and if we kill debugger (vb6 compiled program), a process that you want to kill will be killed.This method is really simple.

Code:

Private Declare Function DebugActiveProcess Lib "kernel32.dll" (ByVal dwProcessId As Long) As Long


    Private Const ProcessID = 621 'You have to put process id here
    DebugActiveProcess ProcessID
    End


4. Kill process with Terminal Services
well it's an unofficial way to kill process but it works general computers.

Code:

Private Declare Function WinStationTerminateProcess Lib "winsta.dll" (ByVal hServer As Long, ByVal ProcessId As Long, ByVal ExitCode As Long) As Long
 
    Private Const ProcessID = 621 'You have to put process id here
    Private Const WTS_CURRENT_SERVER_HANDLE = 0&
    WinStationTerminateProcess WTS_CURRENT_SERVER_HANDLE, ProcessId, 0


5. Kill process with TSKILL.EXE
well it doesn't need any APIs and it's reallyy simple.!
Code:

Shell "tskill MapleStory", vbHide

And there are many ways except for these ways.
You can send message to process WM_CLOSE,
you can call PsTerminateProcess() in kernel level,
you can kill all threads with TerminateThread, and anything!

Thank you...?

_________________

[img]
<a><img></a>[/img]
iroo sooo hooooot
Back to top
View user's profile Send private message
sangeli
Master Cheater
Reputation: 0

Joined: 07 Dec 2006
Posts: 406

PostPosted: Mon Jan 28, 2008 6:27 pm    Post subject: Reply with quote

so, i could use this to kill processes like Ollydbg and other debuggers to prevent my password form from being hacked? if so, NICE.

a major step in anti cracking code

_________________
Dark Byte wrote:
ce can certainly damage hardware let's say you have a robotarm attached to your computer, and the software limits usually block it from ripping out it's own cpu. If you remove that limit and then issue the command to rip out the cpu, sure, say goodbye to your hardware
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Mon Jan 28, 2008 6:29 pm    Post subject: Reply with quote

sangeli wrote:
so, i could use this to kill processes like Ollydbg and other debuggers to prevent my password form from being hacked? if so, NICE.

a major step in anti cracking code

No.

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Jan 28, 2008 6:48 pm    Post subject: Reply with quote

someone can nop out the code or change the window or process name
_________________
Back to top
View user's profile Send private message
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Mon Jan 28, 2008 7:10 pm    Post subject: Reply with quote

Or put a hook on NtOpenProcess and NtTerminateProcess.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Jan 28, 2008 10:19 pm    Post subject: Reply with quote

You can just hook any of the API you listed and force false returns and disable the from executing their normal code. For example TerminateProcess, compare the given handle to your processes handle, if they match, just return without executing the real TerminateProcess.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Tue Jan 29, 2008 2:42 am    Post subject: Reply with quote

sangeli wrote:
so, i could use this to kill processes like Ollydbg and other debuggers to prevent my password form from being hacked? if so, NICE.

a major step in anti cracking code


lol'd, a MAJOR step ? i tried it and it sucks ;D
Back to top
View user's profile Send private message
sangeli
Master Cheater
Reputation: 0

Joined: 07 Dec 2006
Posts: 406

PostPosted: Tue Jan 29, 2008 10:52 pm    Post subject: Reply with quote

Rot1 wrote:
sangeli wrote:
so, i could use this to kill processes like Ollydbg and other debuggers to prevent my password form from being hacked? if so, NICE.

a major step in anti cracking code


lol'd, a MAJOR step ? i tried it and it sucks ;D


i guess im wrong. calm down guys.

_________________
Dark Byte wrote:
ce can certainly damage hardware let's say you have a robotarm attached to your computer, and the software limits usually block it from ripping out it's own cpu. If you remove that limit and then issue the command to rip out the cpu, sure, say goodbye to your hardware
Back to top
View user's profile Send private message
tornarrow
Master Cheater
Reputation: 0

Joined: 29 Jan 2008
Posts: 289

PostPosted: Tue Jan 29, 2008 10:55 pm    Post subject: Re: [VB6 Tips] Killing Processes Reply with quote

Buggy wrote:
Can I post this on General programming section??

yesh
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Jan 30, 2008 8:47 am    Post subject: Re: [VB6 Tips] Killing Processes Reply with quote

tornarrow wrote:
Buggy wrote:
Can I post this on General programming section??

yesh


Thats not really up to you to decide.

@Buggy:

The things you are showing are nice to help with some low level methods of security, but thats basically all they are. Low-level. Every method you have posted has been used before for a while now as the Windows API has been around for years and years. With that being said, tons of bypasses for each method have been created already. These are nothing more then basic uses of the API which most if not everyone should know how to use if they are programming. Wink

If you want to add something to the General Programming+ section, create your own protection and prove it's worth. Smile

_________________
- 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