Esempio n. 1
0
        public ApiStructs.ServiceStatus QueryStatus()
        {
            if (!this.IsOpen)
                throw new Win32Exception("Service not yet open.");

            ApiStructs.ServiceStatus status = new ApiStructs.ServiceStatus();

            int bytesNeeded = 0;
            if(!ApiAdvapi32.QueryServiceStatusEx(m_service, 0, ref status, Marshal.SizeOf(status), ref bytesNeeded))
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to query service status.");
            return status;
        }
Esempio n. 2
0
 public static extern bool QueryServiceStatusEx(
     int hService,
     int InfoLevel,
     [MarshalAs(UnmanagedType.Struct)] ref ApiStructs.ServiceStatus lpServiceStatus,
     int cbBufSize,
     ref int pcbBytesNeeded);