Exemplo n.º 1
0
        public bool Launch(string id, string arguments)
        {
            Game game = this.Games[id];

            this.SetEnvironmentVariables(game.Id);
            Launcher.ProcessInformation processInformation  = default(Launcher.ProcessInformation);
            Launcher.Startupinfo        startupinfo         = default(Launcher.Startupinfo);
            Launcher.SecurityAttributes securityAttributes  = default(Launcher.SecurityAttributes);
            Launcher.SecurityAttributes securityAttributes2 = default(Launcher.SecurityAttributes);
            startupinfo.cb              = Marshal.SizeOf(startupinfo);
            securityAttributes.nLength  = Marshal.SizeOf(securityAttributes);
            securityAttributes2.nLength = Marshal.SizeOf(securityAttributes2);
            bool flag = !Launcher.CreateProcess(game.Directory + game.ExeName, arguments, ref securityAttributes, ref securityAttributes2, false, 4u, IntPtr.Zero, game.Directory, ref startupinfo, out processInformation);
            bool result;

            if (flag)
            {
                MessageBox.Show("Can not create game process.", "TruckersMP - Error");
                result = false;
            }
            else
            {
                string text  = this.Inject(processInformation.hProcess, this.Location + "\\" + game.DllName);
                bool   flag2 = text != "success";
                if (flag2)
                {
                    MessageBox.Show("Can not inject core (" + text + ")");
                    result = false;
                }
                else
                {
                    Launcher.ResumeThread(processInformation.hThread);
                    result = true;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
 private static extern bool CreateProcess(string lpApplicationName, string lpCommandLine, ref Launcher.SecurityAttributes lpProcessAttributes, ref Launcher.SecurityAttributes lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, [In] ref Launcher.Startupinfo lpStartupInfo, out Launcher.ProcessInformation lpProcessInformation);