| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 
 |  
SC_HANDLE hdlSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
 
	CString Calling = ::GetCommandLine();
	Calling += " /mes arguments";
 
	if (hdlSCM == 0) return ::GetLastError();
 
	SC_HANDLE hdlServ = CreateService(
		hdlSCM,                    // SCManager database 
		ServiceName,               // name of service 
		ServiceDisplayName,        // service name to display 
		STANDARD_RIGHTS_REQUIRED,  // desired access 
		SERVICE_WIN32_OWN_PROCESS, // service type 
		SERVICE_DEMAND_START,      // start type 
		SERVICE_ERROR_NORMAL,      // error control type 
		Calling,                   // service's binary Path name
		0,                      // no load ordering group 
		0,                      // no tag identifier 
		0,                      // no dependencies 
		0,                      // LocalSystem account 
		0);                     // no password | 
Partager