Option Explicit Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _ ByVal lpProcName As String) As Long Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, _ lpAddress As Any, _ ByVal dwSize As Long, _ ByVal fAllocType As Long, _ flProtect As Long) As Long Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, _ ByVal lpBaseAddress As Any, _ lpBuffer As Any, _ ByVal nSize As Long, _ lpNumberOfBytesWritten As Long) As Long Private Declare Function CreateRemoteThread Lib "kernel32" (ByVal ProcessHandle As Long, _ lpThreadAttributes As Long, _ ByVal dwStackSize As Long, _ ByVal lpStartAddress As Any, _ ByVal lpParameter As Any, _ ByVal dwCreationFlags As Long, _ lpThreadID As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Public Sub InjectDll(DllPath As String, _ ProsH As Long) Dim DLLVirtLoc As Long Dim DllLength As Long Dim inject As Long Dim LibAddress As Long Dim CreateThread As Long Dim ThreadID As Long Dim Bla As VbMsgBoxResult g_loadlibary: LibAddress = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA") If LibAddress = 0 Then Bla = MsgBox("Can't find LoadLibrary API from kernel32.dll", vbYesNo, "ERROR") If Bla = vbYes Then GoTo g_loadlibary Else 'NOT BLA... Exit Sub End If End If g_virutalallocex: DllLength = Len(DllPath) DLLVirtLoc = VirtualAllocEx(ProsH, 0, DllLength, &H1000, ByVal &H4) If DLLVirtLoc = 0 Then Bla = MsgBox("VirtualAllocEx API failed! - try again?", vbYesNo, "ERROR") If Bla = vbYes Then GoTo g_virutalallocex Else 'NOT BLA... Exit Sub End If End If g_writepmemory: inject = WriteProcessMemory(ProsH, ByVal DLLVirtLoc, ByVal DllPath, DllLength, vbNull) If inject = 0 Then Bla = MsgBox("Failed to Write DLL to Process! - try again?", vbYesNo, "ERROR") If Bla = vbYes Then GoTo g_writepmemory Else 'NOT BLA... Exit Sub End If End If g_creatthread: CreateThread = CreateRemoteThread(ProsH, ByVal 0, 0, ByVal LibAddress, ByVal DLLVirtLoc, 0, ThreadID) If CreateThread = 0 Then Bla = MsgBox("Failed to Create Thead! - try again?", vbYesNo, "ERROR") If Bla = vbYes Then GoTo g_creatthread Else 'NOT BLA... Exit Sub End If End If MsgBox "Dll Has Been Inject...", vbInformation, "NStars.Net" End Sub Public Sub InjectExecute(ByVal sFlDLL As String) Dim lProcInject As Long lProcInject = OpenProcess(PROCESS_ALL_ACCESS, 0, IdTargetOne) If lProcInject > "0" Then Call InjectDll(sFlDLL, lProcInject) End If Call CloseHandle(lProcInject) End Sub