public static extern int CreateServiceA( int hSCManager, string lpServiceName, string displayName, ApiEnums.ServiceControlManagerType dwDesiredAccess, ApiEnums.ServiceType dwServiceType, ApiEnums.ServiceStartType dwStartType, ApiEnums.ServiceErrorControl dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, string lpdwTagId, string lpDependencies, string lpServiceStartName, string lpPassword);
public void Create(string name, string displayName, string imagePath, ApiEnums.ServiceType serviceType) { this.Close(); m_service = ApiAdvapi32.CreateServiceA( m_manager, name, displayName, ApiEnums.ServiceControlManagerType.SC_MANAGER_ALL_ACCESS, serviceType, ApiEnums.ServiceStartType.SERVICE_AUTO_START, ApiEnums.ServiceErrorControl.SERVICE_ERROR_NORMAL, imagePath, null, null, null, null, null); if (m_service == 0) throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to install the service."); }
public static extern int OpenServiceA( int hSCManager, string lpServiceName, ApiEnums.ServiceAccessType dwDesiredAccess);
public static extern int OpenSCManagerA( string lpMachineName, string lpDatabaseName, ApiEnums.ServiceControlManagerType dwDesiredAccess);
public static extern bool ChangeServiceConfigA( int hService, ApiEnums.ServiceType dwServiceType, int dwStartType, int dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, int lpdwTagId, string lpDependencies, string lpServiceStartName, string lpPassword, string lpDisplayName);
public static extern bool ChangeServiceConfig2A( int hService, ApiEnums.ServiceInfoLevel dwInfoLevel, [MarshalAs(UnmanagedType.Struct)] ref ApiStructs.ServiceFailureActions lpInfo);