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

 

 


Tema destacado: Introducción a Git (Primera Parte)


  Mostrar Mensajes
Páginas: 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 ... 74
271  Programación / Programación Visual Basic / [Source]Compresor de ejecutables en: 19 Marzo 2010, 19:52 pm
Este es un proyecto que tenia ganas de intentar hacer, sirve (o es lo que intenta)  comprimir un ejecutable tipo como el UPX, si bien funciona todo bien la compresion es muy baja (desde el vamos es stub esta echo en vb) los métodos empleados son inyeccion en la memoria y CallApibyName (creo que estas funciones son de Cobein y/o Karcrack), CloneFile by ZeR0 para colonar los recursos, y para comprimir utiliza el api nativa RtlCompressBuffer

bueno lo peor de todo es que varios de los antivirus lo detectan como un código malicioso  :-[ y abría que hacer muchos cambios para que esto no pase.

Descargar
272  Programación / Programación Visual Basic / Re: Es posible rotar un control u objeto?? en VB6, mediante la API o usando Asm? en: 18 Marzo 2010, 23:33 pm
Leandro, con controles de usuarios es posible hacerlo...!

si porsupuesto que con un usercontrol se puede, pero no con los controles nativos de windows, como dije antes vos en un usercontrol mediante medotodos graficos y reiones podes ir creado un boton (por hacerla sensilla) y dibujarlo con lienas (o imagenes porque no) y rotarlo como se te den las ganas tambien podes rotar el caption y el icono. pero ya te daras cuenta cuanto trabajo requiere esto con un simple boton, imaginate hacer un listview en 30º
273  Programación / Programación Visual Basic / Re: Es posible rotar un control u objeto?? en VB6, mediante la API o usando Asm? en: 18 Marzo 2010, 18:54 pm
No se puede las ventanas de windows son cuadradas y no se rotan, por ejemplo un commandButon un textbox un listbox nunca vas a poder rotar esas ventanas, lo que si puedes es vos crear un control personalizado donde mediante metodos graficos y regiones podes dar ese efecto.

y lo de asm es utilizando una imagen pero no controles.

saludos.
274  Programación / Programación Visual Basic / Re: [FIX] Error sacar BaseAddress Kernel32 W7 {cInvoke,cRunPe...} en: 10 Marzo 2010, 16:25 pm
Karcrak como aplicaria esto a CallApiByName

Código:
Function CallApiByName(ByVal sLib As String, ByVal sMod As String, ParamArray Params()) As Long
On Error Resume Next
    Dim lPtr                As Long
    Dim bvASM(&HEC00& - 1)  As Byte
    Dim i                   As Long
    Dim lMod                As Long
 
    lMod = GetProcAddress(LoadLibraryA(sLib), sMod)
    If lMod = 0 Then Exit Function
 
    lPtr = VarPtr(bvASM(0))
    RtlMoveMemory ByVal lPtr, &H59595958, &H4:              lPtr = lPtr + 4
    RtlMoveMemory ByVal lPtr, &H5059, &H2:                  lPtr = lPtr + 2
    For i = UBound(Params) To 0 Step -1
        RtlMoveMemory ByVal lPtr, &H68, &H1:                lPtr = lPtr + 1
        RtlMoveMemory ByVal lPtr, CLng(Params(i)), &H4:     lPtr = lPtr + 4
    Next
    RtlMoveMemory ByVal lPtr, &HE8, &H1:                    lPtr = lPtr + 1
    RtlMoveMemory ByVal lPtr, lMod - lPtr - 4, &H4:         lPtr = lPtr + 4
    RtlMoveMemory ByVal lPtr, &HC3, &H1:                    lPtr = lPtr + 1
    CallApiByName = CallWindowProcA(VarPtr(bvASM(0)), 0, 0, 0, 0)
 
End Function

Saludos.
275  Programación / Programación Visual Basic / Re: de byte a long en: 7 Marzo 2010, 18:27 pm
Hola me parece que tu funcion esta mal, un long  = 4 bytes por lo tanto tienes que redimencionar el array a  (0 to 3)

asi es como creo que iria

Código:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

Public Function LongToByteArray(ByVal lng As Long) As Byte()
    Dim ByteArray(3) As Byte
    CopyMemory ByteArray(0), lng, LenB(lng)
    LongToByteArray = ByteArray
End Function

Public Function ByteArrayToLong(ByteArray() As Byte) As Long
    CopyMemory ByteArrayToLong, ByteArray(0), LenB(ByteArrayToLong)
End Function


Private Sub Command1_Click()
    Dim bytArr() As Byte
    bytArr = LongToByteArray(94545712)
    MsgBox ByteArrayToLong(bytArr)
End Sub


Saludos.
276  Programación / Programación Visual Basic / Re: Socket and MultiThread en: 6 Marzo 2010, 01:54 am
Ok, voy a seguir en castellano después usted lo traduce

yo e solucionado eso de la siguiente manera

No envíe el archivo completo, envielo por trozos de 1 kb aproximadamente, cuando se dispara el evento SendComplete active un pulso de un timer para no crear un bucle y así poder formar algo parecido a un Multithreard.

un ejemplo que no lo he probado pero es para que usted tenga una idea de como funciona, es mas lento pero puede enviar varios archivos a la vez


Esto iria dentro de un modulo clase que representa una conexión con un modulo clase de socket y un modulo clase de un timer.

Código:
Const SIZE_OF_BUFFER As Long = 1024

Dim LenData As Long
Dim bData() As Byte
Dim bBuffer() As Byte
Dim lChuncks As Long
Dim lReminder As Long
Dim lPos As Long
Dim SendFileComplete As Boolean

Private Sub SendFile(ByVal FileName As String)
    Dim FF As Integer
    FF = FreeFile
    
    Open FileName For Binary As #FF
      ReDim bData(LOF(FF))
      Get #FF, , bData
    Close #FF
    
    LenData = UBound(bData)
    ReDim bBuffer(SIZE_OF_BUFFER)
    lChuncks = LenData \ SIZE_OF_BUFFER
    lReminder = LenData - lChuncks * SIZE_OF_BUFFER
    SendFileComplete = False
    Call SendSegment
End Sub

        
Private Sub SendSegment()

    If SendFileComplete = True Then Exit Sub

    If lPos <= lChuncks Then
        CopyMemory bBuffer(0), bData(lPos), SIZE_OF_BUFFER
        lPos = lPos + SIZE_OF_BUFFER
        
        SendFileComplete = False
        
        If cSocket.State = 7 Then
            cSocket.SendData bBuffer
        End If
    Else

        If lReminder > 0 Then
            ReDim bBuffer(lReminder)
            CopyMemory bBuffer(0), bData(lPos), lReminder
            
            SendFileComplete = True
            
            If cSocket.State = 7 Then
                cSocket.SendData bBuffer
            End If
        Else
            SendFileComplete = True
        End If
    End If
End Sub

Private Sub cSocket_SendComplete()
    cTimer.StartTimer 1
End Sub

Private Sub cTimer_Timer()
    cTimer.StopTimer
    Call SendSegment
End Sub
277  Programación / Programación Visual Basic / Re: Listar Formularios de un Proyecto en: 5 Marzo 2010, 20:20 pm
hola para los formularios cargados es simple como esto

Código:
Private Sub Command1_Click()
    Dim Frm As Form
    For Each Frm In Forms
        Debug.Print Frm.Name ' o frm.caption
    Next
End Sub

y si no estan cargados no se puede :-X.
278  Programación / Programación Visual Basic / Re: Socket and MultiThread en: 5 Marzo 2010, 20:12 pm
Hello, This is a simple example of how to work with array of controls

Server

Código
  1. Option Explicit
  2. Dim ColSocket As Collection
  3.  
  4. Private Sub Form_Load()
  5.    Set ColSocket = New Collection
  6.    Winsock1(0).LocalPort = 100
  7.    Winsock1(0).Listen  '<<< Main Conextion (don't close this connections!)
  8. End Sub
  9.  
  10. Private Sub Winsock1_Close(Index As Integer)
  11.    Unload Winsock1(Index)
  12.    ColSocket.Remove "K" & Index
  13. End Sub
  14.  
  15. Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long)
  16.  
  17.  
  18.    Dim FreeIndex As Long, NewKey As String
  19.  
  20.    'FreeIndex = Winsock1.UBound + 1  'Maximum value of the array of controls <(Don't use this)
  21.  
  22.    FreeIndex = GetFreeIndex() '<(use This, prevents the increase of the array)
  23.  
  24.    NewKey = "K" & FreeIndex 'Unique key for control
  25.  
  26.    Load Winsock1(FreeIndex) 'load new control
  27.  
  28.    ColSocket.Add Winsock1(FreeIndex), NewKey 'Add the new control in the collection
  29.  
  30.    ColSocket(NewKey).Accept requestID 'The new control accept the new connections
  31.  
  32.    ColSocket(NewKey).SendData "hola mundo" & FreeIndex 'The new control send a message
  33.  
  34.  
  35. End Sub
  36.  
  37. Private Function GetFreeIndex() As Long 'Get the free index in the controls array
  38.    Dim i As Long, j As Long
  39.  
  40.    For i = 1 To ColSocket.Count
  41.        For j = 1 To ColSocket.Count
  42.            If ColSocket(j).Index = i Then
  43.                GetFreeIndex = 0
  44.                Exit For
  45.            Else
  46.                GetFreeIndex = i
  47.            End If
  48.        Next
  49.        If GetFreeIndex <> 0 Then Exit For
  50.    Next
  51.  
  52.    If GetFreeIndex = 0 Then GetFreeIndex = ColSocket.Count + 1
  53.  
  54. End Function
  55.  
  56. Private Sub Command1_Click()
  57.    SendNewMessageForAllConection
  58. End Sub
  59.  
  60. Private Sub SendNewMessageForAllConection()
  61.    Dim i As Long
  62.    For i = 1 To ColSocket.Count
  63.       ColSocket(i).SendData "New Message for all Connections"
  64.    Next
  65. End Sub
  66.  
  67. Private Sub Command2_Click()
  68.    CloseAllConnections
  69. End Sub
  70.  
  71. Private Sub CloseAllConnections()
  72.    Dim i As Long
  73.    For i = ColSocket.Count To 1 Step -1
  74.        ColSocket(i).Close
  75.        Unload Winsock1(ColSocket(i).Index)
  76.        ColSocket.Remove i
  77.    Next
  78. End Sub
  79.  
  80. 'this works only if the data are small, otherwise it should be modulized or create array index data
  81. Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long)
  82.    Dim Data As String
  83.    Winsock1(Index).GetData Data 'or ColSocket("K" & Index).GetData Data
  84.    Me.Print Data
  85. End Sub

Client (compile it and run it several instances)

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.    Winsock1.Connect "127.0.0.1", 100
  5. End Sub
  6.  
  7. Private Sub Winsock1_Close()
  8.    Unload Me
  9. End Sub
  10.  
  11. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  12.    Dim Data As String
  13.    Winsock1.GetData Data
  14.    Me.Caption = Data
  15. End Sub
279  Programación / Programación Visual Basic / Re: Socket and MultiThread en: 4 Marzo 2010, 20:37 pm
are using some sort of loop, it would be good to see some of your code


[Spanish]
esta utilizando algun tipo de bucle, seria bueno ver parte de su codigo
280  Programación / Programación Visual Basic / Re: Problema al Reemplazar archivo de recursos con APIs UpdateResource, etc en: 3 Marzo 2010, 03:46 am
Hola "Creo" que es por el lenguage ose el cuarto parametro de la funcion UpdateResourceA

Saludos.
Páginas: 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 ... 74
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines