locked
Writing into registry RRS feed

  • Question

  • Hi All,

             I am working in a product based application. The application is build in .NET 2005 with VB as its back end coding. I am writing the product activation key and other product specific details in the registry. We give an option to Install the application for the current user who is instaling the application as well as an option to Install to all the users in that particular machine. This being the scenario, we decided to write the entries into the HKEY_LOCAL_MACHINE registry so that the registry is available and accessed across all the users. We also check that the current user is an administrator or a person with the administrator privileges before Installing or writing into the registry. Users logged in as administrator can alone install and the writing to the registry happens. This is working very fine with the XP OS.


    While installing the application in the Vista OS, even if the user is an administrator, the writing into the registry is not happening. Everytime even if our client has activated the product, it asks for the activation process because the serial number is not written into the registry. Any help would be greatly appreciated as our product is already live. How to write into the registry in Vista ?



    Tuesday, December 2, 2008 7:14 AM

Answers

  • Do you need the methods how to add embedded manifest in VB project??
    You can search them in websites. But the method in VB is very few. If you need, I can tell you more detail.

    • Marked as answer by krishna_cbe Monday, March 9, 2009 1:05 PM
    Wednesday, December 24, 2008 2:14 AM

All replies

  •  

    It needs Administrator's full token to write/read registry. Are you sure that the process has Adminsitrator's full token.

    The users in Administrator goup only have restricted privileges.

    Wednesday, December 3, 2008 12:32 AM
  • Hi,

     thanks for your reply. If a users happens to be having the rights of an administrator also it does not work. Instead if i go the exe and right click and run the application by selecting the "RUN AS ADMINISTRATOR" option then it is working fine.

    It would not be a good practice to call our clients with Vista OS to tell them to execute the application for the first time by using the "RUN AS ADMINISTRATOR"  command.

    I dont think no other software on the market requires this. Please help me with a work around.
    Monday, December 8, 2008 12:21 PM
  • It sounds like you may not be very familiar with what UAC is and how it works.  The following documents may help:

     

    Some basic information on UAC:

    http://msdn.microsoft.com/en-us/library/aa905330.aspx

     

    Another short document:

    http://msdn.microsoft.com/en-us/library/bb206295(VS.85).aspx
    Monday, December 8, 2008 7:29 PM
  • To krishna:

    Yes!

    UAC should be ON in Vista OS. In order to get full Administrator's token, you have to run the application as administrator when logon an administrator (not the administrator built-in account). And I also think you should get more knowledges about new features in Vista OS that have been mentioned by David Tyler Hunt.

    Tuesday, December 9, 2008 12:29 AM
  • Hi All,

    Thanks for your replies. I went through the document and it clearly states that the Administrator alone has the rights and full control and not to all who belong to the administrator group.

    I also came across an option called "Create and Embed an Application Manifest" in the document.

    The steps described is as follows

    To mark your application with a requestedExecutionLevel, first create an application manifest file to use with the target application. This file can be created by using any text editor. The application manifest file should have the same name as the target executable file with a .manifest extension. For example: IsUserAdmin.exe.manifest.


    Next, you have to attach the application manifest to the executable by adding a line in the resource file of the application (the .rc file) to have Microsoft Visual Studio embed your manifest within the resource section of the PE file. To accomplish this, place the application manifest in the same directory as the source code for the project you are building and edit the resource file to include the following lines:

    #define MANIFEST_RESOURCE_ID 1
    MANIFEST_RESOURCE_ID RT_MANIFEST "
    IsUserAdmin.exe.manifest"


    Can anyone suggest on how to work on this ? Also please guide me to find the so called resource file
    (.rc file) in my application.

    Any help would be of great relief to me as i am finding it really hard to sort out this issue.

    Thanks & Regards

    krishna




    krishna
    Monday, December 15, 2008 12:50 PM
  • Do you need the methods how to add embedded manifest in VB project??
    You can search them in websites. But the method in VB is very few. If you need, I can tell you more detail.

    • Marked as answer by krishna_cbe Monday, March 9, 2009 1:05 PM
    Wednesday, December 24, 2008 2:14 AM