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

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


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

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #10 en: 10 Octubre 2010, 03:13 am »

Gracias raul338 por reportar el bugs, ya lo estoy corrigiendo, en cuanto a lo del drag a drop que me pasaste el otro día, bueno mala educación la mía no responder ejej, pero igualmente no me sirve por el tema de que el archivo no existe en la pc, osea para poder hacerlo de esa forma primero deberia descargar el archivo y como este no trabaja de una forma sincronizada, no puedo, yo lo que necesitaria saber es el destino donde se soltó el item para luego hacer una descarga normal.
no importa que el uclistview no tenga los eventos del drag and drop yo se los agrego.
una solución no muy elegante que me salio
http://www.vbforums.com/showthread.php?t=629147
pero no esta bien ya que no funciona con el escritorio, con subitems del listview de la carpeta y menos con el treview del explorer, osea una cagada.
pero no importa ya fue.

saludos. y gracias a todos por sus comentarios.


En línea

raul338


Desconectado Desconectado

Mensajes: 2.633


La sonrisa es la mejor forma de afrontar las cosas


Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #11 en: 10 Octubre 2010, 03:38 am »

[offtopic]seria mejor hablar del tema en el hilo que empezaste para ello[/offtopic]

Vi un "intento" de solucion en .net que usa un FileSystemWatcher (una clase especie de "hook" de archivos) lo cual usaba el metodo que puse ahi y con FileSystemWatcher obtenia la ruta final al cual queria copiar. Te digo aver si descubrir algo porque si en .net se puede, en vb6 tambien :xD


En línea

LeandroA
Moderador
***
Desconectado Desconectado

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #12 en: 10 Octubre 2010, 10:33 am »

si de echo yo pensaba lo mismo, pero no lo intente, Cobein hizo una clase FileSystemWatcher para vb6

Saludos.
En línea

BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #13 en: 10 Octubre 2010, 10:43 am »

@FileSystemWatcher  me suena a algo similar a esto... ReadDirectoryChangesW

http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=61052&lngWId=1

Dulces Lunas!¡.
« Última modificación: 10 Octubre 2010, 10:48 am por BlackZeroX » En línea

The Dark Shadow is my passion.
LeandroA
Moderador
***
Desconectado Desconectado

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #14 en: 11 Octubre 2010, 03:07 am »

Solucionado, Gracias Raul338 y BlackZeroX , habia que hacerlo con ReadDirectoryChangesW

