Ejemplo n.º 1
0
        private void ListenClient()
        {
            while (runing)
            {
                System.Threading.Thread.Sleep(600);
                while (Process.GetProcessesByName("Dofus").ToList <Process>().Count < patchedClientCount)
                {
                }
                List <Process> processLst = Process.GetProcessesByName("Dofus").ToList <Process>();
                foreach (Process prc in processLst)
                {
                    if (!alreadyPatchedClient.Contains(prc.Id))
                    {
                        Console.WriteLine("Hello biatch");
                        patchedClientCount += 1;
                        alreadyPatchedClient.Add(prc.Id);
                        DllInjector Injector = new DllInjector();
                        string      dllDir   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", "") + @"\No.Ankama.dll";
                        Logger.Default.Log("Configurations du client : " + Injector.Inject(Convert.ToUInt32(prc.Id), dllDir).ToString());

                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void _injectButton_Click(object sender, EventArgs e)
        {
            if (!IsReadyToInject())
            {
                return;
            }
            // assume things are OK
            var    injector = new DllInjector();
            string filenameOfDllToInject = GetAbsolutePathForDllName();
            var    result = injector.PerformInjection(_selectedProcess.Id, filenameOfDllToInject);

            if (result)
            {
                // store dll with process name in recent list
                AppStateSingleton.Instance().AddDllNameForProcess(_selectedProcess.MainModule.ModuleName, filenameOfDllToInject);
                AppStateSingleton.Instance().SetAttachedProcess(_selectedProcess);
                _selectedProcess.EnableRaisingEvents = true;
                _selectedProcess.Exited += _selectedProcess_Exited;
                DisplayAttachedProcessInUI();
                this.DllInjected.RaiseEvent(this);
            }
            else
            {
                MessageBox.Show(string.Format("Injection failed when performing:{0}{1}{0}The following error occurred:{0}{2}",
                                              Environment.NewLine, injector.LastActionPerformed, new Win32Exception(injector.LastError).Message), "Injection result",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 3
0
        /*
         *  ------------------------
         *  Performing DLL Injection
         *  ------------------------
         */

        /// <summary>
        /// Finds the mods that are currently enabled for the game and injects into the target process.
        /// </summary>
        /// <param name="gameConfiguration">The game configuration which contains the current directory and list of mods to load.</param>
        /// <param name="reloadedProcess">The reloaded process to inject the modifications into.</param>
        public static void LoadMods(GameConfig gameConfiguration, ReloadedProcess reloadedProcess)
        {
            // Retrieve list of DLLs to be injected.
            string[] modLibraries = GetModulesToInject(gameConfiguration);

            // Initialize DLL Injector
            DllInjector reloadedClassicDllInjector = new DllInjector(reloadedProcess);

            // For each DLL file, if the DLL exists, load the DLL.
            foreach (string modLibrary in modLibraries)
            {
                if (File.Exists(modLibrary))
                {
                    // To handle plugin support for this one, we pass the parameters onto each plugin and
                    // each plugin on their own can decide whether to manually inject themselves or not.
                    // If they return "true", we go to next file; else we inject normally.
                    bool dllInjected = false;
                    foreach (var plugin in PluginLoader.LoaderEventPlugins)
                    {
                        if (plugin.ManualDllInject((int)reloadedProcess.ProcessId, modLibrary, "Main"))
                        {
                            dllInjected = true;
                            break;
                        }
                    }

                    if (!dllInjected)
                    {
                        InjectDLLDefault(reloadedProcess, reloadedClassicDllInjector, modLibrary, "Main");
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void InjectDlls()
 {
     foreach (string dll in account.Settings.DLLs)
     {
         DllInjector.Inject((uint)Process.Id, dll);
     }
 }
Ejemplo n.º 5
0
        static int Main(string[] args)
        {
            if (IntPtr.Size != 8)
            {
                Console.WriteLine("This application must be compiled as 64 bit.");
                return(1);
            }
            if (args.Length == 0)
            {
                Console.WriteLine("Expected command line parameters: PID DllName");
                Console.WriteLine($"PID: {DllInjector.FindProcessForWindow("Grim Dawn").FirstOrDefault()}");
                return(1);
            }

            uint pid;

            if (!uint.TryParse(args[0], out pid))
            {
                Console.WriteLine($"The PID argument must be a positive numeric value");
                return(1);
            }

            if (!File.Exists(args[1]))
            {
                Console.WriteLine($"Cannot find the file \"{args[1]}\"");
                return(1);
            }

            try {
                var p = Process.GetProcessById((int)pid);
                if (!DllInjector.Is64BitProcess(p))
                {
                    Console.WriteLine("The target process is not 64bit");
                    return(1);
                }
            }
            catch (ArgumentException ex) {
                Console.WriteLine(ex.Message);
                return(1);
            }

            try {
                var result = DllInjector.NewInject(pid, args[1]);
                if (result == IntPtr.Zero)
                {
                    Console.WriteLine("Unknown error injecting into target process");
                    return(1);
                }
                Console.WriteLine(result);
                return(0);
            }
            catch (ArgumentException ex) {
                Console.WriteLine(ex.Message);
                return(1);
            }
        }
Ejemplo n.º 6
0
 private void unloadSelectedModulesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem i in lvModules.SelectedItems)
     {
         ModuleListViewItem item    = (ModuleListViewItem)i;
         IntPtr             pHandle = PELoader.OpenProcessHandle(ProcessID);
         DllInjector.UnloadDll(pHandle, item.ModuleInfomation.ModuleBaseAddress);
         PELoader.CloseProcessHandle(pHandle);
         PopulateList();
     }
 }
Ejemplo n.º 7
0
        private static void InjectDLLDefault(ReloadedProcess reloadedProcess, DllInjector dllInjector, string dllPath, string dllMethodName)
        {
            // Allocate Memory for Server Port In Game Memory
            IntPtr parameterAddress = reloadedProcess.AllocateMemory(IntPtr.Size);

            // Write Server Port to Game Memory
            byte[] serverPort = BitConverter.GetBytes(LoaderServer.ServerPort);
            reloadedProcess.WriteMemoryExternal(parameterAddress, ref serverPort);

            // Inject the individual DLL.
            dllInjector.InjectDll(dllPath, parameterAddress, dllMethodName);
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                System.Console.WriteLine("Usage: {0} program.exe library.dll", System.AppDomain.CurrentDomain.FriendlyName);
                return;
            }

            string sProcName = args[0];
            string sDllPath  = args[1];

            System.Console.WriteLine("{0} {1}", sProcName, sDllPath);
            DllInjector        inj    = DllInjector.GetInstance;
            DllInjectionResult result = inj.Inject(sProcName, sDllPath);

            System.Console.WriteLine(result);
        }
Ejemplo n.º 9
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (tbDllPath.Text == string.Empty)
            {
                return;
            }
            if (!File.Exists(tbDllPath.Text))
            {
                MessageBox.Show("Invalid File");
                return;
            }

            using (formLoadProcess proc = new formLoadProcess(false))
            {
                if (proc.ShowDialog() == DialogResult.OK)
                {
                    string message = string.Empty;
                    bool   success = false;

                    IntPtr handle = DllInjector.Inject(proc.SelectedProcessID, tbDllPath.Text, out success, cbWaitForHandle.Checked);

                    if (success)
                    {
                        message = "Injected Successfully.";
                        if (handle != IntPtr.Zero)
                        {
                            message += string.Format("{0}Dll Handle: 0x{1:x2}", Environment.NewLine, handle.ToInt32());
                        }
                    }
                    else
                    {
                        message = "Failed to inejct dll.";
                    }

                    MessageBox.Show(message);
                    this.DialogResult = DialogResult.OK;
                }
            }
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
#if !DEBUG
            if (Convert.ToInt32(args[0]) != Engine._supportedVersion)
            {
                Terminate();
            }
#endif

            Engine.Create("BlackDesert64");

            if (Engine.Instance.SupportedVersion)
            {
                string iError;
                if (!DllInjector.DoInject(Engine.Instance.Process, new FileInfo(@".\x64fw2.dll").FullName, out iError))
                {
                    Console.WriteLine("Dll Injection failed!");
                    Console.ReadLine();
                }

                Console.WriteLine("Dll injected!");

                LoadSettings();

                Console.WriteLine("Starting Main - Thread");

                MainThread = new Thread(mThread);
                MainThread.Start();

                StartOverlay();
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Client-Version isn't supported. Please wait for an updated version of the tool.");
                Console.ReadLine();
            }
        }
        private void InjectDLL_metroButton_Click(object sender, EventArgs e)
        {
            if (ProcessList_ComboBox.SelectedIndex > -1)
            {
                string processname = ProcessList_ComboBox.SelectedItem.ToString();

                OpenFileDialog OpenFile = new OpenFileDialog();
                if (DLLInjector_openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    string      dllfile     = DLLInjector_openFileDialog.FileName;
                    DllInjector DLLInjector = new DllInjector();
                    DLLInjector.GetInstance.Inject(processname, dllfile);
                }
                else
                {
                    ShakeMe("No DLL Injected", MessageType.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Warning, true);
                }
            }
            else
            {
                ShakeMe("Select a process", MessageType.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Warning, true);
            }
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            DllInjector di = new DllInjector();

            if (args.Length != 2)
            {
                Console.WriteLine(
                    "usage: " + System.AppDomain.CurrentDomain.FriendlyName +
                    " <process_image_name> <absolute_dll_path>");
                return;
            }

            bool   passedTests = true;
            string procName    = args[0];
            string dllPath     = args[1];

            if (!di.Open(procName))
            {
                Console.WriteLine(
                    procName +
                    " could not be opened. Verify that it is currently running and that you have the correct " +
                    "permissions to open the process.");
                passedTests = false;
            }

            if (!File.Exists(dllPath))
            {
                Console.WriteLine("The supplied DLL path does not exist.");
                passedTests = false;
            }

            if (passedTests)
            {
                di.InjectDll(dllPath);
            }
        }
Ejemplo n.º 13
0
 public void Inject(string dllname)
 {
     DllInjector.Inject((uint)Process.Id, dllname);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Finds the mods that are currently enabled for the game and injects into the target process.
        /// </summary>
        /// <param name="gameConfiguration">The game configuration which contains the current directory and list of mods to load.</param>
        /// <param name="reloadedProcess">The reloaded process to inject the modifications into.</param>
        public static void LoadMods(GameConfigParser.GameConfig gameConfiguration, ReloadedProcess reloadedProcess)
        {
            // Get directory containing the global mod list.
            GameConfigParser.GameConfig globalModConfig = GameConfigParser.ParseConfig(LoaderPaths.GetGlobalGameConfigDirectory());

            // Get directory containing the game's mod list
            string gameModDirectory   = Path.Combine(LoaderPaths.GetModLoaderModDirectory(), gameConfiguration.ModDirectory);
            string globalModDirectory = LoaderPaths.GetGlobalModDirectory();

            // Get directories containing enabled mods.
            List <string> modLibraries = new List <string>(gameConfiguration.EnabledMods.Count);

            // Get the game mod dll locations.
            foreach (string modDirectory in gameConfiguration.EnabledMods)
            {
                // Add native or not native.
                if (ReloadedArchitecture.IsGame32Bit)
                {
                    modLibraries.Add(Path.Combine(gameModDirectory, modDirectory, Strings.Loader.Mod32BitDllFile));
                }
                else
                {
                    modLibraries.Add(Path.Combine(gameModDirectory, modDirectory, Strings.Loader.Mod64BitDllFile));
                }
            }

            // Get the global mod dll locations.
            foreach (string modDirectory in globalModConfig.EnabledMods)
            {
                // Add native or not native.
                if (ReloadedArchitecture.IsGame32Bit)
                {
                    modLibraries.Add(Path.Combine(globalModDirectory, modDirectory, Strings.Loader.Mod32BitDllFile));
                }
                else
                {
                    modLibraries.Add(Path.Combine(globalModDirectory, modDirectory, Strings.Loader.Mod64BitDllFile));
                }
            }

            // Initialize DLL Injector
            DllInjector reloadedDllInjector = new DllInjector(reloadedProcess);

            // If the main.dll exists, load it.
            foreach (string modLibrary in modLibraries)
            {
                // If the DLL Exists, Try to Load It
                if (File.Exists(modLibrary))
                {
                    // Allocate Memory for Server Port In Game Memory
                    IntPtr parameterAddress = reloadedProcess.AllocateMemory(IntPtr.Size);

                    // Write Server Port to Game Memory
                    reloadedProcess.WriteMemoryExternal(parameterAddress, BitConverter.GetBytes(LoaderServer.ServerPort));

                    // Inject the individual DLL.
                    reloadedDllInjector.InjectDll(modLibrary, parameterAddress);
                }
            }

            // Resume game after injection.
            reloadedProcess.ResumeAllThreads();
        }
Ejemplo n.º 15
0
        public static Status Inject(Config config)
        {
            // Inject using specified method

            switch (config.InjectionMethod)
            {
            case "[BLEAK] CreateThread":

                if (Injector.CreateRemoteThread(config.DllPath, config.ProcessName))
                {
                    Status.InjectionOutcome = true;
                }

                break;

            case "[BLEAK] HijackThread":

                if (Injector.RtlCreateUserThread(config.DllPath, config.ProcessName))
                {
                    Status.InjectionOutcome = true;
                }

                break;

            case "[BLEAK] ManualMap":

                if (Injector.SetThreadContext(config.DllPath, config.ProcessName))
                {
                    Status.InjectionOutcome = true;
                }

                break;

            case "BasicInjector":
                if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.Success)
                {
                    Status.InjectionOutcome = true;
                }
                else
                {
                    if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.DllNotFound)
                    {
                        MessageBox.Show("Inject failed using BasicInjector.\nError: Dll not found.", "BleakInjector");
                    }
                    else if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.GameProcessNotFound)
                    {
                        MessageBox.Show("Inject failed using BasicInjector.\nError: Target process isn't running.", "BleakInjector");
                    }
                    else if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.InjectionFailed)
                    {
                        MessageBox.Show("Inject failed using BasicInjector.\nError: Unknown.", "BleakInjector");
                    }
                }
                break;

            case "[RI] Injector":
                Process[] proc   = Process.GetProcessesByName(config.ProcessName);
                var       Injecc = new Reloaded.Injector.Injector(proc[0]);
                Injecc.Inject(config.DllPath);
                Status.InjectionOutcome = true;
                break;
            }

            // Erase headers if EraseHeaders is checked

            if (config.EraseHeaders)
            {
                if (Injector.EraseHeaders(config.DllPath, config.ProcessName))
                {
                    Status.EraseHeadersOutcome = true;
                }
            }

            // Close the program if CloseAfterInject is checked

            if (config.CloseAfterInject)
            {
                Application.Exit();
            }

            return(Status);
        }
Ejemplo n.º 16
0
        public static Status Inject(Config config)
        {
            if (config.EraseHeaders)
            {
                switch (config.InjectionMethod)
                {
                case "[BLEAK] CreateThread":
                    try
                    {
                        var Injekt = new Injector(config.ProcessName, config.DllPath, InjectionMethod.CreateThread);
                        Injekt.EjectDll();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Eject failed using Bleak-CreateThread.\nError:\n{ex}", "BleakInjector");
                        break;
                    }
                    Status.EraseHeadersOutcome = true;
                    break;

                case "[BLEAK] HijackThread":
                    try
                    {
                        var Injekt2 = new Injector(config.ProcessName, config.DllPath, InjectionMethod.HijackThread);
                        Injekt2.EjectDll();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Bleak-HijackThread.\nError:\n{ex}", "BleakInjector");
                        break;
                    }
                    Status.EraseHeadersOutcome = true;
                    break;

                case "[BLEAK] ManualMap":
                    try
                    {
                        var Injekt3 = new Injector(config.ProcessName, config.DllPath, InjectionMethod.ManualMap);
                        Injekt3.EjectDll();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Bleak-ManualMap.\nError:\n{ex}", "BleakInjector");
                        break;
                    }
                    Status.EraseHeadersOutcome = true;
                    break;

                case "BasicInjector":
                    MessageBox.Show("This inject type dosen't support Eject.", "BleakInjector");
                    break;

                case "[RI] Injector":
                    MessageBox.Show("This inject type dosen't support Eject.", "BleakInjector");
                    break;

                case "[LUNAR] Injector":
                    try
                    {
                        foreach (Process proc in Process.GetProcessesByName(config.ProcessName))
                        {
                            var LibMapper = new LibraryMapper(proc, config.DllPath);
                            LibMapper.UnmapLibrary();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Lunar.\nError:\n{ex}", "BleakInjector");
                        break;
                    }
                    Status.EraseHeadersOutcome = true;
                    break;
                }
            }
            else
            {
                switch (config.InjectionMethod)
                {
                case "[BLEAK] CreateThread":
                    try
                    {
                        var Injekt = new Injector(config.ProcessName, config.DllPath, InjectionMethod.CreateThread);
                        if (Injekt.InjectDll() != IntPtr.Zero)
                        {
                            Injekt.Dispose();
                            Status.InjectionOutcome = true;
                        }
                        else
                        {
                            MessageBox.Show("Inject failed using Bleak-CreateThread.\nError: Unknown.", "BleakInjector");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Bleak-CreateThread.\nError:\n{ex}", "BleakInjector");
                    }
                    break;

                case "[BLEAK] HijackThread":
                    try
                    {
                        var Injekt2 = new Injector(config.ProcessName, config.DllPath, InjectionMethod.HijackThread);
                        if (Injekt2.InjectDll() != IntPtr.Zero)
                        {
                            Injekt2.Dispose();
                            Status.InjectionOutcome = true;
                        }
                        else
                        {
                            MessageBox.Show("Inject failed using Bleak-HijackThread.\nError: Unknown.", "BleakInjector");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Bleak-HijackThread.\nError:\n{ex}", "BleakInjector");
                    }
                    break;

                case "[BLEAK] ManualMap":
                    try
                    {
                        var Injekt3 = new Injector(config.ProcessName, config.DllPath, InjectionMethod.ManualMap);
                        if (Injekt3.InjectDll() != IntPtr.Zero)
                        {
                            Injekt3.Dispose();
                            Status.InjectionOutcome = true;
                        }
                        else
                        {
                            MessageBox.Show("Inject failed using Bleak-ManualMap.\nError: Unknown.", "BleakInjector");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Bleak-ManualMap.\nError:\n{ex}", "BleakInjector");
                    }
                    break;

                case "BasicInjector":
                    try
                    {
                        if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.Success)
                        {
                            Status.InjectionOutcome = true;
                        }
                        else
                        {
                            if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.DllNotFound)
                            {
                                MessageBox.Show("Inject failed using BasicInjector.\nError: Dll not found.", "BleakInjector");
                            }
                            else if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.GameProcessNotFound)
                            {
                                MessageBox.Show("Inject failed using BasicInjector.\nError: Target process isn't running.", "BleakInjector");
                            }
                            else if (DllInjector.BasicInject(config.ProcessName, config.DllPath) == DllInjectionResult.InjectionFailed)
                            {
                                MessageBox.Show("Inject failed using BasicInjector.\nError: Unknown.", "BleakInjector");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using BasicInjector.\nError:\n{ex}", "BleakInjector");
                    }
                    break;

                case "[RI] Injector":
                    try
                    {
                        foreach (Process proc in Process.GetProcessesByName(config.ProcessName))
                        {
                            var Injecc = new Reloaded.Injector.Injector(proc);
                            if (Injecc.Inject(config.DllPath) != 0)
                            {
                                break;
                            }
                            else
                            {
                                MessageBox.Show("Inject failed using Reloaded Injector.\nError: Unknown.", "BleakInjector");
                            }
                            Injecc.Dispose();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Reloaded Injector.\nError:\n{ex}", "BleakInjector");
                        break;
                    }
                    Status.InjectionOutcome = true;
                    break;

                case "[LUNAR] Injector":
                    try
                    {
                        foreach (Process proc in Process.GetProcessesByName(config.ProcessName))
                        {
                            var LibMapper = new LibraryMapper(proc, config.DllPath);
                            LibMapper.MapLibrary();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Inject failed using Lunar.\nError:\n{ex}", "BleakInjector");
                        break;
                    }
                    Status.InjectionOutcome = true;
                    break;
                }
                if (config.CloseAfterInject)
                {
                    Environment.Exit(0);
                }
            }
            return(Status);
        }
Ejemplo n.º 17
0
        private void injectMods()
        {
            GameVersion version      = GetGameVersion();
            string      ProcName     = "";
            string      LauncherName = "";

            ModListBox.Dispatcher.Invoke((Action) delegate
            {
                ModListBox.IsEnabled = false;
            });

            String launcherName = "\nStarting: ";

            //IntPtr ThreadHandle = IntPtr.Zero;
            if (version == GameVersion.JABIA)
            {
                LaunchButton.Dispatcher.Invoke((Action) delegate
                {
                    LogTexBox.AppendText(launcherName + JABIA_LAUNCHER);
                    logFile.WriteLine(launcherName + JABIA_LAUNCHER);
                });
                System.Diagnostics.Process.Start(JABIA_LAUNCHER);

                /*
                 * STARTUPINFO si = new STARTUPINFO();
                 * PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
                 * bool success = NativeMethods.CreateProcess(JABIA_PROCESS+".exe", null,
                 *  IntPtr.Zero, IntPtr.Zero, false,
                 *  ProcessCreationFlags.CREATE_SUSPENDED,
                 *  IntPtr.Zero, null, ref si, out pi);
                 * ThreadHandle = pi.hThread;
                 * NativeMethods.ResumeThread(ThreadHandle);
                 * Thread.Sleep(1000);
                 * NativeMethods.SuspendThread(ThreadHandle);
                 */
            }
            else
            {
                LaunchButton.Dispatcher.Invoke((Action) delegate
                {
                    LogTexBox.AppendText(launcherName + JAC_LAUNCHER);
                    logFile.WriteLine(launcherName + JAC_LAUNCHER);
                });
                System.Diagnostics.Process.Start(JAC_LAUNCHER);
            }

            String waitForProcess = "\nWaiting for proces to start: ";

            if (version == GameVersion.JABIA)
            {
                waitForProcess += JABIA_PROCESS;
                ProcName        = JABIA_PROCESS;
                LauncherName    = JABIA_LAUNCHER;
            }
            if (version == GameVersion.JAC)
            {
                waitForProcess += JAC_PROCESS;
                ProcName        = JAC_PROCESS;
                LauncherName    = JAC_LAUNCHER;
            }

            LaunchButton.Dispatcher.Invoke((Action) delegate
            {
                LogTexBox.AppendText(waitForProcess);
                logFile.WriteLine(waitForProcess);
            });

            LaunchButton.Dispatcher.Invoke((Action) delegate
            {
                LaunchButton.IsEnabled = false;
            });

            // wait for launcher to start
            Process[] _procs = Process.GetProcesses();
            for (int j = 0; j < _procs.Length; j++)
            {
                if (_procs[j].ProcessName == LauncherName)
                {
                    break;
                }
            }


            if (settings.mods.Count != 0)
            {
                bool procFound = false;
                for (int i = 0; i < 10; i++)
                {
                    _procs = Process.GetProcesses();
                    for (int j = 0; j < _procs.Length; j++)
                    {
                        if (_procs[j].ProcessName == ProcName)
                        {
                            procFound = true;
                            break;
                        }
                    }
                    System.Threading.Thread.Sleep(settings.delay);
                    if (procFound)
                    {
                        break;
                    }
                }
                if (!procFound)
                {
                    LaunchButton.Dispatcher.Invoke((Action) delegate
                    {
                        String errorProcessNotFound = "\nProcess not found. Exiting";
                        LogTexBox.AppendText(errorProcessNotFound);
                        logFile.WriteLine(launcherName + JABIA_LAUNCHER);
                    });
                    System.Threading.Thread.Sleep(settings.delay);
                    Environment.Exit(0);
                }

                DllInjector inj = DllInjector.GetInstance;
                foreach (Mod mod in settings.mods)
                {
                    if (mod.enabled)
                    {
                        LaunchButton.Dispatcher.Invoke((Action) delegate
                        {
                            String injectMod = "\nInjecting " + mod.modPath;
                            LogTexBox.AppendText(injectMod);
                            logFile.WriteLine(injectMod);
                        });
                        DllInjectionResult result = inj.Inject(ProcName, mod.modPath);
                    }
                }
            }
            logFile.Close();
            //NativeMethods.ResumeThread(ThreadHandle);
            System.Threading.Thread.Sleep(settings.delay);
            Environment.Exit(0);
        }