Include DLL Reference In Injector?
I'm not making a P2C just don't want my cheat to be leaked so I want to attach it to the injector, which requires a login. Basically, I want to make it like a Pay2Cheat login system where you login and can just inject the DLL from there, not look through your files for a cheat to use. This is all the current code I have, but I can't seem to figure out how to get it to work. I just want the DLL to appear in the ListBox and when I click Inject, it loads the DLL from my references. Any help is appreciated.
Code:
Public Class PlainsInjector
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)
Dim DLLFileName As String
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
Dim ExeName As String = IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)
Private Sub Inject()
On Error GoTo 1
Timer1.Stop()
Dim TargetProcess As Process() = Process.GetProcessesByName(TextBox1.Text)
TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
pszLibFileRemote = "C:\Users\maina\Documents\Visual Studio 2017\Projects\Plains Injector\Plains Injector\Resources\Plains.dll"
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)
1: Me.Show()
End Sub
Private Sub Injector_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Injector.Name = "Injector"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If IO.File.Exists("C:\Users\maina\Documents\Visual Studio 2017\Projects\Plains Injector\Plains Injector\Resources\Plains.dll") Then
Dim TargetProcess As Process() = Process.GetProcessesByName(TextBox1.Text)
If TargetProcess.Length = 0 Then
Me.Injector.Items.Add(DLLFileName)
Call Inject()
If CheckBox1.Checked = True Then
End
Else
End If
End If
Else
End If
End Sub
Private Sub Close1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Close1.Click
Application.Exit()
End Sub
Public junkCode()
Sub Main()
Dim DtzmXTHcTGlFS As Integer = 390085277
Dim ewORTdvkqVjTl As String = "FEBbwvyvrysCVQHg"
Dim aVJMHZCNeHJvBR As Integer = 982367397
Dim hWuXgWPJRtQmCk As Byte = 56
Dim yiEgzSPbEbaII As String = "gChiOqKqNFrXDE"
Dim KpRJPHZzGNPBjKd As Byte = 147
Dim yYVNVfuEmyNVSnZe As Byte = 32
Dim sKVczknFrDBQg As Byte = 18
Dim LtKlJIRhbfRBLl As Byte = 41
Dim IfZiAWzUYCYotR As Integer = 1086872769
Dim XARyvzfKZSmcB As Byte = 120
Dim zvpUrvOtZfSPEQ As Integer = 872704171
Dim DbRIOdyXwfleTn As Byte = 35
Console.WriteLine("Plains Junk Code Injector")
Dim cUNKsPbzhJSqh As Integer = 667701145
Dim anrEEPcXBvRHbPZ As Integer = 62195563
Dim oKNdMGLpplEhazPa As String = "xgHPXhuoooZXcIY"
Dim SfEujBocwjyyM As Byte = 72
Dim kNGPuzWQmOqwUIsS As String = "eHVTiqTYCHqxJhI"
Dim qpUdibsOgZfBMkizw As Byte = 82
Dim IiEMybCkGIbpqqJyN As Byte = 196
Dim VtIzOfOdgGYlRRJp As String = "HqZDKaGAzRsHjwmO"
Dim SEqhgTDGWFrtQ As Byte = 111
Dim jlSoqMBlWUpkft As Integer = 1286814455
Dim vNzRMvekFllcpWkJ As Integer = 1673506017
Dim ukfOZEPskEzvB As Integer = 615171583
Dim OAHxgsmsILcyNDI As Integer = 1571502681
End Sub
End Class