예제 #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;
     }
 }
예제 #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);
        }
    }