Author Topic: [VB2010exp] ending a process  (Read 1394 times)

0 Members and 1 Guest are viewing this topic.

Offline gh0st

  • Sir
  • ***
  • Posts: 575
  • Cookies: 8
  • #DEDSec
    • View Profile
[VB2010exp] ending a process
« on: May 29, 2011, 02:44:59 am »
well guys I would like to make a tool in visual basic 2010 express which ends a specific process by just pressing f1 or any other buttom
any kind of suggestion will be apreciated thanx in advance
 
 
« Last Edit: May 29, 2011, 02:45:55 am by gh0st »

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [VB2010exp] ending a process
« Reply #1 on: May 29, 2011, 03:39:13 am »
Code: [Select]
shell("tskill NAME")

That will kill your process, by name NAME. To make it work with a hotkey(globally), you have to look into the GetAsyncKeyState(). Here is an example:

Code: [Select]
<DllImport("user32.dll")> _
Public Shared Function GetAsyncKeyState(ByVal vKey As System.Windows.Forms.Keys) As integer
End Function

Sub BackgroundThreadThatWillLoopForever()
while (1)
     Dim x as integer = GetAsyncKeyState(keys.f1)
     If x = 1 or x = -32767 then
          shell("tskill NAME")
     End if
     System.threading.thread.sleep(1)
     application.doevents()
loop
End sub

I coded that by hand now, and have not tested it but im pretty sure that should work ;)
« Last Edit: May 29, 2011, 03:40:02 am by ande »
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

iMorg

  • Guest
Re: [VB2010exp] ending a process
« Reply #2 on: May 29, 2011, 05:07:53 am »
I would suggest using TerminateProcess and provide a handle to the process. That way if your program doesnt have the access rights to kill the selected process you can update the security token of the program.


Example:
Code: [Select]
// iMorg->EvilZone

bool KillProc(unsigned long pid)
{
     HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS,
                                                         FALSE,
                                                         pid);
     if (pHandle == NULL)
          return false;
     if( !TerminateProcess(pHandle, 0) )
        return false;
     else
        return true;
}


To do it when a key is pressed you can use GetAsyncKeyState() as ande said or you can hook the keyboard and look for the correct message.


EDIT: Shit didnt see the VB, nvm. Ill leave it if you ever need a c++ example anyway.



E
« Last Edit: May 29, 2011, 05:20:58 am by iMorg »