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. Visual Basic
  4. Privilege escalation in VB6 and VB.net programatically

Privilege escalation in VB6 and VB.net programatically

Scheduled Pinned Locked Moved Visual Basic
questioncsharpsecurity
4 Posts 4 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.
  • Q Offline
    Q Offline
    QuickBooksDev
    wrote on last edited by
    #1

    We have programs that require escalated privilege for certain small tasks as writing to HKEY/LOCAL_MACHINE for our own security keys. Vista/Win 7 makes this very difficult. We do not want our apps to always to run as admin but only for the short time when we need to write out the HKEY/LM. What is the way to do this programmatically? I do not mind if the user is asked to confirm or enter a password just need to be able to do it. I did see something about a ShellExecute "runas" but I rather not have another program. I would rather have it in 1 program. Any ideas? Thanks

    D I K 3 Replies Last reply
    0
    • Q QuickBooksDev

      We have programs that require escalated privilege for certain small tasks as writing to HKEY/LOCAL_MACHINE for our own security keys. Vista/Win 7 makes this very difficult. We do not want our apps to always to run as admin but only for the short time when we need to write out the HKEY/LM. What is the way to do this programmatically? I do not mind if the user is asked to confirm or enter a password just need to be able to do it. I did see something about a ShellExecute "runas" but I rather not have another program. I would rather have it in 1 program. Any ideas? Thanks

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

      QBTeKcom wrote:

      What is the way to do this programmatically?

      You can't. I haven't seen anything that will allow you to do this. Either your app runs as an admin or it doesn't. Also, this only works if the user running it has an admin account available. An app cannot give itself more rights than the user that launched it already has.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008
      But no longer in 2009...

      1 Reply Last reply
      0
      • Q QuickBooksDev

        We have programs that require escalated privilege for certain small tasks as writing to HKEY/LOCAL_MACHINE for our own security keys. Vista/Win 7 makes this very difficult. We do not want our apps to always to run as admin but only for the short time when we need to write out the HKEY/LM. What is the way to do this programmatically? I do not mind if the user is asked to confirm or enter a password just need to be able to do it. I did see something about a ShellExecute "runas" but I rather not have another program. I would rather have it in 1 program. Any ideas? Thanks

        I Offline
        I Offline
        i i i
        wrote on last edited by
        #3

        QBTeKcom wrote:

        Any ideas?

        have a post on vista/windows7 forum , might get some solution there. :~

        SOFTDEV If you have knowledge, let others light their candles at it. [ Let's work to help developers, not make them feel stupid ]

        1 Reply Last reply
        0
        • Q QuickBooksDev

          We have programs that require escalated privilege for certain small tasks as writing to HKEY/LOCAL_MACHINE for our own security keys. Vista/Win 7 makes this very difficult. We do not want our apps to always to run as admin but only for the short time when we need to write out the HKEY/LM. What is the way to do this programmatically? I do not mind if the user is asked to confirm or enter a password just need to be able to do it. I did see something about a ShellExecute "runas" but I rather not have another program. I would rather have it in 1 program. Any ideas? Thanks

          K Offline
          K Offline
          kilkfoe1
          wrote on last edited by
          #4

          Yeah I think you can only have an application run entirely as admin or not. You could probably do it by creating a separate project and spawning it from your current project - running it as admin. That might require creating a batch file that starts the new project with elevated privileges and running that batch file from your original project. Or there might be a way to do it when you spawn a new process - System.Diagnostics.Process.Start. There is an msdn article on it: http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/5a66c921-0d9c-483f-af3f-afa7f3e3b9c1[^]

          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