![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum for Windows Vista help and discussion. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
|
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | UAC compatible application advice needed Hi! I need to write an UAC compatible application that should work for standard and admin users. This application should use DIFx 2.1 to install or update a hardware device, but only if necessary. What I´ve done so far: -linked DIFxAPI.lib -embedded .manifest with 'highestAvailable' privileg setting -check the users token to determine if the user has privileges to install or update a device driver if necessary -using DriverPackageInstall to install/update device driver When a standard user runs my application and the hardware device needs to be installed or updated he will be prompted that he needs admin rights to install/update the hardware device. UAC does not prompt. When a admin group user runs my application UAC prompts with the "A program needs your permission to continue" dialog and then runs through installing or updating the device if necessary. I am not sure if this is the correct and best way to create the application. Best for me would be, if UAC would not prompt any dialogs for all users. I know that I could also use ShellExecuteEx with 'RunAs' to launch an executable that needs admin privileges. I really appreciate any advice or improvement. Thanks -Nick |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: UAC compatible application advice needed Nick Rivers wrote: > Hi! > > I need to write an UAC compatible application that should work for standard > and admin users. > > This application should use DIFx 2.1 to install or update a hardware device, > but only if necessary. > > What I´ve done so far: > -linked DIFxAPI.lib > -embedded .manifest with 'highestAvailable' privileg setting > -check the users token to determine if the user has privileges to install or > update a device driver if necessary > -using DriverPackageInstall to install/update device driver > > When a standard user runs my application and the hardware device needs to be > installed or updated he will be prompted that he needs admin rights to > install/update the hardware device. UAC does not prompt. > > When a admin group user runs my application UAC prompts with the "A program > needs your permission to continue" dialog and then runs through installing > or updating the device if necessary. > > I am not sure if this is the correct and best way to create the application. > Best for me would be, if UAC would not prompt any dialogs for all users. I > know that I could also use ShellExecuteEx with 'RunAs' to launch an > executable that needs admin privileges. > > I really appreciate any advice or improvement. > > Thanks > -Nick I've not done any UAC development yet, but I have attended a couple of MS training events which have covered this. If your app's manifest is requesting 'highestAvailable' - I believe this simply means, rather than run as a standard user, acquire the full rights for this class of user. So, if a standard user runs, then the full rights for this user is just standard. If an Admin user runs it, then the full rights for this user is Elevated (ie. full Admin). What I suspect you need is 'requireAdministrator' which for an Admin, is just to Elevate and get the full permissions of that user (same effect as highestAvailable would have. But for a standard user, that is to require an Admin username + password to be entered. The solution to your problem of not asking all users for UAC permission, is what MS recommends and to separate out all Elevated code into a separate assembly (with a .manifest requesting 'requireAdministrator'. Main code's manifest requests 'asInvoker'. In this case, if no elevation is required (ie. driver is installed/up to date, no changes required) then no UAC prompt is seem. If the driver does require updating, then execute the separate assembly, which itself requests elevation, and then when it's finished exits and control returns to the original code, which never left the 'asInvoker' privs. Does that sound right? I hope that helps, David |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: UAC compatible application advice needed Aside for correct ways to program/package for UAC compliance . . . When you say > Best for me would be, if UAC would not prompt any dialogs for all users. it shows that you are missing the point of UAC, ie. that use of elevated privilege, unseen by the user, is not supposed to be under programmatic control when these features are enabled. IOW, that you test and avoid when the context cannot have sufficient privilege is great, but you should not expect to suppress all notices. "Nick Rivers" <nrivers@yahoo.com> wrote in message news:OBWbUoiNHHA.4172@TK2MSFTNGP04.phx.gbl... > Hi! > > I need to write an UAC compatible application that should work for > standard and admin users. > > This application should use DIFx 2.1 to install or update a hardware > device, but only if necessary. > > What I´ve done so far: > -linked DIFxAPI.lib > -embedded .manifest with 'highestAvailable' privileg setting > -check the users token to determine if the user has privileges to install > or > update a device driver if necessary > -using DriverPackageInstall to install/update device driver > > When a standard user runs my application and the hardware device needs to > be installed or updated he will be prompted that he needs admin rights to > install/update the hardware device. UAC does not prompt. > > When a admin group user runs my application UAC prompts with the "A > program needs your permission to continue" dialog and then runs through > installing or updating the device if necessary. > > I am not sure if this is the correct and best way to create the > application. Best for me would be, if UAC would not prompt any dialogs for > all users. I know that I could also use ShellExecuteEx with 'RunAs' to > launch an executable that needs admin privileges. > > I really appreciate any advice or improvement. > > Thanks > -Nick > > > > > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: UAC compatible application advice needed "Nick Rivers" <nrivers@yahoo.com> wrote in message news:OBWbUoiNHHA.4172@TK2MSFTNGP04.phx.gbl... > Hi! > > I need to write an UAC compatible application that should work for > standard and admin users. > > This application should use DIFx 2.1 to install or update a hardware > device, but only if necessary. > > What I´ve done so far: > -linked DIFxAPI.lib > -embedded .manifest with 'highestAvailable' privileg setting > -check the users token to determine if the user has privileges to install > or > update a device driver if necessary > -using DriverPackageInstall to install/update device driver > > When a standard user runs my application and the hardware device needs to > be installed or updated he will be prompted that he needs admin rights to > install/update the hardware device. UAC does not prompt. > > When a admin group user runs my application UAC prompts with the "A > program needs your permission to continue" dialog and then runs through > installing or updating the device if necessary. > > I am not sure if this is the correct and best way to create the > application. Best for me would be, if UAC would not prompt any dialogs for > all users. I know that I could also use ShellExecuteEx with 'RunAs' to > launch an executable that needs admin privileges. > > I really appreciate any advice or improvement. > > Thanks > -Nick > If the program needs to do something that requires administrator privileges then at some point everyone using that function of the program will see a uac prompt including administrators. That is the whole point of uac, to notify the user that the program is doing something that will affect the system and give them the choice to allow it or not. You can either set the program to run in administrator mode or program it ask for elevated privileges only when it actually needs them. In the first case everyone who runs the program will see a uac prompt every time they run the program. In the second case only those people using the function that requires administrator privileges will see the uac prompt. There are some good tips in some of the documents you can download here: http://msdn2.microsoft.com/en-us/win.../aa904987.aspx -- Kerry Brown Microsoft MVP - Shell/User http://www.vistahelp.ca |
My System Specs![]() |
|
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| GSvr.exe - advice needed | Oskari | Drivers | 18 | 1 Week Ago 06:54 PM |
| Installation Advice Needed | Bettie Claxton | Vista installation & setup | 2 | 03-27-2008 03:38 PM |
| advice needed please | Les Brechin | Vista General | 2 | 03-12-2008 03:22 AM |
| advice needed, please | niknik1971 | Vista General | 7 | 10-03-2006 12:57 PM |
| Advice Needed Getting VISTA x64 to run on a Raid 0+1 | Tony_P | Vista installation & setup | 9 | 07-11-2006 04:50 PM |
| Complimentary Industry Resources Vista Forums has joined forces with TradePub.com to offer you a new, exciting, and entirely free professional resource. Visit http://vistax64.tradepub.com today to browse our selection of complimentary Industry magazines, white papers, webinars, podcasts, and more across 34 industry sectors. No credit cards, coupons, or promo codes required. Try it today! |