c# - Run exe file from resource in c# with security(prevent extracting)
问题描述
Hi Engineers, i made a login panel with c# form. I coded everything but now I am in a section that I'm still searching about 1 week and I did not get any result.
I want to add a exe file (rather not .NET) to my resources. and run it when login button press
»»»»IMPORTANT: but I don't want it to copy my exe resources to HDD (simple security :D) so I think I should run it from memory
I dont know this code is true or no but i use this
FileStream fs = new FileStream(filepath, FileMode.Open);
BinaryReader br = new BinaryReader(fs);
byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length));
fs.Close();
br.Close();
Assembly a = Assembly.Load(bin);
MethodInfo method = a.EntryPoint;
if (method != null) {
object o = a.CreateInstance(method.Name);
// invoke the application starting point
method.Invoke(o, null);
}
but I get this error
Could not load file or assembly '8237056 bytes loaded
can anybody help me?
解决方案
推荐阅读
- python - 如何在python中创建具有多个列表/数组的数据框
- python - Python 将 XML 文件解析为 pandas 数据框
- c - C 为命令 'ls -lR [-ddir] | 构建管道 排序 | grep 字符串 [>outfile]'
- java - 需要有关 javardd 中字母计数的帮助
- wpf - 添加命令后按钮被禁用
- python - Scrapy - Shell 抓取页面没有任何问题,但选择器失败
- keycloak - Keycloak:将用户名映射到主题声明
- jquery - 窗口调整大小。适应宽度条件
- powershell - 使用 PowerShell 的两个时间戳之间的差异
- android - 哪种 OAuth2 授权类型适用于移动应用程序