Beispiel #1
0
 private static SERVICE_STATUS_PROCESS QueryStatus(SafeServiceHandle service)
 {
     using (var buffer = new SafeStructureInOutBuffer <SERVICE_STATUS_PROCESS>()) {
         if (!Win32NativeMethods.QueryServiceStatusEx(service, SC_STATUS_TYPE.SC_STATUS_PROCESS_INFO,
                                                      buffer, buffer.Length, out int length))
         {
             throw new SafeWin32Exception();
         }
         return(buffer.Result);
     }
 }