Search code examples
c++validationargumentsstartup

Random arguments validation


I have a program A which can be started by my program B. So I don't want to allow my users to start the program A from Windows Explorer or command line or by any other means. So my idea was to pass an argument to program A from program B, which gets validated at the startup, but it's too easy to bypass. For example Process Hacker shows the argument of each running program.

So maybe I should generate a random text and pass that as an argument, but I have to reproduce that in the program A too, for the validation. So maybe the randomness of the string should depend on the time of the computer, or something like that? What do you guys recommend me, is it a bad way to start with?


Solution

  • You can IPC (Inter process communication) methods to communicate between the programs. Check Here for windows methods. This way you can hide the data exchanged between the programs. Also you can use client/server mechanism to allow program A to work only if program B is connected.