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

 

 


Tema destacado: Estamos en la red social de Mastodon


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12
21  Foros Generales / Foro Libre / Re: amistades entre foros :P en: 19 Septiembre 2011, 02:26 am
Raul100 , me juego los gemelos... que el problema lo tubiste en el foro de VB con Alexmarycoll !!!

22  Programación / Programación Visual Basic / Re: Seriales de Pen-Drives conectados (SRC) en: 17 Septiembre 2011, 01:08 am
Agrego (por si el tema le interesó a alguien) un modulo para asociar la letra de unidad con su respectivo Serial (ESN) de Pen Drive.

Nota1: no pude probar como se comporta el código con Discos uSB externos ni con grabadoras USB, lo voy a hacer en cuanto tenga la oportunidad

Nota 2: es posible que no haya que llamar 2 veces a SetupDiGetDeviceInterfaceDetail, creo que RequiredSize As Long (lSize en el codigo) de esta api seria de &H7B para la clase "{53f56307-b6bf-11d0-94f2-00a0c91efb8b}" pero solo pude probar en XP conectando de uno hasta seis PenDrive.

Saludos


MODULO:

Código
  1.  
  2. Option Explicit
  3.  
  4. 'Modulo: FlashSerial
  5. 'Autor: Sergio Desanti (Hasseds)
  6. 'Agradecimientos: Seba, Cobein, A.Desanti
  7. 'Test: XP (32 BIT) & W7 (32 BIT)
  8. 'Retorno:  Letra de unidad y Serial Number(ESN) de Pen Drive conectados
  9. '
  10. Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
  11. Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
  12. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  13. Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Long, ByVal dwIoControlCode As Long, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesReturned As Long, ByVal lpOverlapped As Long) As Long
  14.  
  15. Private Declare Function IIDFromString Lib "ole32" (ByVal lpsz As Long, ByRef lpiid As GUID) As Long
  16.  
  17. Private Declare Function SetupDiGetClassDevs Lib "setupapi.dll" Alias "SetupDiGetClassDevsA" (ByRef ClassGuid As GUID, ByVal Enumerator As Long, ByVal hwndParent As Long, ByVal flags As Long) As Long
  18. Private Declare Function SetupDiEnumDeviceInterfaces Lib "setupapi.dll" (ByVal DeviceInfoSet As Long, ByVal DeviceInfoData As Long, ByRef InterfaceClassGuid As GUID, ByVal MemberIndex As Long, ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA) As Long
  19. Private Declare Function SetupDiGetDeviceInterfaceDetail Lib "setupapi.dll" Alias "SetupDiGetDeviceInterfaceDetailA" (ByVal DeviceInfoSet As Long, ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA, DeviceInterfaceDetailData As Any, ByVal DeviceInterfaceDetailDataSize As Long, ByRef RequiredSize As Long, DeviceInfoData As Any) As Long
  20. Private Declare Function SetupDiDestroyDeviceInfoList Lib "setupapi.dll" (ByVal DeviceInfoSet As Long) As Long
  21.  
  22. Private Type STORAGE_DEVICE_NUMBER
  23.    DeviceType As Long: DiskNumber As Long: PartNumber As Long
  24. End Type
  25.  
  26. Private Type GUID
  27.    Data1 As Long: Data2 As Integer: Data3 As Integer: Data4(7) As Byte
  28. End Type
  29.  
  30. Private Type SP_DEVICE_INTERFACE_DATA
  31.    cbSize As Long: InterfaceClassGuid As GUID: flags As Long: Reserved As Long
  32. End Type
  33.  
  34. Private Type SP_DEVICE_INTERFACE_DETAIL_DATA
  35.    cbSize As Long: strDevicePath As String * 260
  36. End Type
  37.  
  38. Public Function FlashSerial(ByVal sLetra As String) As String
  39.  
  40.  sLetra = Left$(UCase$(sLetra), 1) & ":"
  41.  
  42.  FlashSerial = sLetra & " NO USB"
  43.  
  44.  Dim RetDeviceIndex    As Long
  45.  RetDeviceIndex = DeviceIndex(sLetra)
  46.  If RetDeviceIndex < 0 Then Exit Function ' " -1 -2 -3 en DeviceIndex"
  47.  
  48.  Dim TGUID             As GUID
  49.  Call IIDFromString(StrPtr("{53f56307-b6bf-11d0-94f2-00a0c91efb8b}"), TGUID)
  50.  
  51.  Dim hDev              As Long
  52.  hDev = SetupDiGetClassDevs(TGUID, &H0, &H0, &H12)
  53.  If hDev = -1 Then: Exit Function
  54.  
  55.  Dim lCount            As Long
  56.  Dim lSize             As Long
  57.  Dim DTA               As SP_DEVICE_INTERFACE_DATA
  58.  Dim DTL               As SP_DEVICE_INTERFACE_DETAIL_DATA
  59.  
  60.  DTA.cbSize = Len(DTA)
  61.  DTL.cbSize = &H5
  62.  
  63.  Do While Not (SetupDiEnumDeviceInterfaces(hDev, &H0, TGUID, lCount, DTA) = &H0&)
  64.    Call SetupDiGetDeviceInterfaceDetail(hDev, DTA, ByVal &H0&, &H0, lSize, ByVal &H0&)
  65.    Call SetupDiGetDeviceInterfaceDetail(hDev, DTA, DTL, ByVal lSize, &H0&, ByVal &H0&)
  66.    If InStr(UCase$(DTL.strDevicePath), "USB") Then
  67.      If DeviceIndex(DTL.strDevicePath, True) = RetDeviceIndex Then
  68.        If UBound(Split(DTL.strDevicePath, "#")) > 1 Then
  69.          FlashSerial = sLetra & Split(UCase$(DTL.strDevicePath), "#")(2)
  70.          Exit Do
  71.        End If
  72.      End If
  73.    End If
  74.    lCount = lCount + 1
  75.  Loop
  76.  
  77.  Call SetupDiDestroyDeviceInfoList(hDev)
  78.  
  79. End Function
  80.  
  81. Public Function DeviceIndex(ByVal sLetra As String, Optional strDevicePath As Boolean) As Long
  82.  
  83.  Dim hdh As Long, br As Long, SDN As STORAGE_DEVICE_NUMBER
  84.  
  85.  If Not strDevicePath Then sLetra = "\\.\" & Left$(UCase$(sLetra), 1) & ":"
  86.  
  87.  hdh = CreateFile(sLetra, &H0&, &H3&, ByVal &H0&, &H3&, &H0&, &H0&) ': MsgBox hdh, , "hdh"
  88.  If Not (hdh = -1) Then
  89.      If DeviceIoControl(hdh, &H2D1080, &H0&, &H0&, SDN, Len(SDN), br, ByVal &H0&) Then
  90.          If SDN.DeviceType = 7 Then
  91.              DeviceIndex = SDN.DiskNumber  ' Retorno DeviceIndex
  92.          Else
  93.              DeviceIndex = -3   ' No es GUID 53f56307-b6bf-11d0-94f2-00a0c91efb8b
  94.          End If
  95.      Else
  96.          DeviceIndex = -2  ' Floppy o DeviceIoControl = 0 (GetLastError)
  97.      End If
  98.      Call CloseHandle(hdh)
  99.  Else
  100.      DeviceIndex = -1  ' Unidad sin dispositivo o CreateFile = -1 (GetLastError)
  101.  End If
  102.  
  103. End Function
  104.  
  105.  
  106.  



