1

What I want is to start my main application using my tiny LicenseExe application.

LicenseExe will check that whether this system is registered or not.

If the system is not registered, LicenseExe should be exit. If the system is registered, then LicenseExe will call ShellExecute or whatever method to execute the main application exe.

This is easy I can do this.

What I want is, my main application could never execute by directly double clicking on its exe file. It only execute by LicenseExe application. Is it possible?

This is a kind of trick to make my application licensed. So, please guide me. How can I stop executing my main application directly and make it dependent on my tiny LicenseExe application.

Main application should only be started from the LicenseExe application, not by double clicking and not even by command line.

I am using C++ Visual Studio 2010 under Windows 7 Platform.

Kevin Brown-Silva
  • 40,873
  • 40
  • 203
  • 237
maxpayne
  • 1,111
  • 2
  • 21
  • 41

4 Answers4

5

In main app, you can check for the parent process that has launched it. If its not LicenseExe then mainapp should exit.

Reference for this: How can a Win32 process get the pid of its parent?

Apart from this, the licenseExe can pass handles or environment variable to the mainapp while launching it. The mainapp can verify if such info is present and continue execution otherwise exit.

Community
  • 1
  • 1
Rohan
  • 52,392
  • 12
  • 90
  • 87
  • Additionally checking for the parent process ID. Make the parent process creates a named event and wait for it, in the child process main, open the named event, if it is successful then continue execution. – Balu Feb 21 '14 at 06:06
2

You can replace main application with dynamic link library (DLL).

DLL can be dynamically called by LinceseExe as you want.

Charlie
  • 418
  • 3
  • 9
1

You could use the command line parameters in your main application. When it's started check for a set of arguments, and if they're not present - exit the application. Then, inside your LicenseExe, you could call the application with the given parameters, that only you know.

Example on a Windows system:

//main.cpp
int main(int argc, char* argv[]){
   if(argc==2 && argv[1]=="f20ASD129d0saCZasa"){
      // your normal app-code goes here
   }
   else return 0;
}

And the LicenseExe:

//LicenseExe.cpp
#include "systemRegisteredTest.h"
int main(){
   if(systemIsLicensed())
       system("yourMainApp.exe f20ASD129d0saCZasa");
   else return 0;
}
Paweł Stawarz
  • 3,952
  • 2
  • 17
  • 26
  • This looks pretty reasonable and useful. Please if possible then describe a little about the merits and demerit of this approach? Is it fully secure? Can it be cracked easily or something like that? Thanks. – maxpayne Feb 21 '14 at 06:05
  • 1
    Whatever security you make someone else can break. You just want to make it hard enough they won't try. Personally I like to work on making my software useful and worry less about the odd pirate. – david.pfx Feb 21 '14 at 13:34
  • Listen to @david.pfx - that's the truth. All of the solutions you could come with, can be cracked. There are no pros/cons. Pick whichever one you preffer. If I would really want to secury my application in a way - I would probably pick multiple solutions from this topic. – Paweł Stawarz Feb 21 '14 at 16:05
  • 1
    @PawełStawarz: Thanks. Let me expand slightly -- the biggest enemy of your software is not piracy, it's obscurity. You should be incredibly grateful if millions of people pirate your software because, sooner or later, you'll figure out how to make money out of it. Sure, make it easier to buy than pirate to encourage honest people, but the biggest threat is no-one uses your software because no-one knows or no-one cares or it's too hard. – david.pfx Feb 23 '14 at 05:36
  • @david.pfx, &PawełStawarz thanks a lot guys. I got the idea. I am using Paweł method with additional &Mukt method. And its working fine. – maxpayne Feb 24 '14 at 02:53
1

Create and lock a mutex in licence.exe [when the system is registered] : CreateMutexEx

Check the mutex in the main app. If the mutex is locked, main application should continue execution.
Else it should exit.

Mukt G
  • 101
  • 3