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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 [2] 3 4 5
11  Programación / Programación Visual Basic / Re: [Regalo de navidad] Perfeccionando el ucListView :) en: 26 Marzo 2011, 08:28 am
Podrias resubir el archivo?, gracias y disculpas por revivirlo  :P
12  Programación / Programación Visual Basic / Re: [Proyecto]Facebook Photo Uploader en: 13 Marzo 2011, 04:00 am
Hola la verdad no entiendo el codigo y me cierra todo con error cuando llamo a InitCurrentThread

como aplicas eso con las apis de inet?

Llama la función CreateNewThread pasandole el puntero a una funcion donde se iniciará el nuevo hilo, al inicio de esa funcion llama InitCurrentThread y luego hace las llamadas que quieras, todo eso será en un nuevo thread, recorda usar vbModal cuando vas a mostrar forms y lo que dije anteriormente pon Sub Main como objeto inicial y desde ahi inicia el/los forms normalmente

Saludos
13  Programación / Programación Visual Basic / [SNIPPET-VB6] DrawGraph - Dibujar sobre controles. en: 12 Marzo 2011, 14:48 pm
Lo hice hace ya un tiempo para hacer poner imágenes en los commandbutton y que queden en la misma linea, pero se puede aplicar a cualquier control.

Código
  1. Option Explicit
  2.  
  3. Private Const WM_PAINT As Long = &HF
  4. Private Const GWL_WNDPROC = -4
  5.  
  6. Private Type DRAW_DATA
  7.    DrawPic As PictureBox
  8.    DrawTop As Long
  9.    DrawLeft As Long
  10.    lpPrevWndProc As Long
  11.    ControlHwnd As Long
  12.    ControlDC As Long
  13. End Type
  14.  
  15. Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  16. Private Declare Function CallWindowProc Lib "USER32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal Hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  17. Private Declare Function GetDC Lib "USER32" (ByVal Hwnd As Long) As Long
  18. Private Declare Function GdiTransparentBlt Lib "GDI32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean
  19.  
  20. Private DrawArray() As DRAW_DATA
  21.  
  22. Public Sub DrawGraph(Hwnd As Long, Pic As PictureBox, Top As Long, Left As Long)
  23.    Dim i As Long
  24.  
  25.    If Not Not DrawArray Then: i = UBound(DrawArray) + 1
  26.    ReDim Preserve DrawArray(i)
  27.  
  28.    With DrawArray(i)
  29.        Set .DrawPic = Pic
  30.        .DrawPic.BorderStyle = 0
  31.        .DrawPic.ScaleMode = vbPixels
  32.        .DrawPic.BackColor = &HFF00FF
  33.        .DrawPic.AutoSize = True
  34.        .DrawPic.Refresh
  35.  
  36.        .ControlHwnd = Hwnd
  37.        .lpPrevWndProc = SetWindowLong(Hwnd, GWL_WNDPROC, AddressOf ControlProc)
  38.        .ControlDC = GetDC(Hwnd)
  39.        .DrawTop = Top: .DrawLeft = Left
  40.    End With
  41. End Sub
  42.  
  43. Public Sub UnDrawGraph(ByVal Hwnd As Long)
  44.    Dim i As Long
  45.  
  46.    For i = 0 To UBound(DrawArray)
  47.        If DrawArray(i).ControlHwnd = Hwnd Then
  48.            Call SetWindowLong(Hwnd, GWL_WNDPROC, DrawArray(i).lpPrevWndProc)
  49.        End If
  50.    Next i
  51. End Sub
  52.  
  53. Private Function ControlProc(ByVal Hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  54.    Dim i As Long
  55.  
  56.    For i = 0 To UBound(DrawArray)
  57.        With DrawArray(i)
  58.            If .ControlHwnd = Hwnd Then
  59.                ControlProc = CallWindowProc(.lpPrevWndProc, Hwnd, Msg, wParam, lParam)
  60.                If (Msg = WM_PAINT) Then
  61.                    Call GdiTransparentBlt(.ControlDC, .DrawLeft, .DrawTop, .DrawPic.ScaleWidth, .DrawPic.ScaleHeight, .DrawPic.hdc, 0, 0, .DrawPic.ScaleWidth, .DrawPic.ScaleHeight, &HFF00FF)
  62.                End If
  63.            End If
  64.        End With
  65.    Next i
  66. End Function
14  Programación / Programación Visual Basic / [VB6] ProgressBarInListView en: 12 Marzo 2011, 14:07 pm
mProgressBarInListView:
Código
  1. Option Explicit
  2.  
  3. Private Type RECT
  4.    Left    As Long
  5.    Top     As Long
  6.    Right   As Long
  7.    Bottom  As Long
  8. End Type
  9.  
  10. Private Const LVM_FIRST As Long = &H1000
  11. Private Const LVM_GETSUBITEMRECT  As Long = (LVM_FIRST + 56)
  12. Private Const LVIR_LABEL  As Long = 2
  13.  
  14. Private Const WM_NOTIFY  As Long = &H4E
  15. Private Const WM_HSCROLL As Long = &H114
  16. Private Const WM_VSCROLL As Long = &H115
  17. Private Const WM_KEYDOWN As Long = &H100
  18.  
  19. Private Const HDN_FIRST      As Long = (0 - 300)
  20. Private Const HDN_ENDTRACK   As Long = (HDN_FIRST - 1)
  21.  
  22. Private Declare Function SendMessageA Lib "USER32" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  23. Private Declare Function SetParent Lib "USER32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
  24. Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
  25.  
  26. Private Declare Function SetWindowLongA Lib "USER32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  27. Private Declare Function CallWindowProcA Lib "USER32" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  28.  
  29. Private lpPrevWndProc As Long
  30.  
  31. Private Function ListView_GetSubItemRect(ByVal hWndLV As Long, ByVal iItem As Long, ByVal iSubItem As Long, ByVal code As Long, lpRect As RECT) As Boolean
  32.    lpRect.Top = iSubItem
  33.    lpRect.Left = code
  34.    ListView_GetSubItemRect = SendMessageA(hWndLV, LVM_GETSUBITEMRECT, ByVal iItem, lpRect)
  35. End Function
  36.  
  37. Public Sub PutProgressBarInListView(ListView As ListView, InColumn As Long)
  38.    Dim i As Long
  39.  
  40.    For i = 0 To ListView.ListItems.Count - 1
  41.        If i > Form1.ProgressBar1.Count - 1 Then: Call Load(Form1.ProgressBar1(i))
  42.        Call SetParent(Form1.ProgressBar1(i).hWnd, ListView.hWnd)
  43.    Next
  44.  
  45.    Call AdjustProgressBar(ListView, InColumn)
  46.    lpPrevWndProc = SetWindowLongA(ListView.hWnd, -4, AddressOf ListViewProc)
  47. End Sub
  48.  
  49. Public Sub AdjustProgressBar(ListView As ListView, InColumn As Long)
  50.    Dim Pos    As RECT
  51.    Dim i      As Long
  52.  
  53.    For i = 0 To Form1.ProgressBar1.Count - 1
  54.        Call ListView_GetSubItemRect(ListView.hWnd, i, InColumn, LVIR_LABEL, Pos)
  55.        With Form1.ProgressBar1(i)
  56.            .Left = (Pos.Left) * Screen.TwipsPerPixelX
  57.            .Width = (Pos.Right - Pos.Left) * Screen.TwipsPerPixelX
  58.            .Height = ((Pos.Bottom - Pos.Top) * Screen.TwipsPerPixelY)
  59.            .Top = Pos.Top * Screen.TwipsPerPixelY + ((Pos.Bottom - Pos.Top) * Screen.TwipsPerPixelY - .Height) / 2
  60.  
  61.            Call IIf(Pos.Top <= 3, .Visible = False, .Visible = True)
  62.        End With
  63.    Next
  64. End Sub
  65.  
  66. Private Function ListViewProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  67.    Dim Param       As Long
  68.    Dim bAdjust     As Boolean
  69.  
  70.    Select Case Msg
  71.        Case WM_HSCROLL, WM_VSCROLL: bAdjust = True
  72.        Case WM_KEYDOWN
  73.            Select Case wParam
  74.                Case 33 To 40: bAdjust = True
  75.            End Select
  76.        Case WM_NOTIFY
  77.            Call CopyMemory(Param, ByVal lParam + 8, 4)
  78.            If Param = HDN_ENDTRACK Then: bAdjust = True
  79.    End Select
  80.  
  81.    If bAdjust = True Then: Call AdjustProgressBar(Form1.ListView1, 1)
  82.    ListViewProc = CallWindowProcA(lpPrevWndProc, hWnd, Msg, wParam, lParam)
  83. End Function

Simplemente necesitaba hacer esto y lo comparto, espero que le sirva a alguien ;)
15  Programación / Programación Visual Basic / Re: [Proyecto]Facebook Photo Uploader en: 11 Marzo 2011, 18:01 pm
@F3B14N  si seria lo correcto, pero la verdad no le tengo mucha fe a vb con el uso de threads  seria un gran dolor de cabeza.

