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

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


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


Desconectado Desconectado

Mensajes: 624



Ver Perfil
Path (SRC)
« en: 24 Enero 2010, 16:34 pm »


Una boludez, pero a veces puede servir, con este code se puede saber la ruta (Path) del ejetutable al  que pertenece a una ventana, solo hay que pasar el puntero del mouse sobre la ventana que se quiere "investigar".

Código:

Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
'Dessa
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwprocessid As Long) 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 Function GetModuleFileNameExA Lib "PSAPI.DLL" (ByVal hProcess As Long, ByVal hModule As Long, ByVal lpFilename As String, ByVal nSize As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI: x As Long: y As Long: End Type


Private Sub Form_Load()

  Dim ClassName As String: ClassName = Space$(256)
  Dim ret As Long: ret = GetClassName(Me.hwnd, ClassName, 256)
  If Left$(ClassName, ret) = "ThunderFormDC" Then
    MsgBox "Esta aplicacion debe correr compilada", , ""
    End
  End If
 
  Me.BackColor = vbBlack: Me.ForeColor = vbWhite: Me.FontBold = True
  Me.Top = 0: Me.Left = 0: Me.Width = 6450: Me.Height = 1000
  Me.BorderStyle = 5: Timer1.Interval = 16

End Sub

Private Sub Timer1_Timer()
 
  Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, &H2 Or &H1)
  Dim Cor As POINTAPI: Dim retorno As Long: retorno = GetCursorPos(Cor)
  Dim Handle As Long: Handle = WindowFromPoint(Cor.x, Cor.y)
  Dim idProc As Long: Call GetWindowThreadProcessId(Handle, idProc)
  Dim Handle_Proceso As Long: Handle_Proceso = OpenProcess(&H400 + &H10, 0, idProc)
  Dim Buffer As String: Buffer = Space$(255)
  Dim ret As Long: ret = GetModuleFileNameExA(Handle_Proceso, 0, Buffer, 255)
  Dim Ruta As String: Ruta = Left$(Buffer, ret): Call CloseHandle(Handle_Proceso)
 
  Me.Cls: Me.Print "": Me.Print Ruta: Me.Caption = "ID PROCESO =  " & idProc

End Sub





En línea

Adrian Desanti
seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: Path (SRC)
« Respuesta #1 en: 24 Enero 2010, 16:41 pm »

esta buena la idea  ;D, lo unico que no me gusta es el tema ese de programar en una linea, la verdad casi no se puede leer el codigo.

saludos.


En línea

Dessa


Desconectado Desconectado

Mensajes: 624



Ver Perfil
Re: Path (SRC)
« Respuesta #2 en: 24 Enero 2010, 16:51 pm »

Si, es una de mis tantas malas costumbres  ;)

Código:


Option Explicit

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
'Dessa
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwprocessid As Long) 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 Function GetModuleFileNameExA Lib "PSAPI.DLL" (ByVal hProcess As Long, ByVal hModule As Long, ByVal lpFilename As String, ByVal nSize As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI: x As Long: y As Long: End Type

Dim CtlHandle As Long


Private Sub Form_Load()
 
  Me.BackColor = vbBlack
  Me.ForeColor = vbWhite
  Me.FontBold = True
  Me.Top = 0: Me.Left = 0
  Me.Width = 6450
  Me.Height = 1000
  Me.BorderStyle = 5
  Timer1.Interval = 16

End Sub

Private Sub Timer1_Timer()
 
  Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, &H2 Or &H1)
 
  Dim Cor As POINTAPI
  Call GetCursorPos(Cor)
 
  Dim Handle As Long
  Handle = WindowFromPoint(Cor.x, Cor.y)
 
  If Handle <> CtlHandle Then

      Dim idProc As Long
      Call GetWindowThreadProcessId(Handle, idProc)
 
      Dim Handle_Proceso As Long
      Handle_Proceso = OpenProcess(&H400 + &H10, 0, idProc)
 
      Dim Buffer As String
      Buffer = Space$(255)
      Dim ret As Long
      ret = GetModuleFileNameExA(Handle_Proceso, 0, Buffer, 255)
 
      Dim Ruta As String
      Ruta = Left$(Buffer, ret)
 
      Call CloseHandle(Handle_Proceso)
 
      Me.Cls
      Me.Print ""
      Me.Print Ruta
 
      Me.Caption = "PID =  " & idProc
   
      CtlHandle = Handle

  End If

End Sub



« Última modificación: 28 Enero 2010, 21:17 pm por Dessa » En línea

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

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
problema con app.path
Programación Visual Basic
maxtextla 9 4,380 Último mensaje 5 Octubre 2011, 00:38 am
por 79137913
Path of exile
Juegos y Consolas
marc20 0 3,156 Último mensaje 27 Septiembre 2013, 11:25 am
por marc20
IIS Physical Path?
Hacking
cachuchin 0 2,278 Último mensaje 12 Mayo 2020, 03:03 am
por cachuchin
Red Team Tools Path
Tutoriales - Documentación
ehn@ 0 847 Último mensaje 16 Noviembre 2023, 16:49 pm
por ehn@
PenTesting Path
Tutoriales - Documentación
ehn@ 0 1,437 Último mensaje 17 Noviembre 2023, 17:47 pm
por ehn@
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines