pipharvester
Posts: 1
Joined: Mon Apr 16, 2007 4:33 pm

Removal of Directory created after installation

I need to delete a directory from the AppData (Vista) and Application Data (XP) that is created by my program after the installation is completed. How can this be done so that the uninstall will remove the correct directory in either operating system version?
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

If that directory is created by the installer then it will be deleted automatically on uninstall.

If that directory is created by your application (not by the installer in "Files and Folders" page) then you need a custom action to delete it. For a similar approach take a look here:
http://www.advancedinstaller.com/forums ... ove+folder

The "Application Data" folder corresponds to the AppDataFolder Windows Installer property. On Vista is translated to: "C:\Users\username\AppData\Roaming", on XP to: "C:\Documents and Settings\username\Application Data"

You can read more about AppDataFolder property here:
http://msdn2.microsoft.com/en-us/library/aa367565.aspx

Hope this helps.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
burggraaf
Posts: 4
Joined: Tue Sep 11, 2007 3:21 pm

Similar Vista problem. In Windows Vista Advanced installer does not remove all Files and Folders from the appdata folder (in our case C:\Users\<username>\AppData\Local\VirtualStore\Program Files\<appfolder>) allthough the files and folders are created by the installer. There's also, in our case, a file in a directory which not has been changed but both the directory and file are not removed by uninstall. Strange thing is that is does affect specific files and folders, others are removed properly

It does remove them from the c:\program files\<app dir> where we the files originally are installed. However: when installing the application the application looks at the AppData dir...

In our case that would not be much of a trouble but when uninstalling and installing again it won't overwrite some datafiles in the AppData dir (as said it does not remove them there). The datafiles where installed by Advanced installer. Modified in use (names of files where not modified).

Tried the option 'Ensure that this file overwrites any installed target file' -> No result

Is there a solution?
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,
In Windows Vista Advanced installer does not remove all Files and Folders from the appdata folder (in our case C:\Users\<username>\AppData\Local\VirtualStore\Program Files\<appfolder>) allthough the files and folders are created by the installer.
The files under this directory are not created by the installer, but rather by your application, which is virtualized in Vista (because it does not embed an application manifest with an appropriate requestedExecutionLevel).

===

Virtualization is implemented to improve application compatibility problems for applications running as a standard user on Windows Vista. Developers must NOT rely on virtualization being present in subsequent versions of Windows.

Prior to Windows Vista, many applications were typically run by administrators. As a result, applications could freely read and write system files and registry keys. If standard users ran these applications, they would fail due to insufficient access. Windows Vista improves application compatibility for standard users by redirecting writes (and subsequent file or registry operations) to a per-user location within the user’s profile.

For example, if an application attempts to write to "C:\Program Files\Contoso\Settings.ini", and the user does not have permissions to write to that directory, the write will get redirected to "C:\Users\Username\AppData\Local\VirtualStore\Program Files\contoso\settings.ini".

For the registry, if an application attempts to write to "HKEY_LOCAL_MACHINE\Software\Contoso\" it will automatically get redirected to "HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\Software\Contoso" or "HKEY_USERS\UserSID_Classes\VirtualStore\Machine\Software\Contoso".

While developing Windows Vista programs, to reduce the complexity of virtualized files and registry keys, be sure to embed an application manifest with an appropriate requestedExecutionLevel in order to turn off file and registry virtualization.

The virtual copy will always be present to the application first. For example, if "config.ini" is available in "\Program Files\ApplicationName\config.ini" and "%LOCALAPPDATA%\VirtualStore\config.ini", the "config.ini" in the virtual store will always be the one read, even if "\Program Files\ApplicationName\config.ini" is updated.

Virtualization Recommendations

Virtualization is intended only to assist in application compatibility with existing programs. Applications designed for Windows Vista should NOT perform writes to sensitive system areas, nor should they rely on virtualization to provide redress for incorrect application behavior.

When updating existing code to run on Windows Vista, developers should ensure that, during run-time, applications only store data in per-user locations or in computer locations within %allusersprofile% (CSIDL_COMMON_APPDATA) that have access control list (ACL) settings properly set.

Important

Microsoft intends to remove virtualization from future versions of the Windows operating system as more applications are migrated to Windows Vista. For example, virtualization is disabled on 64-bit applications.

The following list details other file and registry virtualization recommendations:

- Add an application manifest with an appropriate requestedExecutionLevel for your interactive applications. This will turn virtualization off for the manifested application.

- Do not use the registry as an inter-process communication mechanism. Services and user applications will have different views of the registry key.

- Test your application on Windows Vista: Ensure that processes running as standard user do not write to global namespaces like %systemroot%.

- Remember that virtualized resources are per-user copies of global resources.

Advanced Installer supports automatic embedding of application manifest with configurable requested execution level for the created Java products, bootstrapper and MSI. There is no support for other virtualization mechanisms, since Microsoft does not recommend them.

===

For more details, see the following pages and documents:

http://blogs.msdn.com/cheller/archive/2 ... -ways.aspx
http://blogs.msdn.com/cheller/archive/2 ... jects.aspx
http://download.microsoft.com/download/ ... tCases.doc
http://download.microsoft.com/download/ ... %201.1.doc

Hope this helps.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
burggraaf
Posts: 4
Joined: Tue Sep 11, 2007 3:21 pm

Ionut must say: complements! Very clear answer! But...
This leaves me with a problem... My compiler (Filemaker) has no ability to add a requestedExecutionLevel.

However, because the runtime application I want to install is not depending on special Windows settings, it can be on any place on the system as long as it is a place where I can rely on (the same with every user/Vista). So the questions are:
- Is there a place you can recommend? (if possible not nessecary for all users);
- If there is, which settings/place I have to use in AI (5.2.2);
- Is it possible to have different settings for XP and Vista (not nessecary).

Thanx for your advise
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,
My compiler (Filemaker) has no ability to add a requestedExecutionLevel.
There is a tool in the Windows SDK called "Mt.exe" which can embed a manifest resource. See the following page for details:
http://msdn2.microsoft.com/en-us/library/aa375649.aspx

The Web install for the Windows SDK can be downloaded from:
http://www.microsoft.com/downloads/deta ... laylang=en
However, because the runtime application I want to install is not depending on special Windows settings, it can be on any place on the system as long as it is a place where I can rely on (the same with every user/Vista). So the questions are:
- Is there a place you can recommend? (if possible not nessecary for all users);
- If there is, which settings/place I have to use in AI (5.2.2);
- Is it possible to have different settings for XP and Vista (not nessecary).
I am not sure I understand what you mean. Please give me more details about this. If you are referring to the data files created by your application, it is recommended to store them under a subfolder of the "Application Data" directory for the current user ("Application Data" folder in AI) or for all users ("Common Application Data" folder in AI).

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
burggraaf
Posts: 4
Joined: Tue Sep 11, 2007 3:21 pm

OK sorry was too busy for some time but picking this up now...

What I meant is that Filemaker runtimes require the datafiles to be in the same directory as the application files. There's no other option. So is there is a preferred/advised other installing directory (option in AI) to install the complete application in another place on a Vista PC?
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,
What I meant is that Filemaker runtimes require the datafiles to be in the same directory as the application files.
In this case you can use the "Mt.exe" tool to embed a manifest resource with a requestedExecutionLevel set to requireAdministrator. The application can be installed in any location and it will not be virtualized anymore. However, the user needs to have admin privileges in order to use the program.
So is there is a preferred/advised other installing directory (option in AI) to install the complete application in another place on a Vista PC
The installation directory can be chosen by the user at install time in the FolderDlg dialog. The default Application Folder can be changed in the Install Parameters page.

For instance you can set it to:

Code: Select all

[AppDataFolder][Manufacturer]\[ProductName]
Additionally, in this case the Installation Type will be changed to "Per-user only".

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
burggraaf
Posts: 4
Joined: Tue Sep 11, 2007 3:21 pm

Thanks, see what you mean. I have to figure out how "MT.exe" works / how i can use it.

But... if I understand you in the right way... The safest way in our case on Vista is to install in the applicationdata directory because we can't garantuee users have admin privileges...

Regards,
burggraaf

Return to “Common Problems”