VOID DoSvcStartType() { SC_HANDLE schSCManager; SC_HANDLE schService; // Get a handle to the SCM database. schSCManager = OpenSCManager( NULL, // local computer NULL, // ServicesActive database SC_MANAGER_ALL_ACCESS); // full access rights if (NULL == schSCManager) { printf("OpenSCManager failed (%d)/n", GetLastError()); return; } // Get a handle to the service. schService = OpenService( schSCManager, // SCM database szSvcName, // name of service SERVICE_CHANGE_CONFIG); // need change config access if (schService == NULL) { printf("OpenService failed (%d)/n", GetLastError()); CloseServiceHandle(schSCManager); return; } // Change the service start type. SC_LOCK sclLock; sclLock = LockServiceDatabase(schService); if (! ChangeServiceConfig( schService, // handle of service