C#:做一个exe不要直接运行 [英] C# : Making an exe to not run directly

查看:311
本文介绍了C#:做一个exe不要直接运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做的首要的.exe unrunnable从它(当您尝试直接启动它,你就会得到一个消息:不能直接启动,如果从二级exe文件(仅运行,必须有一个CRC校验,我认为),然后启动。

I need to make the primary .exe unrunnable from it (When you try to start it directly ,you get a message : Cannot start directly,if it runs from the secondary exe (only it,must have a crc verification i think) then start .

希望我说清楚了
首先.exe文件无法直接启动
第二的.exe就可以开始第一个exe文件(仅)

Hope i make myself clear First .exe can't start directly Second .exe can start the first exe (only)

推荐答案

设置不能直接开始接受一个参数的EXE,比如一个SHA-256散列。从一个最应该一些独特的数据来启动它。如果该参数不存在或不是什么预期,显示错误并退出

Set up the EXE that can't be started directly to accept a parameter, such as a SHA-256 hash of some unique data from the one that's supposed to start it. If that parameter doesn't exist or is not what's expected, display an error and exit.

编辑:

static class Program
{
   static void Main(params string[] args) //<- first needed change
   {
       if(args.Length == 0 || args[0] != "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
       {
          Console.WriteLine("Cannot execute this program directly.")
          return;
       }

       ... //rest of main function
   }
}

这篇关于C#:做一个exe不要直接运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