Results 1 to 25 of 25

Thread: Issue with registry editing

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Issue with registry editing

    Hello everyone,

    I am facing an issue with editing in registry. Here are the details.

    When computer starts I want to run my application automatically. For this I have a code to edit registry

    Code:
                    regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
                    regKey.SetValue(GlbProjectName, Application.ExecutablePath)
                    regKey.Close()
    I also added app.manifest to get admin access to application file.

    Code:
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
    This code works fine, but the issue is when I compile my application, the app icon gets an small yellow mark showing that the file is an admin level file. which I don't want, also when every time the application runs it ask for "Do you want to allow this app from an unknown publisher to make changes to your device?" so whenever the computer restarts my application does not run automatically every time user has to say "Yes" to run application.

    On the other hand when I change app.manifest to : "asInvoker"

    Code:
    <requestedExecutionLevel level="asInvoker" uiAccess="false" />
    now the application behave normally and works fine, but then registry editing does not work, I cannot make my application to run every time when system restarts.

    I want some solution that my application runs without asking any thing and also I can edit windows registry settings with full privilege.
    I am also comfortable If there is any DLL file which can be called for registry editing or any other option.

    Please help me out to find the solution

    Thank you
    Ladak

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,895

    Re: Issue with registry editing

    So you want your app to perform an action that requires admin privileges but you don't want it to have admin privileges? Do you ride your unicorn with a saddle or bareback?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    Hi jmcilhinney ,

    I understand, if an application doesn't have admin privilege how it will edit the registry? That's why I asked for any 3rd party application or DLL which can edit the registry.

    Thank you.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,895

    Re: Issue with registry editing

    Quote Originally Posted by accmaster View Post
    That's why I asked for any 3rd party application or DLL which can edit the registry.
    And how exactly would that help? Any library is still going to be executed through your application so will have the exact same permissions that your app has. Any application started by your application would still needed to be run as an admin to edit the Registry so you're simply passing the issue along one step. Windows security exists for a reason.

  5. #5
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,795

    Re: Issue with registry editing

    what do you want to execute/perform ?
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,895

    Re: Issue with registry editing

    I notice that you're using the LocalMachine hive. That is definitely going to be a problem. Maybe you should be using the CurrentUser hive, although you probably still need admin privileges. Of course any old user can't change a system-wide setting.

  7. #7
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,795

    Re: Issue with registry editing

    @accmaster

    well instead of an answer to my question in Post#5
    you logged out...

    so that makes me evan more wonder what you want to perform on a Machine that's not yours
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    @ChrisE

    This is my code, I am providing a check box in my application so that user can decide if he want to run this application on next start or not. "asInvoker" in application is running my app without any issues and I want some solution to edit registry with "asInvoker" in app.manifest



    Public Sub StartApplicationOnStartup()

    Dim regKey As Microsoft.Win32.RegistryKey


    Try
    If My.Settings.AutomaticallyStartTheClient = 1 Then

    regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
    regKey.SetValue(GlbProjectName, Application.ExecutablePath)
    regKey.Close()

    Else

    ' Remove Keys from registry
    regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
    regKey.DeleteValue(GlbProjectName, False)
    regKey.Close()

    End If


    Catch ex As Exception

    MessageBox.Show("Error while setting application startup." & vbNewLine & Err.Description & vbNewLine & "Contact VeeamEye support.", "VeeamEye - Client", MessageBoxButtons.OK, MessageBoxIcon.Hand)
    If Conn.State = 1 Then Conn.Close()
    End

    End Try



    End Sub

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    Quote Originally Posted by ChrisE View Post
    @accmaster

    well instead of an answer to my question in Post#5
    you logged out...

    so that makes me evan more wonder what you want to perform on a Machine that's not yours
    I am in Pakistan, It was prayer time so I took break for 15 mins, I am online now and replied to your queruy

  10. #10
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,795

    Re: Issue with registry editing

    Quote Originally Posted by accmaster View Post
    @ChrisE

    This is my code, I am providing a check box in my application so that user can decide if he want to run this application on next start or not. "asInvoker" in application is running my app without any issues and I want some solution to edit registry with "asInvoker" in app.manifest
    don't do stuff like that, if a user want's to start/open a/your Program they will do so.
    I find it anoying when a Program asks me stuff, just like I turned of Alexa


    or perhaps it's just me
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    @ChrisE

    I am designing a time management system for my client. He has 50+ employees in office working on laptops or desktop computers. it is necessary to run my application when system restarts. It maintains login time and project wise time. Need some solution.

    Thank you.

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    I am low looking at https://techtalk.pcmatic.com/2012/12...g-regedit-exe/
    May be there is some solution to edit registry through Cmd using vb.net

    If anyone has idea please let me know.

    @ChrisE
    going offline now, leaving for home.

    Thank you

  13. #13
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,795

    Re: Issue with registry editing

    well you would use Timespan (Start of program till the User ends)
    write that to a LogFile
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  14. #14
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,968

    Re: Issue with registry editing

    Put your reg values in a .reg file (google that)
    Then using process start, with verb = "runas", you can run the .reg file, and give the process admin privileges without giving the app admin privileges

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    @.paul

    Hi there,

    here is my code


    Dim process As System.Diagnostics.Process = Nothing
    Dim processStartInfo As System.Diagnostics.ProcessStartInfo
    processStartInfo = New System.Diagnostics.ProcessStartInfo()

    processStartInfo.FileName = "C:\Windows\regedit.exe"
    processStartInfo.Verb = "runas"

    processStartInfo.Arguments = " L:\AddKeyRegFile.reg /s"
    processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
    processStartInfo.UseShellExecute = True
    process = System.Diagnostics.Process.Start(processStartInfo)

    Just to remind you that I am using
    Code:
    questedExecutionLevel level="asInvoker" uiAccess="false" />
    to build my exe file.

    when I run my application again it show

    "Do you want to allow this app....."


    As you mentioned in your post this time I created .reg file to add in registry..

    If there is any solution please let me know.

    Thank you
    Ladak

  16. #16
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,968

    Re: Issue with registry editing

    It asks for permission for the process, as i told you in post #14. You have to agree to admin privileges one way or the other at some stage.

  17. #17
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,895

    Re: Issue with registry editing

    Quote Originally Posted by .paul. View Post
    You have to agree to admin privileges one way or the other at some stage.
    But the OP doesn't want to, so please provide a magical solution that anyone could use to completely ignore Windows security because reasons. TIA.

  18. #18
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,795

    Re: Issue with registry editing

    Quote Originally Posted by accmaster View Post
    @ChrisE

    I am designing a time management system for my client. He has 50+ employees in office working on laptops or desktop computers. it is necessary to run my application when system restarts. It maintains login time and project wise time. Need some solution.

    Thank you.
    well if you have to maintain Login Time and probably EndTime (when user quits the Program) you have the duration = how many Hours;Minutes;Seconds a User was Working.

    so what is it you want to Track? the Time a User is working ?
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  19. #19
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,968

    Re: Issue with registry editing

    Quote Originally Posted by jmcilhinney View Post
    But the OP doesn't want to, so please provide a magical solution that anyone could use to completely ignore Windows security because reasons. TIA.

  20. #20
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,968

    Re: Issue with registry editing

    Quote Originally Posted by jmcilhinney View Post
    But the OP doesn't want to, so please provide a magical solution that anyone could use to completely ignore Windows security because reasons. TIA.
    Well there is one way... But that way is worth $$$

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing


    @jmcilhinney
    @ChrisE


    Hello everyone,

    Finally I found magical solution for my issue "Edit registry" without "run as administrator" , my friend @jmcilhinney instead of making fun of others, try to get some proper solution.
    I posted this project on upwork and I get 7 bids on this project. I discussed this issue with a freelancer and next day he provided me exe file with only 1 form and check box labelled : "automatically restart application on restart". I opened task manager -> Startup on right side and on left side I ran his application, the application works smoothly and on clicking check box it add and removes from startup. I also restarted my PC to check if everything is working fine and the application was awesome.

    I paid $30 to him and he upload all source codes on upwork, then I implemented his source code on my project and now I am happy that his magical solution works 100% as I was looking.

    I hope instead of making fun of other, try to get some solution, I was sure that this can be done because I saw some other company's project is already doing the same thing. If they can do why not I????

    Thanks for your time and efforts.

    Ladak

  22. #22
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,795

    Re: Issue with registry editing

    well I can't see any Post where JMC was making fun of you, and I wasn't making fun of you.

    glad you got it sorted anyway
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  23. #23
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,895

    Re: Issue with registry editing

    Quote Originally Posted by accmaster View Post

    @jmcilhinney
    @ChrisE


    Hello everyone,

    Finally I found magical solution for my issue "Edit registry" without "run as administrator" , my friend @jmcilhinney instead of making fun of others, try to get some proper solution.
    I posted this project on upwork and I get 7 bids on this project. I discussed this issue with a freelancer and next day he provided me exe file with only 1 form and check box labelled : "automatically restart application on restart". I opened task manager -> Startup on right side and on left side I ran his application, the application works smoothly and on clicking check box it add and removes from startup. I also restarted my PC to check if everything is working fine and the application was awesome.

    I paid $30 to him and he upload all source codes on upwork, then I implemented his source code on my project and now I am happy that his magical solution works 100% as I was looking.

    I hope instead of making fun of other, try to get some solution, I was sure that this can be done because I saw some other company's project is already doing the same thing. If they can do why not I????

    Thanks for your time and efforts.

    Ladak
    Was it, perhaps, that the developer made the Registry change under the CurrentUser hive, rather than the LocalMachine hive, like I suggested in post #6?

  24. #24

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    @jmcilhinney

    Yes, I will upload source code soon for your reference and to help others.

    Thank you
    Ladak

  25. #25

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    277

    Re: Issue with registry editing

    Quote Originally Posted by jmcilhinney View Post
    Was it, perhaps, that the developer made the Registry change under the CurrentUser hive, rather than the LocalMachine hive, like I suggested in post #6?
    @jmcilhinney

    Yes, I will upload source code soon for your reference and to help others.

    Thank you
    Ladak

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width