Código
  1. Option Explicit
  2.  
  3. Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
  4. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  5. Private Declare Function ReadDirectoryChangesW Lib "kernel32.dll" (ByVal hDirectory As Long, ByVal lpBuffer As Long, ByVal nBufferLength As Long, ByVal bWatchSubtree As Boolean, ByVal dwNotifyFilter As Long, lpBytesReturned As Long, ByVal lpOverlapped As Long, ByVal lpCompletionRoutine As Long) As Long
  6. Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
  7. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)
  8.  
  9. Private Const FILE_SHARE_DELETE             As Long = &H4
  10. Private Const FILE_SHARE_READ               As Long = &H1
  11. Private Const FILE_SHARE_WRITE              As Long = &H2
  12. Private Const FILE_LIST_DIRECTORY           As Long = &H1
  13. Private Const OPEN_EXISTING                 As Long = &H3
  14. Private Const FILE_FLAG_BACKUP_SEMANTICS    As Long = &H2000000
  15. Private Const FILE_FLAG_OVERLAPPED          As Long = &H40000000
  16. Private Const INVALID_HANDLE_VALUE          As Long = (-1)
  17. Private Const FILE_NOTIFY_CHANGE_ALL        As Long = &H17F
  18.  
  19.  
  20. Private Type OVERLAPPED
  21.    Internal                        As Long
  22.    InternalHigh                    As Long
  23.    offset                          As Long
  24.    OffsetHigh                      As Long
  25.    hEvent                          As Long
  26. End Type
  27.  
  28. Private Type FILE_NOTIFY_INFORMATION
  29.    dwNextEntryOffset               As Long
  30.    dwAction                        As Long
  31.    dwFileNameLength                As Long
  32.    wcFileName(1023)                As Byte
  33. End Type
  34.  
  35.  
  36. Private Type DriveChange
  37.    hDrive                          As Long
  38.    sDrive                          As String
  39.    Buff(0 To 1024 * 9 - 1)         As Byte
  40. End Type
  41.  
  42.  
  43. Private aChange()           As DriveChange
  44.  
  45. Private MyFileName          As String
  46.  
  47. Private Sub Form_Load()
  48.    MyFileName = "RemoteImagen.bmp"
  49.    Picture1.OLEDragMode = 1
  50. End Sub
  51.  
  52. Private Sub Picture1_OLECompleteDrag(Effect As Long)
  53.    Debug.Print GetDestination(MyFileName)
  54.    Kill App.Path & "\" & MyFileName
  55. End Sub
  56.  
  57.  
  58. Private Sub Picture1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
  59.    Open App.Path & "\" & MyFileName For Binary As #1: Close #1
  60.  
  61.    Call StartWatching
  62.    Data.SetData , vbCFFiles
  63.    Data.Files.Add App.Path & "\" & MyFileName
  64.    AllowedEffects = vbDropEffectCopy
  65. End Sub
  66.  
  67. Public Sub StartWatching()
  68.    Dim lRet As Long
  69.    Dim sBuff As String * 255
  70.    Dim arrDrive() As String
  71.    Dim lPos As Long
  72.    Dim i As Long
  73.    Dim tOLAP As OVERLAPPED
  74.  
  75.    lRet = GetLogicalDriveStrings(255, sBuff)
  76.  
  77.    arrDrive = Split(Left$(sBuff, lRet - 1), Chr$(0))
  78.  
  79.    For i = 0 To UBound(arrDrive)
  80.        lRet = CreateFile(arrDrive(i), FILE_LIST_DIRECTORY, FILE_SHARE_READ Or FILE_SHARE_DELETE Or FILE_SHARE_WRITE, 0&, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS Or FILE_FLAG_OVERLAPPED, 0&)
  81.  
  82.        If lRet <> INVALID_HANDLE_VALUE Then
  83.            ReDim Preserve aChange(lPos)
  84.            aChange(lPos).hDrive = lRet
  85.            aChange(lPos).sDrive = arrDrive(i)
  86.            lPos = lPos + 1
  87.        End If
  88.    Next
  89.  
  90.    For i = 0 To UBound(aChange)
  91.        Call ReadDirectoryChangesW(aChange(i).hDrive, VarPtr(aChange(i).Buff(0)), 9216, True, FILE_NOTIFY_CHANGE_ALL, 0&, VarPtr(tOLAP), 0&)
  92.    Next
  93.  
  94. End Sub
  95.  
  96. Private Function GetDestination(ByVal sName As String) As String
  97.    Dim i As Long
  98.    Dim sData As String
  99.    Dim lPos As Long
  100.    Dim lRet As Long
  101.    Dim tFNI As FILE_NOTIFY_INFORMATION
  102.    Dim tOLAP As OVERLAPPED
  103.  
  104.    Dim SafeCounter As Long
  105.  
  106.    Do While SafeCounter < 1000
  107.  
  108.        For i = 0 To UBound(aChange)
  109.            lPos = 0
  110.  
  111.            Do
  112.                Call CopyMemory(VarPtr(tFNI), VarPtr(aChange(i).Buff(lPos)), Len(tFNI))
  113.  
  114.                sData = Left$(tFNI.wcFileName, tFNI.dwFileNameLength / 2)
  115.  
  116.                If InStr(sData, sName) Then
  117.                    GetDestination = aChange(i).sDrive & sData
  118.                    GoTo StopWatching
  119.                End If
  120.  
  121.                If tFNI.dwNextEntryOffset = 0 Then Exit Do
  122.  
  123.                lPos = lPos + tFNI.dwNextEntryOffset
  124.            Loop
  125.  
  126.            Call ReadDirectoryChangesW(aChange(i).hDrive, VarPtr(aChange(i).Buff(0)), 9216, True, FILE_NOTIFY_CHANGE_ALL, 0&, VarPtr(tOLAP), 0&)
  127.  
  128.            DoEvents
  129.        Next
  130.        SafeCounter = SafeCounter + 1
  131.  
  132.    Loop
  133.  
  134.    Debug.Print "Error or Cancel"
  135.  
  136. StopWatching:
  137.  
  138.    For i = 0 To UBound(aChange)
  139.        Call CloseHandle(aChange(i).hDrive)
  140.    Next
  141.  
  142.    Erase aChange
  143.  
  144. End Function
  145.  
  146.  