Código
  1.  
  2. Option Explicit
  3.  
  4. Private Sub Form_Load()
  5.  
  6.      MsgBox FlashSerial("f")
  7.  
  8. End Sub
  9.  
  10.  
  11.  







23  Programación / Programación Visual Basic / Re: cargar bytes de la memoria de un proceso en un textbox... en: 10 Septiembre 2011, 01:26 am
Hola , pueden ser por varios motivos, pero dejo el tema para los que mas saben, aún así... te conviene cambiar la siguiente linea:

Código:

If InStr(1, uProcess.szExeFile, sProcess) Then ElPID = uProcess.th32ProcessID



por esta:

Código:

If InStr(1, uProcess.szExeFile, sProcess, vbTextCompare) Then ElPID = uProcess.th32ProcessID




Saludos


24  Programación / Programación Visual Basic / Re: Clickear sin mover mouse en: 28 Agosto 2011, 21:26 pm

Bueno, hay un tal macrocrack que hace click en una coordenada todo el tiempo sin mover el mouse...



yalosabes,  Si aunque sea hubieras leido todo el hilo...


http://foro.elhacker.net/programacion_visual_basic/clickear_sin_mover_mouse-t334718.0.html;msg1652116#msg1652116


http://foro.elhacker.net/programacion_visual_basic/wmnchittest-t336567.0.html;msg1652687#msg1652687


Bah...

q verguenza..

Gracias por la GRAN AYUDA



Nada !!!!

25  Programación / Programación Visual Basic / Re: No logro encontrar handle a SysListView32 de taskmanager en: 28 Agosto 2011, 19:51 pm
Edito: olvidé unos parentesis en el codigo original

