Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2011
    Posts
    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

  2. #2
    Join Date
    Jan 2001
    Location
    Shelton,WA
    Posts
    3,123
    Quote Originally Posted by fmenditto View Post
    - %LaunchUserApplicationDataFolder% is correct for a non administrator user.
    is it correct for hte user that is logged in?

    Quote 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...


    Quote 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?

  3. #3
    Join Date
    Mar 2011
    Posts
    9
    - %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

  4. #4
    Join Date
    Mar 2011
    Posts
    9
    Nothing about this ?

  5. #5
    Join Date
    Apr 2005
    Location
    Tabo„o da Serra
    Posts
    3,606
    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 at 03:04 PM.

  6. #6
    Join Date
    Mar 2011
    Posts
    9
    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 ?

  7. #7
    Join Date
    Apr 2010
    Posts
    3
    Hi,
    I have the same problem. Is there a solution for a domain user?
    Thank you anyway

  8. #8
    Join Date
    Apr 2005
    Location
    Tabo„o da Serra
    Posts
    3,606
    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

Posting Permissions

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