Results 1 to 12 of 12

Thread: Unable to write to registery with Vista even as admin

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Unable to write to registery with Vista even as admin

    My program that works fine in XP now does not write anything to the registry in Vista. I created an admin user on vista and even with that user, it still will not do this.

    For example, my program lets you add or remove it from windows startup at
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

    My install program that can run as administrator puts it there but my own VB app will not put it there again if I delete it manually. And I am loggin in as an admin user. Why would this be happenning?

    Thanks

    Warren

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Unable to write to registery with Vista even as admin

    Vista has a lot of security advantages, i guess we can call them that. If your not a administrator account it could be it is writing to a different key. I believe it writes to a different key silently. Check if there are any new keys HKEY_####, have a read of the below link to:

    Modifications Required for VB6 Applications to work on VB6
    Last edited by Paul M; Aug 4th, 2007 at 08:19 PM.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Unable to write to registery with Vista even as admin

    No, you shouldnt be writting to the registry anymore. Vista uses a process called Registry Virtualization which is why you are not finding your writes.

    You can not write to HKLM anymore. Also, Microsoft is only providing the virtualization workaround on a temporary basic. It will be discontinued so you shouldnt use the workaround or rely upon it.
    Last edited by RobDog888; Aug 4th, 2007 at 10:03 PM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: Unable to write to registery with Vista even as admin

    How owuld you add your program to startup if you cannot write to the registry anymore?

    And if I should not be using the registry anymore, do we have to go back to ini files then?

    Thanks

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: Unable to write to registery with Vista even as admin

    Also, other software can still write to the registry such as my installer I use. It can write anywhere in the registry including in the Run area. So why would another program be able to write to the registry but VB6 apps cannot?

    Warren

  6. #6
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Unable to write to registery with Vista even as admin

    Use the CurrentUser hive:

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: Unable to write to registery with Vista even as admin

    I want it to run for all users that login though.

  8. #8
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Unable to write to registery with Vista even as admin

    Quote Originally Posted by WarrenW
    I want it to run for all users that login though.
    Unless one of them disables it, at which point it no longer runs at startup for anybody? Is that really the functionality you want?

  9. #9
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Unable to write to registery with Vista even as admin

    You could handle it this way:

    Installer adds key to LocalMachine\Run, but includes a command line parameter to indicate it's an autorun on startup. When program launches, before doing or displaying anything, it first checks the command line parameter to see if it's been autorun. If so, it checks a registry key under CurrentUser\Software\Company\App to see if this user wants to run on startup. If the key isn't there, create the key defaulting to yes and load normally. If the key is there and says no, exit gracefully without showing the user anything.

    That way it will run on startup for everyone after install until they disable it, at which point it is only disabled for that user.

    I'm not saying this is a particularly good way to go, but it would work.

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: Unable to write to registery with Vista even as admin

    I'm just puzzled why I cannot write to the registry when other software can. I use the Install Creator Pro by clickteam.com and they have a checkbox to make it run as an administrator so it can do this stuff. Why can't we do this in VB6? Is there something special they can do in C++ or other language that is not supported in VB6?

    Thanks

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Unable to write to registery with Vista even as admin

    How are you writting to the registry? Using the APIs?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: Unable to write to registery with Vista even as admin

    Yes, I use APIs for read and write on the registry. I tested out writing to the HKCU and I can do that as you said. I was wanting to use HKLM so all users will have the same settings which I need.

    I'll keep tinkering with it all!

    Thanks

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