codifo fuente del modulo, .bas:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Nombre: Evolution Offset Tester '
'Autor: Strup '
'Objetivo: Testear grandes cantidades de offsets '
'Fecha: 02/02/2014 03:17 '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
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 SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Const HWND_TOPMOST As Integer = -1
Private Const SWP_NOSIZE As Integer = 1
Private Const SWP_NOMOVE As Integer = 2
Private Const WM_CLOSE As Integer = &H10
Private Const SW_HIDE As Integer = 0
Private Cuenta As Long, Contador As Long, Sustraccion As Long, Adicion As Long, i As Long, x As Long, Medida As Long, Ancho As Long, Tops As Long, Lefts As Long, Pid As Long
Private Exe() As String, Titulo As String, Directorio As String, RutaOffsets As String, Offsets() As String, Skin As String
Private Recurso() As Byte, Canal As Byte
Private Clear As Variant
Public Flag As Boolean
Public Sub Testear()
If Form1.Testeo.Caption = CStr(Cuenta) Then
Call Ejecutar
Else
Form1.LV.Checkboxes = False: Flag = True: Form1.Testeo.Caption = "Pausar": Form1.Suma.Enabled = False: Form1.Resta.Enabled = False: Form1.Limpieza.Enabled = False
On Error GoTo RE
Medida = UBound(Offsets)
Form1.PB.Max = Medida
For x = Form1.PB.Value + 1 To Medida
Form1.PB.Value = x
Call Progreso(CStr(Fix(x * 100 / Form1.PB.Max)) & "%")
Form1.Text1.Text = "Testeados: " + CStr(Form1.PB.Value) + " De " + CStr(Medida)
On Error Resume Next
Pid = Shell(Directorio + "\" + Offsets(x), vbNormalFocus)
Resume Next
Call ShellExecute(0, "open", "tskill.exe", "dwwin", vbNullString, SW_HIDE)
Sleep (CLng(CStr(Form1.Text2.Text) & "000"))
Call SendMessage(FindWindow(vbNullString, Directorio + "\" + Offsets(x)), WM_CLOSE, 0&, 0&)
Call SendMessage(FindWindow("#32770", vbNullString), WM_CLOSE, 0&, 0&)
Call TerminateProcess(OpenProcess(&H1, False, Pid), 0)
DoEvents
Next x
End If
If Form1.PB.Value >= Medida And x > 1 Then
Flag = False: Form1.Testeo.Caption = "Terminado": Form1.Suma.Enabled = True: Form1.Resta.Enabled = True: Form1.Limpieza.Enabled = True
ElseIf x > 1 Then
Flag = False: Form1.Testeo.Caption = "Continuar": Form1.Suma.Enabled = True: Form1.Resta.Enabled = True: Form1.Limpieza.Enabled = True
End If
RE:
If Err.Number = 9 Then
Form1.LV.ListItems.Clear
Form1.LV.ColumnHeaders.Clear
OLEDragAndDrop (Directorio)
Call Testear
End If
End Sub
Public Sub FormLoad()
Call Aplicar_Skin
Call SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
Titulo = Form1.Caption
Form1.Caption = "Arrastra Un Directorio"
Lefts = Form1.Left: Tops = Form1.Top: Ancho = Form1.Width
End Sub
Public Sub OLEDragAndDrop(ByVal Ruta As String)
Directorio = Ruta
If (Ruta <> vbNullString) Then
On Error Resume Next
RutaOffsets = Dir(Ruta & "\*.exe", vbNormal)
Resume Next
If (RutaOffsets <> vbNullString) Then
Call Modificar
i = 1
End If
While (RutaOffsets <> vbNullString)
ReDim Preserve Offsets(i) As String
Offsets(i) = Form1.LV.ListItems.Add(, , RutaOffsets)
RutaOffsets = Dir
i = i + 1
DoEvents
Wend
If i > 1 Then
Form1.Suma.Enabled = True: Form1.Resta.Enabled = True
Form1.Testeo.Caption = "Testear"
Form1.Limpieza.Enabled = True
Form1.Testeo.Enabled = True
Call Form1.LV.ColumnHeaders.Add(, , "Listado", 4520)
Form1.LV.Checkboxes = True
End If
End If
End Sub
Public Sub Ejecutar()
Dim h As Long
Erase Offsets()
Form1.LV.ListItems.Clear
Contador = 1
For h = LBound(Exe) + 1 To UBound(Exe)
If Exe(h) <> vbNullString Then
ReDim Preserve Offsets(Contador) As String
Offsets(Contador) = Exe(h)
Call Form1.LV.ListItems.Add(, , Offsets(Contador))
Contador = Contador + 1
End If
DoEvents
Next h
Form1.Testeo.Caption = vbNullString
Call Testear
End Sub
Public Sub Abrir(item)
On Error GoTo IR
Pid = Shell(Directorio + "\" + item, vbNormalFocus)
IR:
If Err.Number = 5 Then
Call MsgBox("El Offset " + item + " No Es Funcional", vbInformation, "Aviso")
End If
Call ShellExecute(0, "open", "tskill.exe", "dwwin", vbNullString, SW_HIDE)
Sleep (CLng(CStr(Form1.Text2.Text) & "000"))
Call SendMessage(FindWindow(vbNullString, Directorio + "\" + item), WM_CLOSE, 0&, 0&)
Call SendMessage(FindWindow("#32770", vbNullString), WM_CLOSE, 0&, 0&)
Call TerminateProcess(OpenProcess(&H1, False, Pid), 0)
End Sub
Public Sub Añadir(item)
Adicion = Adicion + 1
ReDim Preserve Exe(Adicion) As String
Exe(Adicion) = item
Cuenta = Cuenta + 1
Form1.Testeo.Caption = Cuenta
End Sub
Public Sub Quitar(item)
For Sustraccion = 1 To UBound(Exe)
If Exe(Sustraccion) = item Then
Exe(Sustraccion) = vbNullString
End If
Next Sustraccion
Cuenta = Cuenta - 1
Form1.Testeo.Caption = Cuenta
End Sub
Public Sub Sumar()
Form1.Text2.Text = Form1.Text2.Text + 1
End Sub
Public Sub Restar()
If Form1.Text2.Text < 1 Then
Form1.Text2.Text = 0
Else
Form1.Text2.Text = Form1.Text2.Text - 1
End If
End Sub
Public Sub Limpiar()
Form1.Testeo.Caption = vbNullString
Form1.Porcentaje = Clear: Form1.Text1.Text = Clear: Form1.LV.ListItems.Clear: Form1.PB = Clear
Form1.Testeo.Enabled = False: Form1.Text1.Visible = False: Form1.Limpieza.Enabled = False: Form1.Suma.Enabled = False: Form1.Resta.Enabled = False
RutaOffsets = vbNullString: Directorio = vbNullString
Form1.OLEDropMode = 1
Form1.LV.ColumnHeaders.Clear
Form1.LV.Checkboxes = True
Erase Offsets()
Erase Exe()
x = 0: i = 0: Adicion = 0: Sustraccion = 0: Contador = 0: Cuenta = 0
End Sub
Public Sub Pausar()
x = Medida
End Sub
Private Sub Modificar()
With Form1
.Caption = Titulo
.Height = 6720
.Width = Ancho
.Left = Lefts
.Top = Tops
.OLEDropMode = 0
End With
With Form1.LV
.Height = 4215
.Top = 480
End With
With Form1.Text1
.Visible = True
.Text = Directorio & "\"
End With
Call Form1.Creditos.Move(4080, 5280, 615, 375)
End Sub
Private Sub Progreso(ByVal Porciento As String)
Form1.Porcentaje.Caption = Porciento
If (Len(Porciento) = 4) Then
Form1.Porcentaje.Left = 2265
ElseIf (Len(Porciento) = 3) Then
Form1.Porcentaje.Left = 2305
End If
End Sub
Private Sub Aplicar_Skin()
Canal = FreeFile
Recurso = LoadResData(101, "CUSTOM")
Skin = App.Path + "\" + "M3.msstyles"
Open Skin For Binary As #Canal
On Error Resume Next
Put #Canal, , Recurso
Resume Next
Close #Canal
Call Form1.SF.LoadSkin(Skin, vbNullString)
Form1.SF.ApplyWindow (Form1.hwnd)
End Sub
Private Sub LV_ItemCheck(ByVal item As MSComctlLib.ListItem)
If item.Checked = False Then
Quitar (item)
Else
Añadir (item)
End If
End Sub
Private Sub LV_ItemClick(ByVal item As MSComctlLib.ListItem)
Abrir (item)
End Sub
Private Sub Testeo_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
With Testeo
Select Case .Caption
Case "Testear"
.ToolTipText = "Empezar A Testear Offsets"
Case "Pausar"
.ToolTipText = "Pausar Proceso De Ejecuciones"
Case "Continuar"
.ToolTipText = "Continuar Proceso De Ejecuciones"
Case "Terminado"
.ToolTipText = "Proceso De Ejecuciones Terminado"
Case Else
.ToolTipText = "Ejecutar Seleccionados"
End Select
End With
End Sub
Private Sub Suma_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Suma.ToolTipText = "Sumar Segundos"
End Sub
Private Sub Resta_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Resta.ToolTipText = "Restar Segundos"
End Sub
Private Sub Creditos_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Creditos.ToolTipText = "Creditos"
End Sub
Private Sub Limpieza_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Limpieza.ToolTipText = "Limpiar Campos y Variables"
End Sub
Private Sub Testeo_Click()
If Flag = True Then
Call Pausar
Else
Call Testear
End If
End Sub
Private Sub Suma_Click()
Call Sumar
End Sub
Private Sub Resta_Click()
Call Restar
End Sub
Private Sub Limpieza_Click()
Call Limpiar
End Sub
Private Sub Creditos_Click()
Dialog.Show
End Sub
Private Sub Form_Load()
Call FormLoad
End Sub
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Call OLEDragAndDrop(Data.Files(1))
End Sub