http://foro.elhacker.net/programacion_visual_basic/no_logro_encontrar_handle_a_syslistview32_de_taskmanager-t332950.0.html;msg1636759#msg1636759


Código:

Private Function IsWinBorder(ByVal hwnd As Long) As Boolean
   If (GetWindowLong(hwnd, &HFFF0) And &H800000) = &H800000 Then IsWinBorder = True
End Function


26  Programación / Programación Visual Basic / Re: obtener el hwnd de un programa sin form en: 28 Agosto 2011, 19:40 pm
Cita de: BlackZeroX▓▓▒▒░░

Código
  1.  
  2. 'VOID CALLBACK TimerProc(
  3. '  __in  HWND hwnd,
  4. '  __in  UINT uMsg,
  5. '  __in  UINT_PTR idEvent,
  6. '  __in  DWORD dwTime
  7. ');
  8.  
  9.  


Mas claro Imposible !!!

27  Programación / Programación Visual Basic / Re: obtener el hwnd de un programa sin form en: 28 Agosto 2011, 04:59 am

de todos modos en todos los codigos ya espuestos aqui se a guardado el uIDEvent generado por SetTimer() para posteriormente usarlo en el KillTimer()...



A eso me refería, que es mas practico como se expuso que utilizando el  Hwnd, estamos diciendo lo mismo.


es mas practico guardar el retorno de SetTimer para  luego utilizarlo con KillTimer pero esto Por Ejemplo con este hwnd tambien se puede


Código:

Valor de Retorno
Si la función tiene éxito y el parámetro hWnd es NULO, el valor de vuelta es un número entero que identifica el nuevo temporizador.se puede pasar este valor a la función de KillTimer para destruir el temporizador.




Lo que no llego a entender por qué el uIDEvent tambien se puede recuperar a travez de uElapse de TimerProc


Código:


Option Explicit

Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
 
Dim A As Boolean
 
Sub Main()
  
  Call SetTimer(0, 0, 2000, AddressOf TimerProc)
  
 Do While Not A
    DoEvents
  Loop

End Sub
 
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
  Debug.Print uElapse
  Debug.Print KillTimer(0, uElapse)
  A = True
End Sub










28  Programación / Programación Visual Basic / Re: obtener el hwnd de un programa sin form en: 28 Agosto 2011, 00:38 am
Ok, gracias por la aclaración BlackZeroX▓▓▒▒░░ , como dije anteriormente Acabo de enterarme de este tipo hwnd,  ( voy a investigar que utilidad puede tener)

PD:  es mas practico guardar el retorno de SetTimer para  luego utilizarlo con KillTimer pero este Por Ej con este hwnd tambien se puede , lo dicho ( voy a investigar que utilidad puede tener)

Saludos







29  Programación / Programación Visual Basic / Re: obtener el hwnd de un programa sin form en: 27 Agosto 2011, 23:16 pm

buenas pues esa duda tengo :P como puedo obtener el hwnd de un programa de VB sin form?


El tema ya quedó resuelto, pero si alguna vez tenés que obtener el hwnd de un Main podes usar FindWindow. (Acabo de enterarme de esto, ya que también pensaba que este tipo de hwnd era unicamente propio de ventanas).

Código:



Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
 
Sub Main()
  
  Dim lpClase As String
  
  If Not App.LogMode = 0 Then
    lpClase = "ThunderRT6Main" ' Exe Compilado
  Else
    lpClase = "ThunderMain" ' en el IDE
  End If
  
  MsgBox FindWindow(lpClase, App.Title)

End Sub

 






30  Programación / Programación Visual Basic / WM_NCHITTEST en: 16 Agosto 2011, 23:10 pm
Hola, para el q le interese el Mensaje WM_NCHITTEST puede detectar en que lugar de una ventana o control está pasando el puntero del mouse o combinado con un hook al mouse tambien se puede saber donde se está haciendo un click (entre otras cosas)... Abarca el area-cliente, botones de cerrar, maximizar y minimizar, barra de titulo, icono de la barra, bordes derecho, izquierdo, angulos, bordes bixed, etc.

No se trata de un código optimizado, solo un simple concepto para el q no la conoce, saludos

Form

Código
  1.  
  2.  
  3. Option Explicit
  4.  
  5. Private Sub Form_Load()
  6. Call SetWindowPos(Me.hwnd, &HFFFF, &H0, &H0, &H0, &H0, &H2 Or &H1) 'on top (opcional)
  7. Call StartHook
  8. End Sub
  9. Private Sub Form_Unload(Cancel As Integer)
  10.  StopHook
  11. End Sub
  12.  
  13.  
  14.  