Código
  1. Option Explicit
  2.  
  3. Private Type GUID
  4.    Data1 As Long
  5.    Data2 As Integer
  6.    Data3 As Integer
  7.    Data4(7) As Byte
  8. End Type
  9.  
  10. Private Declare Function VirtualProtect Lib "KERNEL32" (lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
  11. Private Declare Function CreateThread Lib "KERNEL32" (ByVal lpSecurityAttributes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Long, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
  12. Private Declare Function ReadProcessMemory Lib "KERNEL32" (ByVal hProcess As Long, ByRef lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
  13. Private Declare Function VBDllGetClassObject Lib "MSVBVM60" (g1 As Long, g2 As Long, ByVal g3_vbHeader As Long, REFCLSID As Long, REFIID As GUID, ppv As Long) As Long
  14. Private Declare Function CreateIExprSrvObj Lib "MSVBVM60" (ByVal p1_0 As Long, ByVal p2_4 As Long, ByVal p3_0 As Long) As Long
  15. Private Declare Function CoInitialize Lib "OLE32" (ByVal pvReserved As Long) As Long
  16. Private Declare Sub CoUninitialize Lib "OLE32" ()
  17. Private VBHeaderAddress As Long
  18. Private MainAddress As Long
  19.  
  20. Public Sub CreateNewThread(ByVal lAddress As Long, ByVal lVal As Long, Optional ByRef lHandle As Long, Optional ByRef lThread As Long)
  21.    If VBHeaderAddress = 0 Then
  22.        Call GetFakeHeader: Call GetMainAddress
  23.        Call VirtualProtect(ByVal MainAddress, 1, &H40, 0&)
  24.    End If
  25.    lHandle = CreateThread(ByVal 0&, ByVal 0&, lAddress, ByVal lVal, 0, lThread)
  26. End Sub
  27.  
  28. Public Sub InitCurrentThread()
  29.    Call CreateIExprSrvObj(0, 4, 0)
  30.    Call CoInitialize(0)
  31.    Call InitDLL
  32. End Sub
  33.  
  34. Public Sub TerminateCurrentThread()
  35.    Call CoUninitialize
  36. End Sub
  37.  
  38. Public Sub GetFakeHeader()
  39.    Dim lPtr            As Long
  40.    Dim lProc           As Long
  41.    Dim bData(1024)     As Byte
  42.    Dim sData           As String
  43.    Dim lRet            As Long
  44.  
  45.    lPtr = App.hInstance
  46.    Do While lRet = 0
  47.        Call ReadProcessMemory(-1, ByVal lPtr, bData(0), 1024, 0&)
  48.        sData = StrConv(bData, vbUnicode)
  49.        lRet = InStr(1, sData, "VB5!", vbBinaryCompare)
  50.        lPtr = lPtr + 1024
  51.    Loop
  52.    VBHeaderAddress = lPtr + lRet - 1024 - 1
  53. End Sub
  54.  
  55. Private Sub GetMainAddress()
  56.    Call ReadProcessMemory(-1, ByVal VBHeaderAddress + &H2C, MainAddress, 4, 0&)
  57.    'If MainAddress = 0 Then
  58.    '    'MainAddress = AddressOf Private Sub Form_Initialize()
  59.    'End If
  60. End Sub
  61.  
  62. Private Sub InitDLL()
  63.    Dim pIID As GUID
  64.  
  65.    With pIID
  66.        .Data1 = 1
  67.        .Data4(0) = &HC0
  68.        .Data4(7) = &H46
  69.    End With
  70.  
  71.    Call ReadProcessMemory(-1, &HC3, ByVal MainAddress, 4, 0&)
  72.    Call VBDllGetClassObject(0, 0, VBHeaderAddress, 0, pIID, 0)
  73.    Call ReadProcessMemory(-1, &H8B, ByVal MainAddress, 4, 0&)
  74. End Sub
  75.  
  76. Private Sub Main()
  77.    CLIENT_Main.Show
  78. End Sub

Funciona sin problemas, simplemente pon Sub Main como objeto inicial y desde ahi inicia el/los forms normalmente. Recorda llamar InitCurrentThread en cada nuevo thread también.
16  Programación / Programación Visual Basic / Re: AddressOf Form_Initialize() en: 9 Marzo 2011, 21:47 pm
Podrias usar las estructuras definidas en este script de IDA: http://www.openrce.org/downloads/details/245/VB_Helper_Script

Solo debes convertirlas para usarlas con VB y listo...

Saludos!

Gracias, pero aún sigo sin lograr lo que busco, seguiré intentandolo  :-\
Aca dejo las estructuras y poco mas para quienes las puedan necesitar:

Código
  1. Private Type VBHeader
  2.    szVbMagic As Long '0x00, VB5! String
  3.    wRuntimeBuild  As Integer '0x04, Build of the VB6 Runtime
  4.    szLangDll(13) As Byte '0x06, Language Extension DLL
  5.    szSecLangDll(13) As Byte '0x14, Language Extension DLL
  6.    wRuntimeRevision As Integer '0x22, Internal Runtime Revision
  7.    dwLcid  As Long '0x24, LCID of Language DLL
  8.    dwSecLCID   As Long '0x28, LCID of 2nd Language DLL
  9.    lpSubMain   As Long '0x2C, Pointer to Sub Main Code
  10.    lpProjectData As Long '0x30, Pointer to Project Data
  11.    fMdlIntCtls As Long '0x34, VB Control Flags for IDs < 32
  12.    fMdlIntCtls2 As Long '0x38, VB Control Flags for IDs > 32
  13.    dwThreadFlags As Long '0x3C, Threading Mode
  14.    dwThreadCount As Long '0x40, Threads to support in pool
  15.    wFormCount As Long '0x44, Number of forms present
  16.    wExternalCount As Integer '0x46, Number of external controls
  17.    dwThunkCount As Long '0x48, Number of thunks to create
  18.    lpGuiTable As Long '0x4C, Pointer to GUI Table
  19.    lpExternalTable As Long '0x50, Pointer to External Table
  20.    lpComRegisterData As Long '0x54, Pointer to COM Information
  21.    bSZProjectDescription As Long '0x58, Offset to Project Description
  22.    bSZProjectExeName As Long '0x5C, Offset to Project EXE Name
  23.    bSZProjectHelpFile As Long '0x60, Offset to Project Help File
  24.    bSZProjectName As Long '0x64, Offset to Project Name
  25. End Type
  26.  
  27. Private Type COMRegistrationData
  28.    bRegInfo As Long '0x00, Offset to COM Interfaces Info
  29.    bSZProjectName As Long '0x04, Offset to Project/Typelib Name
  30.    bSZHelpDirectory As Long '0x08, Offset to Help Directory
  31.    bSZProjectDescription As Long '0x0C, Offset to Project Description
  32.    uuidProjectClsId(15) As Byte ' 0x10, CLSID of Project/Typelib
  33.    dwTlbLcid As Long '0x20, LCID of Type Library
  34.    wUnknown As Integer '0x24, Might be something. Must check
  35.    wTlbVerMajor As Integer '0x26, Typelib Major Version
  36. End Type
  37.  
  38. Private Type COMRegistrationInfo
  39.    bNextObject     As Long '0x00, Offset to COM Interfaces Info
  40.    bObjectName     As Long '0x04, Offset to Object Name
  41.    bObjectDescription  As Long '0x08, Offset to Object Description
  42.    dwInstancing    As Long '0x0C, Instancing Mode
  43.    dwObjectId  As Long '0x10, Current Object ID in the Project
  44.    uuidObject(15) As Byte  '0x14, CLSID of Object
  45.    fIsInterface    As Long '0x24, Specifies if the next CLSID is valid
  46.    bUuidObjectIFace    As Long '0x28, Offset to CLSID of Object Interface
  47.    bUuidEventsIFace    As Long '0x2C, Offset to CLSID of Events Interface
  48.    fHasEvents  As Long '0x30, Specifies if the CLSID above is valid
  49.    dwMiscStatus    As Long '0x34, OLEMISC Flags (see MSDN docs)
  50.    fClassType As Byte '0x38, Class Type
  51.    fObjectType As Byte '0x39, Flag identifying the Object Type
  52.    wToolboxBitmap32 As Integer '0x3A, Control Bitmap ID in Toolbox
  53.    wDefaultIcon As Integer '0x3C, Minimized Icon of Control Window
  54.    fIsDesigner As Integer ' 0x3E, Specifies whether this is a Designer
  55.    bDesignerData As Long '0x40, Offset to Designer Data
  56. End Type
  57.  
  58. Private Type DesignerInfo
  59.    uuidDesigner(15) As Byte '0x00, CLSID of the Addin/Designer
  60.    cbStructSize As Long '0x10, Total Size of the next fields.
  61.    '    ea = ea + 0x18;
  62.    '    MakeDword       (ea - 0x04
  63.    'bstrAddinRegKey     FixStr          (ea, Registry Key of the Addin
  64.    '    ea = ea + 0x04 + Dword(ea - 0x04
  65.    '    MakeDword       (ea - 0x04
  66.    'bstrAddinName   FixStr          (ea, Friendly Name of the Addin
  67.    '    ea = ea + 0x04 + Dword(ea - 0x04
  68.    '    MakeDword       (ea - 0x04
  69.    'bstrAddinDescription    FixStr          (ea, Description of Addin
  70.    '    ea = ea + Dword(ea - 0x04
  71.    'dwLoadBehaviour     FixDword        (ea, CLSID of Object
  72.    '    ea = ea + 0x08;
  73.    '    MakeDword       (ea - 0x04
  74.    'bstrSatelliteDll    FixStr          (ea, Satellite DLL, if specified
  75.    '    ea = ea + 0x04 + Dword(ea - 0x04
  76.    '    MakeDword       (ea - 0x04
  77.    'bstrAdditionalRegKey    FixStr          (ea, Extra Registry Key, if specified
  78.    '    ea = ea + Dword(ea - 0x04
  79.    'dwCommandLineSafe   FixDword        (ea, Specifies a GUI-less Addin if 1.
  80. End Type
  81.  
  82. Private Type ProjectInformation
  83.    dwVersion   As Long '0x00, 5.00 in Hex (0x1F4). Version.
  84.    lpObjectTable   As Long '0x04, Pointer to the Object Table
  85.    dwNull  As Long '0x08, Unused value after compilation.
  86.    lpCodeStart     As Long '0x0C, Points to start of code. Unused.
  87.    lpCodeEnd   As Long '0x10, Points to end of code. Unused.
  88.    dwDataSize  As Long '0x14, Size of VB Object Structures. Unused.
  89.    lpThreadSpace   As Long '0x18, Pointer to Pointer to Thread Object.
  90.    lpVbaSeh    As Long '0x1C, Pointer to VBA Exception Handler
  91.    lpNativeCode    As Long '0x20, Pointer to .DATA section.
  92.    szPathInformation(527) As Byte '0x24, Contains Path and ID string. < SP6
  93.    lpExternalTable     As Long '0x234, Pointer to External Table.
  94.    dwExternalCount     As Long '0x238, Objects in the External Table.
  95. End Type
  96.  
  97. Private Type SecondaryProjectInformation
  98.    lpHeapLink  As Long '0x00, Unused after compilation, always 0.
  99.    lpObjectTable   As Long '0x04, Back-Pointer to the Object Table.
  100.    dwReserved  As Long '0x08, Always set to -1 after compiling. Unused
  101.    dwUnused    As Long '0x0C, Not written or read in any case.
  102.    lpObjectList    As Long '0x10, Pointer to Object Descriptor Pointers.
  103.    dwUnused2   As Long '0x14, Not written or read in any case.
  104.    szProjectDescription    As Long '0x18, Pointer to Project Description
  105.    szProjectHelpFile   As Long '0x1C, Pointer to Project Help File
  106.    dwReserved2     As Long '0x20, Always set to -1 after compiling. Unused
  107.    dwHelpContextId     As Long '0x24, Help Context ID set in Project Settings.
  108. End Type
  109.  
  110. Private Type ObjectTable
  111.    lpHeapLink  As Long '0x00, Unused after compilation, always 0.
  112.    lpExecProj  As Long '0x04, Pointer to VB Project Exec COM Object.
  113.    lpProjectInfo2  As Long '0x08, Secondary Project Information.
  114.    dwReserved  As Long '0x0C, Always set to -1 after compiling. Unused
  115.    dwNull  As Long '0x10, Not used in compiled mode.
  116.    lpProjectObject     As Long '0x14, Pointer to in-memory Project Data.
  117.    uuidObject(15) As Byte '0x18, GUID of the Object Table.
  118.    fCompileState   As Integer '0x28, Internal flag used during compilation.
  119.    dwTotalObjects  As Integer '0x2A, Total objects present in Project.
  120.    dwCompiledObjects   As Integer '0x2C, Equal to above after compiling.
  121.    dwObjectsInUse  As Integer '0x2E, Usually equal to above after compile.
  122.    lpObjectArray   As Long '0x30, Pointer to Object Descriptors
  123.    fIdeFlag    As Long '0x34, Flag/Pointer used in IDE only.
  124.    lpIdeData   As Long '0x38, Flag/Pointer used in IDE only.
  125.    lpIdeData2  As Long '0x3C, Flag/Pointer used in IDE only.
  126.    lpszProjectName     As Long '0x40, Pointer to Project Name.
  127.    dwLcid  As Long '0x44, LCID of Project.
  128.    dwLcid2     As Long '0x48, Alternate LCID of Project.
  129.    lpIdeData3  As Long '0x4C, Flag/Pointer used in IDE only.
  130.    dwIdentifier    As Long '0x50, Template Version of Structure.
  131. End Type
  132.  
  133. Private Type PrivateObjectDescriptor
  134.    lpHeapLink  As Long '0x00, Unused after compilation, always 0.
  135.    lpObjectInfo    As Long '0x04, Pointer to the Object Info for this Object.
  136.    dwReserved  As Long '0x08, Always set to -1 after compiling.
  137.    dwIdeData   As Long '0x0C, [3] Not valid after compilation.
  138.    Unknown1 As Long '0x10
  139.    Unknown2 As Long '0x14
  140.    lpObjectList    As Long '0x18, Points to the Parent Structure (Array)
  141.    dwIdeData2  As Long '0x1C, Not valid after compilation.
  142.    lpObjectList2   As Long '0x20, [3] Points to the Parent Structure (Array).
  143.    Unknown3 As Long '0x24
  144.    Unknown4 As Long ' 0x28
  145.    wIdeData3  As Long '0x2C, [3] Not valid after compilation.
  146.    Unknown5 As Long '0x30
  147.    Unknown6 As Long '0x34
  148.    dwObjectType    As Long '0x38, Type of the Object described.
  149.    dwIdentifier    As Long '0x3C, Template Version of Structure.
  150. End Type
  151.  
  152. Private Type PublicObjectDescriptor
  153.    lpObjectInfo    As Long '0x00, Pointer to the Object Info for this Object.
  154.    dwReserved  As Long '0x04, Always set to -1 after compiling.
  155.    lpPublicBytes   As Long '0x08, Pointer to Public Variable Size integers.
  156.    lpStaticBytes   As Long '0x0C, Pointer to Static Variable Size integers.
  157.    lpModulePublic  As Long '0x10, Pointer to Public Variables in DATA section
  158.    lpModuleStatic  As Long '0x14, Pointer to Static Variables in DATA section
  159.    lpszObjectName  As Long '0x18, Name of the Object.
  160.    dwMethodCount   As Long '0x1C, Number of Methods in Object.
  161.    lpMethodNames   As Long '0x20, If present, pointer to Method names array.
  162.    bStaticVars     As Long '0x24, Offset to where to copy Static Variables.
  163.    fObjectType     As Long '0x28, Flags defining the Object Type.
  164.    dwNull  As Long '0x2C, Not valid after compilation.
  165. End Type
  166.  
  167. Private Type ObjectInformation
  168.    wRefCount   As Integer '0x00, Always 1 after compilation.
  169.    wObjectIndex    As Integer '0x02, Index of this Object.
  170.    lpObjectTable   As Long '0x04, Pointer to the Object Table
  171.    lpIdeData   As Long '0x08, Zero after compilation. Used in IDE only.
  172.    lpPrivateObject     As Long '0x0C, Pointer to Private Object Descriptor.
  173.    dwReserved  As Long '0x10, Always -1 after compilation.
  174.    dwNull  As Long '0x14, Unused.
  175.    lpObject    As Long '0x18, Back-Pointer to Public Object Descriptor.
  176.    lpProjectData   As Long '0x1C, Pointer to in-memory Project Object.
  177.    wMethodCount    As Integer '0x20, Number of Methods
  178.    wMethodCount2   As Integer '0x22, Zeroed out after compilation. IDE only.
  179.    lpMethods   As Long '0x24, Pointer to Array of Methods.
  180.    wConstants  As Integer '0x28, Number of Constants in Constant Pool.
  181.    wMaxConstants   As Integer '0x2A, Constants to allocate in Constant Pool.
  182.    lpIdeData2  As Long '0x2C, Valid in IDE only.
  183.    lpIdeData3  As Long '0x30, Valid in IDE only.
  184.    lpConstants     As Long '0x34, Pointer to Constants Pool.
  185. End Type
  186.  
  187. Private Type OptionalObjectInformation
  188.    dwObjectGuids   As Long '0x00, How many GUIDs to Register. 2 = Designer
  189.    lpObjectGuid    As Long '0x04, Unique GUID of the Object *VERIFY*
  190.    dwNull  As Long '0x08, Unused.
  191.    lpuuidObjectTypes   As Long '0x0C, Pointer to Array of Object Interface GUIDs
  192.    dwObjectTypeGuids   As Long '0x10, How many GUIDs in the Array above.
  193.    lpControls2     As Long '0x14, Usually the same as lpControls.
  194.    dwNull2     As Long '0x18, Unused.
  195.    lpObjectGuid2   As Long '0x1C, Pointer to Array of Object GUIDs.
  196.    dwControlCount  As Long '0x20, Number of Controls in array below.
  197.    lpControls  As Long '0x24, Pointer to Controls Array.
  198.    wEventCount     As Integer '0x28, Number of Events in Event Array.
  199.    wPCodeCount     As Integer '0x2A, Number of P-Codes used by this Object.
  200.    bWInitializeEvent   As Integer '0x2C, Offset to Initialize Event from Event Table.
  201.    bWTerminateEvent    As Integer '0x2E, Offset to Terminate Event in Event Table.
  202.    lpEvents    As Long '0x30, Pointer to Events Array.
  203.    lpBasicClassObject  As Long '0x34, Pointer to in-memory Class Objects.
  204.    dwNull3     As Long '0x38, Unused.
  205.    lpIdeData   As Long '0x3C, Only valid in IDE.
  206. End Type
  207.  
  208. Private Type ControlInformation
  209.    fControlType    As Long '0x00, Type of control.
  210.    wEventCount     As Integer '0x04, Number of Event Handlers supported.
  211.    bWEventsOffset  As Integer '0x06, Offset in to Memory struct to copy Events.
  212.    lpGuid  As Long '0x08, Pointer to GUID of this Control.
  213.    dwIndex     As Long '0x0C, Index ID of this Control.
  214.    dwNull  As Long '0x10, Unused.
  215.    dwNull2     As Long '0x14, Unused.
  216.    lpEventTable    As Long '0x18, Pointer to Event Handler Table.
  217.    lpIdeData   As Long '0x1C, Valid in IDE only.
  218.    lpszName    As Long '0x20, Name of this Control.
  219.    dwIndexCopy     As Long '0x24, Secondary Index ID of this Control.
  220. End Type
  221.  
  222. Private Function GetFakeHeader() As Long
  223.    Dim lPtr            As Long
  224.    Dim lProc           As Long
  225.    Dim bData(1024)     As Byte
  226.    Dim sData           As String
  227.    Dim lRet            As Long
  228.  
  229.    lPtr = App.hInstance
  230.    Do While lRet = 0
  231.        Call ReadProcessMemory(-1, ByVal lPtr, bData(0), 1024, 0&)
  232.        sData = StrConv(bData, vbUnicode)
  233.        lRet = InStr(1, sData, "VB5!", vbBinaryCompare)
  234.        lPtr = lPtr + 1024
  235.    Loop
  236.    GetFakeHeader = lPtr + lRet - 1024 - 1
  237. End Function
  238.  
  239. Public Function GetFormAddress() As Long
  240. Dim dd As VBHeader
  241. Dim tt As ProjectInformation
  242. Dim ss As ObjectTable
  243. Dim aa As PublicObjectDescriptor
  244. Dim jj As OptionalObjectInformation
  245. Dim yy As ControlInformation
  246.  
  247. Call ReadProcessMemory(-1, ByVal GetFakeHeader, dd, LenB(dd), 0)
  248. Call ReadProcessMemory(-1, ByVal dd.lpProjectData, tt, LenB(tt), 0)
  249. Call ReadProcessMemory(-1, ByVal tt.lpObjectTable, ss, LenB(ss), 0)
  250. Call ReadProcessMemory(-1, ByVal ss.lpObjectArray, aa, LenB(aa), 0)
  251.  
  252. Call ReadProcessMemory(-1, ByVal aa.lpObjectInfo, jj, LenB(jj), 0)
  253. Call ReadProcessMemory(-1, ByVal jj.lpControls, yy, LenB(yy), 0)
  254. MsgBox jj.bWInitializeEvent
  255. MsgBox jj.bWTerminateEvent
  256. MsgBox yy.lpEventTable
17  Programación / Programación Visual Basic / Re: [Proyecto]Facebook Photo Uploader en: 9 Marzo 2011, 21:31 pm
Muy linda herramienta ;-)
Me gustaría que utilizaras threads en vez un proceso por cada subida :P

Saludos
18  Programación / Programación Visual Basic / Re: AddressOf Form_Initialize() en: 1 Marzo 2011, 03:57 am
Gracias Leandro, pero no es eso lo que busco sino:

Código:
Option Explicit

Private Type GUID
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(7) As Byte
End Type

Public Declare Function VirtualProtect Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
Private Declare Function CreateThread Lib "kernel32" (ByVal lpSecurityAttributes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Long, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByRef lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
Private Declare Function VBDllGetClassObject Lib "MSVBVM60" (g1 As Long, g2 As Long, ByVal g3_vbHeader As Long, REFCLSID As Long, REFIID As GUID, ppv As Long) As Long
Private Declare Function CreateIExprSrvObj Lib "MSVBVM60" (ByVal p1_0 As Long, ByVal p2_4 As Long, ByVal p3_0 As Long) As Long
Private Declare Function CoInitialize Lib "OLE32" (ByVal pvReserved As Long) As Long
Private Declare Sub CoUninitialize Lib "OLE32" ()
Private m_nFakeHeader As Long
Public Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

Public Sub CreateNewThread(ByVal lAddress As Long, ByVal lVal As Long, Optional ByRef lHandle As Long, Optional ByRef lThread As Long)
    If m_nFakeHeader = 0 Then
        Call GetFakeHeader

    End If
    lHandle = CreateThread(ByVal 0&, ByVal 0&, lAddress, ByVal lVal, 0, lThread)
End Sub

Public Sub InitCurrentThread()
    Call CreateIExprSrvObj(0, 4, 0)
    Call CoInitialize(0)
    Call InitVBdll
End Sub

Public Sub TerminateCurrentThread()
    Call CoUninitialize
End Sub

Public Sub GetFakeHeader()
    Dim lPtr            As Long
    Dim lProc           As Long
    Dim bdata(1024)     As Byte
    Dim sData           As String
    Dim lRet            As Long
       
    lPtr = App.hInstance
    Do While lRet = 0
        If Not ReadProcessMemory(-1, ByVal lPtr, bdata(0), 1024, 0&) = 0 Then
            sData = StrConv(bdata, vbUnicode)
            lRet = InStr(1, sData, "VB5!", vbBinaryCompare)
        Else
            Exit Sub
        End If
        lPtr = lPtr + 1024
    Loop
    m_nFakeHeader = lPtr + lRet - 1024 - 1
End Sub

Private Sub InitVBdll()
    Dim pIID As GUID

    With pIID
        .Data1 = 1
        .Data4(0) = &HC0
        .Data4(7) = &H46
    End With
   
    'Escribir en (AddressOf Main o AddressOf Form_Initialize): &HC3 (RETN)
    Call VBDllGetClassObject(0, 0, m_nFakeHeader, 0, pIID, 0)
End Sub

Public Sub aaa()
InitCurrentThread
Form2.Show vbModal
TerminateCurrentThread
End Sub

Si probas el código, podrás ver que al crear un thread nuevo se ejecuta la función principal del programa (Main o Form_Init..), yo creo poder evitar eso escribiendo un RETN &HC3, en la dirección de "la función principal" pero no se crear una función genérica que me devuelva la dirección sea un modulo o form.

La función principal es llamada al llamar VBDllGetClassObject, estuve viendo las estructuras http://vb-decompiler.com/viewtopic.php?t=2 , pensando que podria encontrar la dirección ahi pero tampoco  :-\

Bueno eso es lo que quiero hacer, pero necesito ayuda  :-X Saludos  :)
19  Programación / Programación Visual Basic / Re: AddressOf Form_Initialize() en: 1 Marzo 2011, 00:08 am
AdressOf no funciona con algo que no sea una funcion de modulo publico :xD

por ello hice este post  :silbar:
20  Programación / Programación Visual Basic / AddressOf Form_Initialize() en: 28 Febrero 2011, 23:41 pm
Hola gente, estoy buscando obtener la direccion de Form_Initialize. A mi se me ocurre por medio de un hook, pero no me gusta es muy groncho  :-X

Gracias
Páginas: 1 [2] 3 4 5
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines