Originally posted by Fordy
<disclaimer>Without trying.......</disclaimer>
If you install yourm service using CreateService(), then you can specify arguments in the lpBinaryPathName param....
... interesting. I knew nothing about this. It appears you create a second program that runs once to tell Windows about a program you want to run as a service? So this would be a program that you run as a part of an installer for the original program?
from MSDN:
Code:
VOID CreateSampleService()
{
LPCTSTR lpszBinaryPathName =
"%SystemRoot%\\system\\testserv.exe";
schService = CreateService(
schSCManager, // SCManager database
"Sample_Srv", // name of service
lpszDisplayName, // service name to display
SERVICE_ALL_ACCESS, // desired access
SERVICE_WIN32_OWN_PROCESS, // service type
SERVICE_DEMAND_START, // start type
SERVICE_ERROR_NORMAL, // error control type
lpszBinaryPathName, // service's binary
NULL, // no load ordering group
NULL, // no tag identifier
NULL, // no dependencies
NULL, // LocalSystem account
NULL); // no password
if (schService == NULL)
MyErrorExit("CreateService");
else
printf("CreateService SUCCESS.\n");
CloseServiceHandle(schService);
}
... this is a function that would be in the service installer, correct? Anyone ever used it before? Want to give a hint or two as to what the rest of that service installer program would look like?