I've made a little server app that has to run (as a daemon/service) on Linux, Irix, and Windows. Everything is done with the exeption of making it run as a service in Windows.

My question for the impatient is: Can I pass arguments to a program pointed to by a key in the registry; using the arguments in the same way that you would if you ran the program from a command line?

More detailed version of the question: In trying to keep the code more readable and the port to windows easier, I've kept the getopt function in my program by using the gnu getopt.c/h. In case you're not familiar, getopt parses arguments on the command line in such a way that you can send as many or as few arguments as you'd like to the program at execution. If I understand things correctly, to make a program run as a service in Windows, I simply need to link to the program from HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr entVersion\RunServices. If that is the case, is there a way I can send -l foo -c bar and so on to the program through that key in the registry?

If not, does anyone have any other clever methods for getting those arguments to the program (I suppose I could make system environment variables - I think those are active before login?)