UAC prompt for some app only

K

kpg

Hi all,

Trying to get my vb6 app to run on vista.

The program has an option to get an update. When the user clicks the
update button I shell to antoher program that downloads the update.

Here's the problem:

The main program runs without the UAC prompt for elevation, but the update
program does get the propmt - no big deal, except when I try to shell to
the update program from the main program it does not launch and the
extended error message is: requested operation requires elevation.

So I wrote a samll test program that all it does is shell to the update
program. When I run the test app I get no UAC prompt, and when I shell
from it I get the UAC prompt and the update program runs!

So I have a few questions/issues:

1. Why does vista allow my main and shelltest program run without UAC
prompting but my update program does propmt?

What is is about some programs that vista think don't need to be elevated
but other that it obviously think need to be elevated? How does it
determine that?

2. Why would my testshell app be able to launch the update program but my
main cannot? My main program is much larger than the testsehll, but
functionally for the purpose of shelling to the update they are the same.
shelling to update form main should cause vista to show the UAC prompt and
allow the program to be run - but it does not, it just fails with the error
elevation required.

Normally I use createprocess to shell, but I also tried shellexecute and
the native vb6 shell. All three work fine in my testshell app, but none
work in main.

Here's another twist: If is disable UAC everything works fine, main can
shell to update. So I lnow this is a UAC issue.

In summary - I don't mind UAC prompting when I try to shell to update, but
form main the shell fails but in a samll test program it succeeds. Turning
off UAC allows main to shell, Very strange.
 
J

Jon

Couple of comments ...

1. Certain keywords contained within a filename can trigger a UAC prompt
irrespective of other considerations eg install.exe, setup.exe, or perhaps
in your case update.exe. If your update file is similarly named and there's
no apparent need for elevation you could try renaming it.

2. I can't see any reason why things would work differently in a large main
app to a smaller app, other than a coding difference, but you can usually
force a UAC prompt, if required, by using a "runas" flag with ShellExecute
(one of the arguments to the method).
 
K

kpg

Couple of comments ...

1. Certain keywords contained within a filename can trigger a UAC
prompt irrespective of other considerations eg install.exe, setup.exe,
or perhaps in your case update.exe. If your update file is similarly
named and there's no apparent need for elevation you could try
renaming it.

2. I can't see any reason why things would work differently in a large
main app to a smaller app, other than a coding difference, but you can
usually force a UAC prompt, if required, by using a "runas" flag with
ShellExecute (one of the arguments to the method).

Yes - I tried shellExecuteEx with the runas verb and it did work, but not
as cleanly as I would like. My main program window normally closes as the
main program exsits - but with runas it pauses (waiting for user action) so
the update program does not show except as a flashing taskbar button.

I tried renaming my update program (which is called update2.exe) but it
still prompted. I will try to recompile it under a different name so the
meta data is changed as well.


....to be continued
 
J

Jon

kpg said:
Yes - I tried shellExecuteEx with the runas verb and it did work, but not
as cleanly as I would like. My main program window normally closes as the
main program exsits - but with runas it pauses (waiting for user action)
so
the update program does not show except as a flashing taskbar button.

I tried renaming my update program (which is called update2.exe) but it
still prompted. I will try to recompile it under a different name so the
meta data is changed as well.


...to be continued



Ok, keep us updated - sorry couldn't resist ....
 
K

kpg

Ok, keep us updated - sorry couldn't resist ....

Yes - if nothing else Vista is stimulating.

OK - recompiled as not update.exe and indeed no UAC prompt.

I'm sorry, but I find looking at a file name and deciding if it is a threat
somewhat specious.

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top