Process priority/running from outside visual studio

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wtfhits

    Process priority/running from outside visual studio

    I'm writing my own task manager as I often change process priorities but have gotten myself into trouble on several occasions. I have discovered by keeping csrss.exe and explorer at the equal highest priority, I can keep the computer running ok, or at least recover. So that's what my program does - keeps itself and those programs with high enough priority. It works great when run from visual studio, but as soon as i run it directly (whether in release or debug mode) I cannot access the process priority of csrss.exe. Is this a security issue

    The error message begins like this

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box

    ************** Exception Text *************
    System.Componen tModel.Win32Exc eption: Access is denie
    at System.Diagnost ics.ProcessMana ger.OpenProcess (Int32 processId, Int32 access, Boolean throwIfExited
    at System.Diagnost ics.Process.Get ProcessHandle(I nt32 access, Boolean throwIfExited
    at System.Diagnost ics.Process.Get ProcessHandle(I nt32 access
    at System.Diagnost ics.Process.set _PriorityClass( ProcessPriority Class value
    at MyTaskManager.M yTaskManager.Me _Load(Object sender, EventArgs e) in C:\Documents and Settings\Richar d Hart\My Documents\Visua l Studio Projects\MyTask Manager\Form1.v b:line 11

  • Willy Denoyette [MVP]

    #2
    Re: Process priority/running from outside visual studio

    The caller needs "SeDebugPrivile ge".

    Willy.

    "wtfhits" <anonymous@disc ussions.microso ft.com> wrote in message
    news:FA951536-B0A0-4867-A2F1-708D129C3C3C@mi crosoft.com...[color=blue]
    > I'm writing my own task manager as I often change process priorities but
    > have gotten myself into trouble on several occasions. I have discovered by
    > keeping csrss.exe and explorer at the equal highest priority, I can keep
    > the computer running ok, or at least recover. So that's what my program
    > does - keeps itself and those programs with high enough priority. It works
    > great when run from visual studio, but as soon as i run it directly
    > (whether in release or debug mode) I cannot access the process priority of
    > csrss.exe. Is this a security issue?
    >
    > The error message begins like this:
    >
    > See the end of this message for details on invoking
    > just-in-time (JIT) debugging instead of this dialog box.
    >
    > ************** Exception Text **************
    > System.Componen tModel.Win32Exc eption: Access is denied
    > at System.Diagnost ics.ProcessMana ger.OpenProcess (Int32 processId, Int32
    > access, Boolean throwIfExited)
    > at System.Diagnost ics.Process.Get ProcessHandle(I nt32 access, Boolean
    > throwIfExited)
    > at System.Diagnost ics.Process.Get ProcessHandle(I nt32 access)
    > at System.Diagnost ics.Process.set _PriorityClass( ProcessPriority Class
    > value)
    > at MyTaskManager.M yTaskManager.Me _Load(Object sender, EventArgs e) in
    > C:\Documents and Settings\Richar d Hart\My Documents\Visua l Studio
    > Projects\MyTask Manager\Form1.v b:line 113
    >[/color]


    Comment

    • Willy Denoyette [MVP]

      #3
      Re: Process priority/running from outside visual studio

      The caller needs "SeDebugPrivile ge".

      Willy.

      "wtfhits" <anonymous@disc ussions.microso ft.com> wrote in message
      news:FA951536-B0A0-4867-A2F1-708D129C3C3C@mi crosoft.com...[color=blue]
      > I'm writing my own task manager as I often change process priorities but
      > have gotten myself into trouble on several occasions. I have discovered by
      > keeping csrss.exe and explorer at the equal highest priority, I can keep
      > the computer running ok, or at least recover. So that's what my program
      > does - keeps itself and those programs with high enough priority. It works
      > great when run from visual studio, but as soon as i run it directly
      > (whether in release or debug mode) I cannot access the process priority of
      > csrss.exe. Is this a security issue?
      >
      > The error message begins like this:
      >
      > See the end of this message for details on invoking
      > just-in-time (JIT) debugging instead of this dialog box.
      >
      > ************** Exception Text **************
      > System.Componen tModel.Win32Exc eption: Access is denied
      > at System.Diagnost ics.ProcessMana ger.OpenProcess (Int32 processId, Int32
      > access, Boolean throwIfExited)
      > at System.Diagnost ics.Process.Get ProcessHandle(I nt32 access, Boolean
      > throwIfExited)
      > at System.Diagnost ics.Process.Get ProcessHandle(I nt32 access)
      > at System.Diagnost ics.Process.set _PriorityClass( ProcessPriority Class
      > value)
      > at MyTaskManager.M yTaskManager.Me _Load(Object sender, EventArgs e) in
      > C:\Documents and Settings\Richar d Hart\My Documents\Visua l Studio
      > Projects\MyTask Manager\Form1.v b:line 113
      >[/color]


      Comment

      Working...