IzPack

with <run-privileged/>, always asks for user account on winxp even if user is an administrator

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 4.2.0, 4.3.0
  • Fix Version/s: 4.2.1, 4.3.0
  • Component/s: Installer
  • Labels:
    None
  • Environment:
    Win XP SP3
  • Number of attachments :
    2

Description

My account is called "xyz" and it's a member of the Administrators group - I've write-access to all relevant parts of the system. However, running any installer with <run-privileged/> set, I get asked what account should be used for the installer. This is rather bad since I only can use this one account and it has all privileges anyway.

I currently workaround this by testing for some write-access in %PROGRAMFILES% and in the registry (hardcoded, in com.izforge.izpack.installer.PrivilegedRunner.isElevationNeeded()), but I guess it would be best to be able to define what rights the user needs in the install.xml and to test for them in the mentioned method call.

Activity

Hide
Julien Ponge added a comment -

We'll try to get a fix for the release after.

Show
Julien Ponge added a comment - We'll try to get a fix for the release after.
Hide
Julien Ponge added a comment -

Tested on Windows XP and Windows 7 Beta.

Show
Julien Ponge added a comment - Tested on Windows XP and Windows 7 Beta.
Hide
Christian d'Heureuse added a comment -

In PrivilegedRunner.canWriteToProgramFiles(), the path of the windows program directory is hard coded: "C:\Program Files". The problem is, that this is only correct in the english Windows version. For a german Windows XP for example, the path is "C:\Programme".

There are two possible solutions. The first solution is easy, but the second solution would probably be better:

1. Use System.getenv("ProgramFiles") instead of the hard coded string "C:\Program Files".

2. Use a native library (JNI, DLL) to call the Win32 API routine SHGetFolderPath with CSIDL_PROGRAM_FILES.
I'm attaching a file that shows how to do that.
MS Visual C++ Express 2008 (which can be downloaded from http://www.microsoft.com/express/vc/ ) may be used to compile the DLL.

Show
Christian d'Heureuse added a comment - In PrivilegedRunner.canWriteToProgramFiles(), the path of the windows program directory is hard coded: "C:\Program Files". The problem is, that this is only correct in the english Windows version. For a german Windows XP for example, the path is "C:\Programme". There are two possible solutions. The first solution is easy, but the second solution would probably be better: 1. Use System.getenv("ProgramFiles") instead of the hard coded string "C:\Program Files". 2. Use a native library (JNI, DLL) to call the Win32 API routine SHGetFolderPath with CSIDL_PROGRAM_FILES. I'm attaching a file that shows how to do that. MS Visual C++ Express 2008 (which can be downloaded from http://www.microsoft.com/express/vc/ ) may be used to compile the DLL.
Hide
Christian d'Heureuse added a comment -

I cannot attach a file to this issue, because the status of this issue is "closed". Could someone with admin privileges reopen it, or should I open a new Jira issue?

The file is currently at http://www.source-code.biz/temp/izpack/javaSHGetFolderPathTest.zip

Show
Christian d'Heureuse added a comment - I cannot attach a file to this issue, because the status of this issue is "closed". Could someone with admin privileges reopen it, or should I open a new Jira issue? The file is currently at http://www.source-code.biz/temp/izpack/javaSHGetFolderPathTest.zip
Hide
Kjell Braden added a comment -

Re-opened as it still seems to make issues.

Show
Kjell Braden added a comment - Re-opened as it still seems to make issues.
Hide
Christian d'Heureuse added a comment -

Added sample code that shows how to call the Win32 API routine SHGetFolderPath using JNI.

Show
Christian d'Heureuse added a comment - Added sample code that shows how to call the Win32 API routine SHGetFolderPath using JNI.
Hide
Christian d'Heureuse added a comment -

Added a patch for using System.getenv("ProgramFiles") instead of "C:\Program Files".

Show
Christian d'Heureuse added a comment - Added a patch for using System.getenv("ProgramFiles") instead of "C:\Program Files".
Hide
Julien Ponge added a comment -

Thanks Christian, I have applied the non-JNI patch.

Show
Julien Ponge added a comment - Thanks Christian, I have applied the non-JNI patch.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: