[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Vista privilege problem

Posted on 2008-06-26
12
Medium Priority
?
549 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
10 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.
Suggested Courses

831 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