所以基本上我一直试图创建一个注入dll的程序
现在我停留在webclient下载部分,因为它基本上只下载了#34;一半"我的dll
(dll的大小是470 kb,但下载的dll只有216 kb)
代码:
(从stackoverflow中偷走了这个)
[(code)]
//使用
public void DownloadFile(string sourceUrl, string targetFolder)
{
WebClient downloader = new WebClient();
// fake as if you are a browser making the request.
downloader.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0)");
downloader.DownloadFileCompleted += new AsyncCompletedEventHandler(Downloader_DownloadFileCompleted);
downloader.DownloadProgressChanged +=
new DownloadProgressChangedEventHandler(Downloader_DownloadProgressChanged);
downloader.DownloadFile(new Uri(sourceUrl), targetFolder);
// wait for the current thread to complete, since the an async action will be on a new thread.
while (downloader.IsBusy) { }
}
private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
// print progress of download.
metroLabel2.Text = "Downloading: " + e.ProgressPercentage + "%";
}
private void Downloader_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
// display completion status.
if (e.Error != null)
Console.WriteLine(e.Error.Message);
else
metroLabel2.Text = "Ready to Inject!";
injectbutton.Enabled = true;
}
答案 0 :(得分:-1)
一直是我的dll
感谢大家的帮助