-
Wupdate.exe problem
Hi Friedrich,
A mutual client has run into a problem with some code that I use to
run programs. It doesnt' work with Wupdate.exe on his XP machine.
After some digging into this, I have found out that the code I use -
which uses ShellExecuteEx, WaitForSingleObject etc. - does NOT work
with Wupdate.exe if the program is not called with parameters. If it
is called with parameters, then everything is fine. This behaviour is
present on both XP SP2 and Vista Home Premium, both with all the
latest updates applied.
What seems to happen is that if Wupdate is called without parameters,
it waits for the calling process to terminate. When I terminate the
process using the Task Manager, the Wupdate.exe pops up immediately
after the calling process is terminated.
My code works properly with all other programs that I have tried it
with and I (and others) have been using this for about 6 months now
without issues.
http://www.buildautomator.com/stuff/...RunProgram.zip
This file includes a Clarion 6.3, 9058 application and the compiled
EXE. Run the exe and select a wupdate.exe and check the Wait
checkbox. The program will attemt to run wupdate.exe but stops as
it's waiting for wupdate.exe to terminate. Wupdate.exe OTOH seems to
be waiting for test.exe to terminate before it continues. Now try it
again with the "/C /S" parameters and it will run fine.
I can run any other program with this test.exe, including the Setup
Builder IDE without any issues.
Since I never call the Wupdate.exe with the wait parameter without
using the /S /C parameters also I have never run into this myself.
Just for fun I tried this on a wupdate.exe from SB5 and it produced
the same results.
I tried to run the BuildAutomatorInstall.exe from the Test.exe and let
it wait and there I also get the same results. The install doesn't
show until I terminate Test.exe. When test.exe disappears from the
task list in Task Manager the install appears immediately.
On my quest to execute installs, I'm realizing that installs build
with earlier 4.0, 5.5 or 6.x (6.6 2040 in the htm reported on a file
that does work) do NOT show this behaviour. New installs that are
compiled in the latest build DO show this behaviour. I have tried to
run several installs that I have and were not created with SB and none
of them shows this behaviour when run with wait turned on. It seems
that this behaviour started in the installs sometime during 6.7-6.8
and they now also behave like wupdate.exe
I dont' make much sense of it, but it seems that you cannot run exes
created in Setup Builder from a different process and use
WaitforSingleObject() to wait for it.
Best regards,
Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com
Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php
-
Re: Wupdate.exe problem
Hi Arnór,
I am at home right now and can't test your application. I have created a
small ShellExecute demo:
http://www.lindersoft.com/projects/ShellExecute.zip
SellExecute.exe uses he ShellExecuteEx API to start test.exe. It does not
pass any parameter to the test.exe compiled with SB68.
On my Vista-64 machine here it "waits" for the SB68 application.
Does the above test application also cause problems on your machine?
Friedrich
-
Re: Wupdate.exe problem
Hi Friedrich,
>On my Vista-64 machine here it "waits" for the SB68 application.
>
>Does the above test application also cause problems on your machine?
No, but these are not Clarion exes, are they?
If I run the ShellExecute.exe from _my_ Test.exe it works fine and my
Test.exe waits for your ShellExecute.exe to finish. If I run your
Test.exe from my Test.exe they are both locked.
All the code is in the app I uploaded. It really doesn't make sense
to me why it would fail on those SB exes only and nothing else...
I've tested it on XP SP2 (Home) and Vista Home Premium both with all
updates. If I have time later tonight I may try to duplicate this in
a VC++ application and see what happens there. Note that I'm using
Clarion 6.3 9058, but my client was using an older build (not sure
which one).
The basic code that I'm using looks like this:
SHi.fMask = IT_SEE_MASK_NOCLOSEPROCESS
SHi.hwnd = 0{Prop:Handle}
SHi.lpVerb = Address(Verb)
SHi.lpFile = Address(cCmdLine)
SHi.lpParameters = Address(cParam)
SHi.lpDirectory = Address(P)
SHi.nShow = IT_SW_SHOWNORMAL
SHi.lpIDList = 0
SHi.lpClass = 0
SHi.hkeyClass = 0
SHi.dwHotKey = 0
SHi.DUMMYUNIONNAME = 0
SHi.cbSize = Size(SHi)
If Not SELF.ShellExecEx(SHi)
hProc = 0
Else
hProc = Shi.hProcess
End
If hProc
If pWait
RetVal = IT_WaitForSingleObject(hProc,-1)
If IT_GetExitCodeProcess(hProc, lRetCode)
RetValue = lRetCode
Else
RetValue = RetVal
End
RetVal = IT_CloseHandle(hProc)
End
End
Now, this is interesting. If I add a message() in there:
If pWait
Message('pWait')
RetVal = IT_WaitForSingleObject(hProc,-1)
Then it works! The message pops up for about a second, then the SB
test.exe window shows up.
Best regards,
Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com
Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php
-
Re: Wupdate.exe problem
Hi Friedrich,
> If hProc
> If pWait
> RetVal = IT_WaitForSingleObject(hProc,-1)
This has got to be one of the most silliest things I have ever
encountered<bg>
After a lot of thoughts and gallons of coffee and more thoughts I came
up with this instead:
If hProc
If pWait
Accept
Sleep(750)
Break
End
RetVal = IT_WaitForSingleObject(hProc,-1)
This works. But on XP it works without the Sleep. On Vista it needs
to wait for longer so I had to put in the Sleep() for that.
From this it seems that if the calling process starts waiting before
the window of the called process is drawn or something, it causes this
deadlock. Since I can't duplicate this with anything except
wupdate.exe or recent SB installs, it's very difficult to try to
pinpoint what is causing this. I have read back and forth pages after
pages of example code in VC, VB and Delphi on ShellExecuteEx and
WaitForSingleObject and I cannot see anything wrong or out of place
with my code that could possibly be causing this.
Best regards,
Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com
Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php
-
Re: Wupdate.exe problem
Hi Friedrich,
>pinpoint what is causing this. I have read back and forth pages after
>pages of example code in VC, VB and Delphi on ShellExecuteEx and
>WaitForSingleObject and I cannot see anything wrong or out of place
>with my code that could possibly be causing this.
I've went through my code with a fine toothed comb and compared every
structure and every prototype to my MSDN. Everything should work
perfectly. Still doesn't. Your Shellexecute.exe runs my wupdate.exe
fine, but my test.exe does not. My guess is that your exe was made
with VC, where as mine is made with Clarion.
While this is not causing me any problems per se. this could be a
problem for people who want to create actions in the Build Automator
to do batch installs of for example third party tools to recreate a
development environment. They would run into that only earlier SB
installs would run and new ones would lock up.
Best regards,
Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com
Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php
-
1 Attachment(s)
Re: Wupdate.exe problem
Hi Arnór,
> On my quest to execute installs, I'm realizing that installs build
> with earlier 4.0, 5.5 or 6.x (6.6 2040 in the htm reported on a file
> that does work) do NOT show this behaviour. New installs that are
> compiled in the latest build DO show this behaviour.
I have just installed SetupBuilder 6.0 Gold (Build 1718, dated December 18,
2006) and it also shows this behavior. See attached testme.exe. It display
a "test" message box and then "hangs".
This only happens when ShellExecuteEx() and Wait is used from Clarion
applications. VC++, etc. applications do not have this behavior.
So in fact, this "problem" is there for at least 18 months now. I'll
install SetupBuilder 5 now...
Friedrich
-
1 Attachment(s)
Re: Wupdate.exe problem
Hi Arnór,
I wrote:
> So in fact, this "problem" is there for at least 18 months now. I'll
> install SetupBuilder 5 now...
Same "problem" in SetupBuilder 5 (see attached SB5 installer).
Friedrich
-
Re: Wupdate.exe problem
I have debugged the code compiled by SetupBuilder and see where Clarion
(ShellExecuteEx/Wait) causes a "deadlock". The deadlock is in the dialog
initialization function. I'll keep you posted.
--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910
"point. click. ship" - that's SetupBuilder
Create Windows Vista ready installations in minutes
-- Official Comodo Code Signing and SSL Certificate Partner
-
Re: Wupdate.exe problem
Hi Arnór,
Okay, I found out what causes this. Because the SetForegroundWindow()
Windows API has been intentionally crippled by Microsoft, we have to use an
alternative called "ForceForegroundWindow" (most VC++ developers make use of
this function). Installations compiled with SetupBuilder 5 and 6 use that
function to bring the installation wizard into the foreground.
Unfortunately, this causes problems when a Clarion application uses the
ShellExecuteEx and WaitForSingleObject Windows APIs to start an SetupBuilder
application to wait for its termination.
So the only possible solution would be a new \CLARION command line switch.
If you use ShellExecuteEx and WaitForSingleObject from your Clarion
application to start a SetupBuilder installer and wait for it, then the
\CLARION switch would disable the (AttachThreadInput) API that causes this
"deadlock".
Would this be okay for you?
--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910
"point. click. ship" - that's SetupBuilder
Create Windows Vista ready installations in minutes
-- Official Comodo Code Signing and SSL Certificate Partner
-
1 Attachment(s)
Re: Wupdate.exe problem
Hi Arnór,
I have attached a quick and dirty "ShellExecuteEx and Wait" source code demo
for Clarion. IMO, this is the correct way to handle it in Clarion and to
keep the system "alive".
What do you think?
--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910
"point. click. ship" - that's SetupBuilder
Create Windows Vista ready installations in minutes
-- Official Comodo Code Signing and SSL Certificate Partner