Ejemplo n.º 1
0
 public void Release()
 {
     try
     {
         WrapperWinAPI.CloseHandle(m_ProcessHandle);
     }
     catch
     {
         // do nothing
         Console.WriteLine("Nothing to release.");
     }
     finally
     {
         m_ProcessHandle = new IntPtr(0);
         m_Process       = null;
     }
 }
Ejemplo n.º 2
0
    public string GetUserOwningProcess()
    {
        try
        {
            WindowsIdentity WI   = new WindowsIdentity(m_Process.Handle);
            string          user = WI.Name;

            return(user.Contains(@"\") ? user.Substring(user.IndexOf(@"\") + 1) : user);
        }
        catch
        {
            return(null);
        }
        finally
        {
            WrapperWinAPI.CloseHandle(m_ProcessHandle);
        }
    }