Administrator rights

Got a problem you cannot solve? Try here.
matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Administrator rights

Postby matthewj » Wed Jan 19, 2005 9:02 am

Can I ask you to do some experimentation please? I think it would make a great improvement to InstallAware. Basically, it is back to this Administrator rights that are needed to install in Program Files. Right now, I have a CD with a welcome app, and you click a button to run the installer. It runs fine, but a standard Win 2000 user will wait a while and then get an "not admin" error dialog and that's it.

My suggestion is that you ask the user for an admin domain\\name and password at that point, thus allowing them to continue. This is where the experimentation comes in. My first suggestion is to try the following code:

Code: Select all

      lbResult := LogonUser(PChar(szUser), PChar(szDomain), PChar(szPassword),
         {LOGON32_LOGON_NETWORK {} LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, hToken);
//      nLastError := GetLastError;
      if lbResult then
         lbResult := ImpersonateLoggedOnUser(hToken);
      if not lbResult then
         Report('User "' + szDomain + '\\' + szUser + '" logon failed - cancelling.', true);


This is what I use in my backup app to access remote shares. The app takes on the rights of the user temporarily, and doing this may allow them to continue the install without trouble. Alternatively, if that doesn't work, how about you do this, or use the RunAs methods to re-run the installer as admin in a "pre-unpacked" state? Then it could just carry on.

This would all give a much smoother end-user experience.

Hopefully this will get into an update, along with my previous suggestion of being able to test for power-user status which is actually all that is needed to do a basic app install.

Thanks,

Matthew

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Thu Jan 20, 2005 8:53 am

Just as a side note, a certain other installer tells people to use "right click and use Run As" in their "you don't have permission" dialog. Doesn't actually help in my case, since they aren't at Windows Explorer.

Hmm, I wonder if I can check the install capability in my CD startup and use the technique I suggest there? I'd rather the installer did it though.

Matthew

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Thu Jan 20, 2005 10:23 am

Thanks for this code. I am hoping to get in a "Run As User" command for the next update of InstallAware. With such a command, you'd be able to easily script this behavior in yourself.

Windows Installer may also be able to help. I don't remember if I told you this before, but you can actually install apps with elevated priviledges on Windows Installer. The system admin of the corporate net needs to allow this - its a group policy setting (AlwaysInstallElevated, I believe).

With AlwaysInstallElevated set, even non-power users (limited users) can install stuff into Program Files.

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Thu Jan 20, 2005 10:31 am

Thanks - that is useful information for corporate roll-outs, though I want this for the average user who has also been having trouble since XP with restricted rights came out.

Matthew

matthewj
Posts: 66
Joined: Tue Dec 07, 2004 12:48 pm

Postby matthewj » Thu Jan 20, 2005 12:27 pm

matthewj wrote:Just as a side note, a certain other installer tells people to use "right click and use Run As" in their "you don't have permission" dialog.

Okay, I just found that I can of course edit the text in the message to say whatever I want it to say!

Matthew

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Thu Jan 20, 2005 1:29 pm

:D


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 27 guests