?
Solved

Vista privilege problem

Posted on 2008-06-26
12
Medium Priority
?
547 Views
Last Modified: 2013-11-20
I have Vista privilege problem.

If I install my app ( on admin user of course ) the installation works fine. On my app, a user can choose to upgrade to pro version. The upgrading download some files and copy it to the app folder. If a user installed my app and at the end of the installtion choose to open the app and then choose to upgrade to pro, everything works fine. However, if the user closed the app, opened it again, upgrading will not work and a runtime error message will raised.  on another case, where a user can check for updateds I am checking if the user account in an admin and the answer is false.
I found a place where I can turn off UAC. After I turn off UAC everything will work fine.

My question is how do I turn off this flag in advance ?

Thanks, Udi Raz
0
Comment
Question by:UdiRaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 6

Accepted Solution

by:
dnudelman earned 672 total points
ID: 21872425
Right click on the icon and click properties.
Select "run this program as Administrator"  on the properties tab on the program icon.
0
 

Author Comment

by:UdiRaz
ID: 21872442
Thanks but how do I do it programmaticly using c++ code?
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 21873929
You can do this via the following command:

C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pol icies\System /v EnableLUA
/t REG_DWORD /d 0 /f

However, you will need to log off again for this to take effect.  You cannot complete the turn off without logging off.

HTH
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:UdiRaz
ID: 21874579
thanks mrwad99, but I don't want to change the account privilage, I think it is too aggressive. Now that dnudelman showed me how to change the privilage to my app alone.
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 21874617
OK then, if you are happy with just running the app with Admin privelidges, you can force this by altering your app's manifest file so it will not run unless the current user can log on as an admin BTW.
0
 

Author Comment

by:UdiRaz
ID: 21874671
Sorry, didn't understand the answer:
 What do I need to change and how do I change it?
0
 
LVL 19

Assisted Solution

by:mrwad99
mrwad99 earned 664 total points
ID: 21874716
OK.  You mentioned that the first comment posted by dnudelman,

>> Right click on the icon and click properties.
Select "run this program as Administrator"  on the properties tab on the program icon.

achieves what you are after (getting the app to run with Administrator privelidges), although it is not programmatical: you have to manually do this.

I am suggesting that instead of right clicking the applications's icon, then choosing "Run as Admin..." you can embed a manifest in the application which will prompt Vista for the admin login details on app startup; essentially the same as the manual procedure outlined above.

In order to do this, you need the something like the following as your app's manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

The key line is the requestedExecutionLevel.

If I am way off target here, I appologise in advance.

0
 
LVL 19

Expert Comment

by:LordOfPorts
ID: 21875780
0
 

Author Comment

by:UdiRaz
ID: 21896790
It looks like that this document answers my question but I got lost in it.
I Think that adding a manifest is the way. so I copied the suggeted xml code to a file and added it as a manifest ( visual 2005 ) but that does not. I guess just copy is not enough. I have no understanding with xml or manifests to if the example is just a guideline I still need some help to make it work,

Thanks
0
 
LVL 19

Assisted Solution

by:LordOfPorts
LordOfPorts earned 664 total points
ID: 21912830
It is not a simple process unfortunately, try following the step-by-step guide at http://support.microsoft.com/kb/944276 

In the example manifest file change the value of the level attribute from "asInvoker" to "requireAdministrator" or "highestAvailable" depending on your needs, e.g.:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question