Solved

Vista privilege problem

Posted on 2008-06-26
12
538 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
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 6

Accepted Solution

by:
dnudelman earned 168 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
 

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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 166 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 166 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa‚Ķ
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now