Code:
Option Explicit On
Imports System
Imports System.Collections
Imports System.Collections.Specialized
Public Class Form1
Private TargetProcessHandle As Integer
Private pfnStartAddr As Integer
Private pszLibFileRemote As String
Private TargetBufferSize As Integer
Public Const PROCESS_VM_READ = &H10
Public Const TH32CS_SNAPPROCESS = &H2
Public Const MEM_COMMIT = 4096
Public Const PAGE_READWRITE = 4
Public Const PROCESS_CREATE_THREAD = (&H2)
Public Const PROCESS_VM_OPERATION = (&H8)
Public Const PROCESS_VM_WRITE = (&H20)
Public Declare Function ReadProcessMemory Lib "kernel32" ( _
ByVal hProcess As Integer, _
ByVal lpBaseAddress As Integer, _
ByVal lpBuffer As String, _
ByVal nSize As Integer, _
ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" ( _
ByVal lpLibFileName As String) As Integer
Public Declare Function VirtualAllocEx Lib "kernel32" ( _
ByVal hProcess As Integer, _
ByVal lpAddress As Integer, _
ByVal dwSize As Integer, _
ByVal flAllocationType As Integer, _
ByVal flProtect As Integer) As Integer
Public Declare Function WriteProcessMemory Lib "kernel32" ( _
ByVal hProcess As Integer, _
ByVal lpBaseAddress As Integer, _
ByVal lpBuffer As String, _
ByVal nSize As Integer, _
ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function GetProcAddress Lib "kernel32" ( _
ByVal hModule As Integer, ByVal lpProcName As String) As Integer
Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" ( _
ByVal lpModuleName As String) As Integer
Public Declare Function CreateRemoteThread Lib "kernel32" ( _
ByVal hProcess As Integer, _
ByVal lpThreadAttributes As Integer, _
ByVal dwStackSize As Integer, _
ByVal lpStartAddress As Integer, _
ByVal lpParameter As Integer, _
ByVal dwCreationFlags As Integer, _
ByRef lpThreadId As Integer) As Integer
Public Declare Function OpenProcess Lib "kernel32" ( _
ByVal dwDesiredAccess As Integer, _
ByVal bInheritHandle As Integer, _
ByVal dwProcessId As Integer) As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Integer
Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" ( _
ByVal hObject As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Text = My.Settings.process
ListView1.FullRowSelect = True
ListView1.GridLines = True
Timer2.Enabled = True
Timer2.Start()
Dim ProcessList As System.Diagnostics.Process()
ProcessList = System.Diagnostics.Process.GetProcesses()
Dim Proc As System.Diagnostics.Process
For Each Proc In ProcessList
ComboBox1.Items.Add(Proc.ProcessName)
Next
'ListView1.Items.AddRange(My.Settings.dll)
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Dim open As New OpenFileDialog
open.Multiselect = True
open.Filter = "DLL Files(*.dll) |*.dll"
open.CheckFileExists = True
open.ShowDialog()
If (open.FileName = "") Then
Else
For Each item As String In open.FileNames
Dim listItem As New ListViewItem
listItem.Text = item
Dim subItem As New ListViewItem.ListViewSubItem()
subItem.Text = My.Computer.FileSystem.GetName(item)
listItem.SubItems.Add(subItem)
ListView1.Items.Add(listItem)
Next
End If
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
For Each lsvrow As ListViewItem In ListView1.SelectedItems
ListView1.Items.Remove(lsvrow)
Next
End Sub
Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
If (ComboBox1.Text = "Select a process...") Then
MsgBox("Please select a process!")
Else
Timer3.Enabled = True
Timer3.Interval = 50
Timer3.Start()
call_save()
My.Settings.process = ComboBox1.Text
My.Settings.Save()
End If
End Sub
Private Function Success(ByVal accept As Integer) As Integer
Timer1.Enabled = True
Timer1.Interval = 3000
If (accept = 1) Then
Label3.Text = "Success!"
Label3.ForeColor = Color.Green
Label3.Visible = True
Timer1.Start()
ElseIf (accept = 2) Then
Label3.Text = "Failed!"
Label3.ForeColor = Color.Red
Label3.Visible = True
Timer1.Start()
End If
End Function
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Stop()
Timer1.Enabled = False
Label3.Visible = False
If (Label3.Text = "Failed!") Then
Me.Close()
ElseIf (Label3.Text = "Success!") Then
Me.Close()
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Me.Text = RandomNumber(100) & RandomNumber(100) & RandomNumber(100) & RandomNumber(100) & RandomNumber(100) & RandomNumber(100) & RandomNumber(100) & RandomNumber(100) & RandomNumber(100) & " by Helicopter12"
End Sub
Private Function RandomNumber(ByVal rUpper As Integer, Optional ByVal rLower As Integer = 1) As Integer
' Generate random number between upper and lower bound values
Randomize()
RandomNumber = Int((rUpper - rLower + 1) * Rnd() + rLower)
End Function
Private Sub Inject()
Try
For Each lsvrow As ListViewItem In ListView1.Items
Timer1.Stop()
Dim TargetProcess As Process() = Process.GetProcessesByName(ComboBox1.Text)
TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
pszLibFileRemote = lsvrow.Text
pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
TargetBufferSize = 1 + Len(pszLibFileRemote)
Dim Rtn As Integer
Dim LoadLibParamAdr As Integer
LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
CloseHandle(TargetProcessHandle)
Success(1)
Me.Close()
Next
Catch es As Exception
Success(2)
Me.Close()
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If (ComboBox1.Text = "") Then
ComboBox1.Text = "Select a process..."
End If
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
Dim TargetProcess As Process() = Process.GetProcessesByName("HSUpdate")
If TargetProcess.Length = 0 Then
Label3.Text = "Waiting..."
Label3.ForeColor = Color.Green
Label3.Visible = True
Else
Timer3.Stop()
Call Inject()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
System.Diagnostics.Process.Start("https://zyrm.zzl.org/forum/")
Catch ex As Exception
End Try
End Sub
Private Function call_save() As Integer
' Create and initializes a new StringCollection.
Dim myCol As New StringCollection()
' Add a range of elements from an array to the end of the StringCollection.
For Each lsvrow As ListViewItem In ListView1.Items
myCol.Add(lsvrow.Text)
Next
My.Settings.dll = myCol
My.Settings.Save()
End Function
End Class