PDA

View Full Version : Windows 7 wucheck/wupdate problem



NewsArchive
11-24-2009, 02:50 AM
I am running the current version of SetupBuilder Developer.

After wucheck finds an update, wupdate is called to download it. This
works fine on XP and Vista, but on Windows 7 I get a RunCode = -4.

Here is the code I am running:
RUN( 'wucheck.exe /C',1 ) !This works.

If RunCode() = 1
CASE Message( 'There is an update for ' & CLIP(msgPrgName) &
'.||' & |
'Would you like to download and install
it?','Confirm', |
ICON:Question,BUTTON:Yes+BUTTON:No,BUTTON:Yes,1 )
OF BUTTON:Yes
RUN( 'wupdate.exe /S' ) !RunCode = -4 on Windows 7

If RunCode() = -4
STOP( ErrorCode() & ': ' & Error() ) !This produces
errorcode 0 which is worthless
End
glo:CloseOK = TRUE
POST(EVENT:CloseWindow)
OF BUTTON:No
!Continue.
END
Else
Message( 'You have the current version of ' & CLIP(msgPrgName)
& '.','Status',ICON:Asterisk )
End
End

I thought I had this figured out, but obviously I don't. Could someone
tell me what I'm doing wrong?

I have tried to run wucheck.exe /S but that also fails. I can run both
wucheck and wupdate from the CMD prompt and they work as expected.

Thanks.

Bob

NewsArchive
11-24-2009, 02:51 AM
-4 from wupdate means it can't download the manifest file (pic)
Is it all Win7 machines or just one? (Maybe firewall issue?)

The source code for wucheck and wupdate is included with your SB
installation (inside of Redist\1033).

You might make a copy and play with it -- add additional error messages to
try to pin down your problem.

Or maybe it will be obvious to someone else...

Jane

NewsArchive
11-24-2009, 02:52 AM
Bob,

I don't understand the first question?? Should you be seeing the -4 return
code?

As for the manifest, both wucheck and wupdate are actually SB "installers".
SB7 always inserts a Windows 7 manifest into any installers it creates.
Your only option is to specify execution level (on the Generator tab).

If you create your own version of either of them, you should of course
code-sign it. The ones Friedrich supplies are code-signed.

Jane

> Jane,
>
> Should I be seeing that error message? I'm not seeing anything except for
> the stop I added to the code.
>
> Also, should wucheck and wupdate have a manifest added to them? I haven't
> done that.
>
>
> Thanks,
>
> Bob

NewsArchive
11-24-2009, 02:52 AM
Jane,

The return code of -4 is from the RUN statement, isn't it? I'm not
getting, as far as I know, any error from wupdate.

And, sorry, I thought I deleted my previous reply to you. Checking
wucheck and wupdate, I found, as you write, that both have manifest and
both are codesigned; so I deleted the message.

Thanks,

Bob

NewsArchive
11-24-2009, 02:53 AM
Hi Bob,

> RUN( 'wucheck.exe /C',1 ) !This works.
> RUN( 'wupdate.exe /S' ) !RunCode = -4 on Windows 7
> If RunCode() = -4
> STOP( ErrorCode() & ': ' & Error() ) !This produces
> errorcode 0 which is worthless

Quick:

1. Run can't elevate wupdate.exe. The first one works because wucheck.exe
doesn't require elevation. wupdate.exe requires elevation which is why it
is failing.

2. Your second Run doesnt' have a wait flag so the runcode() probably
doesn't tell the truth

3. You should check for error code on Run() but your code is checking for
error code on RunCode()

In detail:

The second RUN doesn't have the WAIT flag. So the Runcode is going to be
pointless. You are never going to get a sensible error code value after
RunCode().

Run(...)
If ErrorCode()
!! Handle error from Run
Else
If RunCode()
End
End

However, RunCode() of any value (I think) means that the program ran so this
means that the -4 is coming from wupdate.exe and you can take a look at the
wupdate.sb7 to see what it is. And if you look into the .sb7 script you
will see that -4 means:

"Cannot download server manifest file"

But because you use the /S (silent) switch you are not getting the error
messages popping up from the install;)

Also note that if your application is NOT elevated, then RUN is going to
fail on UAC enabled operating systems because it cannot handle elevating.
Here is the code that I use, using the Icetips Utilities, for this (I'm not
using wucheck.exe in this code, but it's the same stuff:) Note that my
wupdate.exe is named "AutoUpdate.EXE"

CheckforWebUpdates ROUTINE
Data
Rc Long
Ec Long
PP CString(2049)
pF CString(50)
Code
pF = 'autoupdate.exe'
PP = Upper(ShortPath(ITU.ProgPath & '\' & pF))
If Exists(PP)
PP = '"' & ITU.ProgPath & '\' & pF & '"'
RC = ITU.ITRun(PP,true,'/C /S',,True) !! Elevate
If RC = 1
If Message('There are new updates to the Build Automator program
available for download. ' &|
'If you want to update the program, the program will shut
down automatically and ' &|
'run the web update wizard.' &|
'||Do you want to update the program now?',|
'Updates Available - download now?',|
'~RO-Mx1_internet-america.ico',|
Button:Yes+Button:No)=Button:Yes
ITU.ITRun(PP)
Halt()
End
Else
Message('No updates to download for the Build Automator','No new
updates','~RO-Mx1_internet-america.ico')
End
Else
If Message('The AutoUpdate.EXE file could not be found in the "' &
ITU.ProgPath & '" folder. ' &|
'Please download and install the latest build from
www.buildautomator.com. ' &|
'||Do you want to go to our download page now?',|
'Automatic update program not found.',|
'~RO-Mx1_internet-america.ico',|
BUTTON:Yes+BUTTON:No,BUTTON:Yes) = BUTTON:Yes
ITU.OpenUrl('http://www.buildautomator.com/downloads.php')
End
End

Hope this helps:)

Best regards,

--
ArnĂ³r Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com - www.altawebworks.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
11-25-2009, 02:41 AM
Should anyone be interested, the problem was not with my code. The
problem was because I failed to set Compatibility Information to
"Windows 7" in Setup Builder's Embed UAC Manifest window.

Bob Robesky