elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Tutorial básico de Quickjs


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  IsWay
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: IsWay  (Leído 1,568 veces)
Hasseds

Desconectado Desconectado

Mensajes: 145



Ver Perfil
IsWay
« en: 22 Mayo 2011, 00:08 am »



Código:

Option Explicit

'Author: Sergio Desanti
'Proved: XP (32 BIT)

Private Declare Function CreateToolhelp32Snapshot Lib "Kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Sub CloseHandle Lib "Kernel32" (ByVal hPass As Long)

Private Declare Function GetModuleFileNameExA Lib "PSAPI.DLL" (ByVal hProcess As Long, ByVal hModule As Long, ByVal lpFilename As String, ByVal nSize As Long) As Long

Private Type PROCESSENTRY32
    dwSize As Long: cntUsage As Long: th32ProcessID As Long: th32DefaultHeapID As Long: th32ModuleID As Long: cntThreads As Long: th32ParentProcessID As Long: pcPriClassBase As Long: dwFlags As Long: szExeFile As String * 260
End Type

Private Sub Form_Load()
   
    Shell "calc"
    Shell "calc"
   
    MsgBox IsWay("caLc.Exe")

End Sub

Private Function IsWay(ByVal NombreDelProceso As String) As String
 
  Dim Handle_Procesos As Long
  Handle_Procesos = CreateToolhelp32Snapshot(&HF, 0&)
 
  Dim PE32 As PROCESSENTRY32
  PE32.dwSize = Len(PE32)

  Dim PidProc   As Long
  Dim NameProc  As String
  Dim RutaProc  As String
 
  Dim ret As Long
  ret = Process32First(Handle_Procesos, PE32)
   
  While ret > 0
   
      NameProc = Split(PE32.szExeFile, Chr$(0))(0)
   
      If LCase$(NameProc) = LCase$(NombreDelProceso) Then
     
          PidProc = PE32.th32ProcessID
     
          Dim H_Proceso As Long
          H_Proceso = OpenProcess(&H410, &H0, PidProc)
   
          Dim Buffer As String * &H104
   
          Call GetModuleFileNameExA(H_Proceso, &H0, Buffer, &H104)
          Call CloseHandle(H_Proceso)
   
          RutaProc = Split(Buffer, Chr$(0))(0)
     
          IsWay = IsWay & vbNewLine & RutaProc & vbTab & PidProc
   
      End If
   
      ret = Process32Next(Handle_Procesos, PE32)
 
  Wend
 
  Call CloseHandle(Handle_Procesos)

  If IsWay = "" Then IsWay = "No esta Corriendo"
 
End Function





En línea

Sergio Desanti
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines