HOLA!!!
Mira, te lo traduje lo mejor que pude, no se como usar pointers en vb6 asique eso lo cas a tener que hacer vos.
Te dejo el codigo del formulario, la Dll la podes compilar calculo.
Y usa una libreria psApi, encontre una para vb6 pero no tiene todas las funciones fijate si la encontras. Entonces tambien te queda por ponerle psapi. a todas sus funciones.
*Ahh, el codigo esta traducido, no esta funcional para nada, aviso.
Dim psAPI As New mPSAPI 'con esto tenes que hacer psapi.funcion
'NOTAS: NIL ES PARA VACIAR LOS POINTERS, NO SE ESO EN VB6
Private Sub btnInyectar_Click()
Dim Procesos(1 To 1024) As Long
Dim Needed As Long
Dim i As Long
Dim Process As Long ' aca no se me ocurio que poner \\ Process, Thread: THandle;
Dim Thread As Long ' aca no se me ocurio que poner \\ Process, Thread: THandle;
Dim ModName(0 To Max_Path) As Byte
'RemLibPath : PChar; \\aca un pointer a un caracter de alguna variable
Dim ExitCode As Long
Dim LibPath As String
Dim Target As String
If lsbMain.ListIndex >= 0 Then
Target = lsbMain.List(lsbMain.ListIndex)
LibPath = App.Path & "\Hook.dll"
If EnumProcesses(Procesos, LenB(Procesos), Needed) Then
For i = 1 To (Needed \ LenB(DWORD))
Process = OpenProcess(PROCESS_ALL_ACCESS, False, Procesos(i))
If Process <> 0 Then
If GetModuleFileNameEx(Process, 0, ModName, LenB(ModName) - 1) > 0 Then
If AnsiStrPos(ModName, PChar(Target)) <> nil Then
RemLibPath = VirtualAllocEx(Process, nil, Len(LibPath) + 1, MEM_COMMIT, PAGE_READWRITE)
If RemLibPath <> nil Then
If WriteProcessMemory(Process, RemLibPath, PChar(LibPath), Len(LibPath), PDWORD(nil)) Then ' no se si esta bien la ultima parte
'If WriteProcessMemory(Process, RemLibPath, PChar(LibPath), Len(LibPath), PDWORD(nil)^) Then
Thread = CreateRemoteThread(Process, nil, 0, GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA"), RemLibPath, 0, PDWORD(nil)) ' no se si esta bien la ultima parte
'Thread = CreateRemoteThread(Process, nil, 0, GetProcAddress(GetModuleHandle('Kernel32'), 'LoadLibraryA'), RemLibPath, 0, PDWORD(nil)^)
If Thread <> 0 Then
'WaitForSingleObject(Thread,INFINITE ); NOSE
'GetExitCodeThread(Thread,ExitCode); NOSE
CloseHandle (Thread)
End If
End If
'VirtualFreeEx(Process,RemLibPath,Length(LibPath)+1,MEM_RELEASE); ¿? NOSE
End If
End If
End If
CloseHandle (Process)
End If
Next
End If
End If
End Sub
Private Sub btnRefrescar_Click()
Dim Procesos(1 To 1024) As Long
Dim Needed As Long
Dim i As Long
Process As Long ' aca no se me ocurio que poner \\ Process: THandle
ModName(0 To Max_Path) As Byte
lsbMain.Clear
If EnumProcesses(Procesos, UBound(Procesos), Needed) Then
For i = 1 To (Needed \ LenB(DWORD))
Process = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, False, Procesos(i))
If Process <> 0 Then
If GetModuleFileNameEx(Process, 0, ModName, LenB(ModName) - 1) > 0 Then
lsbMain.Add ModName
End If
CloseHandle (Process)
End If
Next
End If
End Sub
GRACIAS POR LEER!!!