PHP Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace Loader
{
public partial class Form1 : Form
{
[DllImport("kernel32.dll")]
static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
static extern IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
static extern uint ReadProcessMemory(IntPtr hProcess, uint lpBaseAddress, uint lpbuffer, uint nSize, uint lpNumberOfBytesRead);
[DllImport("kernel32.dll")]
static extern uint WriteProcessMemory(IntPtr hProcess, uint lpBaseAddress, byte[] lpBuffer, int nSize, uint lpNumberOfBytesWritten);
[DllImport("kernel32.dll")]
static extern uint VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, uint flAllocationType, uint flProtect);
[DllImport("kernel32.dll")]
static extern IntPtr CreateMutex(IntPtr lpMutexAttributes, bool bInitialOwner, string lpName);
[DllImport("kernel32.dll")]
static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("kernel32")]
static extern uint GetProcAddress(IntPtr hModule, string procName);
[DllImport("kernel32.dll")]
static extern uint WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
public static IntPtr Handle;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
CreateMutex(IntPtr.Zero, false, "Silkroad Online Launcher");
CreateMutex(IntPtr.Zero, false, "Ready");
uint count = 0;
Process SilkProcess;
SilkProcess = new Process();
SilkProcess.StartInfo.FileName = @"D:\Program Files\Creddy Avengers Loki\sro_client.exe";
SilkProcess.StartInfo.Arguments = "0/22 0 0";
SilkProcess.Start();
Handle = OpenProcess((uint)(0x000F0000L | 0x00100000L | 0xFFF), 0, SilkProcess.Id);
uint ConnectionStack = VirtualAllocEx(Handle, IntPtr.Zero, 8, 0x1000, 0x4);
byte[] ConnectionStackArray = BitConverter.GetBytes(ConnectionStack);
byte[] Connection = {
0x02,0x00,
0x3D, 0xA2, // PORT (15778)
0x7F,0x00,0x00,0x01 // IP (127.0.0.1)
};
uint Codecave = VirtualAllocEx(Handle, IntPtr.Zero, 16, 0x1000, 0x4);
byte[] CodecaveArray = BitConverter.GetBytes(Codecave - 0x004B08A1 - 5);
byte[] CodeCaveFunc = {
0xBF,ConnectionStackArray[0],ConnectionStackArray[1],ConnectionStackArray[2],ConnectionStackArray[3],
0x8B,0x4E,0x04,
0x6A,0x10,
0x68,0xA6,0x08,0x4B,0x00,
0xC3
};
byte[] JMPCodeCave = { 0xE9, CodecaveArray[0], CodecaveArray[1], CodecaveArray[2], CodecaveArray[3] };
WriteProcessMemory(Handle, ConnectionStack, Connection, Connection.Length, count);
WriteProcessMemory(Handle, Codecave, CodeCaveFunc, CodeCaveFunc.Length, count);
WriteProcessMemory(Handle, 0x004B08A1, JMPCodeCave, JMPCodeCave.Length, count);
}
}
}