Beispiel #1
0
    private static ProcessInjection.ProcessInfo GetProcessInfo(string path, string args)
    {
        var text  = Path.Combine(Path.GetDirectoryName(path) ?? string.Empty, "UnityCrashHandler64.exe");
        var text2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\RealmOfTheMadGod\\Production", "UnityCrashHandler64.exe");

        try
        {
            if (File.Exists(text))
            {
                File.Delete(text);
            }
            if (File.Exists(text2))
            {
                File.Delete(text2);
            }
        }
        catch (Exception innerException)
        {
            throw new Exception("PLEASE DELETE THE FOLLOWING FILES TO MAKE IT WORK:\n- " + text + "\n- " + text2 + "\n\nOnly if they exist.", innerException);
        }

        ProcessInjection.ProcStartupInfo lpStartupInfo = default;
        if (!ProcessInjection.CreateProc(path, args, IntPtr.Zero, IntPtr.Zero, bInheritHandles: true, 4u, IntPtr.Zero, IntPtr.Zero, ref lpStartupInfo, out var lpProcessInformation))
        {
            throw new Exception("CreateProcess");
        }

        ProcessIds.Add(lpProcessInformation._Xfy86MzBYkDHYV6eC0jeyWpmMqW);
        Program.LogInfoMessage("core", "Started Process: " + path);
        return(lpProcessInformation);
    }