Problem with HKEY_CURRENT_USER on windows 7 installation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • fmenditto
    Forum Member
    • Mar 2011
    • 9

    Problem with HKEY_CURRENT_USER on windows 7 installation

    Hi, I'm using Setup Factory 9.0. My setup have "Require administrator" setting for Requested User Privilege Level and "Collect launch user information" to true.
    The setup write something in HKEY_LOCAL_MACHINE, something in HKEY_CURRENT_USER and create a shortcut on desktop with location setting for shortcut tab.
    I launch the setup with a user that is not administrator.
    When I launch the setup it require name and password of administrator user and happen a strange things:

    - %LaunchUserApplicationDataFolder% is correct for a non administrator user.
    - value are right write in registry under HKEY_LOCAL_MACHINE
    - value in registry for HKEY_CURRENT_USER are NOT write under current user but under administrator user
    - desktop shortcut are NOT write on a user descktop but on administrator desktop

    Have you any idea ?

    Thanks Filippo
  • jassing
    Indigo Rose Customer
    • Jan 2001
    • 3124

    #2
    Originally posted by fmenditto View Post
    - %LaunchUserApplicationDataFolder% is correct for a non administrator user.
    is it correct for hte user that is logged in?

    Originally posted by fmenditto View Post
    - value in registry for HKEY_CURRENT_USER are NOT write under current user but under administrator user
    That's because you elevated...


    Originally posted by fmenditto View Post
    - desktop shortcut are NOT write on a user descktop but on administrator desktop
    Did you create them on the collected launch user or as current user?

    Comment

    • fmenditto
      Forum Member
      • Mar 2011
      • 9

      #3
      - %LaunchUserApplicationDataFolder% is correct for the user that is logged in.
      - I must elevate the user becasue I must write something in HKEY_LOCAL_MACHINE. In this case is not possibile to write on HKEY_CURRENT_USER for the logged in User ?
      - I create shortcut using standard configuration of file properties -> Shortcuts Tab -> Location

      Comment

      • fmenditto
        Forum Member
        • Mar 2011
        • 9

        #4
        Nothing about this ?

        Comment

        • Ulrich
          Indigo Rose Staff Member
          • Apr 2005
          • 5130

          #5
          You have to write some code, but you already have everything you need to make this work. As you noticed, after elevation, the "current user" will be the administrator account, not the user who launched the setup.

          If you want to create an entry in the registry for the user who launched the setup, you must use HKU (HKEY_USERS) instead. Using "Collect launch user information", the "%LaunchUser...%" session variables will be set with the proper content. You can any of these session variables to extract the current username. For example, if you use %LaunchUserStartFolder%, it will return something like

          "C:\Documents and Settings\[username]\Start Menu" or
          "C:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu".

          All you need to do is extract the username from the path of your choice. Once you have the name of the LaunchUser, you can use System.GetUserSID(UserName) to get his SID. And, finally, it is no secret that HKEY_USERS\[User's SID] is the same as HKEY_CURRENT_USER, when that user is logged on.

          So, instead of creating a key or setting a value directly under HKCU after the elevation, you should use the key under
          HKU\[SID] instead.

          Finally, for the shortcut, you should use the Custom option and provide the location with a %LauchUser...% folder location, or use the Shell.CreateShortcut() action.

          Ulrich
          Last edited by Ulrich; 04-13-2011, 03:04 PM.

          Comment

          • fmenditto
            Forum Member
            • Mar 2011
            • 9

            #6
            Hi Ulrich, now it's clear. But in this case my user is a domain user and the strUser it's like user.domain. Sistem.GetuserSID return null string. So maybe there is a spcific format for a doamin user ?

            Comment

            • paicab
              Forum Member
              • Apr 2010
              • 3

              #7
              Hi,
              I have the same problem. Is there a solution for a domain user?
              Thank you anyway

              Comment

              • Ulrich
                Indigo Rose Staff Member
                • Apr 2005
                • 5130

                #8
                Hello,

                I am not sure that I understand the issue. Are you saying that you don't know how to use the String actions to extract the username from the full string, or that System.GetUserSID() fails when you process the extracted username? Maybe you could provide an exact sample.

                Ulrich

                Comment

                Working...
                X