Solved

Vista privilege problem

Posted on 2008-06-26
12
544 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapBully challenge 6 152
Create a path if not exists 7 89
How to open a .vcf file 11 105
HTTPSendRequest with WinINet delays on first call 11 31
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.
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 viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.

840 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