Beispiel #1
0
        private static void Win32RunService(ServiceBase [] services)
        {
            SERVICE_TABLE_ENTRY[] table = new SERVICE_TABLE_ENTRY[services.Length + 1];

            NotifyStatus = new NotifyStatusCallback(Win32NotifyStatus);

            for (int i = 0; i < services.Length; i++)
            {
                table[i].lpServiceName = services[i].ServiceName ?? "";
                table[i].lpServiceProc = new LPSERVICE_MAIN_FUNCTION(services[i].ServiceMainCallback);
            }

            // table[services.Length] is a NULL terminator

            share_process = (services.Length > 1);

            if (!StartServiceCtrlDispatcher(table))
            {
                throw new Win32Exception();
            }
        }
Beispiel #2
0
		private static void Win32RunService (ServiceBase [] services)
		{
			SERVICE_TABLE_ENTRY[] table = new SERVICE_TABLE_ENTRY[services.Length + 1];

			NotifyStatus = new NotifyStatusCallback (Win32NotifyStatus);

			for (int i = 0; i<services.Length; i++)
			{
				table[i].lpServiceName = services[i].ServiceName ?? "";
				table[i].lpServiceProc = new LPSERVICE_MAIN_FUNCTION (services[i].ServiceMainCallback);
			}

			// table[services.Length] is a NULL terminator

			share_process = (services.Length > 1);

			if (!StartServiceCtrlDispatcher (table))
				throw new Win32Exception ();
		}