cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
shawntp
Level 3

Vista/Windows 7 requireAdministrator vs "run as administrator"

I am wondering if anyone can help here.

I have a file that I am registering during an installation. It fails on Windows 7/Vista because of a permission issue.

There is a documented discrepancy between something with requireAdministrator defined in its manifest and the right-click & "run as administrator" option. There are some highest order permissions reserved only for the actual administrator account that requireAdministrator doesn't have.

In my setup the file is trying to access some reserved registry area and pops up an error under "requireAdministrator". If you register it directly from "run as administrator" however things work.

Is there any way via command line (setup.ini/otherwise) to automatically launch the setup with "run as administrator".

Alternatively, is there any way to detect if "run as administrator" was used and notify users (perhaps make this a root install condition and notify/exit if its not satisfied). I looked into [LogonUser] but it doesn't change.

If anyone has a tip it would be great - I might be just asking for too much here.
Labels (1)
0 Kudos

(3) Replies
Holger_G
Level 10

Which project type do you talk about? And how do you register the file? I presume it´s a COM dll.
If it´s a Basic MSI project there is normally no need to request elevated privileges during the UI sequence. Just make sure that the MSI package requires admin privileges for the execute sequence (default setting for a Basic MSI project).
And if you have not read this document.
0 Kudos
shawntp
Level 3

I looked into it more. THe registration routine (regsvr32 of a com dll) is trying to write/modify a key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\xyz\ which is not permitted even in elevated mode.

Only with Run As Administrator. I've talked around with some people and we believe we need to send this one back to the offending developer to look at more - sounds like W7 is stopping us for mucking where we do not belong anyways.
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

As an aside, Windows Installer will automatically ignore such keys that are protected by WRP, when they're represented in a table instead of through self-registration. This is another benefit to COM Extraction, if it works for your COM DLL. (Oh, and if you're using an MSI-based project; that wasn't clear in your posts.)
0 Kudos