tarnic
Posts: 26
Joined: Mon May 18, 2009 10:41 am

Write/Move/Delete file in Program Files - Vista/7

Good evening, I have a problem launching file at the installation finish.
I'm using latest version of AI.

My program is a plugin of other softwares.
The behaviour of my setup would be like this:
1- Let the user to select an option about install some file like x86 or x64. (it depends installation version of other software)
2- At the installation finished, I launch some DLL/VBS to write files in ProgramFiles and delete some folders.

PART 1
To resolve this, I use 32bit setup version, because I don't want to install my x64 files if the windows version is x64, but ONLY if other program installed is x64. Elsewhere install x86 also if Windows version is x64.
I create 2 folder:
X32 Dir, with all x86 files.
X64 Dir, with all x64 files.
When setup is finished, I launch a VBS that remove one of this folder as the user choosed, and rename the other to the name desidered.
Is a correct procedure? Or does AI permit other methods?
Moreover AI always change from C:\ProgramFiles\ to C:\ProgramFiles (x86)\ Installation Path automatically, because it says that it's a 32bit package... but I don't want this behaviour.

PART 2
My biggest problem is to write and launch files in ProgramFiles by CustomActions.
I tried with:
- Deferred no impersonation under PublishProducts as you suggest in help file.
- Bootstrapper admin (also tried with as Invoker)
- Installation type: per-user only if it has administration rights (also tried other selection)
- Tried to disable Win 7 UAC, nothing.Work only if UAC disabled under InstallFinalize. (but I can't deploy to customers saying them to disable UAC!!!)
- Tried all execution properties.
All rights with Windows XP, nothing with Vista/7.

See the attachment image if I have committed any mistakes.

Where is the problem?
03-05-2010 21-54-55.png
03-05-2010 21-54-55.png (124.21 KiB) Viewed 5994 times
The DLL only open a txt file and write in it some text. Work only if UAC disabled under InstallFinalize.

Thank you,
Nicola
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Write/Move/Delete file in Program Files - Vista/7

Hello Nicola,

Please check our tutorial on how to conditionally install a file depending on system architecture.
Use the Search functionality to search for installed application for which you are installing the plugins
Use the search result property in the conditions for installing the two components from the above tutorial, to condition them to install 32bit files on 64bit platforms.
Moreover AI always change from C:\ProgramFiles\ to C:\ProgramFiles (x86)\ Installation Path automatically, because it says that it's a 32bit package... but I don't want this behaviour.
This is not done by AI, this is done by Windows because your package is marked as 32bit. Use mixed 32bit/64bit package as described in the tutorial.

Regarding PART 2, I am not sure what the problem is. Are you encountering an error? What exactly does not work?

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
tarnic
Posts: 26
Joined: Mon May 18, 2009 10:41 am

Re: Write/Move/Delete file in Program Files - Vista/7

Hi Grabiel,
thank you for your answer.

About part 1 I'll read again tutorial to resolve the problem.
Thank you for your explanation.

Regarding part 2, I don't understand why doesn't work.
Custom Actions at the end the setup installation were launched: I'm sure about this because I inserted MsgBox messages, and they appear with message correctly.
But nothing happen to files: the text file where setup must be write in, remains blank/empty. Custom Actions don't delete folders.
So I'm thinking about privileges...
On XP, seems all OK.

Any idea?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Write/Move/Delete file in Program Files - Vista/7

Hello,

I doubt it's a privilege problem. Your custom action runs under SYSTEM account, which means it can do pretty much anything. This seems to be an issue within your custom action. Try debugging it by attaching to the process if you are using Visual Studio. My best guess is you are not getting the correct path to your txt file. Try finding out which path your dll is trying to open.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
tarnic
Posts: 26
Joined: Mon May 18, 2009 10:41 am

Re: Write/Move/Delete file in Program Files - Vista/7

Hi Gabriel

About PART 1
I read the tutorial to adapt it to my software installation, but maybe I'm not lucky. :(

My software is a CAD (AutoDesk software) "plugin".
It's not important the Windows Version, but the CAD version (if 32bit or 64bit). I explain my self:
- I have a VBS registry search that find where the CAD needed is installed, and I also know if the CAD needed version is 32bit or is 64bit. (Not important windows version, if CAD needed is installed as 64bit, I know consequently that also Windows is 64bit)
This is because a customer can install old 32bit CAD version in Windows 64bit (in Program Files (32bit)).
I want to install files in the same folder of CAD, but if CAD is 32bit, install my 32bit files, else if CAD is 64bit, install my 64bit files. And the best is to create a mixed 32/64 bit installer.

As I explained, the worst situation is if a customer as Windows 64bit, but installed 32bit CAD.

My idea:
1) Prepare setup as mixed 32bit/64bit.
2) Prepare 2 folder in ApplicationFolder, named "prog_32bit" and "prog_64bit" with correct files inside
3) Change dinamically during dialogs "APP" Property to the path retrieved by VBS
for example:
"C:\Program Files (x86)\CAD\" (Win64, CAD installed 32bit)
or
"C:\Program Files\CAD\" (Win64, CAD installed 64bit, or simply Win32).
But I want to be sure that Win don't change me APP path (if I use mixed setup, Win doesn't change my path, right???)
4) At the end of setup, the wrong folder is deleted with VBS Custom Action, and the other renamed as "prog". (With admin privileges)

Is it the best solution? I haven't other idea.
Are there any more simple solution?

Thank you
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Write/Move/Delete file in Program Files - Vista/7

Hi Nicola,

Please try placing the vbscript custom action under InstallUISequence->CostFinalize. Your vbscript must set the APPDIR property to the location to which your files will be installed.
Under APPDIR (Application Folder) on the Files and Folders page, create two subfolders, one for your 32bit files and one for 64bit files as mentioned in the guide on installing different versions of a file based on machine architecture.

If you still can not make it work, please send your .aip project file to support at advancedinstaller dot com so we can take a look.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”