« Última modificación: 11 Octubre 2010, 03:15 am por LeandroA » En línea

raul338


Desconectado Desconectado

Mensajes: 2.633


La sonrisa es la mejor forma de afrontar las cosas


Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #15 en: 11 Octubre 2010, 04:02 am »

Fuaaaa leandro, sos un groso, yo solo vigilaba la carpeta por lo que nunca podria saber el path de destino :)

Mañana lo testeo (a cazar bugs y a entender como funciona) :P
En línea

ssccaann43 ©


Desconectado Desconectado

Mensajes: 792


¬¬


Ver Perfil
Re: [Proyecto]Explorador Remoto.
« Respuesta #16 en: 11 Octubre 2010, 15:44 pm »

Leandro Excelente...! Buen trabajo..!
En línea

- Miguel Núñez
Todos tenemos derechos a ser estupidos, pero algunos abusan de ese privilegio...
"I like ^TiFa^"
EddyW

Desconectado Desconectado

Mensajes: 187



Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #17 en: 11 Octubre 2010, 16:00 pm »

Wenas,

Gran trabajo Leandro, voy a probarlo más tarde..[En este momento debo irme]
Viendo los Screen's se ve muy bien trabajado ;)

SaluDOS!!!
En línea

raul338


Desconectado Desconectado

Mensajes: 2.633


La sonrisa es la mejor forma de afrontar las cosas


Ver Perfil WWW
Re: [Proyecto]Explorador Remoto.
« Respuesta #18 en: 11 Octubre 2010, 20:44 pm »

Bueno, siempre hay que hacerlo user-like (y anti herrores del usuario XD) asi que agregue este pequeño filtro para evitar unidades de cd. Porque? Porque windows tiene su sistemita para grabar cds... y si se graba no se graba el archivo bajado sino el temporal de 0 bytes (y se pierde un cd/dvd)

Aunque dudo que alguien haga un drag&drop al cd, nunca falta el que lo prueba :xD

En el sub StartWatching...
Código
  1.    ' Private Declare Function GetDriveTypeA Lib "kernel32" (ByVal lpRootPathName As String) As Long
  2.    For i = 0 To UBound(arrDrive)
  3.        If Not GetDriveTypeA(arrDrive(i)) = 5 Then
  4.            lRet = CreateFile(arrDrive(i), FILE_LIST_DIRECTORY, FILE_SHARE_READ Or FILE_SHARE_DELETE Or FILE_SHARE_WRITE, 0&, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS Or FILE_FLAG_OVERLAPPED, 0&)
  5.  
  6.            If lRet <> INVALID_HANDLE_VALUE Then
  7.                ReDim Preserve aChange(lPos)
  8.                aChange(lPos).hDrive = lRet
  9.                aChange(lPos).sDrive = arrDrive(i)
  10.                lPos = lPos + 1
  11.            End If
  12.        End If
  13.    Next
  14.  

Seguire viendo :P
« Última modificación: 11 Octubre 2010, 20:47 pm por raul338 » En línea

Páginas: 1 [2] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Explorador Remoto de Archivos VB.NET
.NET (C#, VB.NET, ASP)
locot3 0 3,385 Último mensaje 5 Diciembre 2011, 05:30 am
por locot3
Desarollar proyecto remoto con Eclipse
Desarrollo Web
K1ll1ng M4ch1n3 2 4,912 Último mensaje 19 Enero 2012, 14:37 pm
por K1ll1ng M4ch1n3
Explorador de archivos remoto
Java
rinrin77 2 3,193 Último mensaje 28 Abril 2016, 23:36 pm
por + 1 Oculto(s)
como crear un explorador de archivos remoto(JAVA) ?
Java
exploiterstack 2 3,149 Último mensaje 1 Julio 2016, 23:09 pm
por KidRabbit
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines