views:

66

answers:

0

I have noticed some strange behaviour with our application's installer which I am struggling to understand. I have managed to reproduce the behaviour with a simple test installer so I will use this to explain what is going on.

The installer is per-machine and installs a single file into a directory underneath "Program Files". The directory is locked down using the "LockPermissions" table so that the "Administrators" group has "Full Control", but no other users are allowed access. (The LockPermissions table automatically gives full control to "Local System" as well).

I can successfully install/uninstall this simple installer on a Windows 2008 OS with User Account Control enabled, logged on as a domain admin. The file and its parent directory are added and removed from the system as expected.

The problem comes when I introduce an entry into the "RemoveFile" table. Let's say I want the installer to remove a file called "foo.txt" (located in the product directory) during uninstall. I add the appropriate entry into the "RemoveFile" table, install the product, create a file (using an elevated command prompt) called foo.txt and then uninstall the product.

The expected behaviour is that my product directory and its contents (the installed file and the created file) are removed. However, what happens is that the directory and the created file are left behind. The RemoveFiles action does not seem to be correctly deleting the foo.txt file.

If I relax the permissions on the product directory (by allowing the "Users" group "Read and Execute" permission), then the uninstall works correctly.

Even weirder, once I have installed my product I can open Explorer and browse to the product directory. I am prompted by UAC, because I don't have permission to view the contents of the directory. If I agree, Windows modifies the ACLs on the directory to give "Read and Execute" permission to my domain admin user account. Once it has done this, the uninstall will work without a hitch.

Can anyone explain why the RemoveFiles action is failing to remove my foo.txt file? I was under the impression that the installer executed this standard action under full privilege, so I am surprised if it is a file permission issue.

Thanks for any help!

related questions