private void CreateBrowser(BaseInjector scraper)
        {
            scraper.Browser      = new WebBrowser();
            scraper.Browser.Dock = DockStyle.Fill;
            scraper.Browser.Name = "webBrowser";
            scraper.Browser.ScrollBarsEnabled = true;
            scraper.Browser.TabIndex          = 0;
            //scraper.Browser.Url = new Uri("http://www.microsoft.com");
            scraper.Browser.Navigate(scraper.Url);

            Form form = new Form();

            // form.WindowState = FormWindowState.Maximized;
            form.Controls.Add(scraper.Browser);
            form.Name = scraper.Name;
            form.Text = "Webbrowser";
            //form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            form.Height         = 500;
            form.Width          = 700;
            scraper.BrowserForm = form;

            scraper.DoneLoading = true;
            Application.Run(form);
            Thread.Sleep(1000);
        }
Esempio n. 2
0
    private void Button_Inject_Click(object sender, RoutedEventArgs e)
    {
        AudioUtil.ClickSound();

        if (InjectInfo.PID == 0)
        {
            TextBlock_Status.Text = "请选择目标进程";
            return;
        }
        else if (string.IsNullOrEmpty(InjectInfo.DLLPath))
        {
            TextBlock_Status.Text = "请选择dll路径";
            return;
        }

        try
        {
            foreach (ProcessModule module in Process.GetProcessById(InjectInfo.PID).Modules)
            {
                if (module.FileName == InjectInfo.DLLPath)
                {
                    TextBlock_Status.Text = "该DLL已经被注入过了";
                    return;
                }
            }

            BaseInjector.DLLInjector(InjectInfo.PID, InjectInfo.DLLPath);
            TextBlock_Status.Text = $"DLL注入到进程 {InjectInfo.PName} 成功";
            BaseInjector.SetForegroundWindow(InjectInfo.MWindowHandle);
        }
        catch (Exception ex)
        {
            TextBlock_Status.Text = ex.Message;
        }
    }
    private void Button_InjectGameProcess_Click(object sender, RoutedEventArgs e)
    {
        AudioUtil.ClickSound();

        SaveBlcokWords();

        var InjectInfo = new InjectInfo();

        InjectInfo.DLLPath = FileUtil.Inject_Path + "BlcokMsg.dll";

        if (string.IsNullOrEmpty(InjectInfo.DLLPath))
        {
            MsgBoxUtil.Warning("发生异常,DLL路径为空");
            return;
        }

        var process = Process.GetProcessesByName("GTA5")[0];

        InjectInfo.PID           = process.Id;
        InjectInfo.PName         = process.ProcessName;
        InjectInfo.MWindowHandle = process.MainWindowHandle;

        foreach (ProcessModule module in Process.GetProcessById(InjectInfo.PID).Modules)
        {
            if (module.FileName == InjectInfo.DLLPath)
            {
                MsgBoxUtil.Warning("该DLL已经被注入过了,请勿重复注入");
                return;
            }
        }

        try
        {
            BaseInjector.SetForegroundWindow(InjectInfo.MWindowHandle);
            BaseInjector.DLLInjector(InjectInfo.PID, InjectInfo.DLLPath);
        }
        catch (Exception ex)
        {
            MsgBoxUtil.Exception(ex);
        }
    }