Module

Código
  1.  
  2.  
  3. Option Explicit
  4.  
  5. 'Modulo: NCHITTEST
  6. 'Autor   : Sergio Desanti (Hasseds)
  7. 'Test    : XP (32 BIT)
  8.  
  9.  
  10. Public 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
  11.  
  12. Private Declare Function SetWindowsHookEx Lib "user32.dll" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
  13. Private Declare Function UnhookWindowsHookEx Lib "user32.dll" (ByVal hHook As Long) As Long
  14. Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
  15. Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
  16. Private Type POINTAPI: x As Long: y As Long: End Type
  17. Private Const WM_NCHITTEST = &H84
  18.  
  19. Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
  20. Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
  21.  
  22. Dim hHook As Long
  23.  
  24. Function Make_lParam(ByVal x As Integer, ByVal y As Integer) As Long
  25.  Make_lParam = x Or (y * &H10000)
  26. End Function
  27.  
  28. Public Sub StartHook()
  29.     hHook = SetWindowsHookEx(&HE, AddressOf MouseProc, App.hInstance, &H0)
  30. End Sub
  31.  
  32. Public Sub StopHook()
  33.    Call UnhookWindowsHookEx(hHook)
  34.    hHook = 0
  35. End Sub
  36.  
  37. Private Function MouseProc(ByVal ncode As Long, ByVal wParam As Long, lParam As POINTAPI) As Long
  38.  
  39.  Dim hwndl As Long
  40.  hwndl = WindowFromPoint(lParam.x, lParam.y)
  41.  
  42.  Dim retNCHITTEST As Long
  43.  retNCHITTEST = SendMessage(hwndl, WM_NCHITTEST, &H0&, ByVal Make_lParam(lParam.x, lParam.y))
  44.  
  45.  
  46.  'If wParam = &H201 Then
  47.    If hwndl = Form1.hwnd Then
  48.      Select Case retNCHITTEST
  49.        Case 1:  Form1.Caption = "AREA CLIENTE"
  50.        Case 2:  Form1.Caption = "BARRA DE TITULO"
  51.        Case 3:  Form1.Caption = "ICONO LA BARRA DE TITULO"
  52.        Case 6:  Form1.Caption = "SCROLL HORIZONTAL"
  53.        Case 7:  Form1.Caption = "SCROLL VERTICAL"
  54.        Case 8:  Form1.Caption = "BOTON MINIMIZAR"
  55.        Case 9:  Form1.Caption = "BOTON MAXIMIZAR"
  56.        Case 10: Form1.Caption = "BORDE IZQUIERDO"
  57.        Case 11: Form1.Caption = "BORDE DERECHO"
  58.        Case 12: Form1.Caption = "BORDE SUPERIOR"
  59.        Case 13: Form1.Caption = "BORDE SUPERIOR IZQUIERDO"
  60.        Case 14: Form1.Caption = "BORDE SUPERIOR DERECHO"
  61.        Case 15: Form1.Caption = "BORDE INFERIOR"
  62.        Case 16: Form1.Caption = "BORDE INFERIOR IZQUIERDO"
  63.        Case 17: Form1.Caption = "BORDE INFERIOR DERECHO"
  64.        Case 18: Form1.Caption = "BORDE FIXED"
  65.        Case 20: Form1.Caption = "BOTON CERRAR"
  66.        Case 21: Form1.Caption = "BOTON AYUDA"
  67.        Case Else: Form1.Caption = retNCHITTEST
  68.      End Select
  69.    Else
  70.      Form1.Caption = "FUERA DE VENTANA"
  71.    End If
  72.  'End If
  73.  
  74.  '.......................................................................
  75.   Dim PT As POINTAPI
  76.   Call ClientToScreen(hwndl, PT)
  77.  
  78.   Form1.Cls
  79.   Form1.Print "Coordenada Screen X " & lParam.x
  80.   Form1.Print "Coordenada Screen Y " & lParam.y
  81.  
  82.   If hwndl = Form1.hwnd Then
  83.     Form1.Print
  84.     Form1.Print "Coordenada Control X " & lParam.x - PT.x
  85.     Form1.Print "Coordenada Control Y " & lParam.y - PT.y
  86.   End If
  87.  '.......................................................................
  88.  
  89.  MouseProc = CallNextHookEx(hHook, ncode, wParam, lParam)
  90.  
  91. End Function
  92.  
  93.  
  94.  







Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines