Issue Details (XML | Word | Printable)

Key: IZPACK-217
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Julien Ponge
Reporter: Kjell Braden
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
IzPack

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

Created: 06/Dec/08 10:28 AM   Updated: 20/Apr/09 03:26 AM   Resolved: 15/Mar/09 08:46 AM
Return to search
Component/s: Installer
Affects Version/s: 4.2.0, 4.3.0
Fix Version/s: 4.2.1, 4.3.0

Time Tracking:
Not Specified

File Attachments: 1. Text File IZPACK-217.patch (0.7 kB)
2. Zip Archive javaSHGetFolderPathTest.zip (22 kB)

Environment: Win XP SP3


 Description  « Hide

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.



Julien Ponge added a comment - 15/Dec/08 07:58 AM

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


Julien Ponge added a comment - 29/Jan/09 04:12 AM

Tested on Windows XP and Windows 7 Beta.


Christian d'Heureuse added a comment - 11/Mar/09 04:53 PM

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.


Christian d'Heureuse added a comment - 11/Mar/09 05:04 PM

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


Kjell Braden added a comment - 11/Mar/09 05:30 PM

Re-opened as it still seems to make issues.


Christian d'Heureuse added a comment - 12/Mar/09 05:01 AM

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


Christian d'Heureuse added a comment - 12/Mar/09 05:19 AM

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


Julien Ponge added a comment - 15/Mar/09 08:46 AM

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