In an application I am developing (in C), a loader app must first be run before the main application is executed. I have made it so the main app runs the loader app as a child when it is launched in order to automate this task. This all works well, except for the fact that the loader app only needs to be run one time during the user's current login session in order for the main app to work correctly, and having to run it every time the main app executes is a real pain. So what I'm asking is: is there a way to check if the loader has already been run using some Windows or C functionality? Ideally something like this would be great, although I have no idea if it is even possible:
if(thisapp.exe hasBeenExecuted)
return;
else
spawnl(app_path, app_name, args, NULL);
Or maybe something like having the main app create a dummy file that acts as a flag when the loader is run. Then on subsequent executions, checking if the file exists and running the loader if it does not. The only problem with this is automating it so the dummy file is erased when the computer is turned off (is there a way to do this?).
Some clarification: I cannot edit the loader app or replicate its functionality in the main app, I did not write it.
Thanks in advance for any help