简体   繁体   English

如何在C#.net中创建的Exe中通过C#.NET注入代码

[英]How to inject code through C#.NET in a Exe created in C#.net

I have created a form in C#.net which ask for key and check validity (expiry date). 我在C#.net中创建了一个表单,要求您输入密钥并检查有效性(有效期)。 i place this form as first running form in my application. 我将此表格作为我的应用程序中的第一个运行表格。 first time it takes key and every next time loading it check for expiration policy which saved through key in registry. 第一次需要密钥,而下次每次加载时,都要检查通过注册表中的密钥保存的过期策略。 this form is working fine. 这种形式很好用。 but now i want to create a another application which browse any exe created in C# or other language and generate new exe (with my validation form as startup form). 但是现在我想创建另一个应用程序,该应用程序浏览用C#或其他语言创建的任何exe并生成新的exe(以我的验证表单作为启动表单)。 means i want to create software which place my form as startup form to any Exe. 意味着我想创建将我的表单作为启动表单放置到任何Exe的软件。 so that it can work as anti piracy for any application (exe). 因此它可以用作任何应用程序(exe)的反盗版。

You can analyse and modify .NET applications with the Cecil Library. 您可以使用Cecil库分析和修改.NET应用程序。
http://www.mono-project.com/Cecil http://www.mono-project.com/Cecil

You need to add your form class. 您需要添加表单类。 Then remember the class that gets loaded in the original application. 然后记住在原始应用程序中加载的类。 Load that instead from your form and change the startup to your form. 而是从表单中加载该表单,然后将启动更改为表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM