Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. System.Diagnostics.Process Help

System.Diagnostics.Process Help

Scheduled Pinned Locked Moved C#
helpquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MeekLogic
    wrote on last edited by
    #1

    Ok I have been having the most trouble with the Process class. It keeps throw Access Is Denied for everything. I stumbled across this.

    [HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true, Synchronization = true,
    ExternalProcessMgmt = true, SelfAffectingProcessMgmt = true)]
    [PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")]
    [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]

    Now I have no clue about this but I know your supposed to put above a func, constructor and all that. How can I just give my app all these permissions. Or better yet is there a better way to stop these rediculous exceptions. It happens on HasExited, Kill, Close, etc.

    modified on Monday, May 4, 2009 2:03 AM

    D 1 Reply Last reply
    0
    • M MeekLogic

      Ok I have been having the most trouble with the Process class. It keeps throw Access Is Denied for everything. I stumbled across this.

      [HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true, Synchronization = true,
      ExternalProcessMgmt = true, SelfAffectingProcessMgmt = true)]
      [PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")]
      [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]

      Now I have no clue about this but I know your supposed to put above a func, constructor and all that. How can I just give my app all these permissions. Or better yet is there a better way to stop these rediculous exceptions. It happens on HasExited, Kill, Close, etc.

      modified on Monday, May 4, 2009 2:03 AM

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Where is the code being launched from and what does your code that uses the Process class look like.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Where is the code being launched from and what does your code that uses the Process class look like.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        M Offline
        M Offline
        MeekLogic
        wrote on last edited by
        #3

        Declaring

                AobotProc = new Process();
                AobotProc.StartInfo.FileName = AOPath + "//" + AOExe;
                AobotProc.StartInfo.Arguments = "-run -hide";
                AobotProc.StartInfo.WorkingDirectory = AOPath;
                AobotProc.EnableRaisingEvents = true;
                AobotProc.Start();
                AobotProc.Exited += new EventHandler(aobot\_proc\_Exited);
        

        and errors wen

                if (AobotProc != null && !AobotProc.HasExited)
                {
                    if (!AobotProc.CloseMainWindow())
                        AobotProc.Kill();
                }
        

        errors at AobotProc.HasExited saying Access Is Denied

        D 1 Reply Last reply
        0
        • M MeekLogic

          Declaring

                  AobotProc = new Process();
                  AobotProc.StartInfo.FileName = AOPath + "//" + AOExe;
                  AobotProc.StartInfo.Arguments = "-run -hide";
                  AobotProc.StartInfo.WorkingDirectory = AOPath;
                  AobotProc.EnableRaisingEvents = true;
                  AobotProc.Start();
                  AobotProc.Exited += new EventHandler(aobot\_proc\_Exited);
          

          and errors wen

                  if (AobotProc != null && !AobotProc.HasExited)
                  {
                      if (!AobotProc.CloseMainWindow())
                          AobotProc.Kill();
                  }
          

          errors at AobotProc.HasExited saying Access Is Denied

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          What version of the .NET Framework are you using?? Is this code running under Vista??

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          M 1 Reply Last reply
          0
          • D Dave Kreskowiak

            What version of the .NET Framework are you using?? Is this code running under Vista??

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            M Offline
            M Offline
            MeekLogic
            wrote on last edited by
            #5

            .Net 3.5 and yes on Vista

            D 1 Reply Last reply
            0
            • M MeekLogic

              .Net 3.5 and yes on Vista

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              The Process class uses the system performance counters, which on Vista, requires an Admin level account to use. You really have no choice but to include a manifest with your app that tells Vista that the app will require an administor account to run. First, watch the video here[^]. Then you can read this[^].

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              M 1 Reply Last reply
              0
              • D Dave Kreskowiak

                The Process class uses the system performance counters, which on Vista, requires an Admin level account to use. You really have no choice but to include a manifest with your app that tells Vista that the app will require an administor account to run. First, watch the video here[^]. Then you can read this[^].

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                M Offline
                M Offline
                MeekLogic
                wrote on last edited by
                #7

                I have done that... I have found this ProccessPrileges and it looks like it has fixed my issues

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups