This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

CreateProcess failure
Started by
vishwa
, Oct 04 2005 16:05
2 replies to this topic
Posted 04 October 2005 - 16:05
During the installation of my product, the installation tries to run an application, say abc.exe.
I do a CreateProcess() to run this executable. This call to CreateProcess() fails on some machines, with return code 0.
I have a MessageBox() that gets displayed on failure. When the installation fails, I open a cmd prompt and try to run abc.exe from cmdline. I get an error saying
"The process cannot access the file because it is being used by another process."
I assumed here the the 'process' is cmd.exe, and 'file' is abc.exe.
I used process explorer (downloaded from sysinternals.com) to see who is holding on to abc.exe. It seems that setup.exe has a handle opened for abc.exe. As long as the installation runs, this file is being held open by setup.exe, and all attempts to run this file fails for the same above mentioned reason.
This does not happen on all machines. The problem is being encountered on HP Laptops with WinXP SP2.
My questions are:
1. Is the first failure to create process because of the abc.exe held by setup.exe?
2. Why does setup not release the file once it is done?
3. What would be the reason for such things to be happening?
I am using the admin account on the laptop.
Please throw some light into this matter.
Many Thanks,
Vishwa
Posted 04 October 2005 - 20:47
Some more findings on what has been happening...
During the installation, I copy abc.exe twice to the same location. The first copy succeeds, but setup is unable to copy it the second time. Since the file already exists, it is not able to overwrite it.
Because of this, setup.exe still holds the handle for abc.exe, thus not allowing any other process to access this exe.
Does my explanation sound logical?
If so, why is InstallShield not able to overwrite the file once its sees the same file? This behavior is not seen on all machines, just a few of them - and all are WinXP.
Any help in this matter would be greatly appreciated.
Many Thanks
Vishwa
During the installation, I copy abc.exe twice to the same location. The first copy succeeds, but setup is unable to copy it the second time. Since the file already exists, it is not able to overwrite it.
Because of this, setup.exe still holds the handle for abc.exe, thus not allowing any other process to access this exe.
Does my explanation sound logical?
If so, why is InstallShield not able to overwrite the file once its sees the same file? This behavior is not seen on all machines, just a few of them - and all are WinXP.
Any help in this matter would be greatly appreciated.
Many Thanks
Vishwa
Posted 05 October 2005 - 06:32
Hi Vishwa
I suggest, you should use LaunchAppAndWait() instead of using CreateProcess() in install script. Following is a small description of LaunchAppAndWait():
The LaunchAppAndWait uses the CreateProcess API. After InstallShield DevStudio launches the application, it searches for the window handle of the launched application. If it finds the window handle and the LAAW_OPTION_WAIT option is specified, it waits until the application window disappears before continuing.
Please read bried description of LaunchAppAndWait() in InstallShield help area. (Click here for online help page.)
In addition, if your application is another Setup or MSI, then use DoInstall(), but on the condition that your child installer should be generated from same InstallShield version. Do read the help description of use DoInstall()(Click here for online help page.)
Hope this helps out
Regards
Farrukh
I suggest, you should use LaunchAppAndWait() instead of using CreateProcess() in install script. Following is a small description of LaunchAppAndWait():
The LaunchAppAndWait uses the CreateProcess API. After InstallShield DevStudio launches the application, it searches for the window handle of the launched application. If it finds the window handle and the LAAW_OPTION_WAIT option is specified, it waits until the application window disappears before continuing.
Please read bried description of LaunchAppAndWait() in InstallShield help area. (Click here for online help page.)
In addition, if your application is another Setup or MSI, then use DoInstall(), but on the condition that your child installer should be generated from same InstallShield version. Do read the help description of use DoInstall()(Click here for online help page.)
Hope this helps out

Regards
Farrukh
Edited by farrukh, 05 October 2005 - 06:39.