基本信息
源码名称:纯C# 托管与非托管DLL注入.7z
源码大小:0.06M
文件格式:.7z
开发语言:C#
更新时间:2019-08-10
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
打开项目重新添加FastWin32的引用,dll在bin\Release目录下找得到。编译好的都在这个目录,全部解压后运行“注入Demo.exe”。FastWin32的源码反编译就可以得到
using System;
using System.Diagnostics;
using System.Threading;
using FastWin32.Diagnostics;
namespace 注入Demo
{
internal static class Program
{
private static void Main(string[] args)
{
ExceptionCatcher.Catch();
KillProcess();
Show("TestConsole32", "TestConsoleInjecting2.dll");
Show("TestConsole32", "TestConsoleInjecting4.dll");
if (Environment.Is64BitProcess)
{
Show("TestConsole64", "TestConsoleInjecting2.dll");
Show("TestConsole64", "TestConsoleInjecting4.dll");
}
Console.ReadKey();
KillProcess();
}
private static void KillProcess()
{
foreach (Process process in Process.GetProcessesByName("TestConsole32"))
process.Kill();
foreach (Process process in Process.GetProcessesByName("TestConsole64"))
process.Kill();
}
private static void Show(string exeNameWithoutExtension, string assemblyName)
{
uint processId;
string argument;
int returnValue;
processId = (uint)Process.Start(exeNameWithoutExtension ".exe").Id;
Thread.Sleep(100);
argument = "现在时间是" DateTime.Now.ToString();
Console.WriteLine($"将{assemblyName}注入到进程{exeNameWithoutExtension}中{(Injector.InjectManaged(processId, assemblyName, "TestConsoleInjecting.Injecting", "WriteConsole", argument, out returnValue) ? "成功" : "失败")},返回值是:{returnValue}");
}
